/*
* TODO
- * - make period size a tuneable
* - check all structs initialised
* - check all fd watches properly undone
* - check all init functions called
/*----- general definitions, probably best not changed -----*/
-#define PERIOD_SECONDS 60
-
#define CONNCHILD_ESTATUS_STREAM 4
#define CONNCHILD_ESTATUS_NOSTREAM 5
static int max_connections=10, max_queue_per_conn=200;
static int target_max_feedfile_size=100000;
+static int period_seconds=60;
+
static double max_bad_data_ratio= 0.01;
static int max_bad_data_initial= 30;
/* in one corrupt 4096-byte block the number of newlines has
now= xtime();
double age= difftime(now, oldest_mtime);
- long age_deficiency= (backlog_retry_minperiods * PERIOD_SECONDS) - age;
+ long age_deficiency= (backlog_retry_minperiods * period_seconds) - age;
if (age_deficiency <= 0) {
debug("backlog scan: found age=%f deficiency=%ld oldest=%s",
return;
}
- until_backlog_nextscan= age_deficiency / PERIOD_SECONDS;
+ until_backlog_nextscan= age_deficiency / period_seconds;
if (backlog_spontaneous_rescan_periods >= 0 &&
until_backlog_nextscan > backlog_spontaneous_rescan_periods)
}
#define EVERY(what, interval_sec, interval_usec, body) \
- static const struct timeval what##_timeout = \
- { interval_sec, interval_usec }; \
+ static struct timeval what##_timeout = { interval_sec, interval_usec }; \
static void what##_schedule(void); \
static void *what##_timedout(oop_source *lp, struct timeval tv, void *u) { \
{ body } \
return slash ? slash+1 : ipf->path;
}
-EVERY(period, PERIOD_SECONDS,0, {
+EVERY(period, -1,0, {
debug("PERIOD"
" sms=%s[%d] conns=%d queue=%d until_connect=%d"
" input_files" DEBUGF_IPF(main) DEBUGF_IPF(old) DEBUGF_IPF(flushing)
static void op_periods_rndup(const Option *o, const char *val) {
int *store= o->store;
op_seconds(o,val);
- *store += PERIOD_SECONDS-1;
- *store /= PERIOD_SECONDS;
+ *store += period_seconds-1;
+ *store /= period_seconds;
}
static void op_setint(const Option *o, const char *val) {
filepoll_schedule();
}
+ period_timeout.tv_sec= period_seconds;
period_schedule();
statemc_init();