MCPcopy Create free account
hub / github.com/Tradias/asio-grpc / reader

Function reader

example/generic-server.cpp:81–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79
80template <class Handler>
81void reader(agrpc::GenericServerRPC& rpc, Channel& channel, const asio::basic_yield_context<Handler>& yield)
82{
83 while (true)
84 {
85 grpc::ByteBuffer buffer;
86 if (!rpc.read(buffer, yield))
87 {
88 std::cout << "Generic: Client is done writing." << std::endl;
89 break;
90 }
91 // Send request to writer. The `max_buffer_size` of the channel acts as backpressure.
92 boost::system::error_code ec;
93 channel.async_send(boost::system::error_code{}, std::move(buffer), yield[ec]);
94 }
95 // Signal the writer to complete.
96 channel.close();
97}
98
99// The writer will pick up reads from the reader through the channel and switch
100// to the thread_pool to compute their response.

Callers 1

Calls 2

moveFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected