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