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

Method addConnection

source/game/StarUniverseConnection.cpp:214–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214void 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
227UniverseConnection UniverseConnectionServer::removeConnection(ConnectionId clientId) {
228 RecursiveMutexLocker connectionsLocker(m_connectionsMutex);

Callers 2

acceptConnectionMethod · 0.80
TESTFunction · 0.80

Calls 3

formatFunction · 0.50
containsMethod · 0.45
addMethod · 0.45

Tested by 1

TESTFunction · 0.64