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

Method writer

example/cpp20/coroutines/chat_server.cpp:136–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134 }
135
136 awaitable<void> writer()
137 {
138 try
139 {
140 while (socket_.is_open())
141 {
142 if (write_msgs_.empty())
143 {
144 boost::system::error_code ec;
145 co_await timer_.async_wait(redirect_error(use_awaitable, ec));
146 }
147 else
148 {
149 co_await boost::asio::async_write(socket_,
150 boost::asio::buffer(write_msgs_.front()), use_awaitable);
151 write_msgs_.pop_front();
152 }
153 }
154 }
155 catch (std::exception&)
156 {
157 stop();
158 }
159 }
160
161 void stop()
162 {

Callers 1

startMethod · 0.95

Calls 6

async_writeFunction · 0.85
bufferFunction · 0.85
frontMethod · 0.80
is_openMethod · 0.45
emptyMethod · 0.45
async_waitMethod · 0.45

Tested by

no test coverage detected