mirror of https://github.com/Icinga/icinga2.git
HttpServerConnection: don't disconnect during sending response
This commit is contained in:
parent
b384f859c9
commit
e129c561d5
|
@ -353,7 +353,6 @@ bool ProcessRequest(
|
||||||
boost::beast::http::request<boost::beast::http::string_body>& request,
|
boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||||
ApiUser::Ptr& authenticatedUser,
|
ApiUser::Ptr& authenticatedUser,
|
||||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||||
double& seen,
|
|
||||||
boost::asio::yield_context& yc
|
boost::asio::yield_context& yc
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -364,8 +363,6 @@ bool ProcessRequest(
|
||||||
try {
|
try {
|
||||||
CpuBoundWork handlingRequest (yc);
|
CpuBoundWork handlingRequest (yc);
|
||||||
|
|
||||||
Defer updateSeen ([&seen]() { seen = Utility::GetTime(); });
|
|
||||||
|
|
||||||
HttpHandler::ProcessRequest(stream, authenticatedUser, request, response, yc, hasStartedStreaming);
|
HttpHandler::ProcessRequest(stream, authenticatedUser, request, response, yc, hasStartedStreaming);
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
if (hasStartedStreaming) {
|
if (hasStartedStreaming) {
|
||||||
|
@ -403,6 +400,8 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
|
||||||
beast::flat_buffer buf;
|
beast::flat_buffer buf;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
m_Seen = Utility::GetTime();
|
||||||
|
|
||||||
http::parser<true, http::string_body> parser;
|
http::parser<true, http::string_body> parser;
|
||||||
http::response<http::string_body> response;
|
http::response<http::string_body> response;
|
||||||
|
|
||||||
|
@ -459,7 +458,7 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
|
||||||
|
|
||||||
m_Seen = std::numeric_limits<decltype(m_Seen)>::max();
|
m_Seen = std::numeric_limits<decltype(m_Seen)>::max();
|
||||||
|
|
||||||
if (!ProcessRequest(*m_Stream, request, authenticatedUser, response, m_Seen, yc)) {
|
if (!ProcessRequest(*m_Stream, request, authenticatedUser, response, yc)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue