diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-05-06 15:06:25 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-05-07 11:42:02 +0200 |
commit | 8dc10f37a48c7cdf8e6992f628719a5e95fd2a13 (patch) | |
tree | 22413357acc7a86cee0b27369e63fd624ff18e6f | |
parent | 00de2ba96ac248ddeef694ac2497a861e81f34dd (diff) |
Fix handling of multiple CoAP messages
When sending multiple CoAP messages at once, some of the frames may
wait in the pending frames queue until the transport gets to "Connected"
state. After the state is changed to "Connected", we need to send all
pending frames, instead of sending only one frame.
Change-Id: I7d22f6018894881bb5c074202c4ad235d72a1fea
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r-- | src/coap/qcoapconnection.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/coap/qcoapconnection.cpp b/src/coap/qcoapconnection.cpp index 23cb0d9..f74ceab 100644 --- a/src/coap/qcoapconnection.cpp +++ b/src/coap/qcoapconnection.cpp @@ -243,8 +243,10 @@ void QCoapConnection::startToSendRequest() Q_D(QCoapConnection); Q_ASSERT(!d->framesToSend.isEmpty()); - const CoapFrame frame = d->framesToSend.dequeue(); - writeData(frame.currentPdu, frame.host, frame.port); + while (!d->framesToSend.isEmpty()) { + const CoapFrame frame = d->framesToSend.dequeue(); + writeData(frame.currentPdu, frame.host, frame.port); + } } /*! |