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

prevent return of None in write() #384

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

Conversation

fs570714
Copy link

@fs570714 fs570714 commented Jul 2, 2023

This change solves issue #379 for me. As @Jef-GB explained, the error occurs for smaller block sizes. The error occurs when the write() function of the BlockDownloadStream class returns None a second time while the input buffer is not read a second time.
Somehow in this case the buffer does not get refilled.

This change ensures that the function always returns a length. However, if there aren't enough bytes in the buffer, the function now returns the number of bytes remaining, but saves and sends them on the next transmission.

I do not think this is the ideal solution, but I am out of ideas.

@fs570714 fs570714 closed this Jul 2, 2023
@fs570714 fs570714 reopened this Jul 2, 2023
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.

1 participant