1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
libwebsockets/test-server
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
..
android Android: update to use SDK Python script 2016-06-07 02:42:32 +08:00
private basic-auth 2016-12-16 22:08:13 +08:00
.gitignore Ignoring linux build files 2013-01-09 15:46:11 +08:00
attack.sh update attack.sh 2016-10-06 20:41:29 +08:00
candide.zip fops-zip 2017-03-05 15:32:55 +08:00
favicon.ico refactor-into-dirs.patch 2010-11-01 09:12:17 +00:00
fuzxy.c Subject: LWS_UNUSED 2017-06-19 10:57:39 +08:00
leaf.jpg add by hand http send example 2013-02-14 23:24:07 +08:00
libwebsockets-test-server.service test server example systemd service file 2016-02-19 12:46:36 +08:00
libwebsockets.org-logo.png add libwebsockets.org logo to share 2013-01-16 10:00:39 +08:00
lws-cgi-test.sh cgi post 2016-04-13 11:53:40 +08:00
lws-common.js plugin table dirlisting 2016-07-14 08:57:28 +08:00
test-client.c raw: enable server and client raw sockets 2017-03-07 16:06:05 +08:00
test-echo.c Subject: Direct extension confirmation to the negotiated protocol's callback 2017-05-29 08:30:26 +08:00
test-fraggle.c client: decruft extensions 2017-02-03 10:39:37 +08:00
test-ping.c lws_intptr_t 2017-07-07 08:32:04 +08:00
test-server-dumb-increment.c Subject: gcc format strings: Make GCC check format strings, fix found problems 2017-02-05 21:32:30 +08:00
test-server-http.c lws_return_http_status: if not in HTTP/2, restrict to a single write 2017-06-29 11:26:22 +08:00
test-server-libev.c test servers: convert to static inclusion of plugins 2017-06-28 11:16:48 +08:00
test-server-libevent.c Subject: Libevent: Initial Support 2017-03-22 05:36:25 +08:00
test-server-libuv.c test-server-libuv: add missing call to lws_context_destroy2() 2017-06-28 11:37:15 +08:00
test-server-pthreads.c lws_intptr_t 2017-07-07 08:32:04 +08:00
test-server-v2.0.c lws-vhost-destroy 2017-07-19 08:51:43 +08:00
test-server.c lws-vhost-destroy 2017-07-19 08:51:43 +08:00
test-server.h test servers: convert to static inclusion of plugins 2017-06-28 11:16:48 +08:00
test.html test-html: unify ws open function 2017-07-14 10:26:39 +08:00