lpolllist.c: fix poll ifdef paths

This commit is contained in:
CPunch 2022-09-01 20:04:54 -05:00
parent b23057b219
commit 587d9a26e5
2 changed files with 4 additions and 4 deletions

View File

@ -38,7 +38,7 @@ typedef char buffer_t;
# include <sys/epoll.h> # include <sys/epoll.h>
/* max events for epoll() */ /* max events for epoll() */
# define MAX_EPOLL_EVENTS 128 # define MAX_EPOLL_EVENTS 128
# define LAIKA_USE_EPOLL //# define LAIKA_USE_EPOLL
# endif # endif
# include <errno.h> # include <errno.h>
# include <unistd.h> # include <unistd.h>

View File

@ -231,14 +231,14 @@ struct sLaika_pollEvent *laikaP_poll(struct sLaika_pollList *pList, int timeout,
.pollOut = pList->ep_events[i].events & EPOLLOUT}; .pollOut = pList->ep_events[i].events & EPOLLOUT};
} }
#else #else
nEvents = poll(pList->fds, pList->fdCount, /* poll returns -1 for error, or the number of events */
timeout); /* poll returns -1 for error, or the number of events */ nEvents = poll(pList->fds, laikaM_countVector(pList->fds), timeout);
if (SOCKETERROR(nEvents)) if (SOCKETERROR(nEvents))
LAIKA_ERROR("poll() failed!\n"); LAIKA_ERROR("poll() failed!\n");
/* walk through the returned poll fds, if they have an event, add it to our revents array */ /* walk through the returned poll fds, if they have an event, add it to our revents array */
for (i = 0; i < pList->fdCount && nEvents > 0; i++) { for (i = 0; i < laikaM_countVector(pList->fds) && nEvents > 0; i++) {
PollFD pfd = pList->fds[i]; PollFD pfd = pList->fds[i];
if (pList->fds[i].revents != 0) { if (pList->fds[i].revents != 0) {
/* grab socket from hashmap */ /* grab socket from hashmap */