Skip to content
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

Ensure multiple shutdown attempts yield #25

Merged
merged 3 commits into from
Dec 13, 2023

Conversation

cmleinz
Copy link
Contributor

@cmleinz cmleinz commented Dec 12, 2023

Currently if the state is set to disconnect, and the user hits poll_shutdown, the function will never yield.

let mut connection = StubbornTcpStream::connect(ADDR).await.unwrap();
let _ = connection.shutdown().await;
let _ = connection.shutdown().await; // Second attempt never yields

My proposed solution (similar to how tokio operates) is to just error in the event a closed stream is told to shutdown again.

Copy link
Owner

@craftytrickster craftytrickster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. Code looks correct, just want to manually run some checks and verify before merging after I'm done with work.

Copy link
Owner

@craftytrickster craftytrickster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the work, please address these comments and then we can merge.

src/tokio/io.rs Outdated Show resolved Hide resolved
tests/dummy_tests.rs Outdated Show resolved Hide resolved
tests/dummy_tests.rs Outdated Show resolved Hide resolved
tests/dummy_tests.rs Outdated Show resolved Hide resolved
@craftytrickster
Copy link
Owner

Thanks for making the test changes, looks good

@craftytrickster craftytrickster merged commit 01960f4 into craftytrickster:main Dec 13, 2023
1 check passed
@craftytrickster
Copy link
Owner

Thank you for your help!

fredclausen referenced this pull request in sdr-enthusiasts/sdre-stubborn-io Dec 30, 2023
* Ensure multiple shutdown attempts behave correctly

---------

Authored-by: Caleb Leinz <[email protected]>
fredclausen referenced this pull request in sdr-enthusiasts/sdre-stubborn-io Dec 30, 2023
Doc changes and logging changes

Option to toggle write failure behavior

Ensure multiple shutdown attempts behave correctly (#25)

* Ensure multiple shutdown attempts behave correctly

---------

Authored-by: Caleb Leinz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants