Fixed problem with Uninstaller and Shutdown handling of Diagnostic service.
This commit is contained in:
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.3.2.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.2.0")]
|
||||
[assembly: AssemblyVersion("1.3.3.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.3.0")]
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace TimberWinR.Diagnostics
|
||||
private CancellationToken CancelToken { get; set; }
|
||||
public int Port { get; set; }
|
||||
public Manager Manager { get; set; }
|
||||
|
||||
|
||||
private HttpListener web;
|
||||
|
||||
public Diagnostics(Manager manager, CancellationToken cancelToken, int port = 5141)
|
||||
@@ -29,7 +29,7 @@ namespace TimberWinR.Diagnostics
|
||||
CancelToken = cancelToken;
|
||||
Manager = manager;
|
||||
|
||||
LogManager.GetCurrentClassLogger().Info("Diagnostic(v4/v6) on Port {0} Ready", Port);
|
||||
LogManager.GetCurrentClassLogger().Info("Diagnostic(v4/v6) on Port {0} Ready", Port);
|
||||
|
||||
var hl = new Thread(new ParameterizedThreadStart(HttpListen));
|
||||
hl.Start(null);
|
||||
@@ -42,11 +42,13 @@ namespace TimberWinR.Diagnostics
|
||||
}
|
||||
|
||||
private void DiagnosticCallback(IAsyncResult result)
|
||||
{
|
||||
{
|
||||
if (web == null)
|
||||
return;
|
||||
|
||||
var context = web.EndGetContext(result);
|
||||
var response = context.Response;
|
||||
|
||||
|
||||
JObject json = new JObject(
|
||||
new JProperty("timberwinr",
|
||||
new JObject(
|
||||
@@ -80,16 +82,20 @@ namespace TimberWinR.Diagnostics
|
||||
private void HttpListen(object o)
|
||||
{
|
||||
web = new HttpListener();
|
||||
web.Prefixes.Add(string.Format("http://*:{0}/", Port));
|
||||
web.Start();
|
||||
|
||||
while (web.IsListening)
|
||||
try
|
||||
{
|
||||
processRequest();
|
||||
web.Prefixes.Add(string.Format("http://*:{0}/", Port));
|
||||
web.Start();
|
||||
|
||||
while (web != null && web.IsListening)
|
||||
{
|
||||
processRequest();
|
||||
}
|
||||
}
|
||||
|
||||
web.Stop();
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.GetCurrentClassLogger().Error("Diagnostic Listener Error: {0}", ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void ListenForClients(object olistener)
|
||||
@@ -168,7 +174,20 @@ namespace TimberWinR.Diagnostics
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if (web != null && web.IsListening)
|
||||
{
|
||||
LogManager.GetCurrentClassLogger().Info("Shutting down diagnostics listener");
|
||||
web.Close();
|
||||
web = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.GetCurrentClassLogger().Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -91,6 +91,8 @@ namespace TimberWinR
|
||||
|
||||
LogManager.GlobalThreshold = LogLevel.FromString(logLevel);
|
||||
|
||||
LogManager.GetCurrentClassLogger()
|
||||
.Info("TimberWinR Version {0}", GetAssemblyByName("TimberWinR.ServiceHost").GetName().Version.ToString());
|
||||
|
||||
// Is it a directory?
|
||||
if (Directory.Exists(jsonConfigFile))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<Product Id="86CA5678-4687-4352-99EB-783CDB7C8D82" Name="TimberWinR" Language="1033" Version="$(var.VersionNumber)" Manufacturer="Vistaprint" UpgradeCode="5c2b6a95-34d5-4131-8fb0-5c97214df942">
|
||||
<Product Id="*" Name="TimberWinR" Language="1033" Version="$(var.VersionNumber)" Manufacturer="Vistaprint" UpgradeCode="5c2b6a95-34d5-4131-8fb0-5c97214df942">
|
||||
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
|
||||
<Property Id="CONFIGFILE">default.json</Property>
|
||||
<Property Id="LOGDIR">c:\logs</Property>
|
||||
@@ -17,7 +17,7 @@
|
||||
<Property Id="REINSTALLMODE" Value="dmus" />
|
||||
|
||||
|
||||
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
|
||||
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
|
||||
<MediaTemplate EmbedCab="yes" />
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user