[tor-commits] [ooni-probe/develop] Set self.input to self.host if no inputFile, and update several log messages.

isis at torproject.org isis at torproject.org
Thu Jun 6 16:41:38 UTC 2013


commit c07bd0eed90cb02a98391976cd4bb49b19909ebf
Author: Isis Lovecruft <isis at torproject.org>
Date:   Mon Apr 22 01:00:45 2013 +0000

    Set self.input to self.host if no inputFile, and update several log messages.
---
 nettests/experimental/tls_handshake.py |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/nettests/experimental/tls_handshake.py b/nettests/experimental/tls_handshake.py
index c26b279..5b1f656 100644
--- a/nettests/experimental/tls_handshake.py
+++ b/nettests/experimental/tls_handshake.py
@@ -412,7 +412,7 @@ class HandshakeTest(nettest.NetTestCase):
 
             if connection.renegotiate():
                 log.debug("Renegotiation possible.")
-                log.message("Retrying handshake with %s..." % host)
+                log.msg("Retrying handshake with %s..." % host)
                 try:
                     connection.do_handshake()
                     while connection.renegotiate_pending():
@@ -458,8 +458,7 @@ class HandshakeTest(nettest.NetTestCase):
             peername, peerport = host
 
             if isinstance(connection, SSL.Connection):
-                log.msg("Closing connection to %s:%d..."
-                        % (peername, peerport))
+                log.msg("Closing connection to %s:%d..." % (peername, peerport))
                 while not connection.shutdown():
                     ## if the connection is halfway shutdown, we have to
                     ## wait for a ZeroReturnError on connection.recv():
@@ -642,8 +641,8 @@ class HandshakeTest(nettest.NetTestCase):
                         self.state = connection.state_string()
                         connection = handleWantRead(connection)
                     else:
-                        ## if we still have an SSL_ERROR_WANT_READ, then try
-                        ## to renegotiate
+                        ## if we still have an SSL_ERROR_WANT_READ, then try to
+                        ## renegotiate
                         self.state = connection.state_string()
                         connection = connectionRenegotiate(connection,
                                                            connection.getpeername(),
@@ -772,6 +771,12 @@ class HandshakeTest(nettest.NetTestCase):
         def deferMakeConnection(host):
             return threads.deferToThread(makeConnection, self.input)
 
+
+        log.msg("Beginning handshake test for %s" % (self.input or self.host))
+
+        if self.host and not self.input:
+            self.input = self.splitInput(self.host)
+
         connection = deferMakeConnection(self.input)
         connection.addCallbacks(connectionSucceeded, connectionFailed,
                                 callbackArgs=[self.input, self.timeout],





More information about the tor-commits mailing list