You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2007/01/23 11:51:54 UTC
svn commit: r498983 - /incubator/qpid/trunk/qpid/python/qpid/peer.py
Author: gsim
Date: Tue Jan 23 02:51:53 2007
New Revision: 498983
URL: http://svn.apache.org/viewvc?view=rev&rev=498983
Log:
Proper fix to race condition where connection-close is sent by server. Now handle socket close on worker thread also.
Modified:
incubator/qpid/trunk/qpid/python/qpid/peer.py
Modified: incubator/qpid/trunk/qpid/python/qpid/peer.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/peer.py?view=diff&rev=498983&r1=498982&r2=498983
==============================================================================
--- incubator/qpid/trunk/qpid/python/qpid/peer.py (original)
+++ incubator/qpid/trunk/qpid/python/qpid/peer.py Tue Jan 23 02:51:53 2007
@@ -71,7 +71,7 @@
try:
frame = self.conn.read()
except EOF, e:
- self.close(e)
+ self.work.close()
break
ch = self.channel(frame.channel)
ch.dispatch(frame, self.work)
@@ -100,6 +100,8 @@
try:
while True:
self.dispatch(self.work.get())
+ except QueueClosed, e:
+ self.close(e)
except:
self.fatal()
@@ -127,22 +129,14 @@
self.queue = None
self.closed = False
self.reason = None
- #lock used to synchronise calls to close
- self.lock = thread.allocate_lock()
def close(self, reason):
- self.lock.acquire()
- try:
- if isinstance(reason, Message):
- self.reason = reason
- if self.closed:
- return
- self.closed = True
- self.reason = reason
- self.incoming.close()
- self.responses.close()
- finally:
- self.lock.release()
+ if self.closed:
+ return
+ self.closed = True
+ self.reason = reason
+ self.incoming.close()
+ self.responses.close()
def dispatch(self, frame, work):
payload = frame.payload