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

[tor-commits] [ooni-probe/master] Add certain deferreds into their own function so that we can do a



commit 15e8e11cb9da46b78a6089f478d28a021c798a81
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Thu Feb 28 04:39:49 2013 +0000

    Add certain deferreds into their own function so that we can do a
    defer.Deferred.addCallbacks on its return value.
---
 nettests/experimental/tls_handshake.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/nettests/experimental/tls_handshake.py b/nettests/experimental/tls_handshake.py
index 0bd84bc..a21b357 100644
--- a/nettests/experimental/tls_handshake.py
+++ b/nettests/experimental/tls_handshake.py
@@ -589,8 +589,15 @@ class TLSHandshakeTest(nettest.NetTestCase):
             ## xxx do we need this?
             #return connection
 
+        @defer.inlineCallbacks
+        def deferMakeConnection(host):
+            connection = yield makeConnection(host)
+            if isinstance(connection, Failure) \
+                    or isinstance(connection, Exception):
+                failed = connectionFailed(connection, host)
+                defer.returnValue(failed)
             else:
-                return handshakeSucceeded(connection)
+                defer.returnValue(connection)
 
         addr, port = self.input
         connection = defer.maybeDeferred(makeConnection, addr, port)



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