예제 #1
0
        public override bool Initialize()
        {
            System.Threading.Thread.Sleep(1500);

            if (false == base.Initialize())
            {
                return(false);
            }

            if (false == RedisMultiplexer.Instance.Start(eRedis.Token, rdToken()))
            {
                return(false);
            }

            if (false == RedisMultiplexer.Instance.Start(eRedis.Game, rdGame()))
            {
                return(false);
            }

            //if (false == RedisMultiplexer.Instance.Start(eRedis.Log, dbLog()))
            //    return false;

            m_messageExecuter.Start(new MessageDispatcher(this));
            m_separator.Start(this);



            List <Connector> listConnector = new List <Connector>();

            m_atchCenter = new CenterServerAttacher(this);
            ChatServerAttacher chatSvr = new ChatServerAttacher(this);

            //m_chatSvr = new ChatServerAttacher(this);
            listConnector.Add(m_atchCenter);
            listConnector.Add(chatSvr);

            ChatSessionManager.Instance.SetAttacher(chatSvr, m_config);

            // managerSAEA
            m_managerSAEA.Initialize(m_config);

            // for client
            m_netServiceForClient = new NetService(this,
                                                   new ClientSessionHandler(m_managerSAEA, OnAddClientSession, OnRemoveClientSession),
                                                   new NetListenable(m_config.m_listnerClient));

            // for attacher
            m_managerSessionForServer = new ServerSessionManager();
            m_netServiceForAttach     = new NetService(this,
                                                       new ServerSessionHandler(m_managerSAEA, OnAddServerSession, OnRemoveServerSession, OnCheckingServer),
                                                       new NetAttachable(listConnector));

            m_netServiceForClient.Initialize(OnHandleMessage);
            m_netServiceForAttach.Initialize(OnHandleMessage);

            // attaching
            m_atchCenter.OnAttach(m_config.m_nSequence, m_config.m_center, m_config.m_listnerClient);
            //m_atchCenter.OnAttach(m_config.m_nSequence, m_config.m_center, m_config.m_listnerClient);
            return(true);
        }
예제 #2
0
 public void SetAttacher(ChatServerAttacher ath, ServerConfig config)
 {
     m_chatSvr = ath;
     m_config  = config;
     State     = eState.eState_Stop;
 }