mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
dont close in user callback wrapper let ancestor do it
Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
parent
5ab9c68687
commit
aedc953a8f
3 changed files with 10 additions and 16 deletions
|
@ -1382,8 +1382,7 @@ _libwebsocket_rx_flow_control(struct libwebsocket *wsi)
|
||||||
if ((wsi->u.ws.rxflow_change_to & 1) && wsi->u.ws.rxflow_buffer) {
|
if ((wsi->u.ws.rxflow_change_to & 1) && wsi->u.ws.rxflow_buffer) {
|
||||||
n = libwebsocket_interpret_incoming_packet(wsi, NULL, 0);
|
n = libwebsocket_interpret_incoming_packet(wsi, NULL, 0);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
lwsl_info("closing connection at libwebsocket_rx_flow_control:\n");
|
lwsl_info("returning that we want to close connection at libwebsocket_rx_flow_control:\n");
|
||||||
libwebsocket_close_and_free_session(context, wsi, LWS_CLOSE_STATUS_NOSTATUS);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (n)
|
if (n)
|
||||||
|
@ -1495,15 +1494,10 @@ int user_callback_handle_rxflow(callback_function callback_function,
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
n = callback_function(context, wsi, reason, user, in, len);
|
n = callback_function(context, wsi, reason, user, in, len);
|
||||||
if (n) {
|
if (!n)
|
||||||
libwebsocket_close_and_free_session(context, wsi,
|
n = _libwebsocket_rx_flow_control(wsi);
|
||||||
LWS_CLOSE_STATUS_NOSTATUS);
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
_libwebsocket_rx_flow_control(wsi);
|
return n;
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -501,8 +501,7 @@ int libwebsockets_serve_http_file_fragment(struct libwebsocket_context *context,
|
||||||
if (wsi->protocol->callback)
|
if (wsi->protocol->callback)
|
||||||
ret = user_callback_handle_rxflow(wsi->protocol->callback, context, wsi, LWS_CALLBACK_HTTP_FILE_COMPLETION, wsi->user_space,
|
ret = user_callback_handle_rxflow(wsi->protocol->callback, context, wsi, LWS_CALLBACK_HTTP_FILE_COMPLETION, wsi->user_space,
|
||||||
NULL, 0);
|
NULL, 0);
|
||||||
/* user_callback_handle_rxflow did any close already */
|
return ret;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -546,6 +546,7 @@ libwebsocket_rx_sm(struct libwebsocket *wsi, unsigned char c)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
struct lws_tokens eff_buf;
|
struct lws_tokens eff_buf;
|
||||||
|
int ret = 0;
|
||||||
#ifndef LWS_NO_EXTENSIONS
|
#ifndef LWS_NO_EXTENSIONS
|
||||||
int handled;
|
int handled;
|
||||||
int m;
|
int m;
|
||||||
|
@ -928,10 +929,10 @@ spill:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (eff_buf.token_len > 0) {
|
if (eff_buf.token_len > 0) {
|
||||||
eff_buf.token[eff_buf.token_len] = '\0';
|
eff_buf.token[eff_buf.token_len] = '\0';
|
||||||
|
|
||||||
if (wsi->protocol->callback)
|
if (wsi->protocol->callback)
|
||||||
user_callback_handle_rxflow(wsi->protocol->callback,
|
ret = user_callback_handle_rxflow(wsi->protocol->callback,
|
||||||
wsi->protocol->owning_server,
|
wsi->protocol->owning_server,
|
||||||
wsi, LWS_CALLBACK_RECEIVE,
|
wsi, LWS_CALLBACK_RECEIVE,
|
||||||
wsi->user_space,
|
wsi->user_space,
|
||||||
|
@ -945,7 +946,7 @@ spill:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
|
|
||||||
illegal_ctl_length:
|
illegal_ctl_length:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue