MCPcopy Create free account
hub / github.com/NVIDIA/stdexec / schedule_request_start

Function schedule_request_start

examples/server_theme/let_value.cpp:73–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71// Returns a sender that yields an http_request object for an incoming request
72template <ex::scheduler S>
73auto schedule_request_start(S sched, int idx) -> ex::sender auto
74{
75 // app-specific-details: building of the http_request object
76 auto url = std::string("/query?image_idx=") + std::to_string(idx);
77 if (idx == 7)
78 url.clear(); // fake invalid request
79 http_request req{.url_ = std::move(url), .headers_ = {}, .body_ = {}};
80 std::cout << "HTTP request " << idx << " arrived\n";
81
82 // Return a sender for the incoming http_request
83 return ex::just(std::move(req)) | ex::continues_on(std::forward<S>(sched));
84}
85
86// Sends a response back to the client; yields a void signal on success
87auto send_response(http_response const & resp) -> ex::sender auto

Callers 1

mainFunction · 0.85

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected