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

minimal: eventlib-custom: handle fds removal in service

https://github.com/warmcat/libwebsockets/issues/2388
This commit is contained in:
Andy Green 2021-08-18 07:37:24 +01:00
parent 1348632d14
commit 31bbeb520d

View file

@ -144,12 +144,19 @@ custom_poll_run(custom_poll_ctx_t *cpcx)
continue;
for (n = 0; n < cpcx->count_pollfds; n++) {
lws_sockfd_type fd = cpcx->pollfds[n].fd;
int m;
if (!cpcx->pollfds[n].revents)
continue;
m = lws_service_fd(context, &cpcx->pollfds[n]);
/* if something closed, retry this slot since may have been
* swapped with end fd */
if (m && cpcx->pollfds[n].fd != fd)
n--;
if (m < 0)
/* lws feels something bad happened, but
* the outer application may not care */