Close new connections that fail for e.g. ban reason.
authorMartin Johansson <martin@fatbob.nu>
Sat, 25 Feb 2012 19:02:11 +0000 (20:02 +0100)
committerMartin Johansson <martin@fatbob.nu>
Sat, 25 Feb 2012 19:02:11 +0000 (20:02 +0100)
src/server.c

index 4f466d77e7c35637dfcb42fdc4307860ff6a9f56..77e59aa3dff6b6139a0b198c59516a9147224740 100644 (file)
@@ -173,7 +173,8 @@ void Server_run()
                        setsockopt(tcpfd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int));
                        Log_debug("Connection from %s port %d\n", inet_ntoa(remote.sin_addr),
                                          ntohs(remote.sin_port));
-                       Client_add(tcpfd, &remote);
+                       if (Client_add(tcpfd, &remote) < 0)
+                               close(tcpfd);
                }
 
                if (pollfds[UDP_SOCK].revents) {