mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Move WebSocket to Webserver & HttpJsonRpc async (#486)
* Move WebSocket to Webserver and HttpJsonRpc is now async * revert...
This commit is contained in:
@@ -57,21 +57,23 @@ uint16_t JsonServer::getPort() const
|
||||
|
||||
void JsonServer::newConnection()
|
||||
{
|
||||
QTcpSocket * socket = _server.nextPendingConnection();
|
||||
|
||||
if (socket != nullptr)
|
||||
while(_server.hasPendingConnections())
|
||||
{
|
||||
Debug(_log, "New connection from: %s ",socket->localAddress().toString().toStdString().c_str());
|
||||
JsonClientConnection * connection = new JsonClientConnection(socket);
|
||||
_openConnections.insert(connection);
|
||||
if (QTcpSocket * socket = _server.nextPendingConnection())
|
||||
{
|
||||
Debug(_log, "New connection from: %s ",socket->localAddress().toString().toStdString().c_str());
|
||||
JsonClientConnection * connection = new JsonClientConnection(socket);
|
||||
_openConnections.insert(connection);
|
||||
|
||||
// register slot for cleaning up after the connection closed
|
||||
connect(connection, SIGNAL(connectionClosed(JsonClientConnection*)), this, SLOT(closedConnection(JsonClientConnection*)));
|
||||
// register slot for cleaning up after the connection closed
|
||||
connect(connection, &JsonClientConnection::connectionClosed, this, &JsonServer::closedConnection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JsonServer::closedConnection(JsonClientConnection *connection)
|
||||
void JsonServer::closedConnection(void)
|
||||
{
|
||||
JsonClientConnection* connection = qobject_cast<JsonClientConnection*>(sender());
|
||||
Debug(_log, "Connection closed");
|
||||
_openConnections.remove(connection);
|
||||
|
||||
|
Reference in New Issue
Block a user