ENABLE_AVAHI is not included in WebServer

This commit is contained in:
Murat 2020-09-07 21:34:14 +02:00
parent 8bb5833250
commit 9204f8a313
4 changed files with 32 additions and 8 deletions

View File

@ -7,6 +7,7 @@
// qt
#include <QVector>
class BonjourServiceRegister;
class QTcpServer;
class FlatBufferClient;
class NetOrigin;
@ -63,6 +64,7 @@ private:
int _timeout;
quint16 _port;
const QJsonDocument _config;
BonjourServiceRegister * _serviceRegister = nullptr;
QVector<FlatBufferClient*> _openConnections;
};

View File

@ -1,10 +1,16 @@
#include <flatbufserver/FlatBufferServer.h>
#include "FlatBufferClient.h"
#include "HyperionConfig.h"
// util
#include <utils/NetOrigin.h>
#include <utils/GlobalSignals.h>
// bonjour
#ifdef ENABLE_AVAHI
#include <bonjour/bonjourserviceregister.h>
#endif
// qt
#include <QJsonObject>
#include <QTcpServer>
@ -100,6 +106,19 @@ void FlatBufferServer::startServer()
else
{
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
}
}
}

View File

@ -2,6 +2,7 @@
#include <stdexcept>
// project includes
#include "HyperionConfig.h"
#include <jsonserver/JsonServer.h>
#include "JsonClientConnection.h"
@ -49,6 +50,7 @@ void JsonServer::start()
return;
}
Info(_log, "Started on port %d", _port);
#ifdef ENABLE_AVAHI
if(_serviceRegister == nullptr)
{

View File

@ -1,4 +1,5 @@
#include "webserver/WebServer.h"
#include "HyperionConfig.h"
#include "StaticFileServing.h"
#include "QtHttpServer.h"