Exemple #1
0
        private void Crash(string processname)
        {
            Console.WriteLine("[DEBUG] Crashing {0}", processname);

            foreach (var remoteUrl in pcs.Keys.ToArray())
            {
                PCSRemotingAbstract remote = pcs[remoteUrl];
                AsyncCallCrash(remote.Crash, processname);
            }
        }
Exemple #2
0
        private void Status()
        {
            Console.WriteLine("[DEBUG] Status");
            Console.WriteLine("[DEBUG] PCS: {0}", pcs.Keys.Count);

            foreach (var remoteUrl in pcs.Keys.ToArray())
            {
                PCSRemotingAbstract remote = pcs[remoteUrl];
                AsyncCallStatus(remote.Status);
            }
        }
Exemple #3
0
        private void CreateServer(string server_id, string URL, int min_delay, int max_delay)
        {
            Console.WriteLine("[DEBUG] Creating server [id={0}, URL={1}, min_delay={2}, max_delay={3}]",
                              server_id, URL, min_delay, max_delay);
            string addr = AddrFromURL(URL);

            if (pcs.ContainsKey(addr))
            {
                PCSRemotingAbstract  p          = pcs[addr];
                IEnumerable <string> serverUrls = processes.Values.ToList();
                AsyncCallServer(p.Server, server_id, URL, min_delay, max_delay, serverUrls);

                ConnectToProcess(server_id, URL);
            }

            else
            {
                throw new PCSNotFoundException(addr);
            }
        }
Exemple #4
0
        private void CreateClient(string client_id, string URL, string script_file)
        {
            Console.WriteLine("[DEBUG] Creating client [id={0}, URL={1}, script_file={2}]",
                              client_id, URL, script_file);
            string addr = AddrFromURL(URL);

            if (pcs.ContainsKey(addr))
            {
                PCSRemotingAbstract p      = pcs[addr];
                string[]            script = File.ReadAllLines(
                    @PROJECT_PATH + CLIENT_SCRIPTS_REL_PATH + script_file);

                IEnumerable <string> serverUrls = processes.Values.ToList();
                AsyncCallClient(p.Client, client_id, URL, script, serverUrls);
            }

            else
            {
                throw new PCSNotFoundException(addr);
            }
        }
Exemple #5
0
        public Controller(string[] addrs)
        {
            pcs       = new Dictionary <string, PCSRemotingAbstract>();
            processes = new Dictionary <string, string>();

            channel = new TcpChannel();
            ChannelServices.RegisterChannel(channel, false);

            foreach (string addr in addrs)
            {
                string URL = "tcp://{0}:{1}/PCS";

                PCSRemotingAbstract obj = (PCSRemotingAbstract)Activator.GetObject(
                    typeof(PCSRemotingAbstract),
                    string.Format(URL, addr, PCS_PORT)
                    );

                pcs.Add(addr, obj);
            }

            timer = new Dictionary <string, Stopwatch>();
        }