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 d3a5505542 multithreaded service
This adds support for multithreaded service to lws without adding any
threading or locking code in the library.

At context creation time you can request split the service part of the
context into n service domains, which are load-balanced so that the most
idle one gets the next listen socket accept.

There's a single listen socket on one port still.

User code may then spawn n threads doing n service loops / poll()s
simultaneously.  Locking is only required (I think) in the existing
FD lock callbacks already handled by the pthreads server example,
and that locking takes place in user code.  So the library remains
completely agnostic about the threading / locking scheme.

And by default, it's completely compatible with one service thread
so no changes are required by people uninterested in multithreaded
service.

However for people interested in extremely lightweight mass http[s]/
ws[s] service with minimum provisioning, the library can now do
everything out of the box.

To test it, just try

$ libwebsockets-test-server-pthreads -j 8

where -j controls the number of service threads

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-19 20:02:36 +08:00
..
.gitignore Ignoring linux build files 2013-01-09 15:46:11 +08:00
attack.sh uridecoding disallow uriencoded equals in name part 2015-12-18 15:40:03 +08:00
favicon.ico refactor-into-dirs.patch 2010-11-01 09:12:17 +00:00
fuzxy.c fuzxy 2016-01-18 11:16:25 +08:00
leaf.jpg add by hand http send example 2013-02-14 23:24:07 +08:00
libwebsockets.org-logo.png add libwebsockets.org logo to share 2013-01-16 10:00:39 +08:00
test-client.c redirect 2016-01-15 19:32:47 +08:00
test-echo.c lws_client_connect_via_info 2016-01-12 17:22:06 +08:00
test-fraggle.c extension permessage deflate 2016-01-11 11:34:01 +08:00
test-ping.c extension permessage deflate 2016-01-11 11:34:01 +08:00
test-server-dumb-increment.c extension permessage deflate 2016-01-11 11:34:01 +08:00
test-server-echogen.c extension permessage deflate 2016-01-11 11:34:01 +08:00
test-server-http.c extension permessage deflate 2016-01-11 11:34:01 +08:00
test-server-libev.c test server libev 2015-12-27 09:43:44 +08:00
test-server-mirror.c extension permessage deflate 2016-01-11 11:34:01 +08:00
test-server-pthreads.c multithreaded service 2016-01-19 20:02:36 +08:00
test-server.c extension permessage deflate 2016-01-11 11:34:01 +08:00
test-server.h extension permessage deflate 2016-01-11 11:34:01 +08:00
test.html extension permessage deflate 2016-01-11 11:34:01 +08:00