mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
feat: Delay M-SEARCH response by a random value according to MX header (#844)
This commit is contained in:
@@ -163,8 +163,8 @@ void SSDPServer::readPendingDatagrams()
|
||||
|
||||
if (headers.value("man") == "\"ssdp:discover\"")
|
||||
{
|
||||
//Debug(_log, "Received msearch from '%s:%d'. Search target: %s",QSTRING_CSTR(sender.toString()), senderPort, QSTRING_CSTR(headers.value("st")));
|
||||
emit msearchRequestReceived(headers.value("st"), headers.value("mx"), sender.toString(), senderPort);
|
||||
//Debug(_log, "Received msearch from '%s:%d'. Search target: %s",QSTRING_CSTR(sender.toString()), senderPort, QSTRING_CSTR(headers.value("st")));
|
||||
emit msearchRequestReceived(headers.value("st"), headers.value("mx"), sender.toString(), senderPort);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,9 +181,7 @@ void SSDPServer::sendMSearchResponse(const QString& st, const QString& senderIp,
|
||||
, _jssPort
|
||||
, _name );
|
||||
|
||||
_udpSocket->writeDatagram(message.toUtf8(),
|
||||
QHostAddress(senderIp),
|
||||
senderPort);
|
||||
_udpSocket->writeDatagram(message.toUtf8(), QHostAddress(senderIp), senderPort);
|
||||
}
|
||||
|
||||
void SSDPServer::sendByeBye(const QString& st)
|
||||
@@ -192,11 +190,8 @@ void SSDPServer::sendByeBye(const QString& st)
|
||||
|
||||
// we repeat 3 times
|
||||
quint8 rep = 0;
|
||||
while(rep < 3) {
|
||||
_udpSocket->writeDatagram(message.toUtf8(),
|
||||
QHostAddress(SSDP_ADDR),
|
||||
SSDP_PORT);
|
||||
rep++;
|
||||
while(rep++ < 3) {
|
||||
_udpSocket->writeDatagram(message.toUtf8(), QHostAddress(SSDP_ADDR), SSDP_PORT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,11 +210,8 @@ void SSDPServer::sendAlive(const QString& st)
|
||||
|
||||
// we repeat 3 times
|
||||
quint8 rep = 0;
|
||||
while(rep < 3) {
|
||||
_udpSocket->writeDatagram(message.toUtf8(),
|
||||
QHostAddress(SSDP_ADDR),
|
||||
SSDP_PORT);
|
||||
rep++;
|
||||
while(rep++ < 3) {
|
||||
_udpSocket->writeDatagram(message.toUtf8(), QHostAddress(SSDP_ADDR), SSDP_PORT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +221,5 @@ void SSDPServer::sendUpdate(const QString& st)
|
||||
, st
|
||||
, _uuid+"::"+st );
|
||||
|
||||
_udpSocket->writeDatagram(message.toUtf8(),
|
||||
QHostAddress(SSDP_ADDR),
|
||||
SSDP_PORT);
|
||||
_udpSocket->writeDatagram(message.toUtf8(), QHostAddress(SSDP_ADDR), SSDP_PORT);
|
||||
}
|
||||
|
Reference in New Issue
Block a user