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

Method do_read

example/cpp11/http/server/connection.cpp:37–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37void connection::do_read()
38{
39 auto self(shared_from_this());
40 socket_.async_read_some(boost::asio::buffer(buffer_),
41 [this, self](boost::system::error_code ec, std::size_t bytes_transferred)
42 {
43 if (!ec)
44 {
45 request_parser::result_type result;
46 std::tie(result, std::ignore) = request_parser_.parse(
47 request_, buffer_.data(), buffer_.data() + bytes_transferred);
48
49 if (result == request_parser::good)
50 {
51 request_handler_.handle_request(request_, reply_);
52 do_write();
53 }
54 else if (result == request_parser::bad)
55 {
56 reply_ = reply::stock_reply(reply::bad_request);
57 do_write();
58 }
59 else
60 {
61 do_read();
62 }
63 }
64 else if (ec != boost::asio::error::operation_aborted)
65 {
66 connection_manager_.stop(shared_from_this());
67 }
68 });
69}
70
71void connection::do_write()
72{

Callers

nothing calls this directly

Calls 7

bufferFunction · 0.85
do_readFunction · 0.85
async_read_someMethod · 0.45
parseMethod · 0.45
dataMethod · 0.45
handle_requestMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected