From e129c561d58386a9992507372dbce73ee64c7cbe Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 22 Feb 2019 15:38:02 +0100 Subject: [PATCH] HttpServerConnection: don't disconnect during sending response --- lib/remote/httpserverconnection.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/remote/httpserverconnection.cpp b/lib/remote/httpserverconnection.cpp index 198a472b9..af2a69b42 100644 --- a/lib/remote/httpserverconnection.cpp +++ b/lib/remote/httpserverconnection.cpp @@ -353,7 +353,6 @@ bool ProcessRequest( boost::beast::http::request& request, ApiUser::Ptr& authenticatedUser, boost::beast::http::response& response, - double& seen, boost::asio::yield_context& yc ) { @@ -364,8 +363,6 @@ bool ProcessRequest( try { CpuBoundWork handlingRequest (yc); - Defer updateSeen ([&seen]() { seen = Utility::GetTime(); }); - HttpHandler::ProcessRequest(stream, authenticatedUser, request, response, yc, hasStartedStreaming); } catch (const std::exception& ex) { if (hasStartedStreaming) { @@ -403,6 +400,8 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc) beast::flat_buffer buf; for (;;) { + m_Seen = Utility::GetTime(); + http::parser parser; http::response response; @@ -459,7 +458,7 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc) m_Seen = std::numeric_limits::max(); - if (!ProcessRequest(*m_Stream, request, authenticatedUser, response, m_Seen, yc)) { + if (!ProcessRequest(*m_Stream, request, authenticatedUser, response, yc)) { break; }