summaryrefslogtreecommitdiff
path: root/windows/WinUI
diff options
context:
space:
mode:
authorGrant Limberg <grant.limberg@zerotier.com>2016-11-17 14:23:04 -0800
committerGrant Limberg <grant.limberg@zerotier.com>2016-11-17 14:23:04 -0800
commitafa1b8cb2df152b0d589eee8020e756b66501194 (patch)
treea09247e1689f400c5767ee0d0ca927b44a698ee5 /windows/WinUI
parent5447c01e1f27eaab595e33a8732ab96e6058eef8 (diff)
downloadinfinitytier-afa1b8cb2df152b0d589eee8020e756b66501194.tar.gz
infinitytier-afa1b8cb2df152b0d589eee8020e756b66501194.zip
add timeouts to requests to the json api
Diffstat (limited to 'windows/WinUI')
-rw-r--r--windows/WinUI/APIHandler.cs7
1 files changed, 7 insertions, 0 deletions
diff --git a/windows/WinUI/APIHandler.cs b/windows/WinUI/APIHandler.cs
index b30e8980..53a9c117 100644
--- a/windows/WinUI/APIHandler.cs
+++ b/windows/WinUI/APIHandler.cs
@@ -187,6 +187,7 @@ namespace WinUI
request.Method = "GET";
request.ContentType = "application/json";
+ request.Timeout = 2000;
try
{
@@ -232,6 +233,7 @@ namespace WinUI
request.Method = "POST";
request.ContentType = "applicaiton/json";
+ request.Timeout = 2000;
using (var streamWriter = new StreamWriter(((HttpWebRequest)request).GetRequestStream()))
{
@@ -271,6 +273,7 @@ namespace WinUI
}
request.Method = "DELETE";
+ request.Timeout = 2000;
try
{
@@ -289,6 +292,10 @@ namespace WinUI
{
MessageBox.Show("Error Leaving Network: Cannot connect to ZeroTier service.");
}
+ catch
+ {
+ Console.WriteLine("Error leaving network: Unknown error");
+ }
}
public delegate void PeersCallback(List<ZeroTierPeer> peers);