diff --git a/src/nhttpd/yhttpd_core/yconnection.cpp b/src/nhttpd/yhttpd_core/yconnection.cpp index ea36c0c7c..d45809bce 100644 --- a/src/nhttpd/yhttpd_core/yconnection.cpp +++ b/src/nhttpd/yhttpd_core/yconnection.cpp @@ -96,8 +96,10 @@ void CWebserverConnection::HandleConnection() { if(string_tolower(Request.HeaderList["Connection"]) == "close" || (httprotocol != "HTTP/1.1" && string_tolower(Request.HeaderList["Connection"]) != "keep-alive") || !Webserver->CheckKeepAliveAllowedByIP(sock->get_client_ip())) -#endif keep_alive = false; +#else + keep_alive = false; +#endif // Send a response Response.SendResponse(); diff --git a/src/nhttpd/yhttpd_core/ywebserver.cpp b/src/nhttpd/yhttpd_core/ywebserver.cpp index 9219c54ee..b4b810fe3 100644 --- a/src/nhttpd/yhttpd_core/ywebserver.cpp +++ b/src/nhttpd/yhttpd_core/ywebserver.cpp @@ -27,6 +27,7 @@ #include "ysocket.h" #include "yconnection.h" #include "yrequest.h" +#include //============================================================================= // Initialization of static variables @@ -117,6 +118,7 @@ CWebserver::~CWebserver() { #define MAX_TIMEOUTS_TO_CLOSE 10 #define MAX_TIMEOUTS_TO_TEST 100 bool CWebserver::run(void) { + set_threadname(__func__); if (!listenSocket.listen(port, HTTPD_MAX_CONNECTIONS)) { if (port != 80) { fprintf(stderr, "[yhttpd] Socket cannot bind and listen on port %d Abort.\n", port); @@ -226,6 +228,8 @@ bool CWebserver::run(void) { CySocket *newConnectionSock; if (!(newConnectionSock = listenSocket.accept())) //Now: Blocking wait { + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_testcancel(); dperror("Socket accept error. Continue.\n"); continue; }