X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fhttpd.c;h=dfd3d6b6a2a167587ef02e1d77e8cd23b16d695b;hb=1321b5e9b11116f961b222a2e142701ff353e9cc;hp=7606933696e1cb8548dc57e326bd346221a831d5;hpb=870f342f5de7311f7895f2ca96a8bdd7df20e046;p=deb_shairplay.git diff --git a/src/lib/httpd.c b/src/lib/httpd.c index 7606933..dfd3d6b 100644 --- a/src/lib/httpd.c +++ b/src/lib/httpd.c @@ -240,7 +240,7 @@ httpd_thread(void *arg) continue; } } - if (FD_ISSET(httpd->server_fd6, &rfds)) { + if (httpd->server_fd6 != -1 && FD_ISSET(httpd->server_fd6, &rfds)) { ret = httpd_accept_connection(httpd, httpd->server_fd6, 1); if (ret == -1) { break; @@ -326,6 +326,16 @@ httpd_thread(void *arg) httpd_remove_connection(httpd, connection); } + /* Close server sockets since they are not used any more */ + if (httpd->server_fd4 != -1) { + closesocket(httpd->server_fd4); + httpd->server_fd4 = -1; + } + if (httpd->server_fd6 != -1) { + closesocket(httpd->server_fd6); + httpd->server_fd6 = -1; + } + logger_log(httpd->logger, LOGGER_INFO, "Exiting HTTP thread"); return 0;