[tor-commits] [ooni-probe/master] Fix tls_handshake.py method makeConnection to handle socket timeouts.

art at torproject.org art at torproject.org
Tue Apr 30 13:01:43 UTC 2013


commit 176901bd0f8411f6cc7ddaf56c242ff9ee71b92e
Author: Isis Lovecruft <isis at torproject.org>
Date:   Thu Feb 28 17:39:46 2013 +0000

    Fix tls_handshake.py method makeConnection to handle socket timeouts.
    
      * makeConnection() now returns a ConnectionTimeout wrapped in a
        t.p.failure.Failure() if it receives a socket timeout.
---
 nettests/experimental/tls_handshake.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/nettests/experimental/tls_handshake.py b/nettests/experimental/tls_handshake.py
index 76b9d3f..4c42017 100644
--- a/nettests/experimental/tls_handshake.py
+++ b/nettests/experimental/tls_handshake.py
@@ -273,8 +273,13 @@ class TLSHandshakeTest(nettest.NetTestCase):
             sckt = self.buildSocket(addr)
             context = self.getContext()
             connection = SSL.Connection(context, sckt)
-            connection.connect(host)
-            return connection
+            try:
+               connection.connect(host)
+            except socket_timeout as stmo:
+               error = ConnectionTimeout(stmo.message)
+               return failure.Failure(error)
+            else:
+               return connection
 
         def connectionFailed(connection, host):
             """





More information about the tor-commits mailing list