You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used async_client and turned off automatic reconnect. After successfully establishing a connection, I disconnected from the network. At this time, calling publish would time out. So I actively called client.reconnect()->wait(). Before the connection_lost callback was triggered, I restored the network. At this time, reconnect would be blocked forever although the connection had been restored.
The process is as follows:
connect to broker and publish messages
Disconnect from the network
call client.reconnect()->wait()
restore network before connection_lost callback triggered.
reconnect would be blocked forever.
Additional explanation:
Why do I call reconnect before connection_lost is triggered?
This involves another question. I found that there is a possibility that the connection is disconnected after the system switches the default gateway, but the connection_lost callback is not triggered. Therefore, I added a judgment when sending a message. If the sending of the qos=2 message times out, it is considered that the connection is disconnected and a reconnection is actively called.
The text was updated successfully, but these errors were encountered:
I used async_client and turned off automatic reconnect. After successfully establishing a connection, I disconnected from the network. At this time, calling publish would time out. So I actively called
client.reconnect()->wait()
. Before theconnection_lost
callback was triggered, I restored the network. At this time, reconnect would be blocked forever although the connection had been restored.The process is as follows:
client.reconnect()->wait()
connection_lost
callback triggered.reconnect
would be blocked forever.Additional explanation:
Why do I call reconnect before connection_lost is triggered?
This involves another question. I found that there is a possibility that the connection is disconnected after the system switches the default gateway, but the connection_lost callback is not triggered. Therefore, I added a judgment when sending a message. If the sending of the qos=2 message times out, it is considered that the connection is disconnected and a reconnection is actively called.
The text was updated successfully, but these errors were encountered: