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

Immediately return StreamError::Closed when the TCP stream is closed. #8968

Merged

Conversation

badeend
Copy link
Contributor

@badeend badeend commented Jul 17, 2024

This saves the caller from having to perform one last poll+read sequence.

Before this change, it would first return an empty list of bytes, which is the wasi-io equivalent of EWOULDBLOCK.

@badeend badeend requested a review from a team as a code owner July 17, 2024 09:41
@badeend badeend requested review from fitzgen and removed request for a team July 17, 2024 09:41
@github-actions github-actions bot added the wasi Issues pertaining to WASI label Jul 17, 2024
@alexcrichton
Copy link
Member

Thanks! Would it be possible to add a test for this too?

This saves the caller from having to perform one last `poll`+`read` sequence.

Before this change, it would first return an empty list of bytes, which is the wasi-io equivalent of EWOULDBLOCK.
@badeend badeend force-pushed the immediate-stream-error-closed2 branch from 0d8758d to 344439f Compare July 17, 2024 19:27
@badeend
Copy link
Contributor Author

badeend commented Jul 17, 2024

Yes!

The test includes a std::thread::sleep. Under Linux this shouldn't be necessary as communication over loopback devices happens synchronously. But I've thrown it in anyway just in case Windows or MacOS works differently.

@alexcrichton alexcrichton added this pull request to the merge queue Jul 17, 2024
Merged via the queue into bytecodealliance:main with commit 2aa4fde Jul 17, 2024
37 checks passed
@badeend badeend deleted the immediate-stream-error-closed2 branch July 17, 2024 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasi Issues pertaining to WASI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants