summaryrefslogtreecommitdiffstats
path: root/src/client.c
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2021-05-04 15:42:45 +0000
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-05-04 18:13:35 +0200
commit40d4279b316e9d8b6636dd518cddec65b78c05aa (patch)
treed10d4bdd529870835bc85f64d3309eef79cd98c6 /src/client.c
parenta7cce8d442a2c83562483ff3e649c95e6e732ea9 (diff)
#995 Add link speed parsing to client probe response
If a probe response contains speedinformation, parse and store it inside the client struct. Speed is interpreted as an unsigned integer representing Mbit/s.
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/client.c b/src/client.c
index fcf3cbf..c21c373 100644
--- a/src/client.c
+++ b/src/client.c
@@ -28,6 +28,7 @@ static int og_resp_probe(struct og_client *cli, json_t *data)
{
const char *status = NULL;
const char *key;
+ uint32_t speed;
json_t *value;
int err = 0;
@@ -39,6 +40,11 @@ static int og_resp_probe(struct og_client *cli, json_t *data)
err = og_json_parse_string(value, &status);
if (err < 0)
return err;
+ } else if (!strcmp(key, "speed")) {
+ err = og_json_parse_uint(value, &speed);
+ if (err < 0)
+ return err;
+ cli->speed = speed;
} else {
return -1;
}