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

Introduce a postWrite hook #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

abramk
Copy link

@abramk abramk commented Jul 7, 2023

If you are sending large amounts of data (multiple megabytes) and you don't want to allocate that large a byte slice, one option is to send the data and have a mechanism to Wake() the connection up after the write is done. This will require a postWrite(conn) hook that also provides a reference to the connection for which data was just written. This way the application can maintain state in the context and in the postWrite hook, call Wake() and send the next batch of data when the Data() hook gets called.

If you are sending large amounts of data (multiple megabytes) and you don't want to allocate that large a byte slice, one option is to send the data and have a mechanism to Wake() the connection up after the write is done. This will require a postWrite(conn) hook that also provides a reference to the connection for which data was just written. This way the application can maintain state in the context and in the postWrite hook, call Wake() and send the next batch of data when the Data() hook gets called.
@abramk
Copy link
Author

abramk commented Jul 7, 2023

@tidwall kindly let me know if you are able to incorporate this and push a release.

@abramk
Copy link
Author

abramk commented Jul 14, 2023

@tidwall any update on this?

@tidwall
Copy link
Owner

tidwall commented Jul 14, 2023

I'm not accepting pull requests at this time.

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