ignore ConnectionRefusedError too

This commit is contained in:
Brian Warner 2019-08-11 21:57:40 -07:00
parent 2e2120f327
commit 854f0d6e01

View File

@ -10,7 +10,7 @@ from twisted.internet.defer import DeferredList, CancelledError
from twisted.internet.endpoints import serverFromString from twisted.internet.endpoints import serverFromString
from twisted.internet.protocol import ClientFactory, ServerFactory from twisted.internet.protocol import ClientFactory, ServerFactory
from twisted.internet.address import HostnameAddress, IPv4Address, IPv6Address 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 twisted.python import log
from .. import ipaddrs # TODO: move into _dilation/ from .. import ipaddrs # TODO: move into _dilation/
from .._interfaces import IDilationConnector, IDilationManager from .._interfaces import IDilationConnector, IDilationManager
@ -312,7 +312,9 @@ class Connector(object):
d = deferLater(self._reactor, delay, d = deferLater(self._reactor, delay,
self._connect, ep, desc, is_relay) self._connect, ep, desc, is_relay)
d.addErrback(lambda f: f.trap(ConnectingCancelledError, d.addErrback(lambda f: f.trap(ConnectingCancelledError,
CancelledError)) ConnectionRefusedError,
CancelledError,
))
# TODO: HostnameEndpoint.connect catches CancelledError and replaces # TODO: HostnameEndpoint.connect catches CancelledError and replaces
# it with DNSLookupError. Remove this workaround when # it with DNSLookupError. Remove this workaround when
# https://twistedmatrix.com/trac/ticket/9696 is fixed. # https://twistedmatrix.com/trac/ticket/9696 is fixed.