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

windows: can't call try_write from a write callback #4183

Open
PeterJohnson opened this issue Oct 25, 2023 · 1 comment
Open

windows: can't call try_write from a write callback #4183

PeterJohnson opened this issue Oct 25, 2023 · 1 comment
Labels

Comments

@PeterJohnson
Copy link
Contributor

In https://github.com/libuv/libuv/blob/v1.x/src/win/tcp.c#L1127, the write() user callback is called before the write_reqs_pending is decremented (line 1130). As uv__tcp_try_write() unconditionally returns EAGAIN when write_reqs_pending is non-zero (line 952), this means it's impossible to have a successful try_write() call from a write() callback, even though the system should be fine with that. I think simply moving the decrement to before the callback would fix this with no other ill effects?

@bnoordhuis
Copy link
Member

That sounds about right. PR welcome; a test would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants