From afa1b8cb2df152b0d589eee8020e756b66501194 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Thu, 17 Nov 2016 14:23:04 -0800 Subject: add timeouts to requests to the json api --- windows/WinUI/APIHandler.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'windows') 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 peers); -- cgit v1.2.3