[Zope-Checkins] CVS: ZODB3/ZEO/zrpc - smac.py:1.38.8.1
Tim Peters
tim.one@comcast.net
Tue, 1 Jul 2003 17:51:34 -0400
Update of /cvs-repository/ZODB3/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv24262/ZEO/zrpc
Modified Files:
Tag: zodb33-devel-branch
smac.py
Log Message:
Squash wng msg from 2.3 by making MAC_BIT unsigned.
=== ZODB3/ZEO/zrpc/smac.py 1.38 => 1.38.8.1 ===
--- ZODB3/ZEO/zrpc/smac.py:1.38 Fri May 30 15:20:56 2003
+++ ZODB3/ZEO/zrpc/smac.py Tue Jul 1 17:51:34 2003
@@ -16,7 +16,7 @@
This class extends the basic asyncore layer with a record-marking
layer. The message_output() method accepts an arbitrary sized string
as its argument. It sends over the wire the length of the string
-encoded using struct.pack('>i') and the string itself. The receiver
+encoded using struct.pack('>I') and the string itself. The receiver
passes the original string to message_input().
This layer also supports an optional message authentication code
@@ -64,7 +64,7 @@
# that we could pass to send() without blocking.
SEND_SIZE = 60000
-MAC_BIT = 0x80000000
+MAC_BIT = 0x80000000L
class SizedMessageAsyncConnection(asyncore.dispatcher):
__super_init = asyncore.dispatcher.__init__
@@ -155,7 +155,7 @@
msg = inp[offset:offset + msg_size]
offset = offset + msg_size
if not state:
- msg_size = struct.unpack(">i", msg)[0]
+ msg_size = struct.unpack(">I", msg)[0]
expect_mac = msg_size & MAC_BIT
if expect_mac:
msg_size ^= MAC_BIT
@@ -256,11 +256,11 @@
try:
# do two separate appends to avoid copying the message string
if self.__hmac:
- self.__output.append(struct.pack(">i", len(message) | MAC_BIT))
+ self.__output.append(struct.pack(">I", len(message) | MAC_BIT))
self.__hmac.update(message)
self.__output.append(self.__hmac.digest())
else:
- self.__output.append(struct.pack(">i", len(message)))
+ self.__output.append(struct.pack(">I", len(message)))
if len(message) <= SEND_SIZE:
self.__output.append(message)
else: