X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fhttpd.c;h=757f05064ae49b9cb14b9b95cbc3c2e86487d7c0;hb=462c72aac86effe29ef0d3b5f98c0c1cbe76e5e9;hp=88971faa5f57451b22d58a1959da108bd9229e68;hpb=2e66aa96aa9068a75c6524796d9fb8392a2e27ba;p=deb_shairplay.git diff --git a/src/lib/httpd.c b/src/lib/httpd.c index 88971fa..757f050 100644 --- a/src/lib/httpd.c +++ b/src/lib/httpd.c @@ -36,8 +36,6 @@ struct httpd_s { logger_t *logger; httpd_callbacks_t callbacks; - int use_rtsp; - int max_connections; int open_connections; http_connection_t *connections; @@ -54,7 +52,7 @@ struct httpd_s { }; httpd_t * -httpd_init(logger_t *logger, httpd_callbacks_t *callbacks, int max_connections, int use_rtsp) +httpd_init(logger_t *logger, httpd_callbacks_t *callbacks, int max_connections) { httpd_t *httpd; @@ -68,7 +66,6 @@ httpd_init(logger_t *logger, httpd_callbacks_t *callbacks, int max_connections, return NULL; } - httpd->use_rtsp = !!use_rtsp; httpd->max_connections = max_connections; httpd->connections = calloc(max_connections, sizeof(http_connection_t)); if (!httpd->connections) { @@ -260,7 +257,7 @@ httpd_thread(void *arg) /* If not in the middle of request, allocate one */ if (!connection->request) { - connection->request = http_request_init(httpd->use_rtsp); + connection->request = http_request_init(); assert(connection->request); } @@ -311,6 +308,8 @@ httpd_thread(void *arg) logger_log(httpd->logger, LOGGER_INFO, "Didn't get response"); } http_response_destroy(response); + } else { + logger_log(httpd->logger, LOGGER_DEBUG, "Request not complete, waiting for more data..."); } } } @@ -326,6 +325,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;