Beispiel #1
0
 internal bool TransitConnectionState(IConnectionState newState, IConnectionState oldState)
 {
     if (Interlocked.CompareExchange <IConnectionState>(ref this.connectionState, newState, oldState) == oldState)
     {
         if (log.IsDebugEnabled)
         {
             log.DebugFormat("Peer {0} changed state from {1} to {2}", new object[] { this.ConnectionId, oldState.GetType().Name, newState.GetType().Name });
         }
         return(true);
     }
     if (log.IsDebugEnabled)
     {
         log.DebugFormat("Peer {0} did not change state from {1} to {2}", new object[] { this.ConnectionId, oldState.GetType().Name, newState.GetType().Name });
     }
     return(false);
 }