1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
libwebsockets/lib
Andy Green ac3bd36c60 vhost_destroy: use vhost wsi reference counting to trigger destroy
This changes the vhost destroy flow to only hand off the listen
socket if another vhost sharing it, and mark the vhost as
being_destroyed.

Each tsi calls lws_check_deferred_free() once a second, if it sees
any vhost being_destroyed there, it closes all wsi on its tsi on
the same vhost, one time.

As the wsi on the vhost complete close (ie, after libuv async close
if on libuv event loop), they decrement a reference count for all
wsi open on the vhost.  The tsi who closes the last one then
completes the destroy flow for the vhost itself... it's random
which tsi completes the vhost destroy but since there are no
wsi left on the vhost, and it holds the context lock, nothing
can conflict.

The advantage of this is that owning tsi do the close for wsi
that are bound to the vhost under destruction, at a time when
they are guaranteed to be idle for service, and they do it with
both vhost and context locks owned, so no other service thread
can conflict for stuff protected by those either.

For the situation the user code may have allocations attached to
the vhost, this adds args to lws_vhost_destroy() to allow destroying
the user allocations just before the vhost is freed.
2018-06-18 09:11:46 +08:00
..
core vhost_destroy: use vhost wsi reference counting to trigger destroy 2018-06-18 09:11:46 +08:00
event-libs cgi: fix for https git server 2018-06-16 09:35:07 +08:00
misc refactor: core code in lib/core and private-libwebsockets.h to core/private.h 2018-05-03 10:49:36 +08:00
plat windows: fix microseconds time calculation 2018-06-02 06:01:47 +08:00
roles vhost_destroy: use vhost wsi reference counting to trigger destroy 2018-06-18 09:11:46 +08:00
tls vhost_destroy: use vhost wsi reference counting to trigger destroy 2018-06-18 09:11:46 +08:00
libwebsockets.h vhost_destroy: use vhost wsi reference counting to trigger destroy 2018-06-18 09:11:46 +08:00
README.md refactor: core code in lib/core and private-libwebsockets.h to core/private.h 2018-05-03 10:49:36 +08:00

Library sources layout

Code that goes in the libwebsockets library itself lives down ./lib

Path Sources
lib/core Core lws code related to generic fd and wsi servicing and management
lib/event-libs Code containing optional event-lib specific adaptations
lib/misc Code for various mostly optional miscellaneous features
lib/plat Platform-specific adaptation code
lib/roles Code for specific optional wsi roles, eg, http/1, h2, ws, raw, etc
lib/tls Code supporting the various TLS libraries
libwebsockets.h Public API header for the whole of lws