class _ClientMachine: (source)
Constructor: _ClientMachine(endpoint, factory, retryPolicy, clock, ...)
State machine for maintaining a single outgoing connection to an endpoint.
| See Also | |
ClientService |
| Method | __init__ |
No summary |
| Method | start |
Start this ClientService, initiating the connection retry loop. |
| Method | stop |
Stop trying to connect and disconnect any current connection. |
| Method | when |
Retrieve the currently-connected Protocol, or the next one to connect. |
| Method | _awaiting |
Return a deferred that will fire with the next connected protocol. |
| Method | _cancel |
Notify all pending requests for a connection that no more connections are expected. |
| Method | _client |
The current connection has been disconnected. |
| Method | _connect |
Start a connection attempt. |
| Method | _connected |
The service is connected. |
| Method | _connecting |
The service has started connecting. |
| Method | _connection |
The current connection attempt failed. |
| Method | _connection |
A connection has been made. |
| Method | _current |
Return the currently connected protocol. |
| Method | _deferred |
Return a deferred that has already fired with None. |
| Method | _deliver |
Deliver connection failures to any ClientService.whenConnected Deferreds that have met their failAfterFailures threshold. |
| Method | _disconnect |
Disconnect the current connection. |
| Method | _disconnecting |
The service is disconnecting after being asked to shutdown. |
| Method | _do |
Undocumented |
| Method | _do |
Undocumented |
| Method | _finish |
Notify all deferreds waiting on the service stopping. |
| Method | _forget |
Forget the current connection. |
| Method | _ignore |
Notify all pending requests for a connection that no more connections are expected, after ignoring the Failure passed in. |
| Method | _ignore |
Notify all deferreds waiting on the service stopping, and ignore the Failure passed in. |
| Method | _ignore |
Schedule a retry attempt, and ignore the Failure passed in. |
| Method | _init |
The service has not been started. |
| Method | _no |
Notify the caller that no connection is expected. |
| Method | _notify |
Notify all pending requests for a connection that a connection has been made. |
| Method | _reconnect |
The wait between connection attempts is done. |
| Method | _reset |
Reset the number of failed attempts. |
| Method | _restarting |
The service is disconnecting and has been asked to restart. |
| Method | _run |
Run any prepareConnection callback with the connected protocol, ignoring its return value but propagating any failure. |
| Method | _stop |
Stop pending connection attempt. |
| Method | _stopped |
The service has been stopped and is disconnected. |
| Method | _stop |
Stop pending attempt to reconnect. |
| Method | _unawait |
Fire all outstanding ClientService.whenConnected Deferreds. |
| Method | _wait |
Schedule a retry attempt. |
| Method | _wait |
Return a deferred that will fire when the service has finished disconnecting. |
| Method | _waiting |
The service is waiting for the reconnection period before reconnecting. |
| Class Variable | _machine |
Undocumented |
| Instance Variable | _awaiting |
notifications to make when connection succeeds, fails, or is cancelled |
| Instance Variable | _clock |
Undocumented |
| Instance Variable | _connection |
Undocumented |
| Instance Variable | _endpoint |
Undocumented |
| Instance Variable | _factory |
Undocumented |
| Instance Variable | _failed |
Undocumented |
| Instance Variable | _log |
Undocumented |
| Instance Variable | _prepare |
Undocumented |
| Instance Variable | _retry |
Undocumented |
| Instance Variable | _stop |
Undocumented |
| Instance Variable | _timeout |
Undocumented |
| Parameters | |
| endpoint | Undocumented |
| factory | Undocumented |
| retry | Undocumented |
| clock | Undocumented |
| prepare | Undocumented |
log:Logger | The logger for the ClientService instance this state machine is associated to. |
| See Also | |
ClientService.__init__ | |
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. |
Retrieve the currently-connected Protocol, or the next one to connect.
| Parameters | |
failint or None | 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. |
| Returns | |
| a Deferred that fires with a protocol produced by the factory passed to __init__ |
Return a deferred that will fire with the next connected protocol.
| Returns | |
Deferred that will fire with the next connected protocol. |
Return the currently connected protocol.
| Returns | |
Deferred that is fired with currently connected protocol. |
Return a deferred that has already fired with None.
| Returns | |
A Deferred that has already fired with None. |
Deliver connection failures to any ClientService.whenConnected Deferreds that have met their failAfterFailures threshold.
| Parameters | |
| f | the Failure to fire the Deferreds with. |
Notify all pending requests for a connection that no more connections are expected, after ignoring the Failure passed in.
Notify all pending requests for a connection that a connection has been made.
| Parameters | |
protocol:IProtocol | The protocol of the connection. |
Run any prepareConnection callback with the connected protocol, ignoring its return value but propagating any failure.
| Parameters | |
protocol:IProtocol | The protocol of the connection. |
| Returns | |
Either: | |
Fire all outstanding ClientService.whenConnected Deferreds.
| Parameters | |
| value | the value to fire the Deferreds with. |
Return a deferred that will fire when the service has finished disconnecting.
| Returns | |
Deferred that fires when the service has finished disconnecting. |