| 225 | } |
| 226 | |
| 227 | UniverseConnection UniverseConnectionServer::removeConnection(ConnectionId clientId) { |
| 228 | RecursiveMutexLocker connectionsLocker(m_connectionsMutex); |
| 229 | if (!m_connections.contains(clientId)) |
| 230 | throw UniverseConnectionException::format("Client '{}' does not exist in UniverseConnectionServer::removeConnection", clientId); |
| 231 | |
| 232 | auto conn = m_connections.take(clientId); |
| 233 | connectionsLocker.unlock(); |
| 234 | MutexLocker connectionLocker(conn->mutex); |
| 235 | |
| 236 | UniverseConnection uc; |
| 237 | uc.m_packetSocket = take(conn->packetSocket); |
| 238 | uc.m_sendQueue = std::move(conn->sendQueue); |
| 239 | uc.m_receiveQueue = std::move(conn->receiveQueue); |
| 240 | return uc; |
| 241 | } |
| 242 | |
| 243 | List<UniverseConnection> UniverseConnectionServer::removeAllConnections() { |
| 244 | List<UniverseConnection> removedConnections; |