mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-10 19:31:57 +00:00
Better error messages when the ZeroTier service can't be contacted
Fixes #681
This commit is contained in:
parent
f9b07c63db
commit
1bec8ddce4
25
one.cpp
25
one.cpp
@ -308,6 +308,11 @@ static int cli(int argc,char **argv)
|
|||||||
} else if ((command == "info")||(command == "status")) {
|
} else if ((command == "info")||(command == "status")) {
|
||||||
const unsigned int scode = Http::GET(1024 * 1024 * 16,60000,(const struct sockaddr *)&addr,"/status",requestHeaders,responseHeaders,responseBody);
|
const unsigned int scode = Http::GET(1024 * 1024 * 16,60000,(const struct sockaddr *)&addr,"/status",requestHeaders,responseHeaders,responseBody);
|
||||||
|
|
||||||
|
if (scode == 0) {
|
||||||
|
printf("Error connecting to the ZeroTier service: %s\n\nPlease check that the service is running and that TCP port 9993 can be contacted via 127.0.0.1." ZT_EOL_S, responseBody.c_str());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
nlohmann::json j;
|
nlohmann::json j;
|
||||||
try {
|
try {
|
||||||
j = OSUtils::jsonParse(responseBody);
|
j = OSUtils::jsonParse(responseBody);
|
||||||
@ -338,6 +343,11 @@ static int cli(int argc,char **argv)
|
|||||||
} else if (command == "listpeers") {
|
} else if (command == "listpeers") {
|
||||||
const unsigned int scode = Http::GET(1024 * 1024 * 16,60000,(const struct sockaddr *)&addr,"/peer",requestHeaders,responseHeaders,responseBody);
|
const unsigned int scode = Http::GET(1024 * 1024 * 16,60000,(const struct sockaddr *)&addr,"/peer",requestHeaders,responseHeaders,responseBody);
|
||||||
|
|
||||||
|
if (scode == 0) {
|
||||||
|
printf("Error connecting to the ZeroTier service: %s\n\nPlease check that the service is running and that TCP port 9993 can be contacted via 127.0.0.1." ZT_EOL_S, responseBody.c_str());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
nlohmann::json j;
|
nlohmann::json j;
|
||||||
try {
|
try {
|
||||||
j = OSUtils::jsonParse(responseBody);
|
j = OSUtils::jsonParse(responseBody);
|
||||||
@ -400,6 +410,11 @@ static int cli(int argc,char **argv)
|
|||||||
} else if (command == "listnetworks") {
|
} else if (command == "listnetworks") {
|
||||||
const unsigned int scode = Http::GET(1024 * 1024 * 16,60000,(const struct sockaddr *)&addr,"/network",requestHeaders,responseHeaders,responseBody);
|
const unsigned int scode = Http::GET(1024 * 1024 * 16,60000,(const struct sockaddr *)&addr,"/network",requestHeaders,responseHeaders,responseBody);
|
||||||
|
|
||||||
|
if (scode == 0) {
|
||||||
|
printf("Error connecting to the ZeroTier service: %s\n\nPlease check that the service is running and that TCP port 9993 can be contacted via 127.0.0.1." ZT_EOL_S, responseBody.c_str());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
nlohmann::json j;
|
nlohmann::json j;
|
||||||
try {
|
try {
|
||||||
j = OSUtils::jsonParse(responseBody);
|
j = OSUtils::jsonParse(responseBody);
|
||||||
@ -504,6 +519,11 @@ static int cli(int argc,char **argv)
|
|||||||
} else if (command == "listmoons") {
|
} else if (command == "listmoons") {
|
||||||
const unsigned int scode = Http::GET(1024 * 1024 * 16,60000,(const struct sockaddr *)&addr,"/moon",requestHeaders,responseHeaders,responseBody);
|
const unsigned int scode = Http::GET(1024 * 1024 * 16,60000,(const struct sockaddr *)&addr,"/moon",requestHeaders,responseHeaders,responseBody);
|
||||||
|
|
||||||
|
if (scode == 0) {
|
||||||
|
printf("Error connecting to the ZeroTier service: %s\n\nPlease check that the service is running and that TCP port 9993 can be contacted via 127.0.0.1." ZT_EOL_S, responseBody.c_str());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
nlohmann::json j;
|
nlohmann::json j;
|
||||||
try {
|
try {
|
||||||
j = OSUtils::jsonParse(responseBody);
|
j = OSUtils::jsonParse(responseBody);
|
||||||
@ -619,6 +639,11 @@ static int cli(int argc,char **argv)
|
|||||||
requestHeaders["Content-Length"] = cl;
|
requestHeaders["Content-Length"] = cl;
|
||||||
const unsigned int scode = Http::GET(1024 * 1024 * 16,60000,(const struct sockaddr *)&addr,"/network",requestHeaders,responseHeaders,responseBody);
|
const unsigned int scode = Http::GET(1024 * 1024 * 16,60000,(const struct sockaddr *)&addr,"/network",requestHeaders,responseHeaders,responseBody);
|
||||||
|
|
||||||
|
if (scode == 0) {
|
||||||
|
printf("Error connecting to the ZeroTier service: %s\n\nPlease check that the service is running and that TCP port 9993 can be contacted via 127.0.0.1." ZT_EOL_S, responseBody.c_str());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
nlohmann::json j;
|
nlohmann::json j;
|
||||||
try {
|
try {
|
||||||
j = OSUtils::jsonParse(responseBody);
|
j = OSUtils::jsonParse(responseBody);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user