| 81 | } |
| 82 | |
| 83 | void 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 | |
| 104 | void JsonServer::signalClientConnectionClosedHandler(JsonClientConnection* client) |
| 105 | { |
nothing calls this directly
no test coverage detected