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

sspc: allow NULL rx and state in ssi

Sometimes there's no need for .tx or even .state... make sure we are OK with
that in the ssi by checking before sspc callthrus
This commit is contained in:
Andy Green 2021-01-01 14:57:07 +00:00
parent 629ccd4db8
commit a82be3bd39
2 changed files with 18 additions and 10 deletions

View file

@ -357,6 +357,11 @@ callback_sspc_client(struct lws *wsi, enum lws_callback_reasons reason,
len = sizeof(pkt) - LWS_PRE - 19;
flags = 0;
if (!h->ssi.tx) {
n = 0;
goto do_write_nz;
}
n = h->ssi.tx(m, h->ord++, pkt + LWS_PRE + 19, &len,
&flags);
switch (n) {
@ -568,7 +573,8 @@ lws_sspc_destroy(lws_sspc_handle_t **ph)
lws_sspc_rxmetadata_destroy(h);
h->ssi.state(m, NULL, LWSSSCS_DESTROYING, 0);
if (h->ssi.state)
h->ssi.state(m, NULL, LWSSSCS_DESTROYING, 0);
*ph = NULL;
__lws_lc_untag(&h->lc);

View file

@ -1239,15 +1239,17 @@ payload_ff:
h->creating_cb_done = 1;
n = ssi->state(client_pss_to_userdata(pss),
NULL, LWSSSCS_CREATING, 0);
switch (n) {
case LWSSSSRET_OK:
break;
case LWSSSSRET_DISCONNECT_ME:
goto hangup;
case LWSSSSRET_DESTROY_ME:
return LWSSSSRET_DESTROY_ME;
if (ssi->state) {
n = ssi->state(client_pss_to_userdata(pss),
NULL, LWSSSCS_CREATING, 0);
switch (n) {
case LWSSSSRET_OK:
break;
case LWSSSSRET_DISCONNECT_ME:
goto hangup;
case LWSSSSRET_DESTROY_ME:
return LWSSSSRET_DESTROY_ME;
}
}
h->dsh = lws_dsh_create(NULL, (size_t)(par->temp32 ?