summaryrefslogtreecommitdiffstats
path: root/src/rest.c
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2021-04-29 11:03:40 +0000
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-04-29 13:11:34 +0200
commit927d42bdf8d84501e2a0011e8d12dbe635ecefdd (patch)
tree73b41f5ca82a4dfcc54005268a4074ba37f35e77 /src/rest.c
parent1f13855e412bba26064672b02dff78deecb795ab (diff)
#1043 don't create wol entries when client is connected
Avoids multiple entries of a same client like {"clients": [{"addr": "192.168.2.230", "state": "WOL_SENT"}, {"addr": "192.168.2.230", "state": "OPG"}] These can arise when ogserver processes a WoL request for an already connected client. When processing the WoL request, search for the target address in the clients list, if found we avoid creating the wol entry.
Diffstat (limited to 'src/rest.c')
-rw-r--r--src/rest.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rest.c b/src/rest.c
index 9823b0f..337ee40 100644
--- a/src/rest.c
+++ b/src/rest.c
@@ -571,6 +571,9 @@ static int og_cmd_wol(json_t *element, struct og_msg_params *params)
return 0;
for (i = 0; i < params->ips_array_len; i++) {
+ if (og_client_find(params->ips_array[i]))
+ continue;
+
if (inet_aton(params->ips_array[i], &addr) < 0)
return -1;