Skip to content

Commit 3b659bd

Browse files
committed
pipe: close path in libuv
1 parent 4e59faf commit 3b659bd

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

lib/core-net/close.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,6 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
474474
delete_from_fdwsi(wsi->a.context, wsi);
475475
#endif
476476
}
477-
lws_plat_pipe_close(pt->pipe_wsi);
478-
pt->pipe_wsi = NULL;
479477
}
480478

481479
#if defined(LWS_WITH_SYS_METRICS) && \
@@ -1056,13 +1054,14 @@ __lws_close_free_wsi_final(struct lws *wsi)
10561054
}
10571055

10581056
/* ... if we're closing the cancel pipe, account for it */
1059-
10601057
{
10611058
struct lws_context_per_thread *pt =
10621059
&wsi->a.context->pt[(int)wsi->tsi];
10631060

1064-
if (pt->pipe_wsi == wsi)
1061+
if (pt->pipe_wsi == wsi) {
1062+
lws_plat_pipe_close(wsi);
10651063
pt->pipe_wsi = NULL;
1064+
}
10661065
if (pt->dummy_pipe_fds[0] == wsi->desc.sockfd)
10671066
{
10681067
#if !defined(LWS_PLAT_FREERTOS)

lib/event-libs/libuv/libuv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ elops_accept_uv(struct lws *wsi)
524524
if (n) {
525525
lwsl_wsi_err(wsi, "uv_poll_init failed %d, sockfd=%p", n,
526526
(void *)(lws_intptr_t)wsi->desc.sockfd);
527+
assert(n != UV_EEXIST);
527528
lws_free(w_read->pwatcher);
528529
w_read->pwatcher = NULL;
529530
return -1;
@@ -633,7 +634,7 @@ elops_init_vhost_listen_wsi_uv(struct lws *wsi)
633634
if (n) {
634635
lwsl_wsi_err(wsi, "uv_poll_init failed %d, sockfd=%p", n,
635636
(void *)(lws_intptr_t)wsi->desc.sockfd);
636-
637+
assert(n != UV_EEXIST);
637638
return -1;
638639
}
639640

@@ -945,6 +946,7 @@ elops_sock_accept_parallel_uv(struct lws *wsi, lws_sockfd_type fd, int pidx)
945946

946947
if (n) {
947948
lwsl_wsi_err(wsi, "uv_poll_init failed %d", n);
949+
assert(n != UV_EEXIST);
948950
lws_free(w_read->pwatcher);
949951
w_read->pwatcher = NULL;
950952
return -1;

0 commit comments

Comments
 (0)