Beispiel #1
0
            public void Start()
            {
                Router = new LeafRouter();
                Router.Start();
                Thread.Sleep(1000);

                Node = new GeoTrackerNode();
                Node.Start(Router, new GeoTrackerServerSettings(), null, null);
            }
Beispiel #2
0
        private void TestInit(string appConfig)
        {
            Config.SetConfig((RouterConfig + appConfig).Replace('&', '#'));
            router = new LeafRouter();
            router.Start();

            client = new GeoTrackerClient(router, null);

            var serverSettings = GeoTrackerServerSettings.LoadConfig("LillTek.GeoTracker.Server");

            serverSettings.IPGeocodeEnabled = false;

            server = new GeoTrackerNode();
            server.Start(router, serverSettings, null, null);
        }
Beispiel #3
0
        private void TestInit(bool enable, bool copyDatabase)
        {
            const string cfg =
                @"
MsgRouter.AppName               = Test
MsgRouter.AppDescription        = Test Description
MsgRouter.DiscoveryMode         = MULTICAST
MsgRouter.RouterEP				= physical://DETACHED/$(LillTek.DC.DefHubName)/$(Guid)
MsgRouter.CloudEP               = $(LillTek.DC.CloudEP)
MsgRouter.CloudAdapter          = ANY
MsgRouter.UdpEP					= ANY:0
MsgRouter.TcpEP					= ANY:0
MsgRouter.TcpBacklog			= 100
MsgRouter.TcpDelay				= off
MsgRouter.BkInterval			= 1s
MsgRouter.MaxIdle				= 5m
MsgRouter.EnableP2P             = yes
MsgRouter.AdvertiseTime			= 1m
MsgRouter.DefMsgTTL				= 5
MsgRouter.SharedKey             = PLAINTEXT
MsgRouter.SessionCacheTime      = 2m
MsgRouter.SessionRetries        = 3
MsgRouter.SessionTimeout        = 10s
";

            Config.SetConfig(cfg);
            router = new LeafRouter();
            router.Start();
            Thread.Sleep(1000);

            client = new GeoTrackerClient(router, null);

            var serverSettings = new GeoTrackerServerSettings()
            {
                IPGeocodeEnabled       = enable,
                IPGeocodeSourceTimeout = TimeSpan.FromMinutes(2),
            };

            if (copyDatabase)
            {
                Helper.DeleteFile(IPGeocoder.DataPath);
                File.Copy(exteralDataPath, IPGeocoder.DataPath);
            }

            server = new GeoTrackerNode();
            server.Start(router, serverSettings, null, null);
            Thread.Sleep(2000);
        }
Beispiel #4
0
        /// <summary>
        /// Starts the service, associating it with an <see cref="IServiceHost" /> instance.
        /// </summary>
        /// <param name="serviceHost">The service user interface.</param>
        /// <param name="args">Command line arguments.</param>
        public void Start(IServiceHost serviceHost, string[] args)
        {
            lock (syncLock) {
                if (router != null)
                {
                    return;     // Already started
                }
                // Global initialization

                NetTrace.Start();
                Program.Config = new Config("LillTek.GeoTracker.Service");
                Program.InstallPerfCounters();

                // Service initialization

                this.serviceHost = serviceHost;
                SysLog.LogInformation("GeoTracker Service v{0} Start", Helper.GetVersionString());

                try {
                    router = new LeafRouter();
                    router.Start();

                    node = new GeoTrackerNode();
                    node.Start(router, GeoTrackerNode.ConfigPrefix, Program.PerfCounters, null);

                    state = ServiceState.Running;
                }
                catch (Exception e) {
                    if (node != null)
                    {
                        node.Stop();
                        node = null;
                    }

                    if (router != null)
                    {
                        router.Stop();
                        router = null;
                    }

                    SysLog.LogException(e);
                    throw;
                }
            }
        }
Beispiel #5
0
        private void TestInit()
        {
            const string cfg =
                @"
MsgRouter.AppName               = Test
MsgRouter.AppDescription        = Test Description
MsgRouter.DiscoveryMode         = MULTICAST
MsgRouter.RouterEP				= physical://DETACHED/$(LillTek.DC.DefHubName)/$(Guid)
MsgRouter.CloudEP               = $(LillTek.DC.CloudEP)
MsgRouter.CloudAdapter          = ANY
MsgRouter.UdpEP					= ANY:0
MsgRouter.TcpEP					= ANY:0
MsgRouter.TcpBacklog			= 100
MsgRouter.TcpDelay				= off
MsgRouter.BkInterval			= 1s
MsgRouter.MaxIdle				= 5m
MsgRouter.EnableP2P             = yes
MsgRouter.AdvertiseTime			= 1m
MsgRouter.DefMsgTTL				= 5
MsgRouter.SharedKey             = PLAINTEXT
MsgRouter.SessionCacheTime      = 2m
MsgRouter.SessionRetries        = 3
MsgRouter.SessionTimeout        = 10s
";

            Config.SetConfig(cfg);
            router = new LeafRouter();
            router.Start();

            client = new GeoTrackerClient(router, null);

            var serverSettings = new GeoTrackerServerSettings();

            serverSettings.IPGeocodeEnabled = false;

            server = new GeoTrackerNode();
            server.Start(router, serverSettings, null, null);
        }