Exemplo n.º 1
0
        public void ConnectReturn(Session session)
        {
            Session oldSession = this.session;

            if (oldSession != null)
            {
                Acceptor.replaceOldSession(oldSession.Id);
                oldSession.IoHandler = null;
            }
            if (session != null)
            {
                this.session             = session;
                session.SessionConfig    = sessionConfig;
                session.Encoder          = encoder;
                session.Decoder          = decoder;
                session.HeartBeatPackage = heartBeatPackage;
                Acceptor.OnConnected(Acceptor, session);
                Trigger(new ConnectSuccessEvent(session));
            }
            else
            {
                Trigger(new ConnectFailEvent(this));
            }
        }