- vector<int>::iterator new_end =
- remove(sleeping_clients.begin(), sleeping_clients.end(), client->sock);
- sleeping_clients.erase(new_end, sleeping_clients.end());
-
- // Bye-bye!
- close(client->sock);
- clients.erase(client->sock);
-}
-
-void Server::put_client_to_sleep(Client *client)
-{
- epoll_event ev;
- ev.events = EPOLLRDHUP;
- ev.data.u64 = 0; // Keep Valgrind happy.
- ev.data.fd = client->sock;
-
- if (epoll_ctl(epoll_fd, EPOLL_CTL_MOD, client->sock, &ev) == -1) {
- perror("epoll_ctl(EPOLL_CTL_MOD)");
- exit(1);
+ if (client->stream != NULL) {
+ delete_from(&client->stream->sleeping_clients, client);
+ delete_from(&client->stream->to_process, client);
+ if (client->stream->mark_pool != NULL) {
+ int fwmark = client->fwmark;
+ client->stream->mark_pool->release_mark(fwmark);
+ }