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

fix: handle edge cases in frame read and write #1

Merged
merged 1 commit into from
May 14, 2023

Conversation

sabify
Copy link
Contributor

@sabify sabify commented May 2, 2023

This PR handles edge cases on AsyncRead and AsyncWrite methods when ready! macro may return early that may cause losing to track the data based on the defined protocol. Also this PR fixes the buffer issue when used in a stack like kaminari library.

Related: zephyrchien/kaminari#7 and zephyrchien/kaminari#8.

@zephyrchien
Copy link
Owner

Thanks a lot for this PR.

The current impl works this way:

1. read to buf;  if not enough then: copy buf to vec
2. copy vec to buf

Personally I prefer to twist it to this way, like a buffered reader:

1. always read to vec
2. if enough then: copy vec to buf

===
Apologies for the delayed response.

@sabify
Copy link
Contributor Author

sabify commented May 17, 2023

Please check out the #2 PR.

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