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

[tor-commits] [ooni-probe/master] Improve report of TCP Connect test



commit ab198019f18b66d18b7e1ddc944127d992918ce1
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Tue Nov 20 17:07:33 2012 +0100

    Improve report of TCP Connect test
---
 nettests/core/tcpconnect.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/nettests/core/tcpconnect.py b/nettests/core/tcpconnect.py
index 4d1e0fc..b763bf8 100644
--- a/nettests/core/tcpconnect.py
+++ b/nettests/core/tcpconnect.py
@@ -35,7 +35,12 @@ class TCPConnectTest(nettest.NetTestCase):
         def connectionFailed(failure):
             failure.trap(ConnectionRefusedError, TCPTimedOutError)
             log.debug("Unable to connect to %s" % self.input)
-            self.report["connection"] = str(failure.value)
+            if isinstance(failure, ConnectionRefusedError):
+                self.report["connection"] = 'refused'
+            elif isinstance(failure, TCPTimedOutError):
+                self.report["connection"] = 'timeout'
+            else:
+                self.report["connection"] = 'failed'
 
         from twisted.internet import reactor
         point = TCP4ClientEndpoint(reactor, host, int(port))



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