From: Michael Tremer Date: Mon, 1 Feb 2021 16:35:29 +0000 (+0000) Subject: server: Read the correct events when handling peer connections X-Git-Tag: 0.1.0~27 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=25ba7928a1fb117d4aca66a4ffbf88e97f611265;p=fireperf.git server: Read the correct events when handling peer connections Signed-off-by: Michael Tremer --- diff --git a/src/server.c b/src/server.c index d5bf2a9..0424f9b 100644 --- a/src/server.c +++ b/src/server.c @@ -347,7 +347,7 @@ int fireperf_server(struct fireperf_config* conf) { goto ERROR; // Add the new socket to epoll() - ev.events = EPOLLIN|EPOLLHUP; + ev.events = EPOLLIN|EPOLLRDHUP; ev.data.fd = connfd; if (epoll_ctl(epollfd, EPOLL_CTL_ADD, connfd, &ev)) { @@ -376,7 +376,7 @@ int fireperf_server(struct fireperf_config* conf) { // Handle any connection events } else { - if (ev.events & EPOLLHUP) { + if (events[i].events & EPOLLRDHUP) { DEBUG(conf, "Connection %d has closed\n", fd); // Remove the file descriptor from epoll() @@ -396,7 +396,7 @@ int fireperf_server(struct fireperf_config* conf) { } // One of the connections had IO - if (ev.events & EPOLLIN) { + if (events[i].events & EPOLLIN) { r = handle_io_on_connection(conf, &stats, fd); if (r < 0) goto ERROR;