MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / removeConnection

Method removeConnection

source/game/StarUniverseConnection.cpp:227–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225}
226
227UniverseConnection 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
243List<UniverseConnection> UniverseConnectionServer::removeAllConnections() {
244 List<UniverseConnection> removedConnections;

Callers 1

doDisconnectionMethod · 0.80

Calls 5

takeFunction · 0.85
formatFunction · 0.50
containsMethod · 0.45
takeMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected