diff options
author | Grant Limberg <grant.limberg@zerotier.com> | 2017-05-08 13:27:54 -0700 |
---|---|---|
committer | Grant Limberg <grant.limberg@zerotier.com> | 2017-05-08 13:27:54 -0700 |
commit | 8c30b2b9f5d5c744c176de8b7cd803cb083db1f1 (patch) | |
tree | ff5f3d9d563f803be09fa3b9daf89b784b81aae7 /windows | |
parent | b9c1407013eba0f26f311ab97937048eaa0ce9df (diff) | |
download | infinitytier-8c30b2b9f5d5c744c176de8b7cd803cb083db1f1.tar.gz infinitytier-8c30b2b9f5d5c744c176de8b7cd803cb083db1f1.zip |
Fixed falling out of the network monitor thread if the ZeroTier service isn't running on Windows
Diffstat (limited to 'windows')
-rw-r--r-- | windows/WinUI/APIHandler.cs | 15 | ||||
-rw-r--r-- | windows/WinUI/NetworkMonitor.cs | 5 |
2 files changed, 13 insertions, 7 deletions
diff --git a/windows/WinUI/APIHandler.cs b/windows/WinUI/APIHandler.cs index 419a11cd..1b1ca1d7 100644 --- a/windows/WinUI/APIHandler.cs +++ b/windows/WinUI/APIHandler.cs @@ -188,7 +188,8 @@ namespace WinUI } catch (System.Net.WebException e) { - if (((HttpWebResponse)e.Response).StatusCode == HttpStatusCode.Unauthorized) + HttpWebResponse res = (HttpWebResponse)e.Response; + if (res != null && res.StatusCode == HttpStatusCode.Unauthorized) { APIHandler.initHandler(true); } @@ -251,7 +252,8 @@ namespace WinUI } catch (System.Net.WebException e) { - if (((HttpWebResponse)e.Response).StatusCode == HttpStatusCode.Unauthorized) + HttpWebResponse res = (HttpWebResponse)e.Response; + if (res != null && res.StatusCode == HttpStatusCode.Unauthorized) { APIHandler.initHandler(true); } @@ -310,7 +312,8 @@ namespace WinUI } catch (System.Net.WebException e) { - if (((HttpWebResponse)e.Response).StatusCode == HttpStatusCode.Unauthorized) + HttpWebResponse res = (HttpWebResponse)e.Response; + if (res != null && res.StatusCode == HttpStatusCode.Unauthorized) { APIHandler.initHandler(true); } @@ -348,7 +351,8 @@ namespace WinUI } catch (System.Net.WebException e) { - if (((HttpWebResponse)e.Response).StatusCode == HttpStatusCode.Unauthorized) + HttpWebResponse res = (HttpWebResponse)e.Response; + if (res != null && res.StatusCode == HttpStatusCode.Unauthorized) { APIHandler.initHandler(true); } @@ -405,7 +409,8 @@ namespace WinUI } catch (System.Net.WebException e) { - if (((HttpWebResponse)e.Response).StatusCode == HttpStatusCode.Unauthorized) + HttpWebResponse res = (HttpWebResponse)e.Response; + if (res != null && res.StatusCode == HttpStatusCode.Unauthorized) { APIHandler.initHandler(true); } diff --git a/windows/WinUI/NetworkMonitor.cs b/windows/WinUI/NetworkMonitor.cs index c276079d..ce722e45 100644 --- a/windows/WinUI/NetworkMonitor.cs +++ b/windows/WinUI/NetworkMonitor.cs @@ -152,10 +152,11 @@ namespace WinUI Thread.Sleep(2000); } } - catch + catch (Exception e) { - Console.WriteLine("Monitor Thread Ended"); + Console.WriteLine("Monitor Thread Exception: " + "\n" + e.StackTrace); } + Console.WriteLine("Monitor Thread Ended"); } public void SubscribeStatusUpdates(StatusCallback cb) |