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:
parent
1348632d14
commit
31bbeb520d
1 changed files with 7 additions and 0 deletions
|
@ -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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue