[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] Fix tls_handshake.py method makeConnection to handle socket timeouts.
commit 176901bd0f8411f6cc7ddaf56c242ff9ee71b92e
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
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):
"""
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits