From a70974d8a1aa14be6bb44b8b6030cff27d232912 Mon Sep 17 00:00:00 2001 From: Massimiliano Pinto Date: Wed, 12 Jun 2013 09:54:27 +0200 Subject: [PATCH] EPOLLER | EPOLLHUP moved at the begininning of the loop --- core/gateway.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/gateway.c b/core/gateway.c index d19f6e05f..18a5fcff8 100644 --- a/core/gateway.c +++ b/core/gateway.c @@ -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