Skip to content
Snippets Groups Projects
Commit c5012fac authored by Andy Green's avatar Andy Green
Browse files

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.
parent a03dd40e
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment