X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fhttpd.c;h=f081c5e65cc74eb4c10f8ac7ad2818a50cffc73f;hb=ac9240fa569df5a10d534a4cd45740a44ee00f63;hp=757f05064ae49b9cb14b9b95cbc3c2e86487d7c0;hpb=462c72aac86effe29ef0d3b5f98c0c1cbe76e5e9;p=deb_shairplay.git diff --git a/src/lib/httpd.c b/src/lib/httpd.c index 757f050..f081c5e 100644 --- a/src/lib/httpd.c +++ b/src/lib/httpd.c @@ -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; @@ -304,6 +305,11 @@ httpd_thread(void *arg) } written += ret; } + + if (http_response_get_disconnect(response)) { + logger_log(httpd->logger, LOGGER_INFO, "Disconnecting on software request"); + httpd_remove_connection(httpd, connection); + } } else { logger_log(httpd->logger, LOGGER_INFO, "Didn't get response"); }