From 34a190a6dabc7b66ea638e9975851b3cc48d9b9b Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 6 May 2019 01:15:27 -0400 Subject: [PATCH] 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. --- src/wormhole/_dilation/connector.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wormhole/_dilation/connector.py b/src/wormhole/_dilation/connector.py index 638a827..83914e3 100644 --- a/src/wormhole/_dilation/connector.py +++ b/src/wormhole/_dilation/connector.py @@ -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)