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

Method on_read

example/http/client/crawl/http_crawl.cpp:286–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284 }
285
286 void
287 on_read(
288 beast::error_code ec,
289 std::size_t bytes_transferred)
290 {
291 boost::ignore_unused(bytes_transferred);
292
293 if(ec)
294 {
295 report_.aggregate(
296 [](crawl_report& rep)
297 {
298 ++rep.read_failures;
299 });
300 return do_get_host();
301 }
302
303 auto const code = res_.result_int();
304 report_.aggregate(
305 [code](crawl_report& rep)
306 {
307 ++rep.success;
308 ++rep.status_codes[code];
309 });
310
311 // Gracefully close the socket
312 stream_.socket().shutdown(tcp::socket::shutdown_both, ec);
313 stream_.close();
314
315 // If we get here then the connection is closed gracefully
316
317 do_get_host();
318 }
319};
320
321class timer

Callers

nothing calls this directly

Calls 3

aggregateMethod · 0.80
shutdownMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected