chiark / gitweb /
Merge branch 'master' of login.chiark.greenend.org.uk:public-git/inn-innduct
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Fri, 30 Apr 2010 23:25:38 +0000 (00:25 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Fri, 30 Apr 2010 23:25:38 +0000 (00:25 +0100)
backends/innduct.c
doc/man/innduct.8

index 813091fd01908cff20d64a0766923da474e1272b..b08205ca4156681b9404caa0590f8579bf946138 100644 (file)
@@ -1,17 +1,10 @@
 /*
- * warning if no inotify
- * inotify not working ?
- * some per-conn info thing for control
-
  * todo
- *  - actually do something with readable on control master
- *  - option for realsockdir
- *  - option for filepoll
- *  - option for no inotify
+ *  - inotify not working ?
+ *  - some per-conn info thing for control
  *  - manpage: document control master stuff
- *  - manpage: innconf is used for communicating with innd
- *  - debug this:
+ *
+ * debugging rune:
  *      build-lfs/backends/innduct --no-daemon -f `pwd`/fee sit dom
  */
 
@@ -330,7 +323,7 @@ static oop_rd_call peer_rd_err, peer_rd_ok;
 static const char *sitename, *remote_host;
 static const char *feedfile, *realsockdir="/tmp/innduct.control";
 static int quiet_multiple=0;
-static int become_daemon=1;
+static int become_daemon=1, try_filemon=1;
 static int try_stream=1;
 static int port=119;
 static const char *inndconffile;
@@ -339,6 +332,7 @@ 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 int filepoll_seconds=5;
 
 static int connection_setup_timeout=200;
 static int inndcomm_flush_timeout=100;
@@ -955,7 +949,7 @@ static void control_init(void) {
       uid_t self= geteuid();
       if (!S_ISDIR(stab.st_mode) ||
          stab.st_uid != self ||
-         stab.st_mode & 0077) {
+         stab.st_mode & 0007) {
        warn("no control socket, because real socket directory"
             " is somehow wrong (ISDIR=%d, uid=%lu (exp.%lu), mode %lo)",
             !!S_ISDIR(stab.st_mode),
@@ -3122,8 +3116,10 @@ static const Option innduct_options[]= {
 {'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,"no-filemon",         0,       &try_filemon,              op_setint, 0   },
 {'C',"inndconf",         "F",     &inndconffile,             op_string      },
 {'P',"port",             "PORT",  &port,                     op_integer     },
+{0,"ctrl-sock-dir",      0,       &realsockdir,              op_string      },
 {0,"help",               0,       0,                         help           },
 
 {0,"max-connections",    "N",     &max_connections,          op_integer     },
@@ -3131,8 +3127,9 @@ static const Option innduct_options[]= {
 {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,"connection-timeout",   "TIME",  &connection_setup_timeout, op_seconds   },
+{0,"stuck-flush-timeout",  "TIME",  &inndcomm_flush_timeout,   op_seconds   },
+{0,"feedfile-poll",        "TIME",  &filepoll_seconds,         op_seconds   },
 
 {0,"no-check-proportion",   "PERCENT",   &nocheck_thresh,       op_double   },
 {0,"no-check-response-time","ARTICLES",  &nocheck_decay,        op_double   },
@@ -3279,10 +3276,16 @@ int main(int argc, char **argv) {
 
   control_init();
 
-  if (!filemon_method_init()) {
-    warn("filemon: no file monitoring available, polling");
-    every(5,0,filepoll);
+  int filemon_ok= 0;
+  if (!try_filemon) {
+    notice("filemon: suppressed by command line option, polling");
+  } else {
+    filemon_ok= filemon_method_init();
+    if (!filemon_ok)
+      warn("filemon: no file monitoring available, polling");
   }
+  if (!filemon_ok)
+    every(filepoll_seconds,0,filepoll);
 
   every(period_seconds,1,period);
 
index fb6e038f5a6976c1dcd6c439475438397c3b0a83..83aeade401744181d29a9495eeb86a6130e5d224 100644 (file)
@@ -94,12 +94,38 @@ Do not daemonise.  innduct runs in the foreground and all messages
 Do not try to use the streaming extensions to NNTP (for use eg if the
 peer can't cope when we send MODE STREAM).
 .TP
+.BI \-\-no-filemon
+Do not try to use the file change monitoring support to watch for
+writes by innd to the feed file; poll it instead.  (If file monitoring
+is not compiled in, this option just downgrades the log message which
+warns about this situation.)
+.TP
 .BR \-C | \-\-inndconf= \fIFILE\fR
 Read
 .I FILE
 instead of the default
 .BR inn.conf .
 .TP
+.BI \-\-ctrl-sock-dir= DIR
+Bind the real control socket to a unique filename in
+.IR DIR .
+A symlink will be made pointing to the actual file used, named
+.IB feedfile _control
+in the same directory as
+.IR feedfile ,
+but since
+.IR feedfile 's
+path may be too long for an AF_UNIX socket path, innduct always
+creates the sockets in this dedicated directory which is expected to
+have a short path.  If
+.I DIR
+does not exist it will be created with mode 0700; if it does
+exist it must not be a symlink and must be owned by the user running
+innduct and have no access for "other".  If the control socket cannot
+be set up (for this or any other reason), a warning is logged, but
+such situations are not fatal for innduct's startup.  The default is
+.BR /tmp/innduct.control .
+.TP
 .BI \-\-port= PORT
 Connect to port
 .I PORT
@@ -142,9 +168,13 @@ working.  The default is
 .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
+innduct wakes up every
+.I PERIOD-INTERVAL
+to do various housekeeping checks.  Also, many of the timeout and
+rescan intervals (those specified in this manual as
+.IR PERIOD )
+are rounded up to the next multiple of
+.IR PERIOD-INTERVAL .
 .TP
 .BI \-\-connection-timeout= TIME
 How long to allow for a connection setup attempt before giving up.
@@ -156,6 +186,16 @@ How long to wait for innd to respond to a flush request before giving
 up.  The default is
 .BR 100s .
 .TP
+.BI \-\-feedfile-poll= TIME
+How often to poll the feedfile for new articles written by innd
+if file monitoring
+.RI ( inotify
+or equivalent) is not available.  (When file monitoring is available,
+there is no need for periodic checks and we wake immediately up
+whenever the feedfile changes.)
+The default is
+.BR 5s .
+.TP
 .BI \-\-no-check-proportion= PERCENT
 If the moving average of the proportion of articles being accepted
 (rather than declined) by the peer exceeds this value, innduct uses
@@ -380,7 +420,8 @@ before you have finished creating it.
 .IX Item inn.conf
 Used to find
 .IR pathoutgoing
-if none is specified, and also for
+if none is specified, for finding how to communicate with innd,
+and also for
 .IR sourceaddress
 and/or
 .IR sourceaddress6 .