test-server-extpoll: add 1-per-second timeout servicing

Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
This commit is contained in:
Denis Osvald 2016-10-06 15:45:25 +02:00 committed by Andy Green
parent 6b7f30ef64
commit af8692e36f

View file

@ -411,6 +411,9 @@ int main(int argc, char **argv)
lws_get_fops(context)->open = test_server_fops_open;
n = 0;
#ifdef EXTERNAL_POLL
int ms_1sec = 0;
#endif
while (n >= 0 && !force_exit) {
struct timeval tv;
@ -456,6 +459,13 @@ int main(int argc, char **argv)
lwsl_notice("extpoll doing forced service!\n");
lws_plat_service_tsi(context, -1, 0);
}
} else {
/* no revents, but before polling again, make lws check for any timeouts */
if (ms - ms_1sec > 1000) {
lwsl_notice("1 per sec\n");
lws_service_fd(context, NULL);
ms_1sec = ms;
}
}
#else
/*