Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mqtt: fix MQTT client PINGREQ failure when using LIBUV as event driver. #3265

Open
wants to merge 4 commits into
base: v4.3-stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/roles/mqtt/mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,7 @@ lws_mqtt_client_send_unsubcribe(struct lws *wsi,
for (n = 0; n < unsub->num_topics; n++) {
mysub = lws_mqtt_find_sub(nwsi->mqtt,
unsub->topic[n].name);
assert(mysub);
//assert(mysub);

if (mysub && --mysub->ref_count == 0) {
lwsl_notice("%s: Need to send UNSUB\n", __func__);
Expand Down
15 changes: 15 additions & 0 deletions lib/roles/mqtt/ops-mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,16 @@ rops_callback_on_writable_mqtt(struct lws *wsi)
)
return 1;

if (lws_check_opt(wsi->a.context->options, LWS_SERVER_OPTION_LIBUV)) {
if (network_wsi->mux_substream != 0)
network_wsi->mux_substream = 0;

lws_start_foreach_ll(struct lws *, w, network_wsi->mux.child_list) {
if (w->mux.requested_POLLOUT == 0)
w->mux.requested_POLLOUT = 1;
} lws_end_foreach_ll(w, mux.sibling_list);
}

return 0;
}

Expand All @@ -562,6 +572,11 @@ rops_close_kill_connection_mqtt(struct lws *wsi, enum lws_close_status reason)
lws_wsi_tag(wsi),
lws_wsi_tag(wsi->mux.parent_wsi), wsi->mux.child_list);
//lws_wsi_mux_dump_children(wsi);
if (lws_check_opt(wsi->a.context->options, LWS_SERVER_OPTION_LIBUV)) {
struct lws *nwsi = lws_get_network_wsi(wsi);
if (nwsi->mux_substream == 0)
nwsi->mux_substream = 1;
}

if (wsi->mux_substream
#if defined(LWS_WITH_CLIENT)
Expand Down