Ejemplo n.º 1
0
        /// <summary>
        /// Start the router with the current RouterContext settings.
        /// </summary>
        public static void Start()
        {
            lock ( StartedLock )
            {
                if (Started)
                {
                    return;
                }

                try
                {
                    var rci = RouterContext.Inst;
                    NetDb.Start();

                    Logging.Log("I: " + RouterContext.Inst.MyRouterInfo.ToString());
                    Logging.Log("Published: " + RouterContext.Inst.Published.ToString());

                    Logging.Log("Connecting...");
                    TransportProvider.Start();
                    TunnelProvider.Start();

                    ClientMgr        = new ClientTunnelProvider(TunnelProvider.Inst);
                    ExplorationMgr   = new ExplorationTunnelProvider(TunnelProvider.Inst);
                    TransitTunnelMgr = new TransitTunnelProvider(TunnelProvider.Inst);

                    Worker = new Thread(Run)
                    {
                        Name         = "Router",
                        IsBackground = true
                    };
                    Worker.Start();

                    NetDb.Inst.IdentHashLookup.LeaseSetReceived += IdentHashLookup_LeaseSetReceived;
                    NetDb.Inst.IdentHashLookup.LookupFailure    += IdentHashLookup_LookupFailure;

                    Started = true;
                }
                catch (Exception ex)
                {
                    Logging.Log(ex);
                }
            }
        }
Ejemplo n.º 2
0
        public static void Start()
        {
            if (Started)
            {
                return;
            }

            var rci = RouterContext.Inst;

            NetDb.Start();

            Logging.Log("I: " + RouterContext.Inst.MyRouterInfo.ToString());
            Logging.Log("Published: " + RouterContext.Inst.Published.ToString());

            Logging.Log("Connecting...");
            TransportProvider.Start();
            TunnelProvider.Start();

            Started = true;
        }