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

Avoid locking the receive buffer when reading from the network #26

Open
Stebalien opened this issue Apr 18, 2020 · 0 comments
Open

Avoid locking the receive buffer when reading from the network #26

Stebalien opened this issue Apr 18, 2020 · 0 comments
Assignees

Comments

@Stebalien
Copy link
Member

Currently, we lock the receive buffer when reading from the network. However, this means that if we're reading a large message, the receiving stream can't read anything already in the buffer.

A simple solution would be to allocate a temporary buffer for reading from the network, then copy into the receive buffer. However, that's an extra copy.

Instead, I'd prefer keep a read offset and a write offset into the same buffer, updating them after reading/writing. Critically, we wouldn't hold the lock while reading.

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

No branches or pull requests

2 participants