Beispiel #1
0
        public void JoinServer(SimulationServer master)
        {
            var id = _newServer++;
            var server = new SimulationServer(id);
            _servers.Add(server);

            server.Add(this);
        }
Beispiel #2
0
        public static SimulationModel SetupFreshScenario()
        {
            var model = new SimulationModel();
            var peers = new int[NUM_SERVERS];

            model._servers = new List<SimulationServer>(NUM_SERVERS);
            var master = new SimulationServer(1, null);
            model._servers.Add(master);
            master.Restart(model);

            model.JoinServer(master);
            //for (var i = 0; i < NUM_SERVERS; i++)
            //    model._servers.Add(new SimulationServer(i + 1, GetPeers(i + 1, NUM_SERVERS)));

            //for (var i = 0; i < NUM_SERVERS; i++)
            //    model._servers[i].Restart(model);

            return model;
        }
Beispiel #3
0
 public void AddServer(SimulationServer server)
 {
     _servers.Add(server);
 }