[tor-commits] [pytorctl/master] Try to catch an AttributeError early..

mikeperry at torproject.org mikeperry at torproject.org
Thu Mar 3 09:39:28 UTC 2011


commit 6eeffeb4f20aefb2f859a9f5754c34342abc307e
Author: Mike Perry <mikeperry-git at fscked.org>
Date:   Thu Mar 3 01:38:15 2011 -0800

    Try to catch an AttributeError early..
    
    It may be silently killing the bwauths on some platforms..
---
 PathSupport.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/PathSupport.py b/PathSupport.py
index 3fefb24..e3ddfd1 100644
--- a/PathSupport.py
+++ b/PathSupport.py
@@ -1342,7 +1342,11 @@ class SmartSocket(_SocketWrapper):
 
   def __del__(self):
     SmartSocket._table_lock.acquire()
-    SmartSocket.port_table.remove(self.__local_addr)
+    try:
+      SmartSocket.port_table.remove(self.__local_addr)
+    except AttributeError,e:
+      traceback.print_exc()
+      plog("WARN", "Hrm. Socket instance without local_addr attribute?")
     SmartSocket._table_lock.release()
     plog("DEBUG", "Removed "+self.__local_addr+" from our local port list")
 



More information about the tor-commits mailing list