2
0
mirror of https://github.com/boostorg/asio.git synced 2026-01-19 04:02:09 +00:00

Ensure sync SSL shutdown remaps error::eof as async_shutdown does.

This commit is contained in:
Christopher Kohlhoff
2025-12-01 22:49:32 +11:00
parent 804c42ca39
commit fc1b01e27c
6 changed files with 30 additions and 0 deletions

View File

@@ -52,6 +52,10 @@ public:
boost::asio::buffer_sequence_end(buffers_));
}
void complete_sync(boost::system::error_code&) const
{
}
template <typename Handler>
void call_handler(Handler& handler,
const boost::system::error_code& ec,

View File

@@ -47,6 +47,10 @@ public:
return eng.handshake(type_, ec);
}
void complete_sync(boost::system::error_code&) const
{
}
template <typename Handler>
void call_handler(Handler& handler,
const boost::system::error_code& ec,

View File

@@ -79,18 +79,21 @@ std::size_t io(Stream& next_layer, stream_core& core,
// Operation is complete. Return result to caller.
core.engine_.map_error_code(ec);
op.complete_sync(ec);
return bytes_transferred;
default:
// Operation is complete. Return result to caller.
core.engine_.map_error_code(ec);
op.complete_sync(ec);
return bytes_transferred;
} while (!ec);
// Operation failed. Return result to caller.
core.engine_.map_error_code(ec);
op.complete_sync(ec);
return 0;
}

View File

@@ -52,6 +52,10 @@ public:
return eng.read(buffer, ec, bytes_transferred);
}
void complete_sync(boost::system::error_code&) const
{
}
template <typename Handler>
void call_handler(Handler& handler,
const boost::system::error_code& ec,

View File

@@ -42,6 +42,17 @@ public:
return eng.shutdown(ec);
}
void complete_sync(boost::system::error_code& ec) const
{
if (ec == boost::asio::error::eof)
{
// The engine only generates an eof when the shutdown notification has
// been received from the peer. This indicates that the shutdown has
// completed successfully, and thus need not be returned to the caller.
ec = boost::system::error_code();
}
}
template <typename Handler>
void call_handler(Handler& handler,
const boost::system::error_code& ec,

View File

@@ -56,6 +56,10 @@ public:
return eng.write(buffer, ec, bytes_transferred);
}
void complete_sync(boost::system::error_code&) const
{
}
template <typename Handler>
void call_handler(Handler& handler,
const boost::system::error_code& ec,