From 854f0d6e011c0a692678fc8d6a1e7a4dc56e3a94 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sun, 11 Aug 2019 21:57:40 -0700 Subject: [PATCH] ignore ConnectionRefusedError too --- src/wormhole/_dilation/connector.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wormhole/_dilation/connector.py b/src/wormhole/_dilation/connector.py index b469376..b421022 100644 --- a/src/wormhole/_dilation/connector.py +++ b/src/wormhole/_dilation/connector.py @@ -10,7 +10,7 @@ from twisted.internet.defer import DeferredList, CancelledError from twisted.internet.endpoints import serverFromString from twisted.internet.protocol import ClientFactory, ServerFactory from twisted.internet.address import HostnameAddress, IPv4Address, IPv6Address -from twisted.internet.error import ConnectingCancelledError, DNSLookupError +from twisted.internet.error import ConnectingCancelledError, ConnectionRefusedError, DNSLookupError from twisted.python import log from .. import ipaddrs # TODO: move into _dilation/ from .._interfaces import IDilationConnector, IDilationManager @@ -312,7 +312,9 @@ class Connector(object): d = deferLater(self._reactor, delay, self._connect, ep, desc, is_relay) d.addErrback(lambda f: f.trap(ConnectingCancelledError, - CancelledError)) + ConnectionRefusedError, + CancelledError, + )) # TODO: HostnameEndpoint.connect catches CancelledError and replaces # it with DNSLookupError. Remove this workaround when # https://twistedmatrix.com/trac/ticket/9696 is fixed.