mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
![]() 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. |
||
---|---|---|
.. | ||
core | ||
event-libs | ||
misc | ||
plat | ||
roles | ||
tls | ||
libwebsockets.h | ||
README.md |
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 |