EPOLLER | EPOLLHUP moved at the begininning of the loop

This commit is contained in:
Massimiliano Pinto
2013-06-12 09:54:27 +02:00
parent d46e256b9a
commit a70974d8a1

View File

@ -242,6 +242,14 @@ int main(int argc, char **argv) {
fprintf(stderr, "New event %i for socket %i is EPOLLPRI\n", n, dcb->fd);
//#endif
if (events[n].events & (EPOLLERR | EPOLLHUP)) {
fprintf(stderr, "CALL the ERROR pointer\n");
(dcb->func).error(dcb, events[n].events);
// go to next event
continue;
}
if (events[n].events & EPOLLIN) {
// now checking the listening socket
if (dcb->state == DCB_STATE_LISTENING) {
@ -262,11 +270,6 @@ int main(int argc, char **argv) {
}
}
if (events[n].events & (EPOLLERR | EPOLLHUP)) {
fprintf(stderr, "CALL the ERROR pointer\n");
(dcb->func).error(dcb, events[n].events);
}
} // filedesc loop
} // infinite loop