summaryrefslogtreecommitdiffstats
path: root/src/core.c
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2024-09-17 17:21:14 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-09-17 17:46:07 +0200
commitad31c3832d08fa1aca7bb473141cd5265e6f670d (patch)
treee82220091b7cee1de96202dd9753bd71f5b7cd81 /src/core.c
parent32b9a53f577e960b7f6120342d67f2c98277f2c1 (diff)
rest: remove scheduler code
Put ogserver into diet, remove this feature, including pending command queue.
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c30
1 files changed, 1 insertions, 29 deletions
diff --git a/src/core.c b/src/core.c
index 5ac7802..270bd9c 100644
--- a/src/core.c
+++ b/src/core.c
@@ -15,7 +15,6 @@
#include "wol.h"
#include "client.h"
#include "json.h"
-#include "schedule.h"
#include <syslog.h>
#include <sys/ioctl.h>
#include <ifaddrs.h>
@@ -207,30 +206,6 @@ static void og_agent_reset_state(struct og_client *cli)
#define OG_AGENT_CMD_TIMEOUT 900
-static void og_agent_deliver_pending_cmd(struct og_client *cli)
-{
- struct timeval now, elapsed;
- const struct og_cmd *cmd;
-
- cmd = og_cmd_find(inet_ntoa(cli->addr.sin_addr));
- if (!cmd)
- return;
-
- gettimeofday(&now, NULL);
- timersub(&now, &cmd->tv, &elapsed);
- if (elapsed.tv_sec >= OG_AGENT_CMD_TIMEOUT) {
- og_dbi_update_action(cmd->id, false);
- og_cmd_free(cmd);
- return;
- }
-
- json_incref(cmd->json);
- og_send_request(cmd->method, cmd->type, &cmd->params, cmd->json);
- cli->last_cmd_id = cmd->id;
-
- og_cmd_free(cmd);
-}
-
static void og_agent_read_cb(struct ev_loop *loop, struct ev_io *io, int events)
{
struct og_client *cli;
@@ -270,11 +245,8 @@ static void og_agent_read_cb(struct ev_loop *loop, struct ev_io *io, int events)
/* fall through. */
case OG_AGENT_PROCESSING_RESPONSE:
ret = og_agent_state_process_response(cli);
- if (ret < 0) {
+ if (ret < 0)
goto close;
- } else if (ret == 0) {
- og_agent_deliver_pending_cmd(cli);
- }
og_agent_reset_state(cli);
break;