summaryrefslogtreecommitdiffstats
path: root/admin/Sources
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2020-05-13 15:44:28 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-06-02 12:32:36 +0200
commit3b6c2d83ef751145d5c387c537797dd9e4adb8af (patch)
treed5408149d07ce307bd56e731f56f763d5d1cf1ed /admin/Sources
parent23dc851cb210eaa0e5618c86c35a269b30a7df95 (diff)
#942 Fix immediate procedures
New versions of ogAdmServer handle pending commands in a different way. Instant procedures uses the old way, now unsupported, so we need to adapt instant procedures. This commit adapts instant procedures to work with the new pending commands implementation.
Diffstat (limited to 'admin/Sources')
-rw-r--r--admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c6
-rw-r--r--admin/Sources/Services/ogAdmServer/sources/schedule.c6
-rw-r--r--admin/Sources/Services/ogAdmServer/sources/schedule.h1
3 files changed, 7 insertions, 6 deletions
diff --git a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c
index 85d19685..75379311 100644
--- a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c
+++ b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c
@@ -3702,6 +3702,7 @@ void og_schedule_run(unsigned int task_id, unsigned int schedule_id,
case OG_SCHEDULE_TASK:
og_dbi_queue_task(dbi, task_id, schedule_id);
break;
+ case OG_SCHEDULE_PROCEDURE:
case OG_SCHEDULE_COMMAND:
og_dbi_queue_command(dbi, task_id, schedule_id);
break;
@@ -3834,6 +3835,9 @@ static int og_dbi_schedule_create(struct og_dbi *dbi,
case OG_SCHEDULE_TASK:
type = 3;
break;
+ case OG_SCHEDULE_PROCEDURE:
+ type = 2;
+ break;
case OG_SCHEDULE_COMMAND:
session = atoi(params->task_id);
type = 1;
@@ -4030,6 +4034,8 @@ static int og_task_schedule_create(struct og_msg_params *params)
if (!strcmp(params->type, "task"))
type = OG_SCHEDULE_TASK;
+ else if (!strcmp(params->type, "procedure"))
+ type = OG_SCHEDULE_PROCEDURE;
else if (!strcmp(params->type, "command"))
type = OG_SCHEDULE_COMMAND;
else
diff --git a/admin/Sources/Services/ogAdmServer/sources/schedule.c b/admin/Sources/Services/ogAdmServer/sources/schedule.c
index 6f886d31..64d10d9a 100644
--- a/admin/Sources/Services/ogAdmServer/sources/schedule.c
+++ b/admin/Sources/Services/ogAdmServer/sources/schedule.c
@@ -14,13 +14,7 @@ static LIST_HEAD(schedule_list);
static void og_schedule_add(struct og_schedule *new)
{
struct og_schedule *schedule, *next;
- time_t now;
- now = time(NULL);
- if (new->seconds < now) {
- free(new);
- return;
- }
list_for_each_entry_safe(schedule, next, &schedule_list, list) {
if (new->seconds < schedule->seconds) {
list_add_tail(&new->list, &schedule->list);
diff --git a/admin/Sources/Services/ogAdmServer/sources/schedule.h b/admin/Sources/Services/ogAdmServer/sources/schedule.h
index c6657fb7..8e0ab8a1 100644
--- a/admin/Sources/Services/ogAdmServer/sources/schedule.h
+++ b/admin/Sources/Services/ogAdmServer/sources/schedule.h
@@ -21,6 +21,7 @@ struct og_schedule_time {
enum og_schedule_type {
OG_SCHEDULE_TASK,
+ OG_SCHEDULE_PROCEDURE,
OG_SCHEDULE_COMMAND,
};