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

Fix exception when an out-of-date descriptor is received #64

Merged
merged 2 commits into from
Apr 28, 2017
Merged
Show file tree
Hide file tree
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
13 changes: 11 additions & 2 deletions onionbalance/eventhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ def new_status(status_event):
if status_event.status_type == stem.StatusType.GENERAL:
if status_event.action == "CONSENSUS_ARRIVED":
# Update the local view of the consensus in OnionBalance
consensus.refresh_consensus()
try:
consensus.refresh_consensus()
except Exception:
logger.exception("An unexpected exception occured in the "
"when processing the consensus update "
"callback.")

@staticmethod
def new_desc(desc_event):
Expand Down Expand Up @@ -59,7 +64,11 @@ def new_desc_content(desc_content_event):
return None

# Send content to callback function which will process the descriptor
descriptor.descriptor_received(descriptor_text)
try:
descriptor.descriptor_received(descriptor_text)
except Exception:
logger.exception("An unexpected exception occured in the "
"new descriptor callback.")

return None

Expand Down
2 changes: 1 addition & 1 deletion onionbalance/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def update_descriptor(self, parsed_descriptor):
self.onion_address,
parsed_descriptor.published,
self.timestamp)
return
return False
else:
self.timestamp = parsed_descriptor.published

Expand Down