| 122 | } |
| 123 | |
| 124 | void TThreadedServer::onClientDisconnected(TConnectedClient* pClient) { |
| 125 | Synchronized sync(clientMonitor_); |
| 126 | drainDeadClients(); // use the outgoing thread to do some maintenance on our dead client backlog |
| 127 | auto it = activeClientMap_.find(pClient); |
| 128 | if (it != activeClientMap_.end()) { |
| 129 | auto end = it; |
| 130 | deadClientMap_.insert(it, ++end); |
| 131 | activeClientMap_.erase(it); |
| 132 | } |
| 133 | if (activeClientMap_.empty()) { |
| 134 | clientMonitor_.notify(); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | TThreadedServer::TConnectedClientRunner::TConnectedClientRunner(const shared_ptr<TConnectedClient>& pClient) |
| 139 | : pClient_(pClient) { |