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:
parent
d1d313b4bf
commit
d5d2bbc4db
3 changed files with 15 additions and 9 deletions
|
@ -153,15 +153,17 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
|
||||||
#if !defined(LWS_NO_CLIENT)
|
#if !defined(LWS_NO_CLIENT)
|
||||||
|
|
||||||
lws_free_set_NULL(wsi->cli_hostname_copy);
|
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
|
* if we have wsi in our transaction queue, if we are closing we
|
||||||
* must go through and close all those first
|
* must go through and close all those first
|
||||||
*/
|
*/
|
||||||
if (wsi->vhost) {
|
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)
|
if ((int)reason != -1)
|
||||||
lws_vhost_lock(wsi->vhost);
|
lws_vhost_lock(wsi->vhost);
|
||||||
|
|
||||||
|
@ -201,6 +203,7 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
|
||||||
if (wsi->role_ops == &role_ops_raw_file) {
|
if (wsi->role_ops == &role_ops_raw_file) {
|
||||||
lws_remove_child_from_any_parent(wsi);
|
lws_remove_child_from_any_parent(wsi);
|
||||||
__remove_wsi_socket_from_fds(wsi);
|
__remove_wsi_socket_from_fds(wsi);
|
||||||
|
if (wsi->protocol)
|
||||||
wsi->protocol->callback(wsi, wsi->role_ops->close_cb[0],
|
wsi->protocol->callback(wsi, wsi->role_ops->close_cb[0],
|
||||||
wsi->user_space, NULL, 0);
|
wsi->user_space, NULL, 0);
|
||||||
goto async_close;
|
goto async_close;
|
||||||
|
@ -329,7 +332,7 @@ just_kill_connection:
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
if (!wsi->told_user_closed && wsi->user_space &&
|
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,
|
lwsl_debug("%s: %p: DROP_PROTOCOL %s\n", __func__, wsi,
|
||||||
wsi->protocol->name);
|
wsi->protocol->name);
|
||||||
wsi->protocol->callback(wsi,
|
wsi->protocol->callback(wsi,
|
||||||
|
@ -340,7 +343,8 @@ just_kill_connection:
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((lwsi_state(wsi) == LRS_WAITING_SERVER_REPLY ||
|
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,
|
wsi->protocol->callback(wsi,
|
||||||
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
|
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
|
||||||
wsi->user_space, NULL, 0);
|
wsi->user_space, NULL, 0);
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
#include "core/private.h"
|
#include "core/private.h"
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
__lws_remove_from_timeout_list(struct lws *wsi)
|
__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;
|
struct lws *wsi1;
|
||||||
int bef = 0;
|
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)
|
if (usecs == LWS_SET_TIMER_USEC_CANCEL)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -92,8 +92,10 @@ rops_handle_POLLIN_listen(struct lws_context_per_thread *pt, struct lws *wsi,
|
||||||
return LWS_HPI_RET_HANDLED;
|
return LWS_HPI_RET_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context->being_destroyed)
|
if (context->being_destroyed) {
|
||||||
|
compatible_close(accept_fd);
|
||||||
return LWS_HPI_RET_PLEASE_CLOSE_ME;
|
return LWS_HPI_RET_PLEASE_CLOSE_ME;
|
||||||
|
}
|
||||||
|
|
||||||
lws_plat_set_socket_options(wsi->vhost, accept_fd, 0);
|
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,
|
NULL,
|
||||||
(void *)(lws_intptr_t)accept_fd, 0)) {
|
(void *)(lws_intptr_t)accept_fd, 0)) {
|
||||||
lwsl_debug("Callback denied net connection\n");
|
lwsl_debug("Callback denied net connection\n");
|
||||||
|
compatible_close(accept_fd);
|
||||||
return LWS_HPI_RET_PLEASE_CLOSE_ME;
|
return LWS_HPI_RET_PLEASE_CLOSE_ME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue