summaryrefslogtreecommitdiffstats
path: root/action.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-08-08 09:59:28 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-08-08 09:59:28 +0000
commite276e32d426e488f9f18f7ca156c301df3604e4f (patch)
tree2baa8374677c210ee4a6fde750a8491fd0a0fc88 /action.c
parent5cca4552674adad6dc24d1e91f41771db7c70beb (diff)
downloadrsyslog-e276e32d426e488f9f18f7ca156c301df3604e4f.tar.gz
rsyslog-e276e32d426e488f9f18f7ca156c301df3604e4f.tar.xz
rsyslog-e276e32d426e488f9f18f7ca156c301df3604e4f.zip
added config file directive $ActionResumeInterval
Diffstat (limited to 'action.c')
-rw-r--r--action.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/action.c b/action.c
index 639e5822..7d0a47d0 100644
--- a/action.c
+++ b/action.c
@@ -30,11 +30,15 @@
#include <time.h>
#include "rsyslog.h"
+#include "syslogd.h"
#include "template.h"
#include "action.h"
#include "modules.h"
+/* object static data (once for all instances) */
+static int glbliActionResumeInterval = 30;
+
/* destructs an action descriptor object
* rgerhards, 2007-08-01
*/
@@ -72,6 +76,8 @@ rsRetVal actionConstruct(action_t **ppThis)
ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
}
+ pThis->iResumeInterval = glbliActionResumeInterval;
+
finalize_it:
*ppThis = pThis;
return iRet;
@@ -91,7 +97,15 @@ static rsRetVal actionResume(action_t *pThis)
}
-#define ACTION_RESUME_INTERVAL 30 /* TODO: make this dynamic from conf file */
+/* set the global resume interval
+ */
+rsRetVal actionSetGlobalResumeInterval(int iNewVal)
+{
+ glbliActionResumeInterval = iNewVal;
+ return RS_RET_OK;
+}
+
+
/* suspend an action -- rgerhards, 2007-08-02
*/
rsRetVal actionSuspend(action_t *pThis)
@@ -100,7 +114,7 @@ rsRetVal actionSuspend(action_t *pThis)
assert(pThis != NULL);
pThis->bSuspended = 1;
- pThis->ttResumeRtry = time(NULL) + ACTION_RESUME_INTERVAL;
+ pThis->ttResumeRtry = time(NULL) + pThis->iResumeInterval;
pThis->iNbrResRtry = 0; /* tell that we did not yet retry to resume */
return iRet;
@@ -131,7 +145,7 @@ rsRetVal actionTryResume(action_t *pThis)
* CPU time. TODO: maybe a config option for that?
* rgerhards, 2007-08-02
*/
- pThis->ttResumeRtry = ttNow + ACTION_RESUME_INTERVAL * (pThis->iNbrResRtry / 10 + 1);
+ pThis->ttResumeRtry = ttNow + pThis->iResumeInterval * (pThis->iNbrResRtry / 10 + 1);
}
} else {
/* it's too early, we are still suspended --> indicate this */
@@ -159,6 +173,7 @@ rsRetVal actionDbgPrint(action_t *pThis)
pThis->pMod->dbgPrintInstInfo(pThis->pModData);
printf("\n\tInstance data: 0x%x\n", (unsigned) pThis->pModData);
printf("\tRepeatedMsgReduction: %d\n", pThis->f_ReduceRepeated);
+ printf("\tResume Interval: %d\n", pThis->iResumeInterval);
printf("\tSuspended: %d", pThis->bSuspended);
if(pThis->bSuspended) {
printf(" next retry: %u, number retries: %d", (unsigned) pThis->ttResumeRtry, pThis->iNbrResRtry);