Reduce src_id/dst_id to 16 bits.

pull/35/head
David Wilson 7 years ago
parent 6a164adb22
commit 6c33d251df

@ -247,9 +247,9 @@ master and slave:
+====================+======+======================================================+
| ``hmac`` | 20 | SHA-1 over remaining fields. |
+--------------------+------+------------------------------------------------------+
| ``dst_id`` | 4 | Integer source context ID. |
| ``dst_id`` | 2 | Integer target context ID. |
+--------------------+------+------------------------------------------------------+
| ``src_id`` | 4 | Integer source context ID. |
| ``src_id`` | 2 | Integer source context ID. |
+--------------------+------+------------------------------------------------------+
| ``handle`` | 4 | Integer target handle in recipient. |
+--------------------+------+------------------------------------------------------+

@ -473,7 +473,7 @@ class Stream(BasicStream):
if not buf:
return self.on_disconnect(broker)
HEADER_FMT = '>20sLLLLL'
HEADER_FMT = '>20shhLLL'
HEADER_LEN = struct.calcsize(HEADER_FMT)
MAC_LEN = sha.digest_size
@ -528,7 +528,7 @@ class Stream(BasicStream):
"""Send `data` to `handle`, and tell the broker we have output. May
be called from any thread."""
IOLOG.debug('%r._send(%r)', self, msg)
pkt = struct.pack('>LLLLL', msg.dst_id, msg.src_id,
pkt = struct.pack('>hhLLL', msg.dst_id, msg.src_id,
msg.handle, msg.reply_to or 0, len(msg.data)
) + msg.data
self._whmac.update(pkt)

Loading…
Cancel
Save