MutexLock lock(&mutex);
Stream *stream = find_stream(client.stream_id());
clients.insert(make_pair(client.sock(), Client(client, stream)));
+ Client *client_ptr = &clients[client.sock()];
// Start listening on data from this socket.
epoll_event ev;
exit(1);
}
- process_client(&clients[client.sock()]);
+ if (client_ptr->state == Client::SENDING_DATA &&
+ client_ptr->bytes_sent == client_ptr->stream->data_size) {
+ put_client_to_sleep(client_ptr);
+ } else {
+ process_client(client_ptr);
+ }
}
void Server::add_stream(const string &stream_id)