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

Consider adding a backpressure buffering mechanism for failed writes to TCP sockets #71

Open
rdw-software opened this issue Jun 22, 2022 · 0 comments

Comments

@rdw-software
Copy link
Member

rdw-software commented Jun 22, 2022

The API I came up with for #61 doesn't handle backpressure from failed Write() calls. In NodeJS, the socket is automatically paused and future writes buffered, but only to a limit (called highWaterMark). The socket then emits a drain event once the empty/writes can continue.

There's no such buffering in the C_Networking API, which is a deliberate decision with the goal of simplifying the API, but that means writes can fail and the caller would have to handle it... which of course works against the goal of making the API easy to use.

Maybe the approach used by Node (and Luvit) can be implemented without the giant inheritance hierarchy of streams etc. that I wanted to avoid with the above "basic" implementation. I'll have to look into creating a test scenario (slow receiver/read from socket with timeout) and then consider if the approach can be recreated on top of simple libuv primitives, without too much accidental complexity.

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

No branches or pull requests

1 participant