コード例 #1
0
ファイル: Server.cs プロジェクト: archie/radical
        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
ファイル: Client.cs プロジェクト: archie/radical
        public void InitClient()
        {
            // Communication Layer
            m_sendReceiveMiddleLayer = new SendReceiveMiddleLayer();
            if (m_isStressTestClient)
            {
                m_perfectPointToPointSend = new PerfectPointToPointSend (UserName);
            }
            else
            {
                m_perfectPointToPointSend = new PerfectPointToPointSend();
            }

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

            DebugInfo ("Started communication services");

            // Services
            //m_groupMulticast = new GroupMulticast ();
            m_calendarService = new CalendarServiceClient ();
            m_calendarService.SetClient (this);
            DebugInfo ("Started calendar service");

            m_lookupService = new LookupServiceClient ();
            m_lookupService.SetClient (this);
            m_sendReceiveMiddleLayer.SetLookupCallback (m_lookupService.Lookup);
            m_sendReceiveMiddleLayer.SetRotateMasterCallback (m_lookupService.RotateMaster);
            DebugInfo ("Started lookup service");

            m_sequenceNumberService = new SequenceNumberServiceClient ();
            m_sequenceNumberService.SetClient (this);
            DebugInfo ("Started numbering service");

            m_connectionServiceClient = new ConnectionServiceClient ();
            m_connectionServiceClient.SetClient (this);
            DebugInfo ("Started connection service");

            if (m_isPuppetControlled) {
                DebugInfo ("Client may be controlled by Puppet Master");
                m_puppetSendReceiveMiddleLayer = new SendReceiveMiddleLayer ();
                m_puppetPerfectPointToPointSend = new PerfectPointToPointSend (true);
                m_puppetPerfectPointToPointSend.Start (m_puppetSendReceiveMiddleLayer, ClientPort+2000);
                m_puppetSendReceiveMiddleLayer.SetPointToPointInterface (m_puppetPerfectPointToPointSend);
                m_puppetSendReceiveMiddleLayer.SetLookupCallback (m_lookupService.Lookup);

                m_puppetService = new PuppetClientService ();
                m_puppetService.SetClient (this);
                m_puppetService.RegisterAsPuppet ();

                // Automatically connect when spawned
                Connect ();

                m_puppetService.SendInfoMsgToPuppetMaster ("Ready to rock \\o/");

                DebugInfo ("Started puppet service");
            }
        }
コード例 #3
0
 public void Init(SendReceiveMiddleLayer demuxer)
 {
     if (demuxer != null)
         m_demuxer = demuxer;
 }
コード例 #4
0
        /**
         * Start a remote listening interface on a specific port
         * Servers: use unique ports
         * Clients: may use same port (unless run on same machine)
         */
        public bool Start(SendReceiveMiddleLayer demuxer, int port)
        {
            if (demuxer == null)
            {
                DebugFatal ("Received null demuxer");
            }

            // Default is active
            Paused = false;

            m_channelProperties["port"] = port.ToString ();

            string useDummyRecipient = ConfigReader.GetConfigurationValue ("dummyrecipient");
            if (useDummyRecipient != null && useDummyRecipient.Equals ("true"))
            {
                m_dummy = new DummyPointToPointSend ();
                m_dummy.Init (demuxer);
            }
            // create sending interfaces
            m_pointToPoint = new PointToPointInterface ();
            m_pointToPoint.Init (demuxer);

            // register tcp channel and connect p2p interface
            m_channel = new TcpChannel (m_channelProperties, null, null);
            ChannelServices.RegisterChannel (m_channel, false);
            m_marshalRef = RemotingServices.Marshal (m_pointToPoint, CHANNEL_NAME, typeof(PointToPointInterface));

            return true;
        }
コード例 #5
0
ファイル: PuppetMaster.cs プロジェクト: archie/radical
        public void InitPuppetMaster()
        {
            // Communication Layer
            m_sendReceiveMiddleLayer = new SendReceiveMiddleLayer ();
            m_perfectPointToPointSend = new PerfectPointToPointSend ();

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

            // Services Layer
            m_puppetMasterService = new PuppetMasterService();
            m_puppetMasterService.SetPuppetMaster (this);

            m_lookupService = new LookupServicePuppet ();
            m_lookupService.SetPuppetMaster (this);
            m_sendReceiveMiddleLayer.SetLookupCallback (m_lookupService.Lookup);

            m_connectionService = new ConnectionServicePuppet();
            m_connectionService.SetPuppetMaster (this);

            DebugInfo ("Started puppet master on {0}", PuppetPort);
            //m_connectionService.Connect ();
            DebugInfo ("Puppet master registered with servers");
        }