public void Register(string entryURL) { //check if other nodes exist if (entryURL != null) { Logger.LogInfo("Attaching myself to existing network at: " + entryURL); IWorker worker = (IWorker)Activator.GetObject(typeof(IWorker), entryURL); List <String> urls = worker.AddWorker(myURL, true); nextURL = urls[1]; nextNextURL = urls[2]; if (urls[0].Equals("continue")) { Logger.LogInfo("Updating existing node at: " + nextURL); worker = (IWorker)Activator.GetObject(typeof(IWorker), nextURL); worker.AddWorker(myURL, false); } Logger.LogInfo("Successfully registered on the network."); Logger.LogInfo("nextURL: " + nextURL); Logger.LogInfo("nextNextURL: " + nextNextURL); } else { Logger.LogErr("Did not provided entryURL"); } }
public void Register(string entryURL) { //check if other nodes exist Logger.LogInfo("starting network registration on node: " + entryURL); if (entryURL != null) { IWorker worker = (IWorker)Activator.GetObject(typeof(IWorker), entryURL); List <String> urls = worker.AddWorker(myURL, true); nextURL = urls[1]; nextNextURL = urls[2]; backURL = urls[3]; if (urls[0].Equals("smallUpdate")) { Logger.LogInfo("Updating existing node at: " + nextURL); worker = (IWorker)Activator.GetObject(typeof(IWorker), nextURL); worker.AddWorker(myURL, false); } if (urls[0].Equals("bigUpdate")) { string wayBackURL = urls[4]; Logger.LogInfo("Updating back node at: " + wayBackURL); worker = (IWorker)Activator.GetObject(typeof(IWorker), wayBackURL); worker.BackUpdate(myURL); Logger.LogInfo("Updating next node at: " + nextURL); worker = (IWorker)Activator.GetObject(typeof(IWorker), nextURL); worker.FrontUpdate(myURL); } PrintUpdateNetwork(); } else { Logger.LogErr("Did not provided entryURL"); } }