1
0
Fork 0
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:
Andy Green 2018-11-14 20:04:14 +08:00
parent 0647806f4c
commit 129d080a8a

View file

@ -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);