/*----- configuration options -----*/
-static const char *sitename, *feedfile, *pathoutgoing;
-static const char *remote_host;
-static int quiet_multiple=0, become_daemon=1;
+static const char *sitename, *remote_host;
+static const char *feedfile;
+static int quiet_multiple=0;
+static int become_daemon=1;
+static int try_stream=1;
+static int port=119;
+static const char *inndconffile;
-static int max_connections=10, max_queue_per_conn=200;
+static int max_connections=10;
+static int 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 connection_setup_timeout=200;
+static int inndcomm_flush_timeout=100;
+
+static double nocheck_thresh= 95.0; /* converted from percentage by main */
+static double nocheck_decay= 100; /* conv'd from articles to lambda by main */
+
+/* all these are initialised to seconds, and converted to periods in main */
+static int reconnect_delay_periods=1000;
+static int flushfail_retry_periods=1000;
+static int backlog_retry_minperiods=50;
+static int backlog_spontrescan_periods=300;
+static int spontaneous_flush_periods=100000;
+static int need_activity_periods=1000;
+
+static double max_bad_data_ratio= 1; /* conv'd from percentage by main */
static int max_bad_data_initial= 30;
/* in one corrupt 4096-byte block the number of newlines has
* mean 16 and standard deviation 3.99. 30 corresponds to z=+3.5 */
-static int connection_setup_timeout=200, port=119, try_stream=1;
-static int inndcomm_flush_timeout=100;
-static int reconnect_delay_periods, flushfail_retry_periods;
-static int backlog_retry_minperiods, backlog_spontaneous_rescan_periods;
-static int spontaneous_flush_periods, need_activity_periods;
-static const char *inndconffile;
-
-static double nocheck_thresh_pct= 95.0;
-static double nocheck_thresh; /* computed in main from _pct */
-static double nocheck_decay_articles= 100; /* converted to _decay */
-static double nocheck_decay; /* computed in main from _articles */
-
/*----- statistics -----*/
xunlink(path_lock, "lockfile for old feed");
exit(0);
}
- until_backlog_nextscan= backlog_spontaneous_rescan_periods;
+ until_backlog_nextscan= backlog_spontrescan_periods;
goto xfree;
}
until_backlog_nextscan= age_deficiency / period_seconds;
- if (backlog_spontaneous_rescan_periods >= 0 &&
- until_backlog_nextscan > backlog_spontaneous_rescan_periods)
- until_backlog_nextscan= backlog_spontaneous_rescan_periods;
+ if (backlog_spontrescan_periods >= 0 &&
+ until_backlog_nextscan > backlog_spontrescan_periods)
+ until_backlog_nextscan= backlog_spontrescan_periods;
debug("backlog scan: young age=%f deficiency=%ld nextscan=%d oldest=%s",
age, age_deficiency, until_backlog_nextscan, oldest_path);
*store= v;
}
-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;
-}
-
static void op_setint(const Option *o, const char *val) {
int *store= o->store;
*store= o->intval;
static void help(const Option *o, const char *val);
static const Option innduct_options[]= {
-{'f',"feedfile", "F", &feedfile, op_string },
-{'q',"quiet-multiple", 0, &quiet_multiple, op_setint, 1 },
-{0,"help", 0, help },
-
-{0,"max-connections", "N", &max_connections, op_integer },
-{0,"max-queue-per-conn", "N", &max_queue_per_conn, op_integer },
-
+{'f',"feedfile", "F", &feedfile, op_string },
+{'q',"quiet-multiple", 0, &quiet_multiple, op_setint, 1 },
+{0,"no-daemon", 0, &become_daemon, op_setint, 0 },
+{0,"no-streaming", 0, &try_stream, op_setint, 0 },
+{0,"inndconf", "F", &inndconffile, op_string },
+{'P',"port", "PORT", &port, op_integer },
+{0,"help", 0, 0, help },
+
+{0,"max-connections", "N", &max_connections, op_integer },
+{0,"max-queue-per-conn", "N", &max_queue_per_conn, op_integer },
+{0,"feedfile-flush-size","BYTES", &target_max_feedfile_size, op_integer },
+{0,"period-interval", "TIME", &period_seconds, op_seconds },
+
+{0,"connection-timeout", "TIME", &connection_setup_timeout, op_seconds },
+{0,"stuck-flush-timeout","TIME", &inndcomm_flush_timeout, op_seconds },
+
+{0,"no-check-proportion", "PERCENT", &nocheck_thresh, op_double },
+{0,"no-check-response-time","ARTICLES", &nocheck_decay, op_double },
+
+{0,"reconnect-interval", "PERIOD", &reconnect_delay_periods, op_seconds },
+{0,"flush-retry-interval", "PERIOD", &flushfail_retry_periods, op_seconds },
+{0,"earliest-deferred-retry","PERIOD", &backlog_retry_minperiods, op_seconds },
+{0,"backlog-rescan-interval","PERIOD",&backlog_spontrescan_periods,op_seconds},
+{0,"max-flush-interval", "PERIOD", &spontaneous_flush_periods,op_seconds },
+{0,"idle-timeout", "PERIOD", &need_activity_periods, op_seconds },
+
+{0,"max-bad-input-data-ratio","PERCENT", &max_bad_data_ratio, op_double },
+{0,"max-bad-input-data-init", "PERCENT", &max_bad_data_initial, op_integer },
-{0,"streaming", 0, &try_stream, op_setint, 1 },
-{0,"no-streaming", 0, &try_stream, op_setint, 0 },
-{'P',"port", "PORT",&port, op_integer },
-{0,"inndconf", "F", &inndconffile, op_string },
-{0,"no-daemon", 0, &become_daemon, op_setint, 0 },
-
-{0,"no-check-proportion","PERCENT", &nocheck_thresh_pct, op_double },
-{0,"no-check-filter", "ARTICLES", &nocheck_decay_articles, op_double },
-
-{0,"reconnect-interval", "TIME", &reconnect_delay_periods, op_periods_rndup },
-{0,"flush-retry-interval","TIME", &flushfail_retry_periods, op_periods_rndup },
-{0,"inndcomm-timeout", "TIME", &inndcomm_flush_timeout, op_seconds },
{0,0}
};
exit(0);
}
+static void convert_to_periods_rndup(int *store) {
+ *store += period_seconds-1;
+ *store /= period_seconds;
+}
+
int main(int argc, char **argv) {
if (!argv[1]) {
printusage(stderr);
if (!remote_host) remote_host= sitename;
- if (nocheck_thresh_pct < 0 || nocheck_thresh_pct > 100)
+ if (nocheck_thresh < 0 || nocheck_thresh > 100)
badusage("nocheck threshold percentage must be between 0..100");
- nocheck_thresh= nocheck_thresh_pct * 0.01;
+ nocheck_thresh *= 0.01;
- if (nocheck_decay_articles < 0.1)
+ if (nocheck_decay < 0.1)
badusage("nocheck decay articles must be at least 0.1");
- nocheck_decay= 1 - 1/nocheck_decay_articles;
-
- if (!pathoutgoing)
- pathoutgoing= innconf->pathoutgoing;
- innconf_read(inndconffile);
-
- if (!feedfile)
- feedfile= xasprintf("%s/%s",pathoutgoing,sitename);
- else if (!feedfile[0])
+ nocheck_decay= 1 - 1.0/nocheck_decay;
+
+ convert_to_periods_rndup(&reconnect_delay_periods);
+ convert_to_periods_rndup(&flushfail_retry_periods);
+ convert_to_periods_rndup(&backlog_retry_minperiods);
+ convert_to_periods_rndup(&backlog_spontrescan_periods);
+ convert_to_periods_rndup(&spontaneous_flush_periods);
+ convert_to_periods_rndup(&need_activity_periods);
+
+ if (max_bad_data_ratio < 0 || max_bad_data_ratio > 100)
+ badusage("bad input data ratio must be between 0..100");
+ max_bad_data_ratio *= 0.01;
+
+ if (!feedfile) {
+ innconf_read(inndconffile);
+ feedfile= xasprintf("%s/%s",innconf->pathoutgoing,sitename);
+ } else if (!feedfile[0]) {
badusage("feed filename must be nonempty");
- else if (feedfile[strlen(feedfile)-1]=='/')
+ } else if (feedfile[strlen(feedfile)-1]=='/') {
feedfile= xasprintf("%s%s",feedfile,sitename);
+ }
const char *feedfile_forbidden= "?*[~#";
int c;