summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2022-05-06 12:11:42 +0200
committerJavier Sánchez Parra <jsanchez@soleta.eu>2022-05-09 12:18:56 +0200
commitf03425e6aeb95fe25253ed541565378c78b6eea1 (patch)
treebb05c0f32e3f7ee764fbcfbbafab5b248992c269
parentf2d83cef7dd221f129a63aedefcd9a74212cfc99 (diff)
#915 Add support for link speed in the refresh response
Add ogServer support for parsing and storing the link speed from ogClient's refresh response. Probe response already has client's link speed, but this API is deprecated.
-rw-r--r--src/client.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/client.c b/src/client.c
index 9796005..f4a47eb 100644
--- a/src/client.c
+++ b/src/client.c
@@ -355,6 +355,7 @@ static int og_resp_refresh(json_t *data, struct og_client *cli)
struct og_dbi *dbi;
const char *key;
unsigned int i;
+ uint32_t link;
json_t *value;
int err = 0;
bool res;
@@ -371,12 +372,17 @@ static int og_resp_refresh(json_t *data, struct og_client *cli)
err = og_json_parse_string(value, &serial_number);
} else if (!strcmp(key, "status")) {
err = og_json_parse_string(value, &status);
+ } else if (!strcmp(key, "link")) {
+ err = og_json_parse_uint(value, &link);
}
if (err < 0)
return err;
}
+ if (link)
+ cli->speed = link;
+
if (status) {
if (!strncmp(status, "LINUX", strlen("LINUX"))) {
cli->status = OG_CLIENT_STATUS_LINUX;