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

ss: http: handle rx DESTROY_ME

This commit is contained in:
Andy Green 2020-07-20 14:41:28 +01:00
parent 195fe76f42
commit 08bc9bf410
2 changed files with 14 additions and 7 deletions

View file

@ -1425,13 +1425,16 @@ spin_chunks:
!!wsi->protocol_bind_balance
#endif
) {
if (user_callback_handle_rxflow(wsi->a.protocol->callback,
wsi, LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ,
wsi->user_space, *buf, n)) {
lwsl_info("%s: RECEIVE_CLIENT_HTTP_READ returned -1\n",
__func__);
int q;
return -1;
q = user_callback_handle_rxflow(wsi->a.protocol->callback,
wsi, LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ,
wsi->user_space, *buf, n);
if (q) {
lwsl_info("%s: RECEIVE_CLIENT_HTTP_READ returned %d\n",
__func__, q);
return q;
}
} else
lwsl_notice("%s: swallowed read (%d)\n", __func__, n);

View file

@ -431,7 +431,10 @@ malformed:
// lwsl_notice("%s: HTTP_READ: client side sent len %d fl 0x%x\n",
// __func__, (int)len, (int)f);
if (h->info.rx(ss_to_userobj(h), (const uint8_t *)in, len, f) < 0)
m = h->info.rx(ss_to_userobj(h), (const uint8_t *)in, len, f);
if (m == LWSSSSRET_DESTROY_ME)
goto do_destroy_me;
if (m < 0)
return -1;
return 0; /* don't passthru */
@ -501,6 +504,7 @@ malformed:
return -1; /* close connection */
case LWSSSSRET_DESTROY_ME:
do_destroy_me:
lws_set_opaque_user_data(wsi, NULL);
h->wsi = NULL;
lws_ss_destroy(&h);