-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
net: debug_assert on creating a tokio socket from a blocking one #7166
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
f456825
net: warn on creating a tokio socket from a nonblocking one.
Noah-Kennedy 857742c
fmt
Noah-Kennedy 782d37f
that operating system is a decades-old mistake
Noah-Kennedy 680f16c
docs.rs doesnt have windows so im guessing
Noah-Kennedy f4a6df7
wat
Noah-Kennedy 9826dac
sadness
Noah-Kennedy c958685
lol what was i doing
Noah-Kennedy 31f24d8
address feedback
Noah-Kennedy 0e396e4
ugh spelling
Noah-Kennedy bdbf1c7
oh right
Noah-Kennedy 0ded975
fix bad test
Noah-Kennedy 277a6f7
fix more tests
Noah-Kennedy 3fe9fdd
moar test fixes
Noah-Kennedy cca424b
sadness
Noah-Kennedy e1f4742
lol
Noah-Kennedy f6bb911
ugh
Noah-Kennedy 2155bb8
fml
Noah-Kennedy b5a3558
lol
Noah-Kennedy 89fdc71
lol
Noah-Kennedy 5e99a1b
make these lines shorter
Noah-Kennedy 83f64bc
Merge branch 'master' into noah/warnings
carllerche 3e84e60
Update tokio/src/util/blocking_check.rs
Noah-Kennedy c67fd66
Merge branch 'master' into noah/warnings
carllerche File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#[cfg(unix)] | ||
use std::os::fd::AsFd; | ||
|
||
#[cfg(unix)] | ||
#[allow(unused_variables)] | ||
#[track_caller] | ||
pub(crate) fn check_socket_for_blocking<S: AsFd>(s: &S) -> crate::io::Result<()> { | ||
#[cfg(not(tokio_allow_from_blocking_fd))] | ||
{ | ||
let sock = socket2::SockRef::from(s); | ||
|
||
debug_assert!( | ||
sock.nonblocking()?, | ||
"Registering a blocking socket with the tokio runtime is unsupported. \ | ||
If you wish to do anyways, please add `--cfg tokio_allow_from_blocking_fd` to your \ | ||
RUSTFLAGS. See github.com/tokio-rs/tokio/issues/7172 for details." | ||
); | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
#[cfg(not(unix))] | ||
#[allow(unused_variables)] | ||
pub(crate) fn check_socket_for_blocking<S>(s: &S) -> crate::io::Result<()> { | ||
// we cannot retrieve the nonblocking status on windows | ||
// and i dont know how to support wasi yet | ||
Ok(()) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.