1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

improve test server poll loop docs

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2013-02-02 23:02:56 +08:00
parent a2156aa863
commit 0d49c8d1a0

View file

@ -608,16 +608,6 @@ int main(int argc, char **argv)
oldus = tv.tv_usec;
}
/*
* This example server does not fork or create a thread for
* websocket service, it all runs in this single loop. So,
* we have to give the websockets an opportunity to service
* "manually".
*
* If no socket is needing service, the call below returns
* immediately and quickly. Negative return means we are
* in process of closing
*/
#ifdef EXTERNAL_POLL
/*
@ -642,6 +632,15 @@ int main(int argc, char **argv)
&pollfds[n]) < 0)
goto done;
#else
/*
* If libwebsockets sockets are all we care about,
* you can use this api which takes care of the poll()
* and looping through finding who needed service.
*
* If no socket needs service, it'll return anyway after
* the number of ms in the second argument.
*/
n = libwebsocket_service(context, 50);
#endif
}