Search code examples
c++linuxboostopenwrt

boost::system::error_code producing error 158 unknown


I'm using boost::system::error_code to capture error codes to a log file and it's logging an unknown error. I haven't found any reference to this error in the Web.

bool read_response_payload(size_t payload_len)
{
     boost::system::error_code ec;
     stream_connector<protocol_type, INTERFACE_BUFFER_LEN,
            INTERFACE_TIMEOUT_SECS>::read_all(payload_len, ec);
     if (ec) {
            LOGGER_LOG_WARN("Interface read error: %s", ec.message().c_str());
            stream_connector<protocol_type, INTERFACE_BUFFER_LEN,
                INTERFACE_TIMEOUT_SECS>::disconnect();
            return false;
     }
     else {
            return true;
     }
}

In the log file I get messages like this:

Interface read error: Unknown error 158

The system is:

root@OpenWrt:~# uname -a
Linux OpenWrt 2.6.30.9 #4 Thu Jul 3 16:08:13 BRT 2014 rlx GNU/Linux

Solution

  • As suggested in the comment it was an error described in <asm/errno.h> from OpenWRT

    #define ECONNREFUSED    146 /* Connection refused */
    #define EHOSTDOWN   147 /* Host is down */
    #define EHOSTUNREACH    148 /* No route to host */
    #define EWOULDBLOCK EAGAIN  /* Operation would block */
    #define EALREADY    149 /* Operation already in progress */
    #define EINPROGRESS 150 /* Operation now in progress */
    #define ESTALE      151 /* Stale NFS file handle */
    #define ECANCELED   158 /* AIO operation canceled */
    

    It's an Asynchronous IO operation that has been cancelled.