/// <summary> /// Stops the service immediately, terminating any user activity. /// </summary> public void Stop() { lock (syncLock) { if (state == ServiceState.Stopped) { return; } SysLog.LogInformation("GeoTracker Service Stop"); SysLog.Flush(); base.Close(); state = ServiceState.Stopped; } if (node != null) { node.Stop(); node = null; } if (router != null) { router.Stop(); router = null; } Program.PerfCounters.Zero(); }
private void TestCleanup() { client = null; if (server != null) { server.Stop(); server = null; } if (router != null) { router.Stop(); router = null; } }
/// <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; } } }
private void TestCleanup() { client = null; if (server != null) { server.Stop(); server = null; } if (router != null) { router.Stop(); router = null; } Helper.DeleteFile(IPGeocoder.DataPath); Helper.DeleteFile(IPGeocoder.DownloadPath); Helper.DeleteFile(IPGeocoder.DecryptedPath); }