chiark / gitweb /
WIP inotify configure test
[inn-innduct.git] / backends / innduct.c
index acbae608ad4ecef16452814f886d56ef3a565d8d..0240e4ee81dc3920d965a924bfabb559645bfcb4 100644 (file)
@@ -1,19 +1,10 @@
 /*
- * bugs
- *
-
- [740] <sit> info: processed feedfile(null) read=4(+0bl,+6err) offered=5(ch5,nc0) accepted=0(ch0+nc0) unwanted=0(0id+0bd+0nc) rejected=0(0id+0bd+0nc) deferred=0(0id+0bd+0nc) missing=2(0id+2bd+0nc) connretry=0(0id+0bd+0nc)
-
-    (null) ?!
-
-   also unwanted should be nonzero I think
-
-   %d(  is too hard to read
-
- [740] <sit> warning: corrupted file: /home/ian/things/Innfeed/inn2-2.4.5/fee, offset 349: line partially blanked: in `                                                  @050000002D130000006A0000000000000000@ <mi'..
-
+ * 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
@@ -387,7 +378,7 @@ typedef enum {      /* in queue                 in conn->sent             */
   RCN(missing)                                 \
   RCN(connretry)
 
-#define RCI_TRIPLE_FMT_BASE "%d(%did+%dbd+%dnc)"
+#define RCI_TRIPLE_FMT_BASE "%d (id=%d,bod=%d,nc=%d)"
 #define RCI_TRIPLE_VALS_BASE(counts,x)         \
        counts[art_Unchecked] x                 \
        + counts[art_Wanted] x                  \
@@ -1674,6 +1665,11 @@ static void article_done(Conn *conn, Article *art, int whichcount) {
 
   while (art->blanklen) {
     static const char spaces[]=
+      "                                                                "
+      "                                                                "
+      "                                                                "
+      "                                                                "
+      "                                                                "
       "                                                                "
       "                                                                "
       "                                                                "
@@ -1917,7 +1913,7 @@ static void *feedfile_got_article(oop_source *lp, oop_read *rd,
   art->midlen= midlen;
   art->ipf= ipf;  ipf->inprogress++;
   art->token= TextToToken(tokentextbuf);
-  art->offset= ipf->offset;
+  art->offset= old_offset;
   art->blanklen= recsz;
   strcpy(art->messageid, space+1);
   LIST_ADDTAIL(queue, art);
@@ -1995,10 +1991,10 @@ static ssize_t tailing_try_read(struct oop_readable *rable, void *buffer,
 
 /*---------- filemon implemented with inotify ----------*/
 
-#if defined(HAVE_INOTIFY) && !defined(HAVE_FILEMON)
+#if defined(HAVE_SYS_INOTIFY_H) && !defined(HAVE_FILEMON)
 #define HAVE_FILEMON
 
-#include <linux/inotify.h>
+#include <sys/inotify.h>
 
 static int filemon_inotify_fd;
 static int filemon_inotify_wdmax;
@@ -2061,7 +2057,7 @@ static void *filemon_inotify_readable(oop_source *lp, int fd,
 static int filemon_method_init(void) {
   filemon_inotify_fd= inotify_init();
   if (filemon_inotify_fd<0) {
-    syswarn("could not initialise inotify: inotify_init failed");
+    syswarn("filemon/inotify: inotify_init failed");
     return 0;
   }
   set nonblock;
@@ -2079,7 +2075,10 @@ static int filemon_method_init(void) {
 
 struct Filemon_Perfile { int dummy; };
 
-static int filemon_method_init(void) { return 0; }
+static int filemon_method_init(void) {
+  warn("filemon/dummy: no filemon method compiled in");
+  return 0;
+}
 static void filemon_method_startfile(InputFile *ipf, Filemon_Perfile *pf) { }
 static void filemon_method_stopfile(InputFile *ipf, Filemon_Perfile *pf) { }
 
@@ -2408,8 +2407,8 @@ static void notice_processed(InputFile *ipf, const char *what,
 
 #define CNT(art,rc) (ipf->counts[art_##art][RC_##rc])
 
-  info("processed %s%s read=%d(+%dbl,+%derr)"
-       " offered=%d(ch%d,nc%d) accepted=%d(ch%d+nc%d)"
+  info("processed %s%s read=%d (+bl=%d,+err=%d)"
+       " offered=%d (ch=%d,nc=%d) accepted=%d (ch=%d,nc=%d)"
        RESULT_COUNTS(RCI_NOTHING, RCI_TRIPLE_FMT)
        ,
        what, spec,
@@ -2433,7 +2432,7 @@ static void statemc_check_backlog_done(void) {
   const char *under= strchr(slash, '_');
   const char *rest= under ? under+1 : leaf;
   if (!strncmp(rest,"backlog",7)) rest += 7;
-  notice_processed(ipf,"backlog:",rest);
+  notice_processed(ipf,"backlog ",rest);
 
   close_input_file(ipf);
   if (unlink(ipf->path)) {
@@ -2455,7 +2454,7 @@ static void statemc_check_flushing_done(void) {
 
   assert(sms==sm_SEPARATED || sms==sm_DROPPING);
 
-  notice_processed(ipf,"feedfile",0);
+  notice_processed(ipf,"feedfile","");
 
   close_defer();
 
@@ -2467,7 +2466,7 @@ static void statemc_check_flushing_done(void) {
 
   if (sms==sm_SEPARATED) {
     notice("flush complete");
-    SMS(NORMAL, 0, "flush complete");
+    SMS(NORMAL, spontaneous_flush_periods, "flush complete");
   } else if (sms==sm_DROPPING) {
     SMS(DROPPED, 0, "old flush complete");
     search_backlog_file();
@@ -2905,7 +2904,7 @@ static char *debug_report_ipf(InputFile *ipf) {
   return xasprintf("%p/%s:ip=%ld,off=%ld,fd=%d%s",
                   ipf, path,
                   ipf->inprogress, (long)ipf->offset,
-                  ipf->fd, ipf->rd ? "+" : "");
+                  ipf->fd, ipf->rd ? "" : ",!rd");
 }
 
 static void period(void) {
@@ -2915,7 +2914,7 @@ static void period(void) {
 
   debug("PERIOD"
        " sms=%s[%d] conns=%d queue=%d until_connect=%d"
-       " input_files main:%s old:%s flushing:%s"
+       " input_files main:%s flushing:%s backlog:%s"
        " children connecting=%ld inndcomm=%ld"
        ,
        sms_names[sms], sm_period_counter,
@@ -3266,7 +3265,7 @@ int main(int argc, char **argv) {
   control_init();
 
   if (!filemon_method_init()) {
-    warn("no file monitoring available, polling");
+    warn("filemon: no file monitoring available, polling");
     every(5,0,filepoll);
   }