MCPcopy Create free account
hub / github.com/awawa-dev/HyperHDR / newConnection

Method newConnection

sources/jsonserver/JsonServer.cpp:83–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83void JsonServer::newConnection()
84{
85 while (_server->hasPendingConnections())
86 {
87 if (QTcpSocket* socket = _server->nextPendingConnection())
88 {
89 if (_netOrigin->accessAllowed(socket->peerAddress(), socket->localAddress()))
90 {
91 Debug(_log, "New connection from: %s ", socket->localAddress().toString().toStdString().c_str());
92 JsonClientConnection* connection = new JsonClientConnection(socket, _netOrigin->isLocalAddress(socket->peerAddress(), socket->localAddress()));
93 _openConnections.insert(connection);
94
95 // register slot for cleaning up after the connection closed
96 connect(connection, &JsonClientConnection::SignalClientConnectionClosed, this, &JsonServer::signalClientConnectionClosedHandler);
97 }
98 else
99 socket->close();
100 }
101 }
102}
103
104void JsonServer::signalClientConnectionClosedHandler(JsonClientConnection* client)
105{

Callers

nothing calls this directly

Calls 4

accessAllowedMethod · 0.80
isLocalAddressMethod · 0.80
toStringMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected