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