From 6db3588c93b6d18c50ca17f0c909623187058a79 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 29 Mar 2018 16:06:18 +0545 Subject: [PATCH] Only call _start_transmit when required; closes #165. --- mitogen/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mitogen/core.py b/mitogen/core.py index 1e3b891a..01d343d6 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -862,8 +862,10 @@ class Stream(BasicStream): pkt = struct.pack(self.HEADER_FMT, msg.dst_id, msg.src_id, msg.auth_id, msg.handle, msg.reply_to or 0, len(msg.data)) + msg.data + was_transmitting = len(self._output_buf) self._output_buf.append(pkt) - self._router.broker._start_transmit(self) + if not was_transmitting: + self._router.broker._start_transmit(self) def send(self, msg): """Send `data` to `handle`, and tell the broker we have output. May