[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r20501: {torctl} Fix an exception crash on stream closing and kill a WARN. (torctl/branches/stable/python/TorCtl)
Author: mikeperry
Date: 2009-09-08 15:29:04 -0400 (Tue, 08 Sep 2009)
New Revision: 20501
Modified:
torctl/branches/stable/python/TorCtl/PathSupport.py
torctl/branches/stable/python/TorCtl/SQLSupport.py
Log:
Fix an exception crash on stream closing and kill a WARN.
Modified: torctl/branches/stable/python/TorCtl/PathSupport.py
===================================================================
--- torctl/branches/stable/python/TorCtl/PathSupport.py 2009-09-08 19:26:51 UTC (rev 20500)
+++ torctl/branches/stable/python/TorCtl/PathSupport.py 2009-09-08 19:29:04 UTC (rev 20501)
@@ -1394,7 +1394,11 @@
""" Close all open streams """
for strm in self.streams.itervalues():
if not strm.ignored:
- self.c.close_stream(strm.strm_id, reason)
+ try:
+ self.c.close_stream(strm.strm_id, reason)
+ except TorCtl.ErrorReply, e:
+ # This can happen. Streams can timeout before this call.
+ plog("NOTICE", "Error closing stream "+str(strm.strm_id)+": "+str(e))
def close_all_circuits(self):
""" Close all open circuits """
Modified: torctl/branches/stable/python/TorCtl/SQLSupport.py
===================================================================
--- torctl/branches/stable/python/TorCtl/SQLSupport.py 2009-09-08 19:26:51 UTC (rev 20500)
+++ torctl/branches/stable/python/TorCtl/SQLSupport.py 2009-09-08 19:29:04 UTC (rev 20501)
@@ -931,7 +931,9 @@
return
strm = Stream.query.filter_by(strm_id = s.strm_id).first()
- if self.track_parent and s.strm_id not in self.parent_handler.streams:
+ if self.track_parent and \
+ (s.strm_id not in self.parent_handler.streams or \
+ self.parent_handler.streams[s.strm_id].ignored):
if strm:
tc_session.delete(strm)
tc_session.commit()