class documentation

class _WrappingFactory(ClientFactory): (source)

View In Hierarchy

Wrap a factory in order to wrap the protocols it builds.
Method __init__
Method build​Protocol Proxy buildProtocol to our self._wrappedFactory or errback the self._onConnection Deferred if the wrapped factory raises an exception or returns None.
Method client​Connection​Failed Errback the self._onConnection Deferred when the client connection fails.
Method do​Start Start notifications are passed straight through to the wrapped factory.
Method do​Stop Stop notifications are passed straight through to the wrapped factory.
Method started​Connecting A connection attempt was started. Remember the connector which started said attempt, for use later.
Method _canceller The outgoing connection attempt was cancelled. Fail that Deferred with an error.ConnectingCancelledError.
Instance Variable _connector A connector that is managing the current or previous connection attempt.
Instance Variable _on​Connection A Deferred that fires when the protocol is connected
Instance Variable _wrapped​Factory A provider of IProtocolFactory whose buildProtocol method will be called and whose resulting protocol will be wrapped.

Inherited from ClientFactory:

Method client​Connection​Lost Called when an established connection is lost.

Inherited from Factory (via ClientFactory):

Class Method for​Protocol Create a factory for the given protocol.
Method log​Prefix Describe this factory for log messages.
Method start​Factory This will be called before I begin listening on a Port or Connector.
Method stop​Factory This will be called before I stop listening on all Ports/Connectors.
Class Variable noisy Undocumented
Class Variable protocol Undocumented
Instance Variable num​Ports Undocumented
def __init__(self, wrappedFactory): (source)
Parameters
wrapped​FactoryA provider of IProtocolFactory whose buildProtocol method will be called and whose resulting protocol will be wrapped.
def buildProtocol(self, addr): (source)
Proxy buildProtocol to our self._wrappedFactory or errback the self._onConnection Deferred if the wrapped factory raises an exception or returns None.
Returns
An instance of _WrappingProtocol or None
def clientConnectionFailed(self, connector, reason): (source)
Errback the self._onConnection Deferred when the client connection fails.
def doStart(self): (source)
Start notifications are passed straight through to the wrapped factory.
def doStop(self): (source)
Stop notifications are passed straight through to the wrapped factory.
def startedConnecting(self, connector): (source)
A connection attempt was started. Remember the connector which started said attempt, for use later.
def _canceller(self, deferred): (source)
The outgoing connection attempt was cancelled. Fail that Deferred with an error.ConnectingCancelledError.
Parameters
deferred:DeferredThe Deferred that was cancelled; should be the same as self._onConnection.
Returns
None
Note
This relies on startedConnecting having been called, so it may seem as though there's a race condition where _connector may not have been set. However, using public APIs, this condition is impossible to catch, because a connection API (connectTCP/SSL/UNIX) is always invoked before a _WrappingFactory's Deferred is returned to connect()'s caller.
_connector = (source)
A connector that is managing the current or previous connection attempt.
_onConnection = (source)
A Deferred that fires when the protocol is connected
_wrappedFactory = (source)
A provider of IProtocolFactory whose buildProtocol method will be called and whose resulting protocol will be wrapped.