Exemple #1
0
        private void InternalOnInternalStateChanged(object sender, ConnectionStateChange connectionStateChange)
        {
            switch (connectionStateChange.Current)
            {
            case ConnectionState.Closed:
                if (State == ChannelState.Attached || State == ChannelState.Attaching)
                {
                    SetChannelState(ChannelState.Detaching);
                }
                break;

            case ConnectionState.Suspended:
                if (State == ChannelState.Attached || State == ChannelState.Attaching)
                {
                    SetChannelState(ChannelState.Detaching, ErrorInfo.ReasonSuspended);
                }
                break;

            case ConnectionState.Failed:
                if (State != ChannelState.Detached && State != ChannelState.Initialized &&
                    State != ChannelState.Failed)
                {
                    SetChannelState(ChannelState.Failed, connectionStateChange.Reason ?? ErrorInfo.ReasonFailed);
                }
                break;
            }
        }
Exemple #2
0
 private void ConnectionStateChange(object sender, ConnectionStateChange stateChange)
 {
     foreach (var channel in Channels.Values)
     {
         try
         {
             channel.ConnectionStateChanged(stateChange);
         }
         catch (Exception e)
         {
             // TODO: Send to Sentry
             Logger.Error($"Error notifying channel '{channel.Name}' of connection stage change", e);
         }
     }
 }