Fix #23 on issue tracker.
authorJuho Vähä-Herttua <juhovh@iki.fi>
Mon, 24 Mar 2014 18:35:29 +0000 (20:35 +0200)
committerJuho Vähä-Herttua <juhovh@iki.fi>
Mon, 24 Mar 2014 18:35:29 +0000 (20:35 +0200)
There is a race condition if IPv4 and IPv6 connections come at the same time.

src/lib/httpd.c

index 1d9e7e2eb454334efec4f6e7ba106a7f9c9104a7..f081c5e65cc74eb4c10f8ac7ad2818a50cffc73f 100644 (file)
@@ -237,7 +237,8 @@ httpd_thread(void *arg)
                                continue;
                        }
                }
-               if (httpd->server_fd6 != -1 && FD_ISSET(httpd->server_fd6, &rfds)) {
+               if (httpd->open_connections < httpd->max_connections &&
+                   httpd->server_fd6 != -1 && FD_ISSET(httpd->server_fd6, &rfds)) {
                        ret = httpd_accept_connection(httpd, httpd->server_fd6, 1);
                        if (ret == -1) {
                                break;