Esempio n. 1
0
        public bool TryRemove(fmWorld world)
        {
            lock (m_objLock)
            {
                m_fmWorldList.Remove(world);
            }

            return(true);
        }
Esempio n. 2
0
        public fmWorld Clone()
        {
            lock (m_objLock)
            {
                //List<fmWorld> list = new List<fmWorld>();

                if (0 < m_fmWorldList.Count)
                {
                    var orderbyList = from x in m_fmWorldList orderby x.m_nPlayer select x;

                    fmWorld world = orderbyList.ElementAt(0);

                    return(world.Clone() as fmWorld);
                }

                return(null);
            }
        }
Esempio n. 3
0
        public override void Process()
        {
            using (var recvfmProtocol = new PT_CA_Auth_Login_RQ())
            {
                // 임시 코드
                try
                {
                    recvfmProtocol.Deserialize(m_recvPacket);
                }
                catch (Exception ex)
                {
                    string str = ex.ToString();
                    using (var sendfmProtocol = new PT_CA_Auth_Login_RS())
                    {
                        sendfmProtocol.m_eErrorCode = eErrorCode.Auth_cVerError;
                        m_session.SendPacket(sendfmProtocol);
                    }
                }


                using (var sendfmProtocol = new PT_CA_Auth_Login_RS())
                {
                    // 1. 클라 버전 체크

                    if (false == m_server.CheckCver(int.Parse(recvfmProtocol.m_strCver)))
                    {
                        sendfmProtocol.m_eErrorCode = eErrorCode.Auth_cVerError;
                        m_session.SendPacket(sendfmProtocol);
                        return;
                    }

                    // 2. 서버 버전 체크
                    if (false == m_server.CheckSver(recvfmProtocol.m_strSver))
                    {
                        sendfmProtocol.m_eErrorCode = eErrorCode.Auth_sVerError;
                        m_session.SendPacket(sendfmProtocol);
                        return;
                    }


                    AuthServer authsvr   = m_server as AuthServer;
                    fmWorld    gameWolrd = authsvr.m_managerWorld.Clone();

                    if (null == gameWolrd)
                    {
                        sendfmProtocol.m_eErrorCode = eErrorCode.Auth_CheckingServer;
                        m_session.SendPacket(sendfmProtocol);
                        return;
                    }

                    // 3. 로그인
                    using (var db = new usp_Login(m_server.dbAcc()))
                    {
                        db.i_strUniqueKey = recvfmProtocol.m_strUniqueKey;
                        if (false == db.Execute())
                        {
                            sendfmProtocol.m_eErrorCode = eErrorCode.Query_Fail;
                            m_session.SendPacket(sendfmProtocol);
                            return;
                        }

                        eErrorCode err   = (eErrorCode)db.o_nResult;
                        long       accid = db.o_biAccID;
                        string     token = string.Empty;


                        if (eErrorCode.Success == err)
                        {
                            token = m_server.GetToken();
                            using (var reidsQuery = new urq_UpdateAuthToken(eRedis.Token))
                            {
                                reidsQuery.i_biAccID    = accid;
                                reidsQuery.i_gameServer = gameWolrd.m_nSequence;
                                reidsQuery.i_strToken   = token;
                                err = reidsQuery.Execute();
                            }
                        }

                        // 4. output
                        sendfmProtocol.m_eErrorCode = err;
                        sendfmProtocol.m_strToken   = token;
                        sendfmProtocol.m_strIP      = gameWolrd.m_strIP;
                        sendfmProtocol.m_nPort      = gameWolrd.m_nPort;
                        m_session.SendPacket(sendfmProtocol);
                    }
                }
            }
        }