[Zodb-checkins] CVS: ZODB3/ZEO/zrpc - smac.py:1.40.2.1
log.py:1.8.24.1 client.py:1.27.2.1
Jeremy Hylton
jeremy at zope.com
Tue Dec 23 14:06:59 EST 2003
Update of /cvs-repository/ZODB3/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv26665/ZEO/zrpc
Modified Files:
Tag: ZODB3-mvcc-2-branch
smac.py log.py client.py
Log Message:
Merge the head to the mvcc branch.
This merge should be the final preparation for merging the branch to
the trunk.
=== ZODB3/ZEO/zrpc/smac.py 1.40 => 1.40.2.1 ===
--- ZODB3/ZEO/zrpc/smac.py:1.40 Thu Oct 2 18:14:03 2003
+++ ZODB3/ZEO/zrpc/smac.py Tue Dec 23 14:05:55 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
@@ -84,14 +84,18 @@
self.__input_lock = threading.Lock()
self.__inp = None # None, a single String, or a list
self.__input_len = 0
- # Instance variables __state and __msg_size work together:
+ # Instance variables __state, __msg_size and __has_mac work together:
# when __state == 0:
# __msg_size == 4, and the next thing read is a message size;
+ # __has_mac is set according to the MAC_BIT in the header
# when __state == 1:
# __msg_size is variable, and the next thing read is a message.
+ # __has_mac indicates if we're in MAC mode or not (and
+ # therefore, if we need to check the mac header)
# The next thing read is always of length __msg_size.
# The state alternates between 0 and 1.
self.__state = 0
+ self.__has_mac = 0
self.__msg_size = 4
self.__output_lock = threading.Lock() # Protects __output
self.__output = []
@@ -149,6 +153,7 @@
input_len = self.__input_len + len(d)
msg_size = self.__msg_size
state = self.__state
+ has_mac = self.__has_mac
inp = self.__inp
if msg_size > input_len:
@@ -171,7 +176,6 @@
inp = "".join(inp)
offset = 0
- has_mac = 0
while (offset + msg_size) <= input_len:
msg = inp[offset:offset + msg_size]
offset = offset + msg_size
@@ -208,9 +212,12 @@
% (_mac, mac))
else:
log("Received MAC but no session key set")
+ elif self.__hmac_send:
+ raise ValueError("Received message without MAC")
self.message_input(msg)
self.__state = state
+ self.__has_mac = has_mac
self.__msg_size = msg_size
self.__inp = inp[offset:]
self.__input_len = input_len - offset
=== ZODB3/ZEO/zrpc/log.py 1.8 => 1.8.24.1 ===
--- ZODB3/ZEO/zrpc/log.py:1.8 Thu Apr 17 17:16:49 2003
+++ ZODB3/ZEO/zrpc/log.py Tue Dec 23 14:05:55 2003
@@ -45,7 +45,7 @@
# The pickle is near the beginning, too, and you can often fit the
# module name in the pickle.
- if isinstance(obj, types.StringType):
+ if isinstance(obj, str):
if len(obj) > REPR_LIMIT:
r = repr(obj[:REPR_LIMIT])
else:
@@ -53,7 +53,7 @@
if len(r) > REPR_LIMIT:
r = r[:REPR_LIMIT-4] + '...' + r[-1]
return r
- elif isinstance(obj, types.TupleType):
+ elif isinstance(obj, (list, tuple)):
elts = []
size = 0
for elt in obj:
@@ -62,7 +62,10 @@
size += len(r)
if size > REPR_LIMIT:
break
- r = "(%s)" % (", ".join(elts))
+ if isinstance(obj, tuple):
+ r = "(%s)" % (", ".join(elts))
+ else:
+ r = "[%s]" % (", ".join(elts))
else:
r = repr(obj)
if len(r) > REPR_LIMIT:
=== ZODB3/ZEO/zrpc/client.py 1.27 => 1.27.2.1 ===
--- ZODB3/ZEO/zrpc/client.py:1.27 Thu Oct 2 14:17:20 2003
+++ ZODB3/ZEO/zrpc/client.py Tue Dec 23 14:05:55 2003
@@ -85,6 +85,7 @@
def close(self):
"""Prevent ConnectionManager from opening new connections"""
self.closed = 1
+ ThreadedAsync.remove_loop_callback(self.set_async)
self.cond.acquire()
try:
t = self.thread
More information about the Zodb-checkins
mailing list