mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
- The first part
- Added CodeDocs config file for customization - Fixing LGTM alerts - LGTM bug fixed again - added token option to hyperion-remote - fix DBManager::getDB() - next bugfix - correct broken signal from SettingManager to Hyperion - Token list is created after the schema is fetched Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
#include <protoserver/ProtoServer.h>
|
||||
#include "ProtoClientConnection.h"
|
||||
|
||||
// util
|
||||
#include <utils/NetOrigin.h>
|
||||
|
||||
// qt
|
||||
#include <QJsonObject>
|
||||
#include <QTcpServer>
|
||||
@@ -24,6 +27,7 @@ ProtoServer::~ProtoServer()
|
||||
|
||||
void ProtoServer::initServer()
|
||||
{
|
||||
_netOrigin = NetOrigin::getInstance();
|
||||
connect(_server, &QTcpServer::newConnection, this, &ProtoServer::newConnection);
|
||||
|
||||
// apply config
|
||||
@@ -58,11 +62,16 @@ void ProtoServer::newConnection()
|
||||
{
|
||||
if(QTcpSocket * socket = _server->nextPendingConnection())
|
||||
{
|
||||
Debug(_log, "New connection from %s", QSTRING_CSTR(socket->peerAddress().toString()));
|
||||
ProtoClientConnection * client = new ProtoClientConnection(socket, _timeout, this);
|
||||
// internal
|
||||
connect(client, &ProtoClientConnection::clientDisconnected, this, &ProtoServer::clientDisconnected);
|
||||
_openConnections.append(client);
|
||||
if(_netOrigin->accessAllowed(socket->peerAddress(), socket->localAddress()))
|
||||
{
|
||||
Debug(_log, "New connection from %s", QSTRING_CSTR(socket->peerAddress().toString()));
|
||||
ProtoClientConnection * client = new ProtoClientConnection(socket, _timeout, this);
|
||||
// internal
|
||||
connect(client, &ProtoClientConnection::clientDisconnected, this, &ProtoServer::clientDisconnected);
|
||||
_openConnections.append(client);
|
||||
}
|
||||
else
|
||||
socket->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user