Boost logo

Boost Users :

Subject: [Boost-users] [asio] Error code by not the same as in async_read_handler
From: Michael Weise (michael.weise_at_[hidden])
Date: 2016-04-06 05:58:16


my question is about the error code returned by io_service.run_one.
I expect the error code returned by run_one to be the same as the one
in the handler - but they are not.

Inside my handler I check the error code, which is equal to operation

void ConnectionBase::ReadUntilHandler(
    const boost::system::error_code & ec,
    std::size_t bytes_transferred)
   // ec == boost::asio::error::operation_aborted

At some other point I call io_service.run_one, which calls the above

    assert(ec == boost::asio::error::operation_aborted);

The assertion fails - for some reason the error code is not the same as
in the handler.

What's the reason for this? Maybe my assumtion that run_one(ec) returns
the error code of the handler is simply wrong? If so, what error does actually report?

Thanks for help,

PS: boost::asio version is 1.56.0

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at