| 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 | |
| 321 | class timer |