An API for using MQTT over multiple transports

Dependencies:   FP MQTTPacket

Dependents:   Cellular_HelloMQTT IoTStarterKit GSwifiInterface_HelloMQTT IBMIoTClientEthernetExample ... more

This library is part of the EclipseTM Paho project; specifically the embedded client.

The goals of this API are:

  1. to be independent of any system library: hence templates parameters for networking, timer and threading classes
  2. not to rely on heap storage, only automatic (I think this is a good thing)
  3. to limit memory use, for instance by defining the size of the buffers and arrays used at object creation time

Files at this revision

API Documentation at this revision

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)