1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
libwebsockets/plugins
Andy Green faa1526b39 lws-vhost-destroy
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.
2017-07-19 08:51:43 +08:00
..
generic-sessions boilerplate: add back missing Lesser that cut-and-pasted itself around 2017-04-06 23:01:34 +08:00
generic-table boilerplate: add back missing Lesser that cut-and-pasted itself around 2017-04-06 23:01:34 +08:00
lwsws-logo.png http cache policy 2016-04-22 08:53:49 +08:00
protocol_client_loopback_test.c gcc- format strings: debug and extra plugins 2017-02-05 22:30:27 +08:00
protocol_dumb_increment.c lws-vhost-destroy 2017-07-19 08:51:43 +08:00
protocol_esp32_lws_group.c plugins: group 2017-05-16 20:21:47 +08:00
protocol_esp32_lws_ota.c esp32: reapply pending count just for esp32 2017-05-07 08:19:55 +08:00
protocol_esp32_lws_reboot_to_factory.c esp32: separate factory setup 2017-03-31 20:05:10 +08:00
protocol_esp32_lws_scan.c esp32: multi ap slots 2017-05-13 10:26:59 +08:00
protocol_lws_mirror.c linkedlist helpers 2017-07-09 10:11:59 +08:00
protocol_lws_raw_test.c raw: enable server and client raw sockets 2017-03-07 16:06:05 +08:00
protocol_lws_server_status.c clean: fixes for appveyor warnings 2017-07-19 04:25:20 +08:00
protocol_lws_status.c ext: pmd: improve dealing with partial input usage with drain 2017-03-20 19:07:19 +08:00
protocol_post_demo.c esp32: return random length from lws_get_random 2017-04-28 11:54:27 +08:00
server-status.html context deprecation 2016-12-20 14:37:07 +08:00