public ForwardingLayer(Machine machine) { m_transport = machine.Transport; m_topology = machine.Topology; m_flm = machine.Interface_flm; m_ReloadConfig = machine.ReloadConfig; }
public ReloadMessage create_update_req(Destination destination, TopologyPlugin.RoutingTable rt, ChordUpdateType type) { return create_reload_message(destination, ++m_ReloadConfig.TransactionID, new UpdateReqAns(rt.GetApproved(rt.Successors), rt.GetApproved(rt.Predecessors), type, m_ReloadConfig.StartTime)); }
public bool Init() { try { if (ReloadGlobals.IgnoreSSLErrors) IgnoreSSLErrors(); m_transport = new MessageTransport(); if (ReloadGlobals.TLS) m_interface_flm = new ReloadFLM(ReloadConfig); else m_interface_flm = new SimpleFLM(ReloadConfig); ReloadConfig.Statistics.SetParams(m_interface_flm); m_interface_flm.ReloadFLMEventHandler += new ReloadFLMEvent(m_transport.rfm_ReloadFLMEventHandler); ReloadConfig.State = ReloadConfig.RELOAD_State.Init; stateUpdates(ReloadConfig.RELOAD_State.Init); ReloadConfigResolve resolve = new ReloadConfigResolve(ReloadConfig); resolve.ReadConfig(); if (ReloadGlobals.TLS) resolve.EnrollmentProcedure(); else resolve.SimpleNodeIdRequest(); m_interface_flm.Init(); m_ReloadConfig.AccessController = new AccessController(m_ReloadConfig); m_topology = new TopologyPlugin(this); if (!m_topology.Init(this)) return false; m_forwarding = new ForwardingLayer(this); m_transport.Init(this); //ReloadConfig.State = ReloadConfig.RELOAD_State.Configured; //stateUpdates(ReloadConfig.RELOAD_State.Configured); BootStrapConfig(); m_ReloadConfig.StartJoining = DateTime.Now; if (m_ReloadConfig.IamClient) m_ReloadConfig.StartJoinMobile = DateTime2.Now; if (!ReloadConfig.IsBootstrap) Arbiter.Activate(ReloadConfig.DispatcherQueue, new IterativeTask<List<BootstrapServer>>(m_BootstrapServerList, m_transport.PreJoinProdecure)); // m_worker_thread.ReportProgress(100); --joscha InitUsageManager(); ReloadConfig.State = ReloadConfig.RELOAD_State.Configured; stateUpdates(ReloadConfig.RELOAD_State.Configured); /* reporting service */ Arbiter.Activate(ReloadConfig.DispatcherQueue, new IterativeTask(Reporting)); /* chord-ping-interval */ Arbiter.Activate(ReloadConfig.DispatcherQueue, new IterativeTask(Maintenance)); /* chord-update-interval */ Arbiter.Activate(ReloadConfig.DispatcherQueue, new IterativeTask(UpdateCycle)); Arbiter.Activate(ReloadConfig.DispatcherQueue, new IterativeTask(CommandCheckTask)); } catch (Exception ex) { ReloadConfig.Logger(ReloadGlobals.TRACEFLAGS.T_ERROR, "Init: " + ex.Message); } return true; }
public void Init(Machine machine) { m_machine = machine; m_topology = machine.Topology; m_forwarding = machine.Forwarding; m_flm = machine.Interface_flm; m_DispatcherQueue = machine.ReloadConfig.DispatcherQueue; m_ReloadConfig = machine.ReloadConfig; m_statistics = m_ReloadConfig.Statistics; }
void PrintNodeInfo(TopologyPlugin topology, bool extended) { if (topology == null) return; TimeSpan deltaT = DateTime.Now - ReloadConfig.Statistics.StartTime; topology.routing_table.PrintNeigborState(); ReloadConfig.Logger(ReloadGlobals.TRACEFLAGS.T_INFO, String.Format(@" Statistics Time up: {0} Rx - Total bytes: {1}, current Bits per Second: {2} Tx - Total bytes: {3}, current Bits per Second: {4}", deltaT.ToString(), ReloadConfig.Statistics.TotalBytesRx, (ReloadConfig.Statistics.RxThroughputPerSec * 1000 * 8).ToString("f0", CultureInfo.InvariantCulture), ReloadConfig.Statistics.TotalBytesTx, (ReloadConfig.Statistics.TxThroughputPerSec * 1000 * 8).ToString("f0", CultureInfo.InvariantCulture))); if (extended) { string fingerTableString = ""; /* * fingerTableString = topology.routing_table.Finger.ToString(); fingerTableString = @" Finger table: (Start: Finger)"; for (int i = 0; i < fingerTable.Length; i++) { if (fingerTable[i] != null) fingerTableString += string.Format("\r\n{0}: {1}", topology.Id + ReloadGlobals.BigIntPow2Array[i], fingerTable[i]); else fingerTableString += string.Format("\r\n<empty>"); } */ fingerTableString += @" Successor cache:"; for (int i = topology.routing_table.GetSuccessorCount(false) - 1; i >= 0; i--) { Node node = topology.routing_table.GetNode(topology.routing_table.GetSuccessorId(i)); fingerTableString += string.Format("\r\n S{0}: {1} {2}", i, node.ToString(), topology.routing_table.GetStatusShortLetter(node.Id)); } fingerTableString += @" Me :"; fingerTableString += string.Format("\r\n ME: {0}", topology.LocalNode.ToString()); fingerTableString += @" Predecessor cache:"; for (int i = 0; i < topology.routing_table.GetPredecessorCount(false); i++) { Node node = topology.routing_table.GetNode(topology.routing_table.GetPredecessorId(i)); fingerTableString += string.Format("\r\n P{0}: {1} {2}", i, node.ToString(), topology.routing_table.GetStatusShortLetter(node.Id)); } Console.WriteLine(fingerTableString); } }