An API for using MQTT over multiple transports
Dependencies: EthernetInterface FP MQTTPacket
Fork of MQTT by
Revision 57:3513ee54ebb4, committed 2017-11-02
- Comitter:
- Ian Craggs
- Date:
- Thu Nov 02 12:07:28 2017 +0000
- Parent:
- 56:71ae1a773b64
- Child:
- 58:1647399a759b
- Commit message:
- Improve sendpacket loop control
Changed in this revision
MQTTClient.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MQTTClient.h Tue Oct 03 22:51:58 2017 +0000 +++ b/MQTTClient.h Thu Nov 02 12:07:28 2017 +0000 @@ -382,13 +382,15 @@ int rc = FAILURE, sent = 0; - do + while (sent < length) { rc = ipstack.write(&sendbuf[sent], length - sent, timer.left_ms()); if (rc < 0) // there was an error writing the data break; sent += rc; - } while (sent < length && !timer.expired()); + if (timer.expired()) // only check expiry after at least one attempt to write + break; + } if (sent == length) { if (this->keepAliveInterval > 0)