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 async send and recv functions to AsyncSession #2

Merged
merged 3 commits into from
Sep 13, 2024

Conversation

AaronKutch
Copy link
Contributor

If I am understanding this correctly, this is equivalent to the strategy already used in the AsyncRead and AsyncWrite implementations. These functions take &self which is needed for sanity downstream.

The only thing is that I am concerned about the writing side which has no polling mechanism or anything. Would it become effectively blocking with high packet rates?

@AaronKutch
Copy link
Contributor Author

AaronKutch commented Sep 12, 2024

I have tested it with a modified rust-tun (which requires nothing more than replacing the two unimplemented! with self.session_reader.session.recv(buf).await and self.session_reader.session.send(buf).await, and it appears to work with decent UDP throughput. TCP is having a hard time initiating though, I'm not sure if it's because of one of my layers.
This is needed to fix ssrlive/rust-tun#109.

src/async_session.rs Outdated Show resolved Hide resolved
@ssrlive
Copy link
Member

ssrlive commented Sep 13, 2024

I have pushed a patch for it. Please report your testing result here.

@AaronKutch
Copy link
Contributor Author

It is working much better now. Thank you!

@ssrlive ssrlive merged commit 8946c0e into tun2proxy:master Sep 13, 2024
6 checks passed
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.

2 participants