mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
client: handle oom4 fail path for vhost dll_active_client_conns list
Client connections can put themselves on the active client list before they have survived the client connect process past oom4, which can fail out without close processing. So ensure the wsi destruction on oom4 removes it from the list.
This commit is contained in:
parent
a03dd40e62
commit
c5012fac1d
1 changed files with 11 additions and 0 deletions
|
@ -177,6 +177,7 @@ create_new_conn:
|
|||
lws_dll_is_null(&wsi->dll_client_transaction_queue) &&
|
||||
lws_dll_is_null(&wsi->dll_active_client_conns)) {
|
||||
lws_vhost_lock(wsi->vhost);
|
||||
/* caution... we will have to unpick this on oom4 path */
|
||||
lws_dll_lws_add_front(&wsi->dll_active_client_conns,
|
||||
&wsi->vhost->dll_active_client_conns);
|
||||
lws_vhost_unlock(wsi->vhost);
|
||||
|
@ -581,6 +582,16 @@ oom4:
|
|||
if (wsi->position_in_fds_table != LWS_NO_FDS_POS)
|
||||
goto failed1;
|
||||
lws_remove_from_timeout_list(wsi);
|
||||
/*
|
||||
* We can't be an active client connection any more, if we thought
|
||||
* that was what we were going to be doing. It should be if we are
|
||||
* failing by oom4 path, we are still called by
|
||||
* lws_client_connect_via_info() and will be returning NULL to that,
|
||||
* so nobody else should have had a chance to queue on us.
|
||||
*/
|
||||
lws_vhost_lock(wsi->vhost);
|
||||
lws_dll_lws_remove(&wsi->dll_active_client_conns);
|
||||
lws_vhost_unlock(wsi->vhost);
|
||||
#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
|
||||
lws_header_table_detach(wsi, 0);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue