Пример #1
0
        public void InitServer()
        {
            // Communication Layer
            m_sendReceiveMiddleLayer = new SendReceiveMiddleLayer ();
            m_perfectPointToPointSend = new PerfectPointToPointSend ();

            m_perfectPointToPointSend.Start (m_sendReceiveMiddleLayer, ServerPort);
            m_sendReceiveMiddleLayer.SetPointToPointInterface (m_perfectPointToPointSend);

            // Services Layer
            m_userTableService = new UserTableServiceServer ();
            m_userTableService.SetServer (this);

            m_sendReceiveMiddleLayer.SetLookupCallback (m_userTableService.Lookup);

            m_sequenceNumberService = new SequenceNumberServiceServer ();
            m_sequenceNumberService.SetServer (this);

            m_replicationService = new ReplicationServiceServer ();
            m_replicationService.SetServer (this);

            // Register servers
            m_userTableService.UserConnect ("central-1", ServerList [0]);
            m_userTableService.UserConnect ("central-2", ServerList [1]);
            m_userTableService.UserConnect ("central-3", ServerList [2]);

            m_replicationService.Start ();

            if (m_isPuppetControlled)
            {
                m_puppetSendReceiveMiddleLayer = new SendReceiveMiddleLayer ();
                m_puppetPerfectPointToPointSend = new PerfectPointToPointSend (true);
                m_puppetPerfectPointToPointSend.Start (m_puppetSendReceiveMiddleLayer, ServerPort-100);
                m_puppetSendReceiveMiddleLayer.SetPointToPointInterface (m_puppetPerfectPointToPointSend);
                m_puppetSendReceiveMiddleLayer.SetLookupCallback (m_userTableService.Lookup);

                m_puppetService = new PuppetServerService ();
                m_puppetService.SetServer (this);
                m_puppetService.RegisterAsPuppet ();

                m_puppetService.SendInfoMsgToPuppetMaster ("Ready to serve");
            }

            DebugUncond ("Started. Available commands: \"exit\", \"status\"");
        }
Пример #2
0
 public bool Unpause()
 {
     bool status = m_perfectPointToPointSend.Unpause ();
     m_replicationService = new ReplicationServiceServer ();
     m_replicationService.SetServer (this);
     m_replicationService.Start ();
     return status;
 }