Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssl::stream::shutdown and ssl::stream::async_shutdown can never complete with an eof error #14

Open
ashtum opened this issue May 27, 2024 · 0 comments

Comments

@ashtum
Copy link
Collaborator

ashtum commented May 27, 2024

SSL/TLS shutdown operations map the eof error from the underlying protocol layer to a stream_truncated error:
https://github.com/chriskohlhoff/asio/blob/master/asio/include/asio/ssl/detail/impl/engine.ipp#L231

When the shutdown procedure completes successfully, eof errors are cleared before calling the completion handler:
https://github.com/chriskohlhoff/asio/blob/master/asio/include/asio/ssl/detail/shutdown_op.hpp#L49

So, there is no need to check and ignore the eof error in shutdown operations:

stream.shutdown(ec);
if (ec == net::error::eof) // Unnecessary
    ec = {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant