/// <summary>
        /// 加密
        /// </summary>
        private void OnEncryptInfo(PacketBase packet)
        {
            gs2c.EncryptInfo msg = packet as gs2c.EncryptInfo;
            GlobalID.ENCRYPT_KEY = msg.key;

            ServerMsgSend.SendLogin(m_conn_idx, "test" + m_account_idx, "1");
        }
Пример #2
0
        /// <summary>
        /// 加密
        /// </summary>
        private void OnEncryptInfo(PacketBase packet)
        {
            gs2c.EncryptInfo msg = packet as gs2c.EncryptInfo;
            GlobalID.ENCRYPT_KEY = msg.key;

            ServerMsgSend.SendLogin(ServerConfig.net_info.user_name, ServerConfig.net_info.user_psw);
        }
Пример #3
0
        /// <summary>
        /// 加密
        /// </summary>
        private void OnClientEncrypt(long conn_idx, PacketBase packet)
        {
            if (!ClientSessionManager.Instance.HasAcceptSession(conn_idx))
            {
                return;
            }

            c2gs.EncryptInfo msg = packet as c2gs.EncryptInfo;

            //版本验证
            byte   main_version;
            byte   sub_version;
            ushort revision_version;

            GlobalID.SplitVersion(msg.version, out main_version, out sub_version, out revision_version);
            if (main_version != GlobalID.VERSION_MAIN)
            {
                ClientSessionManager.Instance.KickoutSession(conn_idx);
                return;
            }
            GlobalID.SetClientVersion(msg.version);

            //收到正常的握手协议后,才加入正式session列表
            ClientSession session = ClientSessionManager.Instance.AddSession(conn_idx);

            if (session != null)
            {
                ClientSessionManager.Instance.CleanupAcceptSession(conn_idx);
                session.session_status = eSessionStatus.CREATED;

                gs2c.EncryptInfo rep_msg = PacketPools.Get(gs2c.msg.ENCRYPT) as gs2c.EncryptInfo;
                rep_msg.key   = PacketEncrypt.Encrypt_Key;
                rep_msg.flags = 0;
                session.Send(rep_msg);
            }
            else
            {
                ClientSessionManager.Instance.KickoutSession(conn_idx);
            }
        }