summaryrefslogtreecommitdiff
path: root/one.cpp
diff options
context:
space:
mode:
authorGrant Limberg <glimberg@gmail.com>2015-07-28 19:18:33 -0700
committerGrant Limberg <glimberg@gmail.com>2015-07-28 19:18:33 -0700
commit508d31513a0848236258542930cf577d95afda99 (patch)
tree453b31d874e6ec0dee3105191142efc8a326a30d /one.cpp
parentbc0954381ccdca065987512a45d5dd6ace6cca9d (diff)
parent7578b5629849f6c286c353dce713b0816b1cc4a9 (diff)
downloadinfinitytier-508d31513a0848236258542930cf577d95afda99.tar.gz
infinitytier-508d31513a0848236258542930cf577d95afda99.zip
Merge branch 'adamierymenko-dev' into android-jni
Diffstat (limited to 'one.cpp')
-rw-r--r--one.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/one.cpp b/one.cpp
index c4970ab8..d6345919 100644
--- a/one.cpp
+++ b/one.cpp
@@ -256,7 +256,23 @@ static int cli(int argc,char **argv)
requestHeaders["X-ZT1-Auth"] = authToken;
- if ((command == "info")||(command == "status")) {
+ if ((command.length() > 0)&&(command[0] == '/')) {
+ unsigned int scode = Http::GET(
+ 1024 * 1024 * 16,
+ 60000,
+ (const struct sockaddr *)&addr,
+ command.c_str(),
+ requestHeaders,
+ responseHeaders,
+ responseBody);
+ if (scode == 200) {
+ printf("%s",cliFixJsonCRs(responseBody).c_str());
+ return 0;
+ } else {
+ printf("%u %s %s"ZT_EOL_S,scode,command.c_str(),responseBody.c_str());
+ return 1;
+ }
+ } else if ((command == "info")||(command == "status")) {
unsigned int scode = Http::GET(
1024 * 1024 * 16,
60000,
@@ -363,7 +379,7 @@ static int cli(int argc,char **argv)
else if ((!strcmp(jpath->u.object.values[kk].name,"active"))&&(jpath->u.object.values[kk].value->type == json_boolean))
active = (jpath->u.object.values[kk].value->u.boolean != 0);
}
- if (paddr) {
+ if ((paddr)&&((active)||(fixed))) {
int64_t now = (int64_t)OSUtils::now();
if (lastSend > 0)
lastSend = now - lastSend;