From 3606580f057ffb8f6387342c38a5ec70e030b512 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 29 Jan 2019 22:12:17 +0000 Subject: [PATCH] issue #260: redundant if statement. --- mitogen/core.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mitogen/core.py b/mitogen/core.py index 9a61d4cd..2cfb559f 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -1684,11 +1684,9 @@ class Stream(BasicStream): msg.reply_to or 0, len(msg.data)) + msg.data if not self._output_buf_len: - # Modifying epoll/Kqueue state is expensive, as is needless broker - # loop iterations. Rather than wait for writeability, simply - # attempt to write immediately, and only fall back to - # start_transmit()/on_transmit() if an error occurred or the socket - # buffer was full. + # Modifying epoll/Kqueue state is expensive, as are needless broker + # loops. Rather than wait for writeability, just write immediately, + # and fall back to the broker loop on error or full buffer. try: n = self.transmit_side.write(pkt) if n: @@ -1698,7 +1696,6 @@ class Stream(BasicStream): except OSError: pass - if not self._output_buf_len: self._router.broker._start_transmit(self) self._output_buf.append(pkt) self._output_buf_len += len(pkt)