From 56023ed154d52a369320de8561f17fc9f82f8b7b Mon Sep 17 00:00:00 2001 From: brindosch Date: Wed, 11 Mar 2020 22:18:08 +0100 Subject: [PATCH] fix(ssdp): ssdp:all provide better feedback (#720) * fix: ssdp:all provide a better feedback * Add more debug statements to webserver --- libsrc/ssdp/SSDPHandler.cpp | 8 ++++++-- libsrc/webserver/WebServer.cpp | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libsrc/ssdp/SSDPHandler.cpp b/libsrc/ssdp/SSDPHandler.cpp index 40d50876..1c5fa082 100644 --- a/libsrc/ssdp/SSDPHandler.cpp +++ b/libsrc/ssdp/SSDPHandler.cpp @@ -9,6 +9,8 @@ #include #include +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); } diff --git a/libsrc/webserver/WebServer.cpp b/libsrc/webserver/WebServer.cpp index e1233a13..8c8b83c4 100644 --- a/libsrc/webserver/WebServer.cpp +++ b/libsrc/webserver/WebServer.cpp @@ -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);