Пример #1
0
 public void Close()
 {
     try
     {
         if (_keepAliveTracker != null)
         {
             _keepAliveTracker.Dispose();
         }
         if (_keepAliveTimeoutTimer != null)
         {
             _keepAliveTimeoutTimer.Dispose();
         }
     }
     finally
     {
         _remoteActor = null;
         IsHandshaked = false;
     }
 }
Пример #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    try
                    {
                        if (_keepAliveTracker != null)
                        {
                            _keepAliveTracker.Dispose();
                        }
                        if (_keepAliveTimeoutTimer != null)
                        {
                            _keepAliveTimeoutTimer.Dispose();
                        }
                    }
                    catch { }
                }

                _disposed = true;
            }
        }
Пример #3
0
        public void Close()
        {
            try
            {
                if (_keepAliveTracker != null)
                {
                    _keepAliveTracker.Dispose();
                }
                if (_keepAliveTimeoutTimer != null)
                {
                    _keepAliveTimeoutTimer.Dispose();
                }

                _connector.Connected    -= OnConnected;
                _connector.Disconnected -= OnDisconnected;
                _connector.DataReceived -= OnDataReceived;

                if (_connector.IsConnected)
                {
                    _connector.Disconnect();
                }

                if (Disconnected != null)
                {
                    Disconnected(this, new ActorDisconnectedEventArgs(this.ConnectToEndPoint.ToString(), _remoteActor));
                }

                _log.DebugFormat("Disconnected with remote [{0}], SessionKey[{1}].", _remoteActor, this.ConnectToEndPoint);
            }
            finally
            {
                _remoteActor = null;
                IsHandshaked = false;
                OnClose();
            }
        }