From f03425e6aeb95fe25253ed541565378c78b6eea1 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Fri, 6 May 2022 12:11:42 +0200 Subject: #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. --- src/client.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- cgit v1.2.3-18-g5258