[Libwebsockets] libuv and clean shutdown

Mateusz Stępień mateusz.stepien at netrounds.com
Mon Mar 4 08:35:40 CET 2019

For people from the future looking into the same problem, I resolved it 
by adding a "shutdown" flag in virtual host data structure, set it to 1 
in a desired place in a callback (in my case it was 
LWS_CALLBACK_CLIENT_CONNECTION_ERROR) and schedule user callback with 
lws_timed_callback_vh_protocol and LWS_CALLBACK_USER reason. In the user 
callback, I check for shutdown flag and call 
lws_context_destroy(lws_get_context(wsi)), which cleanly shuts down the 
whole process.

Thank you Andy again for help.

More information about the Libwebsockets mailing list