[Zodb-checkins] CVS: ZODB3/ZEO/zrpc - smac.py:1.32
Guido van Rossum
guido@python.org
Sun, 29 Sep 2002 03:51:38 -0400
Update of /cvs-repository/ZODB3/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv5839
Modified Files:
smac.py
Log Message:
Of course, the input lock must be held when doing the (non-blocking)
recv() call too, else there'd still be a race condition (two threads
both receiving some data, and then the last to read processing it
first, which would be a disaster).
=== ZODB3/ZEO/zrpc/smac.py 1.31 => 1.32 ===
--- ZODB3/ZEO/zrpc/smac.py:1.31 Sat Sep 28 23:22:28 2002
+++ ZODB3/ZEO/zrpc/smac.py Sun Sep 29 03:51:37 2002
@@ -89,18 +89,18 @@
return 1
def handle_read(self):
- # Use a single __inp buffer and integer indexes to make this fast.
+ self.__input_lock.acquire()
try:
- d = self.recv(8096)
- except socket.error, err:
- if err[0] in expected_socket_read_errors:
+ # Use a single __inp buffer and integer indexes to make this fast.
+ try:
+ d = self.recv(8096)
+ except socket.error, err:
+ if err[0] in expected_socket_read_errors:
+ return
+ raise
+ if not d:
return
- raise
- if not d:
- return
- self.__input_lock.acquire()
- try:
input_len = self.__input_len + len(d)
msg_size = self.__msg_size
state = self.__state