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.

This commit is contained in:
Relintai 2021-04-28 21:48:34 +02:00
parent b8624f190a
commit c5ea34afdc
2 changed files with 9 additions and 9 deletions

View File

@ -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;
}

View File

@ -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;