diff options
author | Andy Green <andy@warmcat.com> | 2021-12-08 06:28:16 +0000 |
---|---|---|
committer | Andy Green <andy@warmcat.com> | 2021-12-14 08:09:25 +0000 |
commit | 91da9e30c7527275d232d2d5f161b53e697ecfe1 (patch) | |
tree | 93b0dbaf0c4aaf16c8c032ca3d858ccf6d57c911 | |
parent | 0bc5b58ee3bf103ba78b6ccacbc58395e3825f8a (diff) | |
download | libwebsockets-91da9e30c7527275d232d2d5f161b53e697ecfe1.tar.gz |
cancel pipe: mark close when wsi is close
-rw-r--r-- | lib/core-net/close.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/core-net/close.c b/lib/core-net/close.c index 1a4e0f7f..5e4edafb 100644 --- a/lib/core-net/close.c +++ b/lib/core-net/close.c @@ -896,6 +896,18 @@ __lws_close_free_wsi_final(struct lws *wsi) sanity_assert_no_sockfd_traces(wsi->a.context, wsi->desc.sockfd); } + /* ... if we're closing the cancel pipe, account for it */ + + { + struct lws_context_per_thread *pt = + &wsi->a.context->pt[(int)wsi->tsi]; + + if (pt->pipe_wsi == wsi) + pt->pipe_wsi = NULL; + if (pt->dummy_pipe_fds[0] == wsi->desc.sockfd) + pt->dummy_pipe_fds[0] = LWS_SOCK_INVALID; + } + wsi->desc.sockfd = LWS_SOCK_INVALID; #if defined(LWS_WITH_CLIENT) |