Пример #1
0
 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;
 }
Пример #2
0
    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;
    }