icinga2/lib/remote/typequeryhandler.hpp
Johannes Schmidt 82bb636d2b Use WaitGroup to wait for or abort HTTP requests
The wait group gets passed to HttpServerConnection, then down to the
HttpHandlers. For those handlers that modify the program state, the
wait group is locked so ApiListener will wait on Stop() for the
request to complete. If the request iterates over config objects,
a further check on the state of the wait group is added to abort early
and not delay program shutdown. In that case, 503 responses will be
sent to the client.

Additionally, in HttpServerConnection, no further requests than the
one already started will be allowed once the wait group is joining.
2025-06-13 14:48:15 +02:00

32 lines
690 B
C++

/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
#ifndef TYPEQUERYHANDLER_H
#define TYPEQUERYHANDLER_H
#include "remote/httphandler.hpp"
namespace icinga
{
class TypeQueryHandler final : public HttpHandler
{
public:
DECLARE_PTR_TYPEDEFS(TypeQueryHandler);
bool HandleRequest(
const WaitGroup::Ptr& waitGroup,
AsioTlsStream& stream,
const ApiUser::Ptr& user,
boost::beast::http::request<boost::beast::http::string_body>& request,
const Url::Ptr& url,
boost::beast::http::response<boost::beast::http::string_body>& response,
const Dictionary::Ptr& params,
boost::asio::yield_context& yc,
HttpServerConnection& server
) override;
};
}
#endif /* TYPEQUERYHANDLER_H */