| 212 | } |
| 213 | |
| 214 | void UniverseConnectionServer::addConnection(ConnectionId clientId, UniverseConnection uc) { |
| 215 | RecursiveMutexLocker connectionsLocker(m_connectionsMutex); |
| 216 | if (m_connections.contains(clientId)) |
| 217 | throw UniverseConnectionException::format("Client '{}' already exists in UniverseConnectionServer::addConnection", clientId); |
| 218 | |
| 219 | auto connection = make_shared<Connection>(); |
| 220 | connection->packetSocket = std::move(uc.m_packetSocket); |
| 221 | connection->sendQueue = std::move(uc.m_sendQueue); |
| 222 | connection->receiveQueue = std::move(uc.m_receiveQueue); |
| 223 | connection->lastActivityTime = Time::monotonicMilliseconds(); |
| 224 | m_connections.add(clientId, std::move(connection)); |
| 225 | } |
| 226 | |
| 227 | UniverseConnection UniverseConnectionServer::removeConnection(ConnectionId clientId) { |
| 228 | RecursiveMutexLocker connectionsLocker(m_connectionsMutex); |