mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
sspc: handle loss of proxy manifesting itself as 0 length rx
If the client library loses the proxy connection, it can receive an endless stream of 0 length rx instead of understanding that the UDS peer has gone. Handle that correctly so the client reacts to the loss of the proxy link by trying to reacquire it. Adapt the sspc state to be suitable for retry in that case, by dropping any dsh and letting the logical ss know that he is DISCONNECTED, if he thought he was CONNECTED.
This commit is contained in:
parent
ddf24783b3
commit
789d98b98b
1 changed files with 13 additions and 0 deletions
|
@ -178,6 +178,13 @@ callback_sspc_client(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
lwsl_info("%s: LWS_CALLBACK_RAW_CLOSE: %s proxy conn down, sspc h %s\n",
|
||||
__func__, lws_wsi_tag(wsi), lws_sspc_tag(h));
|
||||
if (h) {
|
||||
lws_dsh_destroy(&h->dsh);
|
||||
if (h->ss_dangling_connected && h->ssi.state) {
|
||||
lwsl_notice("%s: setting _DISCONNECTED\n", __func__);
|
||||
h->ss_dangling_connected = 0;
|
||||
h->prev_ss_state = LWSSSCS_DISCONNECTED;
|
||||
h->ssi.state(ss_to_userobj(h), NULL, LWSSSCS_DISCONNECTED, 0);
|
||||
}
|
||||
h->cwsi = NULL;
|
||||
/*
|
||||
* schedule a reconnect in 1s
|
||||
|
@ -200,6 +207,12 @@ callback_sspc_client(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!len) {
|
||||
lwsl_notice("%s: RAW_RX: zero len\n", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
n = lws_ss_deserialize_parse(&h->parser, lws_get_context(wsi),
|
||||
h->dsh, in, len, &h->state, h,
|
||||
(lws_ss_handle_t **)m, &h->ssi, 1);
|
||||
|
|
Loading…
Add table
Reference in a new issue