mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Fix API Subscription initialisation (#1354)
* Fix #1352,#1351 * Fix/Add details on client address
This commit is contained in:
@@ -57,3 +57,8 @@ void JsonClientConnection::disconnected()
|
||||
{
|
||||
emit connectionClosed();
|
||||
}
|
||||
|
||||
QHostAddress JsonClientConnection::getClientAddress()
|
||||
{
|
||||
return _socket->peerAddress();
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
#include <QJsonObject>
|
||||
#include <QHostAddress>
|
||||
|
||||
// util includes
|
||||
#include <utils/Logger.h>
|
||||
@@ -24,6 +25,7 @@ public:
|
||||
/// @param socket The Socket object for this connection
|
||||
///
|
||||
JsonClientConnection(QTcpSocket * socket, bool localConnection);
|
||||
QHostAddress getClientAddress();
|
||||
|
||||
signals:
|
||||
void connectionClosed();
|
||||
|
@@ -102,7 +102,7 @@ void JsonServer::newConnection()
|
||||
{
|
||||
if(_netOrigin->accessAllowed(socket->peerAddress(), socket->localAddress()))
|
||||
{
|
||||
Debug(_log, "New connection from: %s ",socket->localAddress().toString().toStdString().c_str());
|
||||
Debug(_log, "New connection from: %s",QSTRING_CSTR(socket->peerAddress().toString()));
|
||||
JsonClientConnection * connection = new JsonClientConnection(socket, _netOrigin->isLocalAddress(socket->peerAddress(), socket->localAddress()));
|
||||
_openConnections.insert(connection);
|
||||
|
||||
@@ -118,7 +118,7 @@ void JsonServer::newConnection()
|
||||
void JsonServer::closedConnection()
|
||||
{
|
||||
JsonClientConnection* connection = qobject_cast<JsonClientConnection*>(sender());
|
||||
Debug(_log, "Connection closed");
|
||||
Debug(_log, "Connection closed for %s", QSTRING_CSTR(connection->getClientAddress().toString()));
|
||||
_openConnections.remove(connection);
|
||||
|
||||
// schedule to delete the connection object
|
||||
|
Reference in New Issue
Block a user