mirror of
https://github.com/Icinga/icinga2.git
synced 2025-08-14 06:08:15 +02:00
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.
56 lines
1.4 KiB
C++
56 lines
1.4 KiB
C++
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
|
|
|
#ifndef CONFIGMODULESHANDLER_H
|
|
#define CONFIGMODULESHANDLER_H
|
|
|
|
#include "remote/httphandler.hpp"
|
|
|
|
namespace icinga
|
|
{
|
|
|
|
class ConfigPackagesHandler final : public HttpHandler
|
|
{
|
|
public:
|
|
DECLARE_PTR_TYPEDEFS(ConfigPackagesHandler);
|
|
|
|
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;
|
|
|
|
private:
|
|
void HandleGet(
|
|
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
|
|
);
|
|
void HandlePost(
|
|
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
|
|
);
|
|
void HandleDelete(
|
|
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
|
|
);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif /* CONFIGMODULESHANDLER_H */
|