[Pkg-privacy-commits] [onionbalance] 31/117: Stylistic change, and begin using stem's get_hidden_service_descriptor()
Donncha O'Cearbahill
donncha-guest at moszumanska.debian.org
Wed Dec 16 23:18:43 UTC 2015
This is an automated email from the git hooks/post-receive script.
donncha-guest pushed a commit to branch debian/sid
in repository onionbalance.
commit 16b226fbd12c4c8a05f3de9aa856ac5052a261fe
Author: Donncha O'Cearbhaill <donncha at donncha.is>
Date: Tue Jun 23 12:15:00 2015 +0100
Stylistic change, and begin using stem's get_hidden_service_descriptor()
---
onionbalance/descriptor.py | 23 ++++++++++++-----------
onionbalance/instance.py | 10 ++++++++--
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/onionbalance/descriptor.py b/onionbalance/descriptor.py
index 2086a5d..5613282 100644
--- a/onionbalance/descriptor.py
+++ b/onionbalance/descriptor.py
@@ -64,17 +64,18 @@ def generate_hs_descriptor_raw(desc_id_base32, permanent_key_block,
"""
Generate hidden service descriptor string
"""
- doc = []
- doc.append("rendezvous-service-descriptor {}".format(desc_id_base32))
- doc.append("version 2")
- doc.append("permanent-key")
- doc.append(permanent_key_block)
- doc.append("secret-id-part {}".format(secret_id_part_base32))
- doc.append("publication-time {}".format(publication_time))
- doc.append("protocol-versions 2,3")
- doc.append("introduction-points")
- doc.append(introduction_points_part)
- doc.append("signature\n")
+ doc = [
+ "rendezvous-service-descriptor {}".format(desc_id_base32),
+ "version 2",
+ "permanent-key",
+ permanent_key_block,
+ "secret-id-part {}".format(secret_id_part_base32),
+ "publication-time {}".format(publication_time),
+ "protocol-versions 2,3",
+ "introduction-points",
+ introduction_points_part,
+ "signature\n",
+ ]
unsigned_descriptor = '\n'.join(doc)
return unsigned_descriptor
diff --git a/onionbalance/instance.py b/onionbalance/instance.py
index 0f3b452..817f8f3 100644
--- a/onionbalance/instance.py
+++ b/onionbalance/instance.py
@@ -4,7 +4,6 @@ import time
import stem.control
-from onionbalance import descriptor
from onionbalance import log
from onionbalance import config
@@ -62,7 +61,14 @@ class Instance(object):
"""
logger.debug("Trying to fetch a descriptor for instance %s.onion.",
self.onion_address)
- return descriptor.fetch_descriptor(self.controller, self.onion_address)
+ try:
+ self.controller.get_hidden_service_descriptor(self.onion_address,
+ await_result=True)
+ except stem.DescriptorUnavailable:
+ # Could not find the descriptor on the HSDir
+ self.received = None
+ logger.warning("No descriptor received for instance %s.onion, "
+ "the instance may be offline.", self.onion_address)
def update_descriptor(self, parsed_descriptor):
"""
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionbalance.git
More information about the Pkg-privacy-commits
mailing list