Esempio n. 1
0
        private void OnTransportDisconnected(object sender, ActorTransportSessionDisconnectedEventArgs e)
        {
            SessionItem item = null;

            if (_sessions.TryRemove(e.SessionKey, out item))
            {
                CloseSession(item.Session);

                _log.DebugFormat("Disconnected with remote [{0}], SessionKey[{1}].", item.RemoteActor, e.SessionKey);
            }
        }
Esempio n. 2
0
        private void OnDisconnected(object sender, ActorTransportSessionDisconnectedEventArgs e)
        {
            ActorChannelSession session = null;

            if (_sessions.TryRemove(e.SessionKey, out session))
            {
                session.Handshaked   -= OnSessionHandshaked;
                session.DataReceived -= OnSessionDataReceived;
                session.Close();
            }

            ActorIdentity remoteActor = null;

            if (_remoteActors.TryRemove(e.SessionKey, out remoteActor))
            {
                _actorKeys.Remove(remoteActor.GetKey());
                _log.InfoFormat("Disconnected with remote [{0}], SessionKey[{1}].", remoteActor, e.SessionKey);

                if (Disconnected != null)
                {
                    Disconnected(this, new ActorDisconnectedEventArgs(e.SessionKey, remoteActor));
                }
            }
        }