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

Commit

Permalink
Merge pull request #64 from DonnchaC/fix/62-old-descriptor-crash
Browse files Browse the repository at this point in the history
Fix exception when an out-of-date descriptor is received
  • Loading branch information
DonnchaC authored Apr 28, 2017
2 parents 78b10a9 + 349c620 commit 72657ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
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

0 comments on commit 72657ac

Please sign in to comment.