From 599596434b5b74c0280006508d195d69e71d0814 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 27 Apr 2010 12:41:28 +0100 Subject: [PATCH 1/1] make period size a tuneable --- backends/innduct.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/backends/innduct.c b/backends/innduct.c index 47561e3..1328d37 100644 --- a/backends/innduct.c +++ b/backends/innduct.c @@ -1,6 +1,5 @@ /* * TODO - * - make period size a tuneable * - check all structs initialised * - check all fd watches properly undone * - check all init functions called @@ -195,8 +194,6 @@ perl -ne 'print if m/-8\<-/..m/-\>8-/; print "\f" if m/-\^L-/' backends/innduct. /*----- general definitions, probably best not changed -----*/ -#define PERIOD_SECONDS 60 - #define CONNCHILD_ESTATUS_STREAM 4 #define CONNCHILD_ESTATUS_NOSTREAM 5 @@ -316,6 +313,8 @@ static int quiet_multiple=0, become_daemon=1; 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 @@ -2247,7 +2246,7 @@ static void search_backlog_file(void) { 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", @@ -2263,7 +2262,7 @@ static void search_backlog_file(void) { 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) @@ -2414,8 +2413,7 @@ static void postfork(const char *what) { } #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 } \ @@ -2440,7 +2438,7 @@ static const char *debug_ipf_path(InputFile *ipf) { 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) @@ -2542,8 +2540,8 @@ static void op_seconds(const Option *o, const char *val) { 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) { @@ -2697,6 +2695,7 @@ int main(int argc, char **argv) { filepoll_schedule(); } + period_timeout.tv_sec= period_seconds; period_schedule(); statemc_init(); -- 2.30.2