-
Notifications
You must be signed in to change notification settings - Fork 705
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
refactor(bindings/bench): make harness own IO #4847
base: main
Are you sure you want to change the base?
Conversation
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.
Have you actually checked that the benchmarks still run with these changes?
@@ -0,0 +1,64 @@ | |||
use std::{cell::RefCell, collections::VecDeque, io::ErrorKind, pin::Pin, rc::Rc}; |
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.
Copyright notice?
// This struct is used by Openssl and Rustls which both rely on a "stream" abstraction | ||
// which implements read and write. This is not used by s2n-tls, which relies on | ||
// lower level callbacks. | ||
pub struct ViewIO { |
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.
Am I insane, how is the ViewIO struct different than the TestPairIO struct?
@@ -325,93 +311,6 @@ where | |||
|
|||
Ok(()) | |||
} | |||
|
|||
/// Shrink buffers owned by the connections | |||
pub fn shrink_connection_buffers(&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.
Why did we have these shrink functions? How are we able to just delete them without having issues?
conn_pair = TlsConnPair::<T, T>::from_configs( | ||
CryptoConfig::default(), | ||
HandshakeType::default(), | ||
buffers.pop().unwrap(), |
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.
How does this work? Doesn't from_configs
accept a client and server config?
// prevent (potentially slow) resizing of buffers for small data transfers, | ||
// like with handshake | ||
recv.borrow_mut().reserve(10000); | ||
send.borrow_mut().reserve(10000); |
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.
Was this important?
Description of changes:
The goal of this PR is to reduce unnecessary abstraction.
Ideally the
S2NConnection
andOpenSSLConnection
structs would just alias the raw types from the corresponding libraries, likes2n_tls::connection::Connection
. This refactor is a step in that direction.Now the ConnPair owns that actual IO Stream, and connections are just handed references (views) to it. Note that I simply used reference counters
Rc
rather than trying to thread lifetimes through everything.Testing:
All existing tests should continue to pass.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.