dilate/connector: trap the right errors

If we had multiple potential connections, the act of cancelling the losing
ones was putting an error into log.err(), which flunked the tests. This
happened to appear on windows because the appveyor environment has different
interfaces than travis hosts.
This commit is contained in:
Brian Warner 2019-05-06 01:15:27 -04:00
parent 2d079e12e6
commit 34a190a6da

View File

@ -6,10 +6,11 @@ from attr.validators import instance_of, provides, optional
from automat import MethodicalMachine
from zope.interface import implementer
from twisted.internet.task import deferLater
from twisted.internet.defer import DeferredList
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
from twisted.python import log
from .. import ipaddrs # TODO: move into _dilation/
from .._interfaces import IDilationConnector, IDilationManager
@ -308,6 +309,8 @@ class Connector(object):
desc = describe_hint_obj(h, is_relay, self._tor)
d = deferLater(self._reactor, delay,
self._connect, ep, desc, is_relay)
d.addErrback(lambda f: f.trap(ConnectingCancelledError,
CancelledError))
d.addErrback(log.err)
self._pending_connectors.add(d)