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

libevent: use event_enable_debug_mode

This commit is contained in:
Andy Green 2021-07-11 10:53:16 +01:00
parent a4720b7dbc
commit 4c4b2c5dcf
3 changed files with 22 additions and 4 deletions

View file

@ -31,18 +31,34 @@ int
lws_plat_pipe_create(struct lws *wsi)
{
struct lws_context_per_thread *pt = &wsi->a.context->pt[(int)wsi->tsi];
int n;
#if defined(LWS_HAVE_EVENTFD)
pt->dummy_pipe_fds[0] = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
pt->dummy_pipe_fds[1] = -1;
return pt->dummy_pipe_fds[0] < 0 ? -1 : 0;
n = pt->dummy_pipe_fds[0] < 0 ? -1 : 0;
goto set;
#elif defined(LWS_HAVE_PIPE2)
return pipe2(pt->dummy_pipe_fds, O_NONBLOCK);
n = pipe2(pt->dummy_pipe_fds, O_NONBLOCK);
#else
return pipe(pt->dummy_pipe_fds);
n = pipe(pt->dummy_pipe_fds);
#endif
#if defined(LWS_HAVE_EVENTFD)
set:
#endif
if (n >= 0) {
if (fcntl(pt->dummy_pipe_fds[0], F_SETFL, O_NONBLOCK) < 0)
n = -1;
else if (pt->dummy_pipe_fds[1] >= 0) {
if (fcntl(pt->dummy_pipe_fds[1], F_SETFL, O_NONBLOCK) < 0)
n = -1;
}
}
return n;
}
int

View file

@ -510,6 +510,8 @@ rops_pt_init_destroy_netlink(struct lws_context *context,
goto bail1;
}
lws_plat_set_nonblocking(wsi->desc.sockfd);
__lws_lc_tag(context, &context->lcg[LWSLCG_VHOST], &wsi->lc,
"netlink");

View file

@ -43,9 +43,9 @@ foreign_event_loop_init_and_run_libevent(void)
tv.tv_sec = 1;
tv.tv_usec = 0;
event_enable_debug_mode();
loop_event = event_base_new();
sighandler_event = evsignal_new((struct event_base *)loop_event, SIGINT, signal_cb_event,
(void*)SIGINT);