mirror of
https://github.com/Icinga/icinga2.git
synced 2025-09-24 10:17:59 +02:00
Revert "[Refactor] CpuBoundWork#CpuBoundWork(): require an io_context::strand"
This reverts commit 5ca0d7102af59ca309fa9c071d5280de4e096b5c.
This commit is contained in:
parent
bb380d33e0
commit
7097bdb97d
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
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)
|
: m_Done(false)
|
||||||
{
|
{
|
||||||
auto& ioEngine (IoEngine::Get());
|
auto& ioEngine (IoEngine::Get());
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include <boost/exception/all.hpp>
|
#include <boost/exception/all.hpp>
|
||||||
#include <boost/asio/deadline_timer.hpp>
|
#include <boost/asio/deadline_timer.hpp>
|
||||||
#include <boost/asio/io_context.hpp>
|
#include <boost/asio/io_context.hpp>
|
||||||
#include <boost/asio/io_context_strand.hpp>
|
|
||||||
#include <boost/asio/spawn.hpp>
|
#include <boost/asio/spawn.hpp>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
@ -31,7 +30,7 @@ namespace icinga
|
|||||||
class CpuBoundWork
|
class CpuBoundWork
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CpuBoundWork(boost::asio::yield_context yc, boost::asio::io_context::strand&);
|
CpuBoundWork(boost::asio::yield_context yc);
|
||||||
CpuBoundWork(const CpuBoundWork&) = delete;
|
CpuBoundWork(const CpuBoundWork&) = delete;
|
||||||
CpuBoundWork(CpuBoundWork&&) = delete;
|
CpuBoundWork(CpuBoundWork&&) = delete;
|
||||||
CpuBoundWork& operator=(const CpuBoundWork&) = delete;
|
CpuBoundWork& operator=(const CpuBoundWork&) = delete;
|
||||||
|
@ -345,8 +345,7 @@ bool EnsureValidBody(
|
|||||||
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,
|
||||||
bool& shuttingDown,
|
bool& shuttingDown,
|
||||||
boost::asio::yield_context& yc,
|
boost::asio::yield_context& yc
|
||||||
boost::asio::io_context::strand& strand
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
namespace http = boost::beast::http;
|
namespace http = boost::beast::http;
|
||||||
@ -437,14 +436,13 @@ bool ProcessRequest(
|
|||||||
HttpServerConnection& server,
|
HttpServerConnection& server,
|
||||||
CpuBoundWork*& m_HandlingRequest,
|
CpuBoundWork*& m_HandlingRequest,
|
||||||
bool& hasStartedStreaming,
|
bool& hasStartedStreaming,
|
||||||
boost::asio::yield_context& yc,
|
boost::asio::yield_context& yc
|
||||||
boost::asio::io_context::strand& strand
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
namespace http = boost::beast::http;
|
namespace http = boost::beast::http;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CpuBoundWork handlingRequest (yc, strand);
|
CpuBoundWork handlingRequest (yc);
|
||||||
Defer resetHandlingRequest ([&m_HandlingRequest] { m_HandlingRequest = nullptr; });
|
Defer resetHandlingRequest ([&m_HandlingRequest] { m_HandlingRequest = nullptr; });
|
||||||
m_HandlingRequest = &handlingRequest;
|
m_HandlingRequest = &handlingRequest;
|
||||||
|
|
||||||
@ -554,13 +552,13 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
|
|||||||
break;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
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, *this, m_HandlingRequest, m_HasStartedStreaming, yc, m_IoStrand)) {
|
if (!ProcessRequest(*m_Stream, request, authenticatedUser, response, *this, m_HandlingRequest, m_HasStartedStreaming, yc)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ void JsonRpcConnection::HandleIncomingMessages(boost::asio::yield_context yc)
|
|||||||
m_Seen = Utility::GetTime();
|
m_Seen = Utility::GetTime();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CpuBoundWork handleMessage (yc, m_IoStrand);
|
CpuBoundWork handleMessage (yc);
|
||||||
|
|
||||||
MessageHandler(message);
|
MessageHandler(message);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user