[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r15467: Fix TorCtl.Connection.close() to be sane+threadsafe. (torflow/branches/gsoc2008/TorCtl)
Author: mikeperry
Date: 2008-06-25 23:17:14 -0400 (Wed, 25 Jun 2008)
New Revision: 15467
Modified:
torflow/branches/gsoc2008/TorCtl/TorCtl.py
Log:
Fix TorCtl.Connection.close() to be sane+threadsafe.
Modified: torflow/branches/gsoc2008/TorCtl/TorCtl.py
===================================================================
--- torflow/branches/gsoc2008/TorCtl/TorCtl.py 2008-06-25 22:49:36 UTC (rev 15466)
+++ torflow/branches/gsoc2008/TorCtl/TorCtl.py 2008-06-26 03:17:14 UTC (rev 15467)
@@ -365,9 +365,6 @@
try:
self._queue.put("CLOSE")
self._eventQueue.put((time.time(), "CLOSE"))
- self._s.close()
- self._s = None
- self._closed = 1
finally:
self._sendLock.release()
@@ -402,7 +399,13 @@
self._eventQueue.put((time.time(), reply))
else:
cb = self._queue.get() # atomic..
- cb(reply)
+ if cb == "CLOSE":
+ self._s.close()
+ self._s = None
+ self._closed = 1
+ return
+ else:
+ cb(reply)
def _err(self, (tp, ex, tb), fromEventLoop=0):
"""DOCDOC"""