| 111 | // |
| 112 | |
| 113 | auto register_shutdown_request_handler(agrpc::GrpcContext& grpc_context, example::v1::ExampleExt::AsyncService& service, |
| 114 | example::ServerShutdown& server_shutdown) |
| 115 | { |
| 116 | using RPC = agrpc::ServerRPC<&example::v1::ExampleExt::AsyncService::RequestShutdown>; |
| 117 | auto rpc_handler = [&](RPC& rpc, const RPC::Request&) |
| 118 | { |
| 119 | return unifex::let_value_with( |
| 120 | [] |
| 121 | { |
| 122 | return RPC::Response{}; |
| 123 | }, |
| 124 | [&](auto& response) |
| 125 | { |
| 126 | return rpc.finish(response, grpc::Status::OK); |
| 127 | }) | |
| 128 | unifex::then( |
| 129 | [&](bool) |
| 130 | { |
| 131 | server_shutdown.shutdown(); |
| 132 | }); |
| 133 | }; |
| 134 | return agrpc::register_sender_rpc_handler<RPC>(grpc_context, service, std::move(rpc_handler)); |
| 135 | } |
| 136 | |
| 137 | template <class Sender> |
| 138 | void run_grpc_context_for_sender(agrpc::GrpcContext& grpc_context, Sender&& sender) |