Class ConnectionManager
Holds the callers waiting for the connection to come up, and releases them when it does.
Inheritance
Namespace: Xrpl.Client
Assembly: Xrpl.dll
Syntax
public class ConnectionManager
Remarks
The connection notifies this from its socket, reconnect and caller threads, while consumers
register from theirs: client.connection.connectionManager is reachable from outside
the library. The list is therefore shared state and is guarded as such - it was not, and a
registration landing inside a notification threw
System.InvalidOperationException ("Collection was modified") or, worse, was dropped
by the reassignment that followed and never resumed.
Waiters are released outside the lock and resume asynchronously. Both matter for the same
reason: ResolveAllAwaiting() is called from inside the connection's own critical
path, before the OnConnected handler, and a waiter resuming there would run consumer
code in the middle of a connection being assembled.
Methods
| Edit this page View SourceAwaitConnection()
Waits until the connection is up, or until it is given up on.
Declaration
public Task AwaitConnection()
Returns
| Type | Description |
|---|---|
| Task |
RejectAllAwaiting(Exception)
Fails everyone waiting with error.
Declaration
public void RejectAllAwaiting(Exception error)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | error |
RejectAllAwaitingWithCancellation()
Cancels everyone waiting, for a connection that was closed on purpose.
Declaration
public void RejectAllAwaitingWithCancellation()
Remarks
TrySetCanceled rather than an System.OperationCanceledException handed to
TrySetException: the second produces a faulted task, and the rule that turns a
cancellation into a cancelled task belongs to the async method builder rather than to
System.Threading.Tasks.TaskCompletionSource<TResult>.
ResolveAllAwaiting()
Releases everyone waiting: the connection is up.
Declaration
public void ResolveAllAwaiting()