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

Add a way to shutdown SyncIoBridge #4932

Closed
imlk0 opened this issue Aug 23, 2022 · 2 comments · Fixed by #4938
Closed

Add a way to shutdown SyncIoBridge #4932

imlk0 opened this issue Aug 23, 2022 · 2 comments · Fixed by #4938
Labels
A-tokio-util Area: The tokio-util crate C-feature-request Category: A feature request. E-easy Call for participation: Experience needed to fix: Easy / not much E-help-wanted Call for participation: Help is requested to fix this issue. M-io Module: tokio/io

Comments

@imlk0
Copy link
Contributor

imlk0 commented Aug 23, 2022

Is your feature request related to a problem? Please describe.
SyncIoBridge(#4146) does not provide a way to call the shutdown() function of its internal tokio::io::AsyncWrite instance.

Describe the solution you'd like
Add a shutdown() function to SyncIoBridge, which invoke the shutdown() function of src field

Describe alternatives you've considered
n/a

Additional context
Take tokio::io::DuplexStream as en example. Its shutdown() can be used to close the writer of stream, but in the following example, I have no way to shutdown:

let (s1, _s2) = tokio::io::duplex(1024);
let (rh, wh) = tokio::io::split(s1);
tokio::task::spawn_blocking(move || {
    let mut wh = SyncIoBridge::new(wh);
    // wh.write_all() ...
    // Now I need to shutdown the write half
    wh.shutdown(); // I need this function
});
@imlk0 imlk0 added A-tokio Area: The main tokio crate C-feature-request Category: A feature request. labels Aug 23, 2022
@Darksonn Darksonn added A-tokio-util Area: The tokio-util crate M-io Module: tokio/io E-help-wanted Call for participation: Help is requested to fix this issue. E-easy Call for participation: Experience needed to fix: Easy / not much and removed A-tokio Area: The main tokio crate labels Aug 23, 2022
@imlk0
Copy link
Contributor Author

imlk0 commented Aug 23, 2022

@Darksonn What do you think about the proposal to add SyncIoBridge::shutdown()? If appropriate, I can create a PR for this.

@Darksonn
Copy link
Contributor

Adding a method for this sounds good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio-util Area: The tokio-util crate C-feature-request Category: A feature request. E-easy Call for participation: Experience needed to fix: Easy / not much E-help-wanted Call for participation: Help is requested to fix this issue. M-io Module: tokio/io
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants