Close server sockets on shutdown, thanks to Memphiz for pointing this out.
[deb_shairplay.git] / src / lib / httpd.c
index 88971faa5f57451b22d58a1959da108bd9229e68..dfd3d6b6a2a167587ef02e1d77e8cd23b16d695b 100644 (file)
@@ -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;