summaryrefslogtreecommitdiffstats
path: root/src/core.c
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2021-04-27 23:45:28 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-04-29 11:52:32 +0200
commit1f13855e412bba26064672b02dff78deecb795ab (patch)
tree7a44db095824ef03cedaa597485ca5d5c73969b6 /src/core.c
parentc05f1345e76e26eadc798425d820665b9fb8a819 (diff)
#1043 add WOL_SENT state
WOL_SENT tells that WakeOnLan was sent to computer, after 60 seconds, if computer does not boot, this state is released.
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c
index fef00ea..a346e7b 100644
--- a/src/core.c
+++ b/src/core.c
@@ -11,6 +11,7 @@
#include "utils.h"
#include "list.h"
#include "rest.h"
+#include "wol.h"
#include "client.h"
#include "json.h"
#include "schedule.h"
@@ -326,6 +327,7 @@ void og_server_accept_cb(struct ev_loop *loop, struct ev_io *io, int events)
int on = 1, idle = OG_TCP_KEEPALIVE_IDLE;
struct sockaddr_in client_addr;
socklen_t addrlen = sizeof(client_addr);
+ struct og_client_wol *cli_wol;
struct og_client *cli;
int client_sd;
@@ -343,6 +345,10 @@ void og_server_accept_cb(struct ev_loop *loop, struct ev_io *io, int events)
setsockopt(client_sd, IPPROTO_TCP, TCP_KEEPINTVL, &intl, sizeof(int));
setsockopt(client_sd, IPPROTO_TCP, TCP_KEEPCNT, &cnt, sizeof(int));
+ cli_wol = og_client_wol_find(&client_addr.sin_addr);
+ if (cli_wol)
+ og_client_wol_destroy(cli_wol);
+
cli = (struct og_client *)calloc(1, sizeof(struct og_client));
if (!cli) {
close(client_sd);