[Libwebsockets] libuv and clean shutdown

Mateusz Stępień mateusz.stepien at netrounds.com
Fri Mar 1 11:39:51 CET 2019


Hello,

I want to use libwebsockets library with an external event loop (libuv 
specifically). I used lws-minimal-ws-client-echo as a base successfully, 
however I noticed that when connection is closed for whatever reason, 
the process does not shutdown at all. Sending SIGTERM does not help, it 
results in log message:

     ERR: internal signal handler caught signal 15
     ERR: lws_libuv_stop
     ERR: lws_libuv_stop: ignoring

When I tried to run lws-minimal-ws-client-echo example unmodified with 
--libuv option, I had the same result. The only thing that worked is to 
manually close the associated libuv loop handle from the callback:

     case LWS_CALLBACK_EVENT_WAIT_CANCELLED:
         uv_stop(lws_uv_getloop(lws_get_context(wsi), 0));
         break;

The downside of that solution is that I use event loop specific API. So 
my question is: is there any event loop agnostic way to close the 
process in a clean way?

Thanks,
Mateusz


More information about the Libwebsockets mailing list