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;
18 std::string remote_addr;
22 size_t num_loss_events;
28 // Serialization/deserialization.
29 Client(const ClientProto &serialized, Stream *stream);
30 ClientProto serialize() const;
32 ClientStats get_stats() const;
34 // The file descriptor associated with this socket.
37 // The fwmark associated with this socket (or 0).
40 // Some information only used for logging.
41 std::string remote_addr;
44 enum State { READING_REQUEST, SENDING_HEADER, SENDING_DATA, SENDING_ERROR };
47 // The HTTP request, as sent by the client. If we are in READING_REQUEST,
48 // this might not be finished.
51 // What stream we're connecting to; parsed from <request>.
52 // Not relevant for READING_REQUEST.
53 std::string stream_id;
56 // The header we want to send. This is nominally a copy of Stream::header,
57 // but since that might change on reconnects etc., we keep a local copy here.
58 // Only relevant for SENDING_HEADER or SENDING_ERROR; blank otherwise.
59 std::string header_or_error;
61 // Number of bytes we've sent of the header. Only relevant for SENDING_HEADER
63 size_t header_or_error_bytes_sent;
65 // Number of bytes we are into the stream (ie., the end of last send).
66 // Only relevant for SENDING_DATA.
69 // Number of bytes we've sent of data. Only relevant for SENDING_DATA.
72 // Number of times we've skipped forward due to the backlog being too big,
73 // and how many bytes we've skipped over in all. Only relevant for SENDING_DATA.
74 size_t bytes_lost, num_loss_events;
77 #endif // !defined(_CLIENT_H)