Commit ab1e8305 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

asio: client: call on_error when connection is dropped

When connection is dropped, we get "nonzero" error code ec in
read_socket callback.  We can just call on_error callback if ec is
nonzero.  But there is a problem when we did ordered shutdown.  In
this case, we also get EOF in ec, but we don't want to call on_error
because it is not an error.  To workaround this, we check return value
of should_stop().  If it is true, then we assume that HTTP/2 session
cleanly ended, and we don't call on_error.
parent 8b4f6f17
......@@ -525,7 +525,7 @@ void session_impl::do_read() {
read_socket([this](const boost::system::error_code &ec,
std::size_t bytes_transferred) {
if (ec) {
if (ec.value() == boost::asio::error::operation_aborted) {
if (!should_stop()) {
call_error_cb(ec);
shutdown_socket();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment