-
Notifications
You must be signed in to change notification settings - Fork 122
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(s2n-quic-platform): use socket ring for tokio #1792
Conversation
2e06837
to
cffd965
Compare
cffd965
to
5fd3f24
Compare
7f1a3cd
to
3b2e56b
Compare
9f7241d
to
cd946a7
Compare
} | ||
|
||
#[inline] | ||
unsafe fn set_payload_len(&mut self, len: usize) { | ||
debug_assert!(len <= core::u32::MAX as usize); | ||
debug_assert!(len <= core::u16::MAX as usize); |
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 are we going from u32 to u16. was the previous check not correct?
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.
the msg_len
is a u32
. but in general we don't allow payloads to be bigger that u16
quic/s2n-quic-platform/Cargo.toml
Outdated
@@ -17,25 +17,25 @@ testing = ["std", "generator", "futures/std", "io-testing"] # Testing allows to | |||
io-testing = ["bach"] | |||
generator = ["bolero-generator", "s2n-quic-core/generator"] | |||
tokio-runtime = ["futures", "tokio"] | |||
xdp = ["s2n-quic-xdp"] | |||
xdp = ["dep:s2n-quic-xdp"] |
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.
what does dep:
do?
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.
https://doc.rust-lang.org/cargo/reference/features.html#optional-dependencies - basically makes it explicit that it's enabling a dependency, not a feature. but i'm going to remove this for now and do a separate PR to fix the --all-feature
stuff in CI
@@ -90,6 +73,7 @@ impl Io { | |||
}, | |||
}); | |||
|
|||
// try to use the tokio runtime handle if provided |
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.
can you also add a comment on the else case. is that case used when s2n-quic runs inside another program which already started the tokio runtime.
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.
yep
@@ -8,13 +8,25 @@ use core::ops::ControlFlow; | |||
use socket2::{Domain, Protocol, Socket, Type}; | |||
use std::io; | |||
|
|||
/// Calls the given libc function and wraps the result in an `io::Result`. | |||
macro_rules! libc { |
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.
doesnt have to be in this PR but all setsockopt
calls can use a comment explaining what its doing. Otherwise reader has to lookup the call and or be familiar with it.
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.
db0dc35
to
0d69d19
Compare
Description of changes:
This change finally wires up the new "socket v2" async ring buffers to the tokio IO provider. It also deletes all of the "socket v1" code.
Testing:
Since this is just a refactor, all of the existing tests should pass, including the QNS tests.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.