mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
service: if we got POLLIN service it before checking timeout
This commit is contained in:
parent
0647806f4c
commit
129d080a8a
1 changed files with 7 additions and 2 deletions
|
@ -936,9 +936,11 @@ lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd,
|
|||
if (!context || context->being_destroyed1)
|
||||
return -1;
|
||||
|
||||
/* the socket we came to service timed out, nothing to do */
|
||||
if (lws_service_periodic_checks(context, pollfd, tsi) || !pollfd)
|
||||
/* the case there's no pollfd to service, we just want to do periodic */
|
||||
if (!pollfd) {
|
||||
lws_service_periodic_checks(context, pollfd, tsi);
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* no, here to service a socket descriptor */
|
||||
wsi = wsi_from_fd(context, pollfd->fd);
|
||||
|
@ -1034,6 +1036,9 @@ handled:
|
|||
#endif
|
||||
pollfd->revents = 0;
|
||||
|
||||
/* check the timeout situation if we didn't in the last second */
|
||||
lws_service_periodic_checks(context, pollfd, tsi);
|
||||
|
||||
lws_pt_lock(pt, __func__);
|
||||
__lws_hrtimer_service(pt);
|
||||
lws_pt_unlock(pt);
|
||||
|
|
Loading…
Add table
Reference in a new issue