@@ -151,10 +151,12 @@ void SSDP::DisableNotifications()
151
151
}
152
152
}
153
153
154
- // ///////////////////////////////////////////////////////////////////////////
155
- //
156
- // ///////////////////////////////////////////////////////////////////////////
157
154
void SSDP::PerformSearch (const QString &sST , std::chrono::seconds timeout)
155
+ {
156
+ m_receiver.performSearch (sST , timeout);
157
+ }
158
+
159
+ void SSDPReceiver::performSearch (const QString &sST , std::chrono::seconds timeout)
158
160
{
159
161
timeout = std::clamp (timeout, 1s, 5s);
160
162
QString rRequest = QString (" M-SEARCH * HTTP/1.1\r\n "
@@ -170,16 +172,14 @@ void SSDP::PerformSearch(const QString &sST, std::chrono::seconds timeout)
170
172
QByteArray sRequest = rRequest.toUtf8 ();
171
173
int nSize = sRequest .size ();
172
174
173
- QUdpSocket socket;
174
- socket.bind (QHostAddress (QHostAddress::AnyIPv4), SSDP_PORT, QUdpSocket::ShareAddress);
175
- if (socket.writeDatagram (sRequest , QHostAddress (QString (SSDP_GROUP)), SSDP_PORT) != nSize)
175
+ if (m_socket.writeDatagram (sRequest , QHostAddress (QString (SSDP_GROUP)), SSDP_PORT) != nSize)
176
176
{
177
177
LOG (VB_GENERAL, LOG_INFO, " SSDP::PerformSearch - did not write entire buffer." );
178
178
}
179
179
180
180
std::this_thread::sleep_for (std::chrono::milliseconds (MythRandom (0 , 250 )));
181
181
182
- if (socket .writeDatagram (sRequest , QHostAddress (QString (SSDP_GROUP)), SSDP_PORT) != nSize)
182
+ if (m_socket .writeDatagram (sRequest , QHostAddress (QString (SSDP_GROUP)), SSDP_PORT) != nSize)
183
183
{
184
184
LOG (VB_GENERAL, LOG_INFO, " SSDP::PerformSearch - did not write entire buffer." );
185
185
}
0 commit comments