I noticed some weirdness in the mqtt_run function. Specifically:
-
in the condition of the while loop
|
} while (t->remaining > 0 && status != MQTTSuccess); |
I don't think status != MQTT_Success is ever true because if it were we would've hit one of the return statements above. This means the loop always executes exactly once, so what's the point of having a loop?! For the same reason I don't think the return at
is ever reachable so the function will never return -ETIMEDOUT.
-
Relatedly, although the function takes a Timeout and elapses it, it will call MQTT_ProcessLoop (which I presume may block?) even if timeout->may_block() is false. Is this the correct behaviour?
I noticed this because this function is called in a loop in the Hugh demo here and I noticed that it never timed out in long runs even though the timeout was never reset. This is harmless in this case and actually what we want, but it's weird.
I noticed some weirdness in the
mqtt_runfunction. Specifically:in the condition of the while loop
network-stack/lib/mqtt/mqtt.cc
Line 1115 in a7314f9
status != MQTT_Successis ever true because if it were we would've hit one of the return statements above. This means the loop always executes exactly once, so what's the point of having a loop?! For the same reason I don't think the return atnetwork-stack/lib/mqtt/mqtt.cc
Line 1119 in a7314f9
-ETIMEDOUT.Relatedly, although the function takes a Timeout and elapses it, it will call
MQTT_ProcessLoop(which I presume may block?) even iftimeout->may_block()is false. Is this the correct behaviour?I noticed this because this function is called in a loop in the Hugh demo here and I noticed that it never timed out in long runs even though the timeout was never reset. This is harmless in this case and actually what we want, but it's weird.