Revert "[Refactor] CpuBoundWork#CpuBoundWork(): require an io_context::strand"

This reverts commit 5ca0d7102af59ca309fa9c071d5280de4e096b5c.
This commit is contained in:
Alexander A. Klimov 2024-12-05 10:38:27 +01:00
parent bb380d33e0
commit 7097bdb97d
4 changed files with 8 additions and 11 deletions

View File

@ -16,7 +16,7 @@
using namespace icinga;
CpuBoundWork::CpuBoundWork(boost::asio::yield_context yc, boost::asio::io_context::strand&)
CpuBoundWork::CpuBoundWork(boost::asio::yield_context yc)
: m_Done(false)
{
auto& ioEngine (IoEngine::Get());

View File

@ -17,7 +17,6 @@
#include <boost/exception/all.hpp>
#include <boost/asio/deadline_timer.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/io_context_strand.hpp>
#include <boost/asio/spawn.hpp>
namespace icinga
@ -31,7 +30,7 @@ namespace icinga
class CpuBoundWork
{
public:
CpuBoundWork(boost::asio::yield_context yc, boost::asio::io_context::strand&);
CpuBoundWork(boost::asio::yield_context yc);
CpuBoundWork(const CpuBoundWork&) = delete;
CpuBoundWork(CpuBoundWork&&) = delete;
CpuBoundWork& operator=(const CpuBoundWork&) = delete;

View File

@ -345,8 +345,7 @@ bool EnsureValidBody(
ApiUser::Ptr& authenticatedUser,
boost::beast::http::response<boost::beast::http::string_body>& response,
bool& shuttingDown,
boost::asio::yield_context& yc,
boost::asio::io_context::strand& strand
boost::asio::yield_context& yc
)
{
namespace http = boost::beast::http;
@ -437,14 +436,13 @@ bool ProcessRequest(
HttpServerConnection& server,
CpuBoundWork*& m_HandlingRequest,
bool& hasStartedStreaming,
boost::asio::yield_context& yc,
boost::asio::io_context::strand& strand
boost::asio::yield_context& yc
)
{
namespace http = boost::beast::http;
try {
CpuBoundWork handlingRequest (yc, strand);
CpuBoundWork handlingRequest (yc);
Defer resetHandlingRequest ([&m_HandlingRequest] { m_HandlingRequest = nullptr; });
m_HandlingRequest = &handlingRequest;
@ -554,13 +552,13 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
break;
}
if (!EnsureValidBody(*m_Stream, buf, parser, authenticatedUser, response, m_ShuttingDown, yc, m_IoStrand)) {
if (!EnsureValidBody(*m_Stream, buf, parser, authenticatedUser, response, m_ShuttingDown, yc)) {
break;
}
m_Seen = std::numeric_limits<decltype(m_Seen)>::max();
if (!ProcessRequest(*m_Stream, request, authenticatedUser, response, *this, m_HandlingRequest, m_HasStartedStreaming, yc, m_IoStrand)) {
if (!ProcessRequest(*m_Stream, request, authenticatedUser, response, *this, m_HandlingRequest, m_HasStartedStreaming, yc)) {
break;
}

View File

@ -78,7 +78,7 @@ void JsonRpcConnection::HandleIncomingMessages(boost::asio::yield_context yc)
m_Seen = Utility::GetTime();
try {
CpuBoundWork handleMessage (yc, m_IoStrand);
CpuBoundWork handleMessage (yc);
MessageHandler(message);