1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-30 00:00:16 +01:00
libwebsockets/test-server
Andy Green d280b6ecb3 http service break into outer loop states
Previously we sat and looped to dump a file over http protocol.

Actually that's a source of blocking to the other sockets being serviced.

This patch breaks up the file service into a roundtrip around the poll()
loop for each 512-byte packet.  It doesn't make much difference if the
server is idle, but if it's busy it makes sure everyone else is getting
service while the file is sent.

It doesn't try to optimize multiple users of the file or to keep the
descriptor open, the point of this patch is to establish the breaking up
of the file send action into the poll loop.

On the user side, there are two differences:

 - context is now needed in the first argument to libwebsockets_serve_http_file()
that's not too bad since we provide context in the callback.

 - file send is now asynchronous to the user code, you get a new callback coming
in protocol 0 when it's done, LWS_CALLBACK_HTTP_FILE_COMPLETION

libwebsockets-test-server is updated accordingly.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-15 16:00:36 +08:00
..
.gitignore Ignoring linux build files 2013-01-09 15:46:11 +08:00
favicon.ico refactor-into-dirs.patch 2010-11-01 09:12:17 +00:00
Makefile.am merge test server extpoll into test server 2013-01-15 15:50:31 +08:00
test-client.c add longlived option to test client 2013-01-15 15:43:17 +08:00
test-fraggle.c logging extend level set api to allow setting emission function 2013-01-12 09:17:42 +08:00
test-ping.c logging extend level set api to allow setting emission function 2013-01-12 09:17:42 +08:00
test-server.c http service break into outer loop states 2013-01-15 16:00:36 +08:00
test.html Use feature check rather than browser check. 2013-01-09 15:39:50 +08:00