New version, state2string updated
This commit is contained in:
@ -218,21 +218,22 @@ int main(int argc, char **argv) {
|
||||
// event loop for all the descriptors added via epoll_ctl
|
||||
while (1) {
|
||||
nfds = epoll_wait(epollfd, events, MAX_EVENTS, -1);
|
||||
// example with timeout
|
||||
//nfds = epoll_wait(epollfd, events, MAX_EVENTS, 1000);
|
||||
if (nfds == -1 && (errno != EINTR)) {
|
||||
perror("GW: epoll_pwait ERROR");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
//#ifdef GW_EVENT_DEBUG
|
||||
#ifdef GW_EVENT_DEBUG
|
||||
fprintf(stderr, "wake from epoll_wait, n. %i events\n", nfds);
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
for (n = 0; n < nfds; ++n) {
|
||||
DCB *dcb = (DCB *) (events[n].data.ptr);
|
||||
|
||||
|
||||
//#ifdef GW_EVENT_DEBUG
|
||||
#ifdef GW_EVENT_DEBUG
|
||||
fprintf(stderr, "New event %i for socket %i is %i\n", n, dcb->fd, events[n].events);
|
||||
if (events[n].events & EPOLLIN)
|
||||
fprintf(stderr, "New event %i for socket %i is EPOLLIN\n", n, dcb->fd);
|
||||
@ -240,8 +241,7 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr, "New event %i for socket %i is EPOLLOUT\n", n, dcb->fd);
|
||||
if (events[n].events & EPOLLPRI)
|
||||
fprintf(stderr, "New event %i for socket %i is EPOLLPRI\n", n, dcb->fd);
|
||||
|
||||
//#endif
|
||||
#endif
|
||||
if (events[n].events & (EPOLLERR | EPOLLHUP)) {
|
||||
fprintf(stderr, "CALL the ERROR pointer\n");
|
||||
(dcb->func).error(dcb, events[n].events);
|
||||
|
||||
Reference in New Issue
Block a user