commit a277eaa249185cea4a221497e885a15743c7e610 Author: Arturo Filastò art@fuffa.org Date: Mon Aug 25 22:50:29 2014 +0200
Use the correct txtorcon API depending on the software version.
This fixes: https://trac.torproject.org/projects/tor/ticket/12747 --- oonib/runner.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/oonib/runner.py b/oonib/runner.py index d413221..aa5cd1a 100644 --- a/oonib/runner.py +++ b/oonib/runner.py @@ -4,6 +4,7 @@ In here we define a runner for the oonib backend system.
from __future__ import print_function
+from distutils.version import LooseVersion import tempfile import os
@@ -14,6 +15,7 @@ from twisted.python.runtime import platformType
from txtorcon import TCPHiddenServiceEndpoint, TorConfig from txtorcon import launch_tor +from txtorcon import __version__ as txtorcon_version
from oonib.api import ooniBackend, ooniBouncer from oonib.config import config @@ -66,10 +68,16 @@ else:
public_port = 80 data_dir = os.path.join(torconfig.DataDirectory, endpointName) - hs_endpoint = TCPHiddenServiceEndpoint(reactor, - torconfig, - public_port, - data_dir=data_dir) + if LooseVersion(txtorcon_version) >= LooseVersion('0.10.0'): + hs_endpoint = TCPHiddenServiceEndpoint(reactor, + torconfig, + public_port, + hidden_service_dir=data_dir) + else: + hs_endpoint = TCPHiddenServiceEndpoint(reactor, + torconfig, + public_port, + data_dir=data_dir) d = hs_endpoint.listen(endpoint) d.addCallback(setup_complete) d.addErrback(self.txSetupFailed)
tor-commits@lists.torproject.org