-
Notifications
You must be signed in to change notification settings - Fork 742
feat(bench): add generic shutdown functionality #5426
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
Conversation
* typo * rename shutdown methods & document io behavior * default disable session resumption on servers * better shutdown error message * correct comment on NST stuff
* rename trait to TlsInfo * fix typo
/// This might also read the `CloseNotify` sent by the peer, because most TLS | ||
/// implementations attempt both reading and writing on this method. | ||
fn shutdown(&mut self); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idk, with the behavior so unpredicatable, is it really worth separating this from shutdown_finish? You're even calling the same methods for both shutdown and shutdown_finished for all the implementations.
Would it make more sense to have a single poll_shutdown for each implementation, and then the harness just calls it for the client and server in a loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no, because there isn't actually a unified poll_shutdown
API. While that would work for OpenSSL and s2n-tls, rustls has an explicit "send_close_notify" API, which doesn't fit into the "poll_shutdown" API
match &mut self.connection {
Connection::Client(client_connection) => client_connection.send_close_notify(),
Connection::Server(server_connection) => server_connection.send_close_notify(),
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but send_close_notify says:
Does nothing if any close_notify or fatal alert was already sent.
So you could just always call it on poll_shutdown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, after a bit more research I think I was just a bit confused by the API naming
- openssl
shutdown
will only write on the first call - rustls
complete_io
will only write on the first call
So I switched the s2n-tls implementation to use poll_shutdown_send
, and everything should now have a unified API with
shutdown_send
-> only writesshutdown_finish
-> only reads.
* fix typo
Description of changes:
Allow connection to be cleanly shutdown through the generic
Connection
trait.We take on a slightly larger refactor, splitting the connection traits into a
TlsConnection
andTlsMetrics
trait. This allows abstractions to be a bit more focused on the relevant functionality. It also allows us to better handle the "fuzziness" of a lot of the metrics APIs.Testing:
Fixed existing unit tests and manually ran the benchmarks.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.