fix(ssdp): ssdp:all provide better feedback (#720)

* fix: ssdp:all provide a better feedback

* Add more debug statements to webserver
This commit is contained in:
brindosch 2020-03-11 22:18:08 +01:00 committed by GitHub
parent 9a587d3a27
commit 56023ed154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -9,6 +9,8 @@
#include <QNetworkInterface>
#include <QNetworkConfigurationManager>
static const QString SSDP_HYPERION_ST("urn:hyperion-project.org:device:basic:1");
SSDPHandler::SSDPHandler(WebServer* webserver, const quint16& flatBufPort, const quint16& jsonServerPort, const QString& name, QObject * parent)
: SSDPServer(parent)
, _webserver(webserver)
@ -33,7 +35,7 @@ void SSDPHandler::initServer()
// announce targets
_deviceList.push_back("upnp:rootdevice");
_deviceList.push_back("uuid:"+_uuid);
_deviceList.push_back("urn:hyperion-project.org:device:basic:1");
_deviceList.push_back(SSDP_HYPERION_ST);
// prep server
SSDPServer::initServer();
@ -145,7 +147,9 @@ void SSDPHandler::handleMSearchRequest(const QString& target, const QString& mx,
// TODO Response delay according to MX field (sec) random between 0 and MX
// when searched for all devices / root devices / basic device
if(target == "ssdp:all" || target == "upnp:rootdevice" || target == "urn:schemas-upnp-org:device:basic:1" || target == "urn:hyperion-project.org:device:basic:1")
if(target == "ssdp:all")
sendMSearchResponse(SSDP_HYPERION_ST, address, port);
else if(target == "upnp:rootdevice" || target == "urn:schemas-upnp-org:device:basic:1" || target == SSDP_HYPERION_ST)
sendMSearchResponse(target, address, port);
}

View File

@ -29,6 +29,7 @@ WebServer::~WebServer()
void WebServer::initServer()
{
Debug(_log, "Initialize Webserver");
_server = new QtHttpServer (this);
_server->setServerName (QStringLiteral ("Hyperion Webserver"));
@ -85,6 +86,7 @@ void WebServer::handleSettingsUpdate(const settings::type& type, const QJsonDocu
{
if(type == settings::WEBSERVER)
{
Debug(_log, "Apply Webserver settings");
const QJsonObject& obj = config.object();
_baseUrl = obj["document_root"].toString(WEBSERVER_DEFAULT_PATH);