diff --git a/TimberWinR.ServiceHost/Properties/AssemblyInfo.cs b/TimberWinR.ServiceHost/Properties/AssemblyInfo.cs index 855a58f..45da4c3 100644 --- a/TimberWinR.ServiceHost/Properties/AssemblyInfo.cs +++ b/TimberWinR.ServiceHost/Properties/AssemblyInfo.cs @@ -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.15.0")] -[assembly: AssemblyFileVersion("1.3.15.0")] +[assembly: AssemblyVersion("1.3.16.0")] +[assembly: AssemblyFileVersion("1.3.16.0")] diff --git a/TimberWinR/Inputs/TcpInputListener.cs b/TimberWinR/Inputs/TcpInputListener.cs index 249b981..947f02a 100644 --- a/TimberWinR/Inputs/TcpInputListener.cs +++ b/TimberWinR/Inputs/TcpInputListener.cs @@ -105,9 +105,17 @@ namespace TimberWinR.Inputs while (reader.Read()) { if (CancelToken.IsCancellationRequested) break; - JObject json = JObject.Load(reader); - ProcessJson(json); - _receivedMessages++; + try + { + JObject json = JObject.Load(reader); + ProcessJson(json); + _receivedMessages++; + } + catch (Exception ex) + { + LogManager.GetCurrentClassLogger().Warn(ex); + } + } } } diff --git a/TimberWinR/Inputs/UdpInputListener.cs b/TimberWinR/Inputs/UdpInputListener.cs index a67b2b3..76c72b0 100644 --- a/TimberWinR/Inputs/UdpInputListener.cs +++ b/TimberWinR/Inputs/UdpInputListener.cs @@ -18,7 +18,7 @@ namespace TimberWinR.Inputs private Thread _listenThreadV4; private Thread _listenThreadV6; - + private readonly int _port; private long _receivedMessages; @@ -26,7 +26,7 @@ namespace TimberWinR.Inputs { public IPEndPoint endPoint; public UdpClient client; - } + } public override JObject ToJson() { @@ -52,10 +52,10 @@ namespace TimberWinR.Inputs _udpListener = new System.Net.Sockets.UdpClient(port); _listenThreadV4 = new Thread(new ParameterizedThreadStart(StartListener)); - _listenThreadV4.Start(new listenProfile() {endPoint = groupV4, client = _udpListener}); + _listenThreadV4.Start(new listenProfile() { endPoint = groupV4, client = _udpListener }); _listenThreadV6 = new Thread(new ParameterizedThreadStart(StartListener)); - _listenThreadV6.Start(new listenProfile() { endPoint = groupV6, client = _udpListener }); + _listenThreadV6.Start(new listenProfile() { endPoint = groupV6, client = _udpListener }); } @@ -77,10 +77,17 @@ namespace TimberWinR.Inputs while (!CancelToken.IsCancellationRequested) { byte[] bytes = profile.client.Receive(ref profile.endPoint); - var data = Encoding.ASCII.GetString(bytes, 0, bytes.Length); - JObject json = JObject.Parse(data); - ProcessJson(json); - _receivedMessages++; + try + { + var data = Encoding.ASCII.GetString(bytes, 0, bytes.Length); + JObject json = JObject.Parse(data); + ProcessJson(json); + _receivedMessages++; + } + catch (Exception ex1) + { + LogManager.GetCurrentClassLogger().Warn(ex1); + } } _udpListener.Close(); }