mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-18 10:46:33 +00:00
Don't crash when attempting to join a network while the zerotier service isn't running
This commit is contained in:
parent
6eb2e3ffa9
commit
c8e66a2b45
@ -230,16 +230,23 @@ namespace WinUI
|
||||
request.Method = "POST";
|
||||
request.ContentType = "applicaiton/json";
|
||||
request.Timeout = 10000;
|
||||
|
||||
using (var streamWriter = new StreamWriter(((HttpWebRequest)request).GetRequestStream()))
|
||||
{
|
||||
string json = "{\"allowManaged\":" + (allowManaged ? "true" : "false") + "," +
|
||||
"\"allowGlobal\":" + (allowGlobal ? "true" : "false") + "," +
|
||||
"\"allowDefault\":" + (allowDefault ? "true" : "false") + "}";
|
||||
streamWriter.Write(json);
|
||||
streamWriter.Flush();
|
||||
streamWriter.Close();
|
||||
}
|
||||
try
|
||||
{
|
||||
using (var streamWriter = new StreamWriter(((HttpWebRequest)request).GetRequestStream()))
|
||||
{
|
||||
string json = "{\"allowManaged\":" + (allowManaged ? "true" : "false") + "," +
|
||||
"\"allowGlobal\":" + (allowGlobal ? "true" : "false") + "," +
|
||||
"\"allowDefault\":" + (allowDefault ? "true" : "false") + "}";
|
||||
streamWriter.Write(json);
|
||||
streamWriter.Flush();
|
||||
streamWriter.Close();
|
||||
}
|
||||
}
|
||||
catch (System.Net.WebException)
|
||||
{
|
||||
MessageBox.Show("Error Joining Network: Cannot connect to ZeroTier service.");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user