]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
tcp-handler: simple code cleanup
authorDaniel Salzman <daniel.salzman@nic.cz>
Tue, 9 Jul 2019 06:52:50 +0000 (08:52 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Fri, 12 Jul 2019 08:03:10 +0000 (10:03 +0200)
src/knot/server/tcp-handler.c

index dabb8e33b8d319ddb0e0f8018c359f8ac499661b..a06e784267c3ef24c5835c6cd753d1da5a5c66d3 100644 (file)
@@ -252,19 +252,17 @@ static int tcp_wait_for_events(tcp_context_t *tcp)
                        should_close = (i >= tcp->client_threshold);
                        --nfds;
                } else if (set->pfd[i].revents & (POLLIN)) {
-                       /* Master sockets */
+                       /* Master sockets - new connections to accept. */
                        if (i < tcp->client_threshold) {
                                tcp_event_accept(tcp, i);
-                       /* Client sockets */
-                       } else {
-                               if (tcp_event_serve(tcp, i) != KNOT_EOK) {
-                                       should_close = true;
-                               }
+                       /* Client sockets - already accepted connections. */
+                       } else if (tcp_event_serve(tcp, i) != KNOT_EOK) {
+                               should_close = true;
                        }
                        --nfds;
                }
 
-               /* Evaluate */
+               /* Evaluate. */
                if (should_close) {
                        fdset_remove(set, i);
                        close(fd);