twisted.application.internet._ClientMachine(object)
class documentationtwisted.application.internet
View Source
(View In Hierarchy)
State machine for maintaining a single outgoing connection to an endpoint.
See Also | ClientService |
Method | __init__ | |
Method | start | Start this ClientService ,
initiating the connection retry loop. |
Method | stop | Stop trying to connect and disconnect any current connection. |
Method | whenConnected | Retrieve the currently-connected Protocol ,
or the next one to connect. |
Method | _init | The service has not been started. |
Method | _connecting | The service has started connecting. |
Method | _waiting | The service is waiting for the reconnection period before reconnecting. |
Method | _connected | The service is connected. |
Method | _disconnecting | The service is disconnecting after being asked to shutdown. |
Method | _restarting | The service is disconnecting and has been asked to restart. |
Method | _stopped | The service has been stopped and is disconnected. |
Method | _connect | Start a connection attempt. |
Method | _resetFailedAttempts | Reset the number of failed attempts. |
Method | _waitForStop | Return a deferred that will fire when the service has finished disconnecting. |
Method | _stopConnecting | Stop pending connection attempt. |
Method | _stopRetrying | Stop pending attempt to reconnect. |
Method | _disconnect | Disconnect the current connection. |
Method | _connectionMade | A connection has been made. |
Method | _notifyWaiters | Notify all pending requests for a connection that a connection has been made. |
Method | _connectionFailed | The current connection attempt failed. |
Method | _wait | Schedule a retry attempt. |
Method | _ignoreAndWait | Schedule a retry attempt, and ignore the Failure passed in. |
Method | _doWait | Undocumented |
Method | _reconnect | The wait between connection attempts is done. |
Method | _clientDisconnected | The current connection has been disconnected. |
Method | _forgetConnection | Forget the current connection. |
Method | _cancelConnectWaiters | Notify all pending requests for a connection that no more connections are expected. |
Method | _ignoreAndCancelConnectWaiters | Notify all pending requests for a connection that no more connections are expected, after ignoring the Failure passed in. |
Method | _finishStopping | Notify all deferreds waiting on the service stopping. |
Method | _ignoreAndFinishStopping | Notify all deferreds waiting on the service stopping, and ignore the Failure passed in. |
Method | _doFinishStopping | Undocumented |
Method | _currentConnection | Return the currently connected protocol. |
Method | _noConnection | Notify the caller that no connection is expected. |
Method | _awaitingConnection | Return a deferred that will fire with the next connected protocol. |
Method | _deferredSucceededWithNone | Return a deferred that has already fired with None . |
Method | _unawait | Fire all outstanding ClientService.whenConnected
Deferred s. |
Method | _deliverConnectionFailure | Deliver connection failures to any ClientService.whenConnected
Deferred s
that have met their failAfterFailures threshold. |
Parameters | log | The logger for the ClientService
instance this state machine is associated to. (type: Logger ) |
See Also | ClientService.__init__ |
The service is waiting for the reconnection period before reconnecting.
The service is disconnecting after being asked to shutdown.
The service is disconnecting and has been asked to restart.
Start this ClientService
,
initiating the connection retry loop.
Stop trying to connect and disconnect any current connection.
Returns | a Deferred
that fires when all outstanding connections are closed and all in-progress
connection attempts halted. |
Return a deferred that will fire when the service has finished disconnecting.
Returns | Deferred
that fires when the service has finished disconnecting. |
A connection has been made.
Parameters | protocol | The protocol of the connection. (type: IProtocol ) |
Notify all pending requests for a connection that a connection has been made.
Parameters | protocol | The protocol of the connection. (type: IProtocol ) |
Schedule a retry attempt, and ignore the Failure passed in.
The current connection has been disconnected.
Notify all pending requests for a connection that no more connections are expected.
Notify all pending requests for a connection that no more connections are expected, after ignoring the Failure passed in.
Notify all deferreds waiting on the service stopping.
Notify all deferreds waiting on the service stopping, and ignore the Failure passed in.
Retrieve the currently-connected Protocol
,
or the next one to connect.
Parameters | failAfterFailures | number of connection failures after which the Deferred will deliver a
Failure (None means the Deferred will only fail if/when the service is
stopped). Set this to 1 to make the very first connection failure signal
an error. Use 2 to allow one failure but signal an error if the subsequent
retry then fails. (type: int
or None) |
Returns | a Deferred that fires with a protocol produced by the factory passed to
__init__ (type: Deferred
that may:
|
Return the currently connected protocol.
Returns | Deferred
that is fired with currently connected protocol. |
Notify the caller that no connection is expected.
Returns | Deferred
that is fired with CancelledError . |
Return a deferred that will fire with the next connected protocol.
Returns | Deferred
that will fire with the next connected protocol. |
Fire all outstanding ClientService.whenConnected
Deferred
s.
Parameters | value | the value to fire the Deferred s
with. |
Deliver connection failures to any ClientService.whenConnected
Deferred
s
that have met their failAfterFailures threshold.
Parameters | f | the Failure to fire the Deferred s
with. |