Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.

Fix bug where instance descriptors were thrown away after first match #49

Merged
merged 1 commit into from
Feb 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions onionbalance/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,19 +255,21 @@ def descriptor_received(descriptor_content):
descriptor_onion_address = util.calc_onion_address(permanent_key)

# Find the HS instance for this descriptor
known_descriptor = False
for service in config.services:
for instance in service.instances:
if instance.onion_address == descriptor_onion_address:
# Update the descriptor and exit
# Update the descriptor
instance.update_descriptor(parsed_descriptor)
return None

# No matching service instance was found for the descriptor
logger.debug("Received a descriptor for an unknown service:\n%s",
descriptor_content.decode('utf-8'))
logger.warning("Received a descriptor with address %s.onion that "
"did not match any configured service instances.",
descriptor_onion_address)
known_descriptor = True

if not known_descriptor:
# No matching service instance was found for the descriptor
logger.debug("Received a descriptor for an unknown service:\n%s",
descriptor_content.decode('utf-8'))
logger.warning("Received a descriptor with address %s.onion that "
"did not match any configured service instances.",
descriptor_onion_address)

return None

Expand Down