Stormancer.ConnectionRepository Class Reference

Inherits Stormancer.Networking.IConnectionManager.

Public Member Functions

 ConnectionRepository (ILogger logger)
 
async Task< IConnectionAddPendingConnection (ulong id)
 
void NewConnection (IConnection connection)
 Adds a connection to the manager More...
 
void CloseConnection (IConnection connection, string reason)
 Closes the target connection. More...
 
IConnection GetConnection (ulong id)
 Returns a connection by id. Returns null if the connection is not completed More...
 
IConnection GetConnection (string id)
 Returns a connection by id. Returns null if the connection is not completed More...
 
async Task< IConnectionGetConnection (string id, Func< string, Task< IConnection >> connectionFactory)
 Returns a connection by id, of create a new if not already created More...
 
int GetConnectionCount ()
 Returns the connection count More...
 
void CloseAllConnections (string reason)
 Close All Connections More...
 
void SetTimeout (TimeSpan timeout, CancellationToken ct)
 Set a timeout duration on all the current open connections More...
 

Member Function Documentation

◆ CloseAllConnections()

void Stormancer.ConnectionRepository.CloseAllConnections ( string  reason)

Close All Connections

Parameters
reasonThe reason of the closure.
Returns

Implements Stormancer.Networking.IConnectionManager.

◆ CloseConnection()

void Stormancer.ConnectionRepository.CloseConnection ( IConnection  connection,
string  reason 
)

Closes the target connection.

Parameters
connectionThe connection to close.
reasonThe reason of the closure.

Implements Stormancer.Networking.IConnectionManager.

◆ GetConnection() [1/3]

IConnection Stormancer.ConnectionRepository.GetConnection ( string  id)

Returns a connection by id. Returns null if the connection is not completed

Parameters
idThe connection Id
Returns

Implements Stormancer.Networking.IConnectionManager.

◆ GetConnection() [2/3]

async Task<IConnection> Stormancer.ConnectionRepository.GetConnection ( string  id,
Func< string, Task< IConnection >>  connectionFactory 
)

Returns a connection by id, of create a new if not already created

Parameters
idThe connection Id
connectionFactoryA factory to create a new connection if not existing
Returns

Implements Stormancer.Networking.IConnectionManager.

◆ GetConnection() [3/3]

IConnection Stormancer.ConnectionRepository.GetConnection ( ulong  id)

Returns a connection by id. Returns null if the connection is not completed

Parameters
idThe connection Id
Returns

Implements Stormancer.Networking.IConnectionManager.

◆ GetConnectionCount()

int Stormancer.ConnectionRepository.GetConnectionCount ( )

Returns the connection count

Returns

Implements Stormancer.Networking.IConnectionManager.

◆ NewConnection()

void Stormancer.ConnectionRepository.NewConnection ( IConnection  connection)

Adds a connection to the manager

Parameters
connectionThe connection object to add.

This method is called by the infrastructure when a new connection connects to a transport.

Implements Stormancer.Networking.IConnectionManager.

◆ SetTimeout()

void Stormancer.ConnectionRepository.SetTimeout ( TimeSpan  timeout,
CancellationToken  ct 
)

Set a timeout duration on all the current open connections

Parameters
timeoutThe timeout duration.
ct
Returns

Implements Stormancer.Networking.IConnectionManager.


The documentation for this class was generated from the following file:
  • Stormancer.Unity/ConnectionRepository.cs