improove UPnP
This commit is contained in:
parent
97e892b87e
commit
317c5e7ea7
@ -46,7 +46,6 @@
|
|||||||
\sa DevicePlugin::upnpNotifyReceived()
|
\sa DevicePlugin::upnpNotifyReceived()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "upnpdiscovery.h"
|
#include "upnpdiscovery.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "guhsettings.h"
|
#include "guhsettings.h"
|
||||||
@ -113,6 +112,8 @@ bool UpnpDiscovery::discoverDevices(const QString &searchTarget, const QString &
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qCDebug(dcHardware) << "UPnP: discover" << searchTarget << userAgent;
|
||||||
|
|
||||||
// create a new request
|
// create a new request
|
||||||
UpnpDiscoveryRequest *request = new UpnpDiscoveryRequest(this, pluginId, searchTarget, userAgent);
|
UpnpDiscoveryRequest *request = new UpnpDiscoveryRequest(this, pluginId, searchTarget, userAgent);
|
||||||
connect(request, &UpnpDiscoveryRequest::discoveryTimeout, this, &UpnpDiscovery::discoverTimeout);
|
connect(request, &UpnpDiscoveryRequest::discoveryTimeout, this, &UpnpDiscovery::discoverTimeout);
|
||||||
@ -204,14 +205,12 @@ void UpnpDiscovery::readData()
|
|||||||
readDatagram(data.data(), data.size(), &hostAddress, &port);
|
readDatagram(data.data(), data.size(), &hostAddress, &port);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.contains("M-SEARCH")) {
|
if (data.contains("M-SEARCH") && !QNetworkInterface::allAddresses().contains(hostAddress)) {
|
||||||
//qCDebug(dcHardware) << "--------------------------------------";
|
|
||||||
//qCDebug(dcHardware) << QString("UPnP data: %1:%2 \n").arg(hostAddress.toString()).arg(QString::number(port)) << data;
|
|
||||||
respondToSearchRequest(hostAddress, port);
|
respondToSearchRequest(hostAddress, port);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.contains("NOTIFY")) {
|
if (data.contains("NOTIFY") && !QNetworkInterface::allAddresses().contains(hostAddress)) {
|
||||||
emit upnpNotify(data);
|
emit upnpNotify(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -225,7 +224,7 @@ void UpnpDiscovery::readData()
|
|||||||
QString value = line.mid(separatorIndex+1).trimmed();
|
QString value = line.mid(separatorIndex+1).trimmed();
|
||||||
|
|
||||||
// get location
|
// get location
|
||||||
if (key.contains("LOCATION")) {
|
if (key.contains("LOCATION") || key.contains("location") || key.contains("Location")) {
|
||||||
location = QUrl(value);
|
location = QUrl(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user