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

hrtimer: remove from correct dll before resetting

This commit is contained in:
Andy Green 2019-03-21 13:41:36 +08:00
parent d1d313b4bf
commit d5d2bbc4db
3 changed files with 15 additions and 9 deletions

View file

@ -153,15 +153,17 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
#if !defined(LWS_NO_CLIENT)
lws_free_set_NULL(wsi->cli_hostname_copy);
/* we are no longer an active client connection that can piggyback */
lws_dll_remove_track_tail(&wsi->dll_cli_active_conns,
&wsi->vhost->dll_cli_active_conns_head);
/*
* if we have wsi in our transaction queue, if we are closing we
* must go through and close all those first
*/
if (wsi->vhost) {
/* we are no longer an active client connection that can piggyback */
lws_dll_remove_track_tail(&wsi->dll_cli_active_conns,
&wsi->vhost->dll_cli_active_conns_head);
if ((int)reason != -1)
lws_vhost_lock(wsi->vhost);
@ -201,7 +203,8 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
if (wsi->role_ops == &role_ops_raw_file) {
lws_remove_child_from_any_parent(wsi);
__remove_wsi_socket_from_fds(wsi);
wsi->protocol->callback(wsi, wsi->role_ops->close_cb[0],
if (wsi->protocol)
wsi->protocol->callback(wsi, wsi->role_ops->close_cb[0],
wsi->user_space, NULL, 0);
goto async_close;
}
@ -329,7 +332,7 @@ just_kill_connection:
n = 0;
if (!wsi->told_user_closed && wsi->user_space &&
wsi->protocol_bind_balance) {
wsi->protocol_bind_balance && wsi->protocol) {
lwsl_debug("%s: %p: DROP_PROTOCOL %s\n", __func__, wsi,
wsi->protocol->name);
wsi->protocol->callback(wsi,
@ -340,7 +343,8 @@ just_kill_connection:
}
if ((lwsi_state(wsi) == LRS_WAITING_SERVER_REPLY ||
lwsi_state(wsi) == LRS_WAITING_CONNECT) && !wsi->already_did_cce)
lwsi_state(wsi) == LRS_WAITING_CONNECT) &&
!wsi->already_did_cce && wsi->protocol)
wsi->protocol->callback(wsi,
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
wsi->user_space, NULL, 0);

View file

@ -21,7 +21,6 @@
#include "core/private.h"
void
__lws_remove_from_timeout_list(struct lws *wsi)
{
@ -50,7 +49,7 @@ __lws_set_timer_usecs(struct lws *wsi, lws_usec_t usecs)
struct lws *wsi1;
int bef = 0;
__lws_remove_from_timeout_list(wsi);
lws_dll_remove_track_tail(&wsi->dll_hrtimer, &pt->dll_hrtimer_head);
if (usecs == LWS_SET_TIMER_USEC_CANCEL)
return;

View file

@ -92,8 +92,10 @@ rops_handle_POLLIN_listen(struct lws_context_per_thread *pt, struct lws *wsi,
return LWS_HPI_RET_HANDLED;
}
if (context->being_destroyed)
if (context->being_destroyed) {
compatible_close(accept_fd);
return LWS_HPI_RET_PLEASE_CLOSE_ME;
}
lws_plat_set_socket_options(wsi->vhost, accept_fd, 0);
@ -120,6 +122,7 @@ rops_handle_POLLIN_listen(struct lws_context_per_thread *pt, struct lws *wsi,
NULL,
(void *)(lws_intptr_t)accept_fd, 0)) {
lwsl_debug("Callback denied net connection\n");
compatible_close(accept_fd);
return LWS_HPI_RET_PLEASE_CLOSE_ME;
}