Example #1
0
 public void ChannelDisconnected(IRequestResponseChannel channel, string reason)
 {
     if (this._requestListener != null)
     {
         _requestListener.ChannelDisconnected(this, reason);
     }
 }
Example #2
0
 public void ChannelDisconnected(string reason)
 {
     if (this.requestListener != null)
     {
         requestListener.ChannelDisconnected(this, reason);
     }
 }
Example #3
0
 public void Execute()
 {
     try
     {
         if (_requestListener != null)
         {
             _requestListener.ChannelDisconnected(channel, reason);
         }
     }
     catch (Exception)
     {
     }
 }
Example #4
0
            public void ChannelDisconnected(string reason)
            {
                if (_responseListener != null)
                {
                    _responseListener.ChannelDisconnected(reason);
                }

                if (_threadPool != null)
                {
                    _threadPool.ExecuteTask(new ChannelDisconnectEventTask(null, reason, _requestListener));
                }
                else
                {
                    _requestListener.ChannelDisconnected(null, reason);
                }
                //if (_requestListener != null)
                //    _requestListener.ChannelDisconnected(null, reason);
            }
Example #5
0
        public void ChannelDisconnected(IRequestResponseChannel channel, string reason)
        {
            if (_channelDisconnctedListener != null)
            {
                _channelDisconnctedListener.ChannelDisconnected(channel, reason);
            }

            if (!_autoReconnect)
            {
                return;
            }

            int  retries   = 3;
            bool connected = false;

            if (channel != null)
            {
                while (0 < retries--)
                {
                    try
                    {
                        lock (_mutex)
                        {
                            if (_channel.RetryConnect())
                            {
                                IServerAuthenticationCredential serverAuthCred = _session.Authenticate(credentials);
                                if (serverAuthCred != null && serverAuthCred.IsAuthenticated)
                                {
                                    _session.Channel.IsAuthenticated = serverAuthCred.IsAuthenticated;
                                    _session.SessionId = serverAuthCred.SessionId;
                                }
                                connected = true;

                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        if (retries == 2)
                        {
                            Thread.Sleep(30000);
                        }
                        else if (retries == 1)
                        {
                            Thread.Sleep(60000);
                        }
                    }
                }

                if (!connected)
                {
                    retries = 3;
                    TraceProvider traceProvider = EnableTracing ? new TraceProvider() : null;
                    if (_secondConfiguratioServer != null)
                    {
                        string disconnectedServer = channel.PeerAddress.ip;
                        string failOverServer     = null;

                        if (string.Compare(disconnectedServer, _firstConfiguratioServer, true) == 0)
                        {
                            failOverServer = _secondConfiguratioServer;
                        }
                        else
                        {
                            failOverServer = _firstConfiguratioServer;
                        }

                        _channel = new DualChannel(failOverServer, _port, null, SessionTypes.Management, traceProvider,
                                                   _channelFormatter);

                        while (0 < retries--)
                        {
                            try
                            {
                                if (_channel.Connect(true))
                                {
                                    _session.Channel = _channel;
                                    //
                                    //Connection re-established and needs to be authenticated
                                    IServerAuthenticationCredential serverAuthCred = _session.Authenticate(credentials);
                                    if (serverAuthCred != null && serverAuthCred.IsAuthenticated)
                                    {
                                        _session.Channel.IsAuthenticated = serverAuthCred.IsAuthenticated;
                                        _session.SessionId = serverAuthCred.SessionId;
                                    }
                                    break;
                                }
                            }
                            catch (ChannelException ex)
                            {
                                if (LoggerManager.Instance.CONDBLogger != null && LoggerManager.Instance.CONDBLogger.IsErrorEnabled)
                                {
                                    LoggerManager.Instance.CONDBLogger.Error("Error: OutProcConfigClient.ChannelDisconnected()", ex.ToString());
                                }
                            }
                        }
                    }
                }
            }
        }