Commit 148ce1d7 authored by David Wilson's avatar David Wilson

issue #155: increase context ID width to 32 bits

Needed to make large range allocations (1000 per ALLOCATE_ID roundtrip)
feasible.
parent 3579b680
...@@ -269,18 +269,18 @@ parent and child: ...@@ -269,18 +269,18 @@ parent and child:
- Description - Description
* - `dst_id` * - `dst_id`
- 2 - 4
- Integer target context ID. :py:class:`Router` delivers messages - Integer target context ID. :py:class:`Router` delivers messages
locally when their `dst_id` matches :py:data:`mitogen.context_id`, locally when their `dst_id` matches :py:data:`mitogen.context_id`,
otherwise they are routed up or downstream. otherwise they are routed up or downstream.
* - `src_id` * - `src_id`
- 2 - 4
- Integer source context ID. Used as the target of replies if any are - Integer source context ID. Used as the target of replies if any are
generated. generated.
* - `auth_id` * - `auth_id`
- 2 - 4
- The context ID under whose authority the message is acting. See - The context ID under whose authority the message is acting. See
:py:ref:`source-verification`. :py:ref:`source-verification`.
......
...@@ -757,7 +757,7 @@ class Stream(BasicStream): ...@@ -757,7 +757,7 @@ class Stream(BasicStream):
while self._receive_one(broker): while self._receive_one(broker):
pass pass
HEADER_FMT = '>hhhLLL' HEADER_FMT = '>LLLLLL'
HEADER_LEN = struct.calcsize(HEADER_FMT) HEADER_LEN = struct.calcsize(HEADER_FMT)
def _receive_one(self, broker): def _receive_one(self, broker):
...@@ -819,9 +819,9 @@ class Stream(BasicStream): ...@@ -819,9 +819,9 @@ class Stream(BasicStream):
def _send(self, msg): def _send(self, msg):
_vv and IOLOG.debug('%r._send(%r)', self, msg) _vv and IOLOG.debug('%r._send(%r)', self, msg)
pkt = struct.pack('>hhhLLL', msg.dst_id, msg.src_id, msg.auth_id, pkt = struct.pack(self.HEADER_FMT, msg.dst_id, msg.src_id,
msg.handle, msg.reply_to or 0, len(msg.data) msg.auth_id, msg.handle, msg.reply_to or 0,
) + msg.data len(msg.data)) + msg.data
self._output_buf.append(pkt) self._output_buf.append(pkt)
self._router.broker.start_transmit(self) self._router.broker.start_transmit(self)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment