def test_connectingCancelledError(self):
     """
     L{error.ConnectingCancelledError} has an C{address} attribute.
     """
     address = object()
     e = error.ConnectingCancelledError(address)
     self.assertIs(e.address, address)
示例#2
0
    def _canceller(self, deferred):
        """
        The outgoing connection attempt was cancelled.  Fail that L{Deferred}
        with an L{error.ConnectingCancelledError}.

        @param deferred: The L{Deferred <defer.Deferred>} that was cancelled;
            should be the same as C{self._onConnection}.
        @type deferred: L{Deferred <defer.Deferred>}

        @note: This relies on startedConnecting having been called, so it may
            seem as though there's a race condition where C{_connector} may not
            have been set.  However, using public APIs, this condition is
            impossible to catch, because a connection API
            (C{connectTCP}/C{SSL}/C{UNIX}) is always invoked before a
            L{_WrappingFactory}'s L{Deferred <defer.Deferred>} is returned to
            C{connect()}'s caller.

        @return: C{None}
        """
        deferred.errback(
            error.ConnectingCancelledError(self._connector.getDestination()))
        self._connector.stopConnecting()
示例#3
0
 def _canceller(deferred):
     connector.stopConnecting()
     deferred.errback(
         error.ConnectingCancelledError(connector.getDestination()))