[Pkg-privacy-commits] [txtorcon] 74/96: Check whether current hidden service dir is the same as other hidden service dir
Jérémy Bobbio
lunar at moszumanska.debian.org
Sun Sep 6 18:33:42 UTC 2015
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository txtorcon.
commit 944c107cc1d64f2ddebf4ff2d7c6847b95d72939
Author: Sambuddha Basu <sambuddhabasu1 at gmail.com>
Date: Mon Feb 23 05:12:00 2015 +0530
Check whether current hidden service dir is the same as other hidden service dir
Cleaner code
Removed directories[]
Allow only one HiddenService to be added on calling listen()
Added check for already added hidden service
Check whether hidden service has already been added
Replaced self.reactor with reactor
Create instance of HiddenService inside if statement
---
test/test_endpoints.py | 1 +
txtorcon/endpoints.py | 11 ++++++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/test/test_endpoints.py b/test/test_endpoints.py
index f9c58b5..b0e613e 100644
--- a/test/test_endpoints.py
+++ b/test/test_endpoints.py
@@ -234,6 +234,7 @@ class EndpointTests(unittest.TestCase):
def check(arg):
self.assertEqual('127.0.0.1', ep.tcp_endpoint._interface)
+ self.assertEqual(len(self.config.HiddenServices), 1)
d0.addCallback(check).addErrback(self.fail)
return d0
diff --git a/txtorcon/endpoints.py b/txtorcon/endpoints.py
index 7703bf1..1a383fb 100644
--- a/txtorcon/endpoints.py
+++ b/txtorcon/endpoints.py
@@ -400,11 +400,12 @@ class TCPHiddenServiceEndpoint(object):
info_callback.callback(None)
self.config.protocol.add_event_listener('INFO', info_event)
- self.hiddenservice = HiddenService(
- self.config, self.hidden_service_dir,
- ['%d 127.0.0.1:%d' % (self.public_port, self.local_port)],
- group_readable=1)
- self.config.HiddenServices.append(self.hiddenservice)
+ if not self.hidden_service_dir in map(lambda hs: hs.dir, self.config.HiddenServices):
+ self.hiddenservice = HiddenService(
+ self.config, self.hidden_service_dir,
+ ['%d 127.0.0.1:%d' % (self.public_port, self.local_port)],
+ group_readable=1)
+ self.config.HiddenServices.append(self.hiddenservice)
yield self.config.save()
self._tor_progress_update(100.0, 'wait_descriptor',
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/txtorcon.git
More information about the Pkg-privacy-commits
mailing list