Skip to content

Conversation

wolfmanjm
Copy link
Contributor

@wolfmanjm wolfmanjm commented Jun 26, 2020

… blocking.

Also added a flush command which will clear the write buffer.

Addresses issue #53

@ulysse314
Copy link

Thanks for this patch, this was useful for my project. I would be happy to see this patch merged into pyserial-asyncio.

@Nable80
Copy link

Nable80 commented Aug 19, 2020

It took some time to understand why 2 almost identical branches were used:

        if self.get_write_buffer_size() == 0:
            self._write_buffer.append(data)
            self._ensure_writer()
        else:
            self._write_buffer.append(data)

I think it's natural to simplify (and clarify) this block to be something like this:

        prev_buffer_size = self.get_write_buffer_size()
        self._write_buffer.append(data)
        if prev_buffer_size == 0:
            self._ensure_writer()

Do you agree?

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.

4 participants