Skip to content

prevent return of None in write() - #384

Closed
fs570714 wants to merge 1 commit into
canopen-python:masterfrom
fs570714:bugfix/BlockingIOError_on_Block_download
Closed

fs570714 wants to merge 1 commit into
canopen-python:masterfrom
fs570714:bugfix/BlockingIOError_on_Block_download

Conversation

@fs570714

@fs570714 fs570714 commented Jul 2, 2023 •

Copy link
Copy Markdown

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.

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