diff --git a/onionbalance/eventhandler.py b/onionbalance/eventhandler.py index 7f919a4..182cf2d 100644 --- a/onionbalance/eventhandler.py +++ b/onionbalance/eventhandler.py @@ -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): @@ -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 diff --git a/onionbalance/instance.py b/onionbalance/instance.py index ffa7c09..e12a8a1 100644 --- a/onionbalance/instance.py +++ b/onionbalance/instance.py @@ -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