#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.
master
Javier Sánchez Parra 2022-05-06 12:11:42 +02:00
parent f2d83cef7d
commit f03425e6ae
1 changed files with 6 additions and 0 deletions

View File

@ -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;