4 // A Client represents a single connection from a client (watching a single stream).
13 // Digested statistics for writing to logs etc.
15 std::string stream_id;
16 std::string remote_addr;
20 size_t num_loss_events;
27 // Serialization/deserialization.
28 Client(const ClientProto &serialized, Stream *stream);
29 ClientProto serialize() const;
31 ClientStats get_stats() const;
33 // The file descriptor associated with this socket.
36 // The fwmark associated with this socket (or 0).
39 // Some information only used for logging.
40 std::string remote_addr;
43 enum State { READING_REQUEST, SENDING_HEADER, SENDING_DATA, SENDING_ERROR };
46 // The HTTP request, as sent by the client. If we are in READING_REQUEST,
47 // this might not be finished.
50 // What stream we're connecting to; parsed from <request>.
51 // Not relevant for READING_REQUEST.
52 std::string stream_id;
55 // The header we want to send. This is nominally a copy of Stream::header,
56 // but since that might change on reconnects etc., we keep a local copy here.
57 // Only relevant for SENDING_HEADER or SENDING_ERROR; blank otherwise.
58 std::string header_or_error;
60 // Number of bytes we've sent of the header. Only relevant for SENDING_HEADER
62 size_t header_or_error_bytes_sent;
64 // Number of bytes we are into the stream (ie., the end of last send).
65 // Only relevant for SENDING_DATA.
68 // Number of bytes we've sent of data. Only relevant for SENDING_DATA.
71 // Number of times we've skipped forward due to the backlog being too big,
72 // and how many bytes we've skipped over in all. Only relevant for SENDING_DATA.
73 size_t bytes_lost, num_loss_events;
76 #endif // !defined(_CLIENT_H)