aboutsummaryrefslogtreecommitdiffstats
path: root/src/coap/qcoapprotocol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/coap/qcoapprotocol.cpp')
-rw-r--r--src/coap/qcoapprotocol.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/coap/qcoapprotocol.cpp b/src/coap/qcoapprotocol.cpp
index 638ca8a..00075f0 100644
--- a/src/coap/qcoapprotocol.cpp
+++ b/src/coap/qcoapprotocol.cpp
@@ -508,9 +508,9 @@ void QCoapProtocolPrivate::sendReset(QCoapInternalRequest *request) const
A Reset (RST) message will be sent at the reception of the next message.
*/
-void QCoapProtocol::cancelObserve(QPointer<QCoapReply> reply)
+void QCoapProtocol::cancelObserve(QPointer<QCoapReply> reply) const
{
- Q_D(QCoapProtocol);
+ Q_D(const QCoapProtocol);
if (reply.isNull())
return;
@@ -531,6 +531,25 @@ void QCoapProtocol::cancelObserve(QPointer<QCoapReply> reply)
/*!
\internal
+ Cancels resource observation for the given \a url. The QCoapReply::notified()
+ signal will not be emitted after cancellation.
+
+ A Reset (RST) message will be sent at the reception of the next message.
+*/
+void QCoapProtocol::cancelObserve(const QUrl &url) const
+{
+ Q_D(const QCoapProtocol);
+
+ for (const auto &exchange : d->exchangeMap) {
+ Q_ASSERT(exchange.userReply);
+ if (exchange.userReply->url() == url)
+ cancelObserve(exchange.userReply);
+ }
+}
+
+/*!
+ \internal
+
Returns a currently unused message Id.
*/
quint16 QCoapProtocolPrivate::generateUniqueMessageId() const