Ejemplo n.º 1
0
 public PingPongSession(BcpSession session)
     : base(session)
 {
 }
Ejemplo n.º 2
0
 public PingPongClient(BcpSession session)
     : base(session)
 {
 }
Ejemplo n.º 3
0
 internal override sealed void Close(BcpSession.Connection connection)
 {
 }
Ejemplo n.º 4
0
 internal override sealed void Busy(BcpSession.Connection connection)
 {
 }
Ejemplo n.º 5
0
 internal override sealed void Close(BcpSession.Connection closeConnection)
 {
     var newCloseConnection = (BcpClient.Connection)closeConnection;
     var connectionSize = connections.Count;
     if (newCloseConnection.busyTimer != null)
     {
         newCloseConnection.busyTimer.Change(Timeout.Infinite, Timeout.Infinite);
         newCloseConnection.busyTimer.Dispose();
         newCloseConnection.busyTimer = null;
     }
     var isConnectionAllClosed = true;
     foreach (var connection in connections.Values)
     {
         if (!(connection == closeConnection || connection.stream == null))
         {
             isConnectionAllClosed = false;
             break;
         }
     }
     if (isConnectionAllClosed && connectionSize < Bcp.MaxConnectionsPerSession)
     {
         StartReconnectTimer();
     }
     if (connectionSize >= Bcp.MaxConnectionsPerSession && isConnectionAllClosed)
     {
         InternalInterrupt();
     }
 }
Ejemplo n.º 6
0
 internal override sealed void Idle(BcpSession.Connection idleConnection)
 {
     var newIdleConnection = (BcpClient.Connection)idleConnection;
     if (newIdleConnection.busyTimer != null)
     {
         newIdleConnection.busyTimer.Change(Timeout.Infinite, Timeout.Infinite);
         newIdleConnection.busyTimer.Dispose();
         newIdleConnection.busyTimer = null;
     }
     newIdleConnection.connectionState = Bcp.ConnectionState.ConnectionIdle;
     CheckFinishConnection();
 }
Ejemplo n.º 7
0
 internal override sealed void Busy(BcpSession.Connection busyConnection)
 {
     var newBusyConnection = (BcpClient.Connection)busyConnection;
     if (reconnectTimer != null)
     {
         reconnectTimer.Change(Timeout.Infinite, Timeout.Infinite);
         reconnectTimer.Dispose();
         reconnectTimer = null;
     }
     newBusyConnection.connectionState = Bcp.ConnectionState.ConnectionBusy;
     var oldBusyTimer = newBusyConnection.busyTimer;
     if (oldBusyTimer == null)
     {
         var newBusyTimer = new Timer(BusyEvent, busyConnection, Bcp.BusyTimeoutMilliseconds, Bcp.BusyTimeoutMilliseconds);
         newBusyConnection.busyTimer = newBusyTimer;
         bool isExistIdleConnection = false;
         foreach (var connection in connections.Values)
         {
             var newConnection = (BcpClient.Connection)connection;
             if (newConnection.stream != null && newConnection.connectionState == Bcp.ConnectionState.ConnectionIdle)
             {
                 isExistIdleConnection = true;
                 break;
             }
         }
         if (!(connections.Count > 1 && isExistIdleConnection))
         {
             if (idleTimer != null)
             {
                 idleTimer.Change(Timeout.Infinite, Timeout.Infinite);
                 idleTimer.Dispose();
                 idleTimer = null;
             }
         }
     }
 }