[tor-commits] [ooni-probe/develop] Add certain deferreds into their own function so that we can do a
isis at torproject.org
isis at torproject.org
Thu Jun 6 16:41:37 UTC 2013
commit 15e8e11cb9da46b78a6089f478d28a021c798a81
Author: Isis Lovecruft <isis at torproject.org>
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 file changed, 8 insertions(+), 1 deletion(-)
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)
More information about the tor-commits
mailing list