diff --git a/event.c b/event.c index fd0934f..2e809fd 100644 --- a/event.c +++ b/event.c @@ -221,7 +221,7 @@ int event_loop(void) continue; } - /* timeout not elapsed, exit search (since list is sorted) */ + /* first timeout not elapsed, exit search (since list is sorted) */ if (cmp_timeval(&entry->nextrun, &now) == -1) break; @@ -265,7 +265,6 @@ int event_loop(void) FD_ZERO(readfds); } FD_SET(entry->fd, readfds); - } if (entry->flags & FD_WRITE) { @@ -285,17 +284,16 @@ int event_loop(void) * after an error. */ continue; + } - } else { - list_for_each_entry(entry, &event_fd_list, list) { - if (((entry->flags & (FD_READ | EVENT_NEW)) == FD_READ) && FD_ISSET(entry->fd, readfds)) - if (entry->read_cb(entry->fd, entry->read_priv) != 0) - entry->flags |= EVENT_DELETE; + list_for_each_entry(entry, &event_fd_list, list) { + if (((entry->flags & (FD_READ | EVENT_NEW)) == FD_READ) && FD_ISSET(entry->fd, readfds)) + if (entry->read_cb(entry->fd, entry->read_priv) != 0) + entry->flags |= EVENT_DELETE; - if (((entry->flags & (FD_WRITE | EVENT_NEW)) == FD_WRITE) && FD_ISSET(entry->fd, writefds)) - if (entry->write_cb(entry->fd, entry->write_priv) != 0) - entry->flags |= EVENT_DELETE; - } + if (((entry->flags & (FD_WRITE | EVENT_NEW)) == FD_WRITE) && FD_ISSET(entry->fd, writefds)) + if (entry->write_cb(entry->fd, entry->write_priv) != 0) + entry->flags |= EVENT_DELETE; } } free(fdsets);