public void Remove(descOtherServer desc)
        {
            if (null == desc)
            {
                Logger.Error("RegisteredServerManager Remove desc == null");
                return;
            }

            lock (m_lockObject)
            {
                if (false == m_dicOtherServers.ContainsKey(desc.m_eServerType))
                {
                    return;
                }

                fmOtherServer otherSvr = m_dicOtherServers[desc.m_eServerType].Find(x => x.m_desc.m_nSequence == desc.m_nSequence);
                if (null == otherSvr)
                {
                    return;
                }

                m_dicOtherServers[desc.m_eServerType].Remove(otherSvr);

                using (otherSvr)
                {
                    Logger.Debug("RegisteredServerManager Remove desc {0} {1}", otherSvr.m_desc.m_eServerType, otherSvr.m_desc.m_nSequence);
                }
            }

            if (desc.m_eServerType == eServerType.Game)
            {
                SendWolrdList();
            }
        }
예제 #2
0
        public override void Process()
        {
            fmOtherServer op = null;

            if (true == RegisteredServerManager.Instance.TryFindOpServer(out op))
            {
                if (null == op)
                {
                    return;
                }
                if (null == op.m_session)
                {
                    return;
                }
                op.m_session.RelayPacket(m_recvPacket);
            }
        }
        public void UpdateWorldState(int sequence, int playercnt)
        {
            lock (m_lockObject)
            {
                if (true == m_dicOtherServers.ContainsKey(eServerType.Game))
                {
                    fmOtherServer otherSvr = m_dicOtherServers[eServerType.Game].Find(x => x.m_desc.m_nSequence == sequence);
                    if (null != otherSvr)
                    {
                        //otherSvr.m_desc.m_eWorldState = worldState;
                        otherSvr.m_desc.m_nPlayerCount = playercnt;

                        Logger.Debug("UpdateWorldState desc {0} {1} {2}", otherSvr.m_desc.m_eServerType, otherSvr.m_desc.m_nSequence, playercnt);
                    }
                }

                Logger.Debug("RegisteredServerManager UpdateWorldState");
            }
        }
        public bool TryFindOpServer(out fmOtherServer op)
        {
            op = null;
            eServerType type = eServerType.Op;

            lock (m_lockObject)
            {
                if (false == m_dicOtherServers.ContainsKey(type))
                {
                    return(false);
                }

                op = m_dicOtherServers[type].FirstOrDefault();
                if (op == null)
                {
                    return(false);
                }
            }

            return(true);
        }