diff --git a/docs/howitworks.rst b/docs/howitworks.rst index c26c79d6..3eef6800 100644 --- a/docs/howitworks.rst +++ b/docs/howitworks.rst @@ -269,18 +269,18 @@ parent and child: - Description * - `dst_id` - - 2 + - 4 - Integer target context ID. :py:class:`Router` delivers messages locally when their `dst_id` matches :py:data:`mitogen.context_id`, otherwise they are routed up or downstream. * - `src_id` - - 2 + - 4 - Integer source context ID. Used as the target of replies if any are generated. * - `auth_id` - - 2 + - 4 - The context ID under whose authority the message is acting. See :py:ref:`source-verification`. diff --git a/mitogen/core.py b/mitogen/core.py index 6105e069..6a1c3a64 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -757,7 +757,7 @@ class Stream(BasicStream): while self._receive_one(broker): pass - HEADER_FMT = '>hhhLLL' + HEADER_FMT = '>LLLLLL' HEADER_LEN = struct.calcsize(HEADER_FMT) def _receive_one(self, broker): @@ -819,9 +819,9 @@ class Stream(BasicStream): def _send(self, msg): _vv and IOLOG.debug('%r._send(%r)', self, msg) - pkt = struct.pack('>hhhLLL', msg.dst_id, msg.src_id, msg.auth_id, - msg.handle, msg.reply_to or 0, len(msg.data) - ) + msg.data + 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 self._output_buf.append(pkt) self._router.broker.start_transmit(self)