From: Ian Jackson Date: Tue, 27 Apr 2010 18:16:27 +0000 (+0100) Subject: options for everything X-Git-Tag: innduct-0.1~115 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=innduct.git;a=commitdiff_plain;h=fc66b511debe93980fd49331d96939fb876024da options for everything --- diff --git a/backends/innduct.c b/backends/innduct.c index d75c51b..8e599f5 100644 --- a/backends/innduct.c +++ b/backends/innduct.c @@ -311,32 +311,38 @@ static oop_rd_call peer_rd_err, peer_rd_ok; /*----- 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 -----*/ @@ -2289,7 +2295,7 @@ static void search_backlog_file(void) { xunlink(path_lock, "lockfile for old feed"); exit(0); } - until_backlog_nextscan= backlog_spontaneous_rescan_periods; + until_backlog_nextscan= backlog_spontrescan_periods; goto xfree; } @@ -2314,9 +2320,9 @@ static void search_backlog_file(void) { 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); @@ -2681,13 +2687,6 @@ static void op_seconds(const Option *o, const char *val) { *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; @@ -2698,26 +2697,35 @@ static void op_setint(const Option *o, const char *val) { 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} }; @@ -2736,6 +2744,11 @@ static void help(const Option *o, const char *val) { 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); @@ -2755,24 +2768,33 @@ int main(int argc, char **argv) { 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; diff --git a/doc/man/innduct.8 b/doc/man/innduct.8 index f3b8785..b71c2f8 100644 --- a/doc/man/innduct.8 +++ b/doc/man/innduct.8 @@ -33,7 +33,7 @@ is not specified, it defaults to Logging is sent to syslog. .SH GENERAL OPTIONS .TP -.BI \-f feedfile +.BR \-f | \-\-feedfile= \fIfeedfile\fR Specifies .IR feedfile . If the specified value ends in a @@ -44,8 +44,36 @@ and the actual feed file used is .IR specified_feedfile / site . .TP .BR \-q | \-\-quiet-multiple -Makes innduct silently exit if another innduct holds the lock for the -site. Without \fB-q\fR, this causes a fatal error to be logged. +Makes innduct silently exit (with status 0) if another innduct holds +the lock for the site. Without \fB-q\fR, this causes a fatal error to +be logged and a nonzero exit. +.TP +.BR \-\-no-daemon +Do not daemonise. innduct runs in the foreground and all messages +(including all debug messages) are written to stderr. +.TP +.BI \-\-no-streaming +Do not try to use the streaming extensions to NNTP (eg if the peer +can't cope when we send MODE STREAM). +.TP +.BI \-\-inndconf= FILE +Read +.I FILE +instead of the default +.BR inn.conf . +This is currently only used if +.BI \-f feedfile +is not specified, to find the value +.I pathoutgoing +for constructing the feedfile name from the site name. +.TP +.BI \-\-port= PORT +Connect to port +.I PORT +at the remote site rather than to the NNTP port (119). +.TP +.BI \-\-help +Just print a brief usage message and list of the options to stdout. .SH TUNING OPTIONS You should not normally need to adjust these. .TP @@ -63,11 +91,21 @@ particular connection The default is 200. (Non-streaming connections can only handle one article at a time.) .TP -.BI \-\-max-queue-per-conn= max -Restricts the maximum number of outstanding articles queued on any -particular connection -.IR max . -The default is 200. +.BI \-\-feedfile-flush-size= bytes +Specifies that innduct should flush when the feedfile size exceeds +.IR bytes ; +the effect is that the innduct will try to avoid the various +batchfiles growing much beyond this size while the link to the peer is +working. The default is 100,000 bytes. +.TP +.BI \-\-period-interval= PERIOD-INTERVAL +Specifies wakup interval and period granularity. +innduct wakes up every PERIOD-INTERVAL to do various housekeeping +checks. Also, many of the timeout and rescan intervals (those +specified in this manual as +.IR PERIOD s) +are rounded up to the next multiple of PERIOD-INTERVAL. +The default is one minute. .SH EXIT STATUS 0 ok 4 one is already running