test-server-extpoll: add 1-per-second timeout servicing
Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
This commit is contained in:
parent
3f8082fecf
commit
14f994f52a
1 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue