Closed denizs closed 5 years ago
ping
I've left some comments
I can't see them (yet) 😢
Almost there. Few nits. We should be good to go after those changes :)
I'll merge this and fix those :). Thanks for you contribution
Sorry - had somewhat of a stressful week! But thanks for taking over though 👍 Should I open another issue w.r.t. to the pause / resume issue so that we can discuss todos there?
Sorry - had somewhat of a stressful week! But thanks for taking over though
Not a problem :)
Should I open another issue w.r.t. to the pause / resume issue so that we can discuss todos there?
Sure. That'll help
This PR introduces a new client method named
shutdown
, which allows the client to gracefully close the connection to the broker.Implementation details:
The
request_tx
sends aRequest::Disconnect
. As a result, thehandle_outgoing_disconnect
method of theMqttState
sets theMqttConnectionStatus
to a new enum value namedDisconnecting
. To verfiy the client is currently disconnecting,MqttState
now exposes ais_disconnecting
method returning abool
.This allows the mqtt event loop to verfiy, whether the
NetworkError::NetworkStreamClosed
error is actually expected to happen or not and jump out of the reconnect loop. For convenience, I pulled theshould_reconnect_again
function into theimpl
of theConnection
, alleviating the necessity of passing in both, the reconnect opts and now also theis_diconnecting
flag (as we don't want to be reconnected when we gracefully shutdown - even if our reconnect options state otherwise)