#include "PipelineTest.h" #include #include void PipelineTest::asyncHandleHttpRequest(const HttpRequestPtr &req, const std::function &callback) { static std::atomic counter = 0; int c = counter.fetch_add(1); double delay = ((double)(10 - (c % 10))) / 10.0; trantor::EventLoop::getEventLoopOfCurrentThread()->runAfter(delay, [c, callback]() { auto resp = HttpResponse::newHttpResponse(); auto str = formattedString("

the %dth response

", c); resp->setBody(std::move(str)); callback(resp); }); }