[tor-commits] [ooni-probe/master] Log failure when OpenVPN process hangs for user input
art at torproject.org
art at torproject.org
Fri Apr 29 09:42:23 UTC 2016
commit 1944e8e80d7605a161a3c56a8bf5ce983b1a10e7
Author: srvetus <srvetus at users.noreply.github.com>
Date: Thu Dec 10 21:03:58 2015 +0100
Log failure when OpenVPN process hangs for user input
---
ooni/nettests/third_party/openvpn.py | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/ooni/nettests/third_party/openvpn.py b/ooni/nettests/third_party/openvpn.py
index 028bf17..bc2f0ea 100644
--- a/ooni/nettests/third_party/openvpn.py
+++ b/ooni/nettests/third_party/openvpn.py
@@ -57,6 +57,15 @@ class OpenVPNTest(ProcessTest):
self.processDirector.transport.signalProcess('TERM')
self.exited = True
+ def inConnectionLost(self):
+ """Monkeypatch inConnectionLost to log failure if the process ends
+ unexpectedly before OpenVPN bootstraps.
+ """
+ log.debug("inConnectionLost")
+
+ if not self.bootstrapped.called:
+ self.bootstrapped.errback(Exception("openvpn_exited_unexpectedly"))
+
def processExited(self, reason):
"""Monkeypatch processExited to log failure if the process ends
unexpectedly before OpenVPN bootstraps.
@@ -64,9 +73,11 @@ class OpenVPNTest(ProcessTest):
log.debug("Exited %s" % handleAllFailures(reason))
# Process exited before OpenVPN bootstrapped. Add failure to report
+ # if it is not added already
if not self.bootstrapped.called:
self.bootstrapped.errback(Exception("openvpn_exited_unexpectedly"))
+
def handleRead(self, stdout=None, stderr=None):
"""handleRead is called with each chunk of data from stdout and stderr
@@ -116,7 +127,8 @@ class OpenVPNTest(ProcessTest):
log.debug("Spawning OpenVPN")
self.d = self.run(self.command)
- # Monkeypatch processExited to log when OpenVPN exits early
+ # Monkeypatch inConnectionLost and processExited to log when OpenVPN exits early
+ self.processDirector.inConnectionLost = self.inConnectionLost
self.processDirector.processExited = self.processExited
# Try to make a request when the OpenVPN connection successfully bootstraps
More information about the tor-commits
mailing list