def _port_test_failure(reason): # is this one of the errors that corresponds to unreachability? if Basic.exception_is_a(reason, [CannotListenError, TimeoutError]): return False # otherwise, we do not know the state of reachability (None signals that) # and log the error if necessary unexpectedException = not Basic.exception_is_a(reason, [ConnectError]) if unexpectedException: log_ex(reason, "Unexpected failure while testing port") return None
def _port_test_failure(reason): #is this one of the errors that corresponds to unreachability? if Basic.exception_is_a(reason, [CannotListenError, TimeoutError]): return False #otherwise, we do not know the state of reachability (None signals that) #and log the error if necessary unexpectedException = not Basic.exception_is_a(reason, [ConnectError]) if unexpectedException: log_ex(reason, "Unexpected failure while testing port") return None
def error(failure): if not self.is_done(): if Basic.exception_is_a(failure, [TorCtl.TorCtlClosed, TorCtl.ErrorReply]): log_msg("Failed to create PAR client, closing", 1, "circuit") else: log_ex(failure, "Unexpected failure while starting circuit") self.on_done()
def on_failure(reason): #is this an expected failure for a single UDP reply test? if Basic.exception_is_a( reason, [CannotListenError, ConnectError, TimeoutError]): return #otherwise, log the error log_ex(reason, "Unexpected failure while testing UDP replies")
def error(failure): if not self.is_done(): if Basic.exception_is_a( failure, [TorCtl.TorCtlClosed, TorCtl.ErrorReply]): log_msg("Failed to create PAR client, closing", 1, "circuit") else: log_ex( failure, "Unexpected failure while starting circuit") self.on_done()
def on_failure(reason): # is this an expected failure for a single UDP reply test? if Basic.exception_is_a(reason, [CannotListenError, ConnectError, TimeoutError]): return # otherwise, log the error log_ex(reason, "Unexpected failure while testing UDP replies")
def udp_test_failure(reason): if Basic.exception_is_a(reason, [TimeoutError]): return False log_ex(reason, "Unexpected failure while testing UDP") return None