mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02: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
1 changed files with 17 additions and 10 deletions
|
@ -230,16 +230,23 @@ namespace WinUI
|
||||||
request.Method = "POST";
|
request.Method = "POST";
|
||||||
request.ContentType = "applicaiton/json";
|
request.ContentType = "applicaiton/json";
|
||||||
request.Timeout = 10000;
|
request.Timeout = 10000;
|
||||||
|
try
|
||||||
using (var streamWriter = new StreamWriter(((HttpWebRequest)request).GetRequestStream()))
|
{
|
||||||
{
|
using (var streamWriter = new StreamWriter(((HttpWebRequest)request).GetRequestStream()))
|
||||||
string json = "{\"allowManaged\":" + (allowManaged ? "true" : "false") + "," +
|
{
|
||||||
"\"allowGlobal\":" + (allowGlobal ? "true" : "false") + "," +
|
string json = "{\"allowManaged\":" + (allowManaged ? "true" : "false") + "," +
|
||||||
"\"allowDefault\":" + (allowDefault ? "true" : "false") + "}";
|
"\"allowGlobal\":" + (allowGlobal ? "true" : "false") + "," +
|
||||||
streamWriter.Write(json);
|
"\"allowDefault\":" + (allowDefault ? "true" : "false") + "}";
|
||||||
streamWriter.Flush();
|
streamWriter.Write(json);
|
||||||
streamWriter.Close();
|
streamWriter.Flush();
|
||||||
}
|
streamWriter.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (System.Net.WebException)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error Joining Network: Cannot connect to ZeroTier service.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue