From c5ea34afdcece6c75d3ab14c5f48f2759d4017b1 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 28 Apr 2021 21:48:34 +0200 Subject: [PATCH] Don't check for connection closed in send and send_file. Sometimes the connection closed callback gets called before send, but the connection still seems to be alive. Will work on it later. --- core/http_server.cpp | 2 +- core/request.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/http_server.cpp b/core/http_server.cpp index 36cfefe..6d1cc72 100644 --- a/core/http_server.cpp +++ b/core/http_server.cpp @@ -54,7 +54,7 @@ void HTTPServer::closedCallbackDefault(const HttpSession::Ptr &session) { if (r == nullptr) { lock.unlock(); - printf("Error HTTPServer::closedCallbackDefault: r == nullptr!\n"); + //printf("Error HTTPServer::closedCallbackDefault: r == nullptr!\n"); return; } diff --git a/core/request.cpp b/core/request.cpp index fb2243d..b013946 100644 --- a/core/request.cpp +++ b/core/request.cpp @@ -42,10 +42,10 @@ void Request::next_stage() { } void Request::send() { - if (connection_closed) { - RequestPool::return_request(this); - return; - } + //if (connection_closed) { + // RequestPool::return_request(this); + // return; + //} if (http_parser->isKeepAlive()) { response->addHeadValue("Connection", "Keep-Alive"); @@ -67,10 +67,10 @@ void Request::send() { } void Request::send_file(const std::string &p_file_path) { - if (connection_closed) { - RequestPool::return_request(this); - return; - } + //if (connection_closed) { + // RequestPool::return_request(this); + // return; + //} file_path = p_file_path;