mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
libuv report init failure
Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
parent
f29fbdf78a
commit
45dead99e0
2 changed files with 13 additions and 2 deletions
|
@ -138,9 +138,15 @@ lws_uv_initloop(struct lws_context *context, uv_loop_t *loop, int tsi)
|
|||
while (vh) {
|
||||
if (vh->lserv_wsi) {
|
||||
vh->lserv_wsi->w_read.context = context;
|
||||
uv_poll_init_socket(pt->io_loop_uv,
|
||||
n = uv_poll_init_socket(pt->io_loop_uv,
|
||||
&vh->lserv_wsi->w_read.uv_watcher,
|
||||
vh->lserv_wsi->sock);
|
||||
if (n) {
|
||||
lwsl_err("uv_poll_init failed %d, sockfd=%p\n",
|
||||
n, (void *)(long)vh->lserv_wsi->sock);
|
||||
|
||||
return -1;
|
||||
}
|
||||
uv_poll_start(&vh->lserv_wsi->w_read.uv_watcher,
|
||||
UV_READABLE, lws_io_cb);
|
||||
}
|
||||
|
|
|
@ -292,13 +292,18 @@ int main(int argc, char **argv)
|
|||
|
||||
lws_uv_sigint_cfg(context, 1, signal_cb);
|
||||
|
||||
lws_uv_initloop(context, NULL, 0);
|
||||
if (lws_uv_initloop(context, NULL, 0)) {
|
||||
lwsl_err("lws_uv_initloop failed\n");
|
||||
|
||||
goto bail;
|
||||
}
|
||||
|
||||
uv_timer_init(lws_uv_getloop(context, 0), &timeout_watcher);
|
||||
uv_timer_start(&timeout_watcher, uv_timeout_cb_dumb_increment, 50, 50);
|
||||
|
||||
lws_libuv_run(context, 0);
|
||||
|
||||
bail:
|
||||
lws_context_destroy(context);
|
||||
lwsl_notice("libwebsockets-test-server exited cleanly\n");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue