Skip to content

Commit 4b2f692

Browse files
committed
Removed infinite agent possiblity & made run-chain-jobs the standard
1 parent 39b88ee commit 4b2f692

3 files changed

Lines changed: 1 addition & 67 deletions

File tree

agent.c

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -479,65 +479,6 @@ bool release_platform(void)
479479
return bResult;
480480
} /* release_platform */
481481

482-
#if defined(__INFINITE_AGENT__)
483-
/* */
484-
/* @fn _loop */
485-
/* Runs the infinite loop agent (OFF by default) */
486-
/* @param - none */
487-
/* @return - none */
488-
/* */
489-
static void main_loop(void)
490-
{
491-
time_t now = 0;
492-
/**************************************************************************/
493-
/* 1. Prepare for the first time through the while loop; force immediate */
494-
/* session generation. */
495-
/**************************************************************************/
496-
SessionData.UnreachableCount = 0;
497-
SessionData.Interval = 30;
498-
SessionData.NextExecution = time(NULL);
499-
int firstPass = 1;
500-
501-
/**************************************************************************/
502-
/* The main loop */
503-
/**************************************************************************/
504-
while (true) {
505-
log_verbose("%s::%s(%d) : Waking up to look for work", LOG_INF);
506-
now = time(NULL);
507-
508-
if ((SessionData.NextExecution <= now) || (1 == firstPass)) {
509-
if (0 == strcmp(SessionData.Token, "")) {
510-
log_verbose("%s::%s(%d) : Need a session", LOG_INF);
511-
register_session(&SessionData, &JobList, AGENT_VERSION);
512-
} else {
513-
log_verbose("%s::%s(%d) : Need to heartbeat", LOG_INF);
514-
heartbeat_session(&SessionData, &JobList, AGENT_VERSION);
515-
write_log_file();
516-
}
517-
firstPass = 0;
518-
}
519-
520-
/* Get current time again to deal with immediate jobs */
521-
now = time(NULL);
522-
523-
SessionJob_t *job;
524-
while (NULL != (job = get_runnable_job(&JobList, now))) {
525-
int status = run_job(job);
526-
if (1 == status) {
527-
strcpy(SessionData.Token, "");
528-
clear_job_schedules(&JobList);
529-
register_session(&SessionData, &JobList, AGENT_VERSION);
530-
} else {
531-
schedule_job(&JobList, job, now);
532-
}
533-
}
534-
535-
sleep(JOB_CHECK_SECONDS);
536-
}
537-
538-
return;
539-
} /* main_loop */
540-
#else
541482
/* */
542483
/* Runs a single loop agent (ON by default) */
543484
/* @param - none */
@@ -571,7 +512,6 @@ static void main_loop(void)
571512

572513
return;
573514
} /* main_loop */
574-
#endif
575515

576516
/* */
577517
/* Main program entry point. This controls all flow. */

makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ CFLAGS += -Wno-ignored-qualifiers
2525

2626
DEBUG_FLAGS = -g0 -O0
2727
DEFINES =
28-
#DEFINES += -D__RUN_CHAIN_JOBS__
29-
#DEFINES += -D__INFINITE_AGENT__
28+
DEFINES += -D__RUN_CHAIN_JOBS__
3029

3130
WOLFLIBS = -I ./ -I/usr/local/include/wolfssl -I/usr/local/include/curl \
3231
-L/usr/local/lib -L/usr/local/include/wolfssl/wolfcrypt \

session.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ typedef struct {
3333
int register_session(SessionInfo_t* session,
3434
ScheduledJob_t** pJobList, uint64_t agentVersion);
3535

36-
#if defined(__INFINITE_AGENT__)
37-
int heartbeat_session(SessionInfo_t* session,
38-
ScheduledJob_t** pJobList, uint64_t agentVersion);
39-
#endif
40-
4136
#endif /* CSS_SESSION_H */
4237
/******************************************************************************/
4338
/******************************* END OF FILE **********************************/

0 commit comments

Comments
 (0)