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

threadpool: disassociate wsi on close

This commit is contained in:
Andy Green 2021-06-19 16:59:11 +01:00
parent 226c88ba32
commit 350a6dc9ef
3 changed files with 23 additions and 0 deletions

View file

@ -505,6 +505,10 @@ just_kill_connection:
lwsl_debug("%s: real just_kill_connection A: %s (sockfd %d)\n", __func__,
lws_wsi_tag(wsi), wsi->desc.sockfd);
#if defined(LWS_WITH_THREADPOOL)
lws_threadpool_wsi_closing(wsi);
#endif
#if defined(LWS_WITH_FILE_OPS) && (defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2))
if (lwsi_role_http(wsi) && lwsi_role_server(wsi) &&
wsi->http.fop_fd != NULL)

View file

@ -1417,6 +1417,9 @@ html_parser_cb(const hubbub_token *token, void *pw);
int
lws_threadpool_tsi_context(struct lws_context *context, int tsi);
void
lws_threadpool_wsi_closing(struct lws *wsi);
void
__lws_wsi_remove_from_sul(struct lws *wsi);

View file

@ -1162,6 +1162,22 @@ lws_threadpool_foreach_task_ss(struct lws_ss_handle *ss, void *user,
}
#endif
static int
disassociate_wsi(struct lws_threadpool_task *task,
void *user)
{
task->args.wsi = NULL;
lws_dll2_remove(&task->list);
return 0;
}
void
lws_threadpool_wsi_closing(struct lws *wsi)
{
lws_threadpool_foreach_task_wsi(wsi, NULL, disassociate_wsi);
}
struct lws_threadpool_task *
lws_threadpool_get_task_wsi(struct lws *wsi)
{