]> git.ipfire.org Git - fireperf.git/commitdiff
server: Read the correct events when handling peer connections
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 1 Feb 2021 16:35:29 +0000 (16:35 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 1 Feb 2021 16:35:29 +0000 (16:35 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/server.c

index d5bf2a9737f949fb5bb5b4237cfe767e9999c79c..0424f9ba6e9de4551c65a2b0b602c4a9ae648619 100644 (file)
@@ -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;