mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
ENABLE_AVAHI is not included in WebServer
This commit is contained in:
parent
8bb5833250
commit
9204f8a313
@ -7,6 +7,7 @@
|
|||||||
// qt
|
// qt
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
|
class BonjourServiceRegister;
|
||||||
class QTcpServer;
|
class QTcpServer;
|
||||||
class FlatBufferClient;
|
class FlatBufferClient;
|
||||||
class NetOrigin;
|
class NetOrigin;
|
||||||
@ -63,6 +64,7 @@ private:
|
|||||||
int _timeout;
|
int _timeout;
|
||||||
quint16 _port;
|
quint16 _port;
|
||||||
const QJsonDocument _config;
|
const QJsonDocument _config;
|
||||||
|
BonjourServiceRegister * _serviceRegister = nullptr;
|
||||||
|
|
||||||
QVector<FlatBufferClient*> _openConnections;
|
QVector<FlatBufferClient*> _openConnections;
|
||||||
};
|
};
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
#include <flatbufserver/FlatBufferServer.h>
|
#include <flatbufserver/FlatBufferServer.h>
|
||||||
#include "FlatBufferClient.h"
|
#include "FlatBufferClient.h"
|
||||||
|
#include "HyperionConfig.h"
|
||||||
|
|
||||||
// util
|
// util
|
||||||
#include <utils/NetOrigin.h>
|
#include <utils/NetOrigin.h>
|
||||||
#include <utils/GlobalSignals.h>
|
#include <utils/GlobalSignals.h>
|
||||||
|
|
||||||
|
// bonjour
|
||||||
|
#ifdef ENABLE_AVAHI
|
||||||
|
#include <bonjour/bonjourserviceregister.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// qt
|
// qt
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QTcpServer>
|
#include <QTcpServer>
|
||||||
@ -93,14 +99,27 @@ void FlatBufferServer::startServer()
|
|||||||
{
|
{
|
||||||
if(!_server->isListening())
|
if(!_server->isListening())
|
||||||
{
|
{
|
||||||
if(!_server->listen(QHostAddress::Any, _port))
|
if(!_server->listen(QHostAddress::Any, _port))
|
||||||
{
|
{
|
||||||
Error(_log,"Failed to bind port %d", _port);
|
Error(_log,"Failed to bind port %d", _port);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info(_log,"Started on port %d", _port);
|
Info(_log,"Started on port %d", _port);
|
||||||
}
|
#ifdef ENABLE_AVAHI
|
||||||
|
if(_serviceRegister == nullptr)
|
||||||
|
{
|
||||||
|
_serviceRegister = new BonjourServiceRegister(this);
|
||||||
|
_serviceRegister->registerService("_hyperiond-flatbuf._tcp", _port);
|
||||||
|
}
|
||||||
|
else if(_serviceRegister->getPort() != _port)
|
||||||
|
{
|
||||||
|
delete _serviceRegister;
|
||||||
|
_serviceRegister = new BonjourServiceRegister(this);
|
||||||
|
_serviceRegister->registerService("_hyperiond-flatbuf._tcp", _port);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
// project includes
|
// project includes
|
||||||
|
#include "HyperionConfig.h"
|
||||||
#include <jsonserver/JsonServer.h>
|
#include <jsonserver/JsonServer.h>
|
||||||
#include "JsonClientConnection.h"
|
#include "JsonClientConnection.h"
|
||||||
|
|
||||||
@ -49,6 +50,7 @@ void JsonServer::start()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Info(_log, "Started on port %d", _port);
|
Info(_log, "Started on port %d", _port);
|
||||||
|
|
||||||
#ifdef ENABLE_AVAHI
|
#ifdef ENABLE_AVAHI
|
||||||
if(_serviceRegister == nullptr)
|
if(_serviceRegister == nullptr)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "webserver/WebServer.h"
|
#include "webserver/WebServer.h"
|
||||||
|
#include "HyperionConfig.h"
|
||||||
#include "StaticFileServing.h"
|
#include "StaticFileServing.h"
|
||||||
#include "QtHttpServer.h"
|
#include "QtHttpServer.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user