1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

ss: mqtt: Avoid CONNECTING to DISCONNECTED transition

Check previous states with 'ss_dangling_connected'.
If it did not visit CONNECTED, transit to UNREACHABLE
instead of DISCONNECTED.
This commit is contained in:
Chunho Lee 2021-04-13 08:23:13 -07:00 committed by Andy Green
parent 8c26063828
commit 0276f3e635

View file

@ -69,7 +69,11 @@ secstream_mqtt(struct lws *wsi, enum lws_callback_reasons reason, void *user,
lws_sul_cancel(&h->sul_timeout);
lws_conmon_ss_json(h);
r= lws_ss_event_helper(h, LWSSSCS_DISCONNECTED);
if (h->ss_dangling_connected)
r = lws_ss_event_helper(h, LWSSSCS_DISCONNECTED);
else
r = lws_ss_event_helper(h, LWSSSCS_UNREACHABLE);
if (h->wsi)
lws_set_opaque_user_data(h->wsi, NULL);
h->wsi = NULL;