Show / Hide Table of Contents

Class ConnectionManager

Holds the callers waiting for the connection to come up, and releases them when it does.

Inheritance
object
ConnectionManager
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 Source

AwaitConnection()

Waits until the connection is up, or until it is given up on.

Declaration
public Task AwaitConnection()
Returns
Type Description
Task
| Edit this page View Source

RejectAllAwaiting(Exception)

Fails everyone waiting with error.

Declaration
public void RejectAllAwaiting(Exception error)
Parameters
Type Name Description
Exception error
| Edit this page View Source

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>.

| Edit this page View Source

ResolveAllAwaiting()

Releases everyone waiting: the connection is up.

Declaration
public void ResolveAllAwaiting()
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX