MCPcopy Create free account
hub / github.com/boostorg/beast / on_read

Method on_read

example/http/client/async-local/http_client_async_local.cpp:120–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118 }
119
120 void
121 on_read(
122 beast::error_code ec,
123 std::size_t bytes_transferred)
124 {
125 boost::ignore_unused(bytes_transferred);
126
127 if(ec)
128 return fail(ec, "read");
129
130 // Write the message to standard out
131 std::cout << res_ << std::endl;
132
133 // Gracefully close the socket
134 stream_.socket().shutdown(stream_protocol::socket::shutdown_both, ec);
135
136 // not_connected happens sometimes so don't bother reporting it.
137 if(ec && ec != beast::errc::not_connected)
138 return fail(ec, "shutdown");
139
140 // If we get here then the connection is closed gracefully
141 }
142};
143
144//------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 2

shutdownMethod · 0.80
failFunction · 0.70

Tested by

no test coverage detected