MCPcopy Create free account
hub / github.com/boostorg/asio / reader

Method reader

example/cpp20/coroutines/chat_server.cpp:117–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115
116private:
117 awaitable<void> reader()
118 {
119 try
120 {
121 for (std::string read_msg;;)
122 {
123 std::size_t n = co_await boost::asio::async_read_until(socket_,
124 boost::asio::dynamic_buffer(read_msg, 1024), "\n", use_awaitable);
125
126 room_.deliver(read_msg.substr(0, n));
127 read_msg.erase(0, n);
128 }
129 }
130 catch (std::exception&)
131 {
132 stop();
133 }
134 }
135
136 awaitable<void> writer()
137 {

Callers 1

startMethod · 0.95

Calls 3

async_read_untilFunction · 0.85
eraseMethod · 0.80
deliverMethod · 0.45

Tested by

no test coverage detected