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

IMuxedStream should implement AsyncContextManager #414

Open
ralexstokes opened this issue May 21, 2020 · 1 comment
Open

IMuxedStream should implement AsyncContextManager #414

ralexstokes opened this issue May 21, 2020 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ralexstokes
Copy link
Contributor

Just an ergonomics feature but it would be nice to allow a consumer of IMuxedStream that receives a stream that will automatically close when the consumer is done with it.

async with _get_a_new_stream(peer_id, protocols) as stream:
    # do stuff with stream
# stream.close called on `__aexit__`.
@ralexstokes ralexstokes added enhancement New feature or request good first issue Good for newcomers labels May 21, 2020
@ralexstokes
Copy link
Contributor Author

Part of this feature working well is that close is idempotent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: No status
Development

No branches or pull requests

1 participant