From d07a26f3f8fbbc02f539721bfed1e3191a8154b3 Mon Sep 17 00:00:00 2001 From: ipknHama Date: Sat, 10 Sep 2016 02:13:50 +0900 Subject: Closing behavior change; should help #151 --- include/http_connection.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/http_connection.h b/include/http_connection.h index 5517521..e8eb4b1 100644 --- a/include/http_connection.h +++ b/include/http_connection.h @@ -467,7 +467,7 @@ namespace crow if (!ec) { bool ret = parser_.feed(buffer_.data(), bytes_transferred); - if (ret && adaptor_.is_open() && !close_connection_) + if (ret && adaptor_.is_open()) { error_while_reading = false; } @@ -482,6 +482,14 @@ namespace crow CROW_LOG_DEBUG << this << " from read(1)"; check_destroy(); } + else if (close_connection_) + { + cancel_deadline_timer(); + parser_.done(); + is_reading = false; + check_destroy(); + // adaptor will close after write + } else if (!need_to_call_after_handlers_) { start_deadline(); -- cgit v1.2.3-54-g00ecf