chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.93k stars 1.22k forks source link

Windows: map connection_aborted to ERROR_CONNECTION_ABORTED #1226

Open masoomshaikh opened 1 year ago

phprus commented 1 year ago

@masoomshaikh Please tell me, without this PR, what kind of errors can there be when using asio?

masoomshaikh commented 1 year ago

This happens when a TLS connection is aborted by calling ssl::stream<tcp::socket>::lowest_layer().close() ssl::stream<tcp::socket>::async_read_some() invokes the callback with this error.

currently using this way!

#if _WIN32
        // net::error::connection_aborted is not mapped
        if (ec.value() == ERROR_CONNECTION_ABORTED) {
            return;
        }
#endif