-
-
Notifications
You must be signed in to change notification settings - Fork 41
http: Implement callbacks to configure the sockets used as listeners #407
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
base: main
Are you sure you want to change the base?
Conversation
|
||
// We have to create an std listener first because the tokio listener isn't clonable | ||
let listener = tokio::net::TcpListener::bind(self.bind).await?.into_std()?; | ||
let listener = { |
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 suspect this might not work on windows. Previously when adding windows support we found that if the listener was constructed outside of tokio it would block the eventloop even if non-blocking was set to true. We didnt investigate this further than that, but perhaps this might be a good time to understand why this behaviour was the case when using std::net::TcpListener::bind
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 have run just fmt now. I haven't had this problem on windows yet at least when using the socket2 crate but my time spent in windows is not a lot.
If you can format your code using |
?brawl try |
http: Implement callbacks to configure the sockets used as listeners Hello, i have recently come across a situation where i wanted to use SO_REUSEPORT on the HttpServers. I added options to the HttpServerBuilder that can be set to callbacks which can configure `socket2::Socket` instances that will then be used as listeners. Requested-by: philipch07 <[email protected]>
💔 Test failed - brawl-done |
Oh I missed some files when reviewing since I'm currently on mobile. When you get the chance, please run |
?brawl try ah no permissions D: |
?brawl try |
http: Implement callbacks to configure the sockets used as listeners Hello, i have recently come across a situation where i wanted to use SO_REUSEPORT on the HttpServers. I added options to the HttpServerBuilder that can be set to callbacks which can configure `socket2::Socket` instances that will then be used as listeners. Requested-by: lennartkloock <[email protected]>
💔 Test failed - brawl-done |
?brawl try |
http: Implement callbacks to configure the sockets used as listeners Hello, i have recently come across a situation where i wanted to use SO_REUSEPORT on the HttpServers. I added options to the HttpServerBuilder that can be set to callbacks which can configure `socket2::Socket` instances that will then be used as listeners. Requested-by: lennartkloock <[email protected]>
💔 Test failed - brawl-done |
fb9a4fa
to
202a9d1
Compare
?brawl try |
http: Implement callbacks to configure the sockets used as listeners Hello, i have recently come across a situation where i wanted to use SO_REUSEPORT on the HttpServers. I added options to the HttpServerBuilder that can be set to callbacks which can configure `socket2::Socket` instances that will then be used as listeners. Requested-by: TroyKomodo <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #407 +/- ##
==========================================
- Coverage 84.23% 84.17% -0.07%
==========================================
Files 215 215
Lines 14902 14844 -58
==========================================
- Hits 12553 12495 -58
Misses 2349 2349
... and 7 files with indirect coverage changes
|
🎉 Try build successful! Requested by: @TroyKomodo |
…loock Change shebangs in Justfile from '/bin/bash/' to '/usr/bin/env bash' This changes the shebangs in the Justfile from `#!/bin/bash` to `#/usr/bin/env bash` which is more portable across systems. `/bin/bash` doesn't exist on e.g. nixOs, most BSDs, Alpine and apparently newer versions of macOs use a very old version of bash at `/bin/bash`. Requested-by: lennartkloock <[email protected]> Reviewed-by: lennartkloock <[email protected]>
crates/http/src/server.rs
Outdated
|
||
impl std::fmt::Debug for ConfigureSocketCallback { | ||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
write!(f, "ConfigureSocketCallback ") |
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.
extra space here
crates/http/src/server.rs
Outdated
/// Callback to configure socket used for http1 and http2 | ||
#[cfg(any(feature = "http1", feature = "http2"))] | ||
#[cfg_attr(docsrs, doc(cfg(any(feature = "http1", feature = "http2"))))] | ||
configure_h12_sock: Option<ConfigureSocketCallback>, |
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 we make bon use an Into
impl for this and then impl this for any Fn<...>
@DrSloth did you still plan to do this pr? |
Yes, i am very sorry. Some other projects came up that i need to attend right now. |
Hello, i have recently come across a situation where i wanted to use SO_REUSEPORT on the HttpServers.
I added options to the HttpServerBuilder that can be set to callbacks which can configure
socket2::Socket
instances that will then be used as listeners.