Open MattBrittan opened 10 months ago
The fix I have just merged should prevent this from being an issue with autopaho. However it would be good to review this code further and see if there is a better way of handling things (this might include looking at what to do if the client gets stalled due to receive maximum depletion - should we drop the connection if this happens?).
Describe the bug
In
autopaho
managePublishQueue
we callPublishWithOptions
and if an error is returned wait on the connection to drop before trying again (so we assume that ifPublishWithOptions
returns an error then it's fatal). This is not a valid assumption because publish may return at other times; for instance ifc.PacketTimeout
is exceeded.Solving this is going to require a bit of thought and modifications to
paho
; considerpublishQoS12
:So if we are attempting to send a lot of messages and
c.Session.AddToSession
blocks for, by default, 10 seconds thenpublishQoS12
returns an error without actually making an attempt to send the message (due toc.PacketTimeout
). This makes it difficult for the caller to know what to do when it receives an error (should it retry or should it expect the connection to drop due to a protocol error).I think there is a quick fix and a longer term project here:
PublishWithOptions
returns an error (checking the connection status before doing so)c.PacketTimeout
(personally I don't like the way it's used inPublish
; the function already takes aContext
so adding an additional timeout is a bit confusing).Software used:
@master