mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
fdm: purge deferred delete list also when handler fails
This commit is contained in:
parent
1543c71f78
commit
ba7f79af18
1 changed files with 8 additions and 5 deletions
13
fdm.c
13
fdm.c
|
|
@ -149,8 +149,9 @@ fdm_poll(struct fdm *fdm)
|
|||
}
|
||||
|
||||
struct epoll_event events[tll_length(fdm->fds)];
|
||||
int ret = epoll_wait(fdm->epoll_fd, events, tll_length(fdm->fds), -1);
|
||||
if (ret == -1) {
|
||||
|
||||
int r = epoll_wait(fdm->epoll_fd, events, tll_length(fdm->fds), -1);
|
||||
if (r == -1) {
|
||||
if (errno == EINTR)
|
||||
return true;
|
||||
|
||||
|
|
@ -158,6 +159,8 @@ fdm_poll(struct fdm *fdm)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ret = true;
|
||||
|
||||
fdm->is_polling = true;
|
||||
for (int i = 0; i < ret; i++) {
|
||||
struct fd *fd = events[i].data.ptr;
|
||||
|
|
@ -165,8 +168,8 @@ fdm_poll(struct fdm *fdm)
|
|||
continue;
|
||||
|
||||
if (!fd->handler(fdm, fd->fd, events[i].events, fd->data)) {
|
||||
fdm->is_polling = false;
|
||||
return false;
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fdm->is_polling = false;
|
||||
|
|
@ -176,5 +179,5 @@ fdm_poll(struct fdm *fdm)
|
|||
tll_remove(fdm->deferred_delete, it);
|
||||
}
|
||||
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue