[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] r24507: {arm} Extra gotcha with socket shutdowns - throws an error if the (arm/resources/TorCtl)



Author: atagar
Date: 2011-03-30 00:37:04 +0000 (Wed, 30 Mar 2011)
New Revision: 24507

Modified:
   arm/resources/TorCtl/TorCtl.py
Log:
Extra gotcha with socket shutdowns - throws an error if the socket wasn't available.



Modified: arm/resources/TorCtl/TorCtl.py
===================================================================
--- arm/resources/TorCtl/TorCtl.py	2011-03-30 00:19:31 UTC (rev 24506)
+++ arm/resources/TorCtl/TorCtl.py	2011-03-30 00:37:04 UTC (rev 24507)
@@ -133,10 +133,14 @@
       print "Connection refused. Is the ControlPort enabled?"
     else: print "Failed to establish socket: %s" % exc
     
-    if s: s.shutdown(socket.SHUT_RDWR)
+    if s:
+      try: s.shutdown(socket.SHUT_RDWR)
+      except socket.error: pass
     return None
   except Exception, exc:
-    if s: s.shutdown(socket.SHUT_RDWR)
+    if s:
+      try: s.shutdown(socket.SHUT_RDWR)
+      except socket.error: pass
     
     if passphrase and str(exc) == "Unable to authenticate: password incorrect":
       # provide a warning that the provided password didn't work, then try

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits