mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
![]() Adds a new api lws_vhost_destroy(struct lws_vhost *) which allows dynamic removal of vhosts. The external api calls two parts of internal helpers that get reused for context destroy. The second part is called deferred by 5s... this is to ensure that event library objects composed into structs owned by the vhost all have a chance to complete their close asynchronously. That should happen immediately, but it requires us to return to the event loop first. The vhost being removed is deleted from the context vhost list by the first part, and does not block further removals or creation during the delay for the deferred freeing of the vhost memory. Part 1: - if the vhost owned a listen socket needed by other vhosts listening on same iface + port, the listen socket is first handed off to another vhost so it stays alive - all wsi still open on the vhost are forcibly closed (including any listen socket still attached) - inform all active protocols on the vhost they should destroy themselves - remove vhost from context vhost list (can no longer be found by incoming connections) - add to a "being destroyed" context list and schedule the second part to be called in 5s Part 2: - remove us from the being destroyed list - free all allocations owned by the vhost - zero down the vhost and free the vhost itself In libwebsockets-test-server, you can send it a SIGUSR1 to have it toggle the creation and destruction of a second vhost on port + 1. |
||
---|---|---|
.. | ||
etc-logrotate.d-lwsws | ||
etc-lwsws-conf-EXAMPLE | ||
etc-lwsws-conf.d-localhost-EXAMPLE | ||
main.c | ||
usr-lib-systemd-system-lwsws.service |