MCPcopy Create free account
hub / github.com/Icinga/icinga2 / ProcessRequest

Function ProcessRequest

lib/remote/httpserverconnection.cpp:415–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415static inline
416void ProcessRequest(
417 HttpApiRequest& request,
418 HttpApiResponse& response,
419 const WaitGroup::Ptr& waitGroup,
420 std::chrono::steady_clock::duration& cpuBoundWorkTime,
421 boost::asio::yield_context& yc,
422 boost::asio::io_context::strand& strand
423)
424{
425 try {
426 // Cache the elapsed time to acquire a CPU semaphore used to detect extremely heavy workloads.
427 auto start (std::chrono::steady_clock::now());
428 response.StartCpuBoundWork(yc, strand);
429 cpuBoundWorkTime = std::chrono::steady_clock::now() - start;
430
431 HttpHandler::ProcessRequest(waitGroup, request, response, yc);
432 response.body().Finish();
433 } catch (const std::exception& ex) {
434 /* Since we don't know the state the stream is in, we can't send an error response and
435 * have to just cause a disconnect here.
436 */
437 if (response.HasSerializationStarted()) {
438 throw;
439 }
440
441 HttpUtility::SendJsonError(response, request.Params(), 500, "Unhandled exception", DiagnosticInformation(ex));
442 }
443
444 response.Flush(yc);
445}
446
447void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
448{

Callers 1

ProcessMessagesMethod · 0.85

Calls 5

StartCpuBoundWorkMethod · 0.80
FinishMethod · 0.80
ParamsMethod · 0.80
FlushMethod · 0.45

Tested by

no test coverage detected