From 72266434dfadf91c36e415bbf3d02781b2b4fd7e Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Thu, 8 Feb 2024 11:30:23 +0100 Subject: [PATCH] Drop redundant `CpuBoundWork` usages in `lib/remote` --- lib/remote/httpserverconnection.cpp | 6 ------ lib/remote/jsonrpcconnection.cpp | 6 ++---- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/remote/httpserverconnection.cpp b/lib/remote/httpserverconnection.cpp index cc80d7a7c..0dd2748b1 100644 --- a/lib/remote/httpserverconnection.cpp +++ b/lib/remote/httpserverconnection.cpp @@ -240,8 +240,6 @@ bool HandleAccessControl( auto headerAllowOrigin (listener->GetAccessControlAllowOrigin()); if (headerAllowOrigin) { - CpuBoundWork allowOriginHeader (yc); - auto allowedOrigins (headerAllowOrigin->ToSet()); if (!allowedOrigins.empty()) { @@ -251,8 +249,6 @@ bool HandleAccessControl( response.set(http::field::access_control_allow_origin, origin); } - allowOriginHeader.Done(); - response.set(http::field::access_control_allow_credentials, "true"); if (request.method() == http::verb::options && !request[http::field::access_control_request_method].empty()) { @@ -537,8 +533,6 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc) auto authenticatedUser (m_ApiUser); if (!authenticatedUser) { - CpuBoundWork fetchingAuthenticatedUser (yc); - authenticatedUser = ApiUser::GetByAuthHeader(std::string(request[http::field::authorization])); } diff --git a/lib/remote/jsonrpcconnection.cpp b/lib/remote/jsonrpcconnection.cpp index 3bae3cafd..db35ef833 100644 --- a/lib/remote/jsonrpcconnection.cpp +++ b/lib/remote/jsonrpcconnection.cpp @@ -81,6 +81,8 @@ void JsonRpcConnection::HandleIncomingMessages(boost::asio::yield_context yc) CpuBoundWork handleMessage (yc); MessageHandler(message); + + l_TaskStats.InsertValue(Utility::GetTime(), 1); } catch (const std::exception& ex) { Log(m_ShuttingDown ? LogDebug : LogWarning, "JsonRpcConnection") << "Error while processing JSON-RPC message for identity '" << m_Identity @@ -88,10 +90,6 @@ void JsonRpcConnection::HandleIncomingMessages(boost::asio::yield_context yc) break; } - - CpuBoundWork taskStats (yc); - - l_TaskStats.InsertValue(Utility::GetTime(), 1); } Disconnect();