[CalendarServer-changes] [9077] CalendarServer/branches/users/glyph/ipv6-client/twext/backport/ internet/endpoints.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Apr 13 11:45:51 PDT 2012
Revision: 9077
http://trac.macosforge.org/projects/calendarserver/changeset/9077
Author: glyph at apple.com
Date: 2012-04-13 11:45:51 -0700 (Fri, 13 Apr 2012)
Log Message:
-----------
Update to the version that made it to trunk (all backports now match r34165 of Twisted trunk).
Revision Links:
--------------
http://trac.macosforge.org/projects/calendarserver/changeset/34165
Modified Paths:
--------------
CalendarServer/branches/users/glyph/ipv6-client/twext/backport/internet/endpoints.py
Modified: CalendarServer/branches/users/glyph/ipv6-client/twext/backport/internet/endpoints.py
===================================================================
--- CalendarServer/branches/users/glyph/ipv6-client/twext/backport/internet/endpoints.py 2012-04-13 18:45:45 UTC (rev 9076)
+++ CalendarServer/branches/users/glyph/ipv6-client/twext/backport/internet/endpoints.py 2012-04-13 18:45:51 UTC (rev 9077)
@@ -113,12 +113,14 @@
"""
Wrap a factory in order to wrap the protocols it builds.
- @ivar _wrappedFactory: A provider of I{IProtocolFactory} whose
- buildProtocol method will be called and whose resulting protocol
- will be wrapped.
+ @ivar _wrappedFactory: A provider of I{IProtocolFactory} whose buildProtocol
+ method will be called and whose resulting protocol will be wrapped.
@ivar _onConnection: An L{Deferred} that fires when the protocol is
connected
+
+ @ivar _connector: A L{connector <twisted.internet.interfaces.IConnector>}
+ that is managing the current or previous connection attempt.
"""
protocol = _WrappingProtocol
@@ -133,10 +135,32 @@
def startedConnecting(self, connector):
+ """
+ A connection attempt was started. Remember the connector which started
+ said attempt, for use later.
+ """
self._connector = connector
def _canceller(self, deferred):
+ """
+ The outgoing connection attempt was cancelled. Fail that L{Deferred}
+ with a 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()))
@@ -483,14 +507,9 @@
Implement L{IStreamClientEndpoint.connect} to connect via a
UNIX Socket
"""
- def _canceller(deferred):
- connector.stopConnecting()
- deferred.errback(
- error.ConnectingCancelledError(connector.getDestination()))
-
try:
wf = _WrappingFactory(protocolFactory)
- connector = self._reactor.connectUNIX(
+ self._reactor.connectUNIX(
self._path, wf,
timeout=self._timeout,
checkPID=self._checkPID)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120413/65af9f30/attachment-0001.html>
More information about the calendarserver-changes
mailing list