// This is postcondition #3.
client->state = Client::SENDING_DATA;
client->bytes_sent = client->stream->data_size;
// This is postcondition #3.
client->state = Client::SENDING_DATA;
client->bytes_sent = client->stream->data_size;
// but resync will be the mux's problem.
const Stream *stream = client->stream;
size_t bytes_to_send = stream->data_size - client->bytes_sent;
// but resync will be the mux's problem.
const Stream *stream = client->stream;
size_t bytes_to_send = stream->data_size - client->bytes_sent;
if (bytes_to_send > BACKLOG_SIZE) {
fprintf(stderr, "WARNING: fd %d lost %lld bytes, maybe too slow connection\n",
client->sock,
if (bytes_to_send > BACKLOG_SIZE) {
fprintf(stderr, "WARNING: fd %d lost %lld bytes, maybe too slow connection\n",
client->sock,