chiark / gitweb /
some fixes; debug for missing
[inn-innduct.git] / backends / innduct.c
index 7f4072549e13a29c713a3568c653b82307a873c8..f28db2edfc6330259bbfe25225186f32b12c7dc9 100644 (file)
@@ -1,4 +1,17 @@
 /*
+ * 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)
+
+   also unwanted should be nonzero I think
+
+ [740] <sit> warning: corrupted file: /home/ian/things/Innfeed/inn2-2.4.5/fee, offset 349: line partially blanked: in `                                                  @050000002D130000006A0000000000000000@ <mi'..
+
+
+
+ * some per-conn info thing for control
+
  * todo
  *  - actually do something with readable on control master
  *  - option for realsockdir
@@ -373,7 +386,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                  \
@@ -1520,6 +1533,8 @@ static void conn_make_some_xmits(Conn *conn) {
        (abort(),-1);
 
       if (!artdata) art->missing= 1;
+fprintf(stderr,"INC %d %d?%d:%d\n",(int)art->state,
+       !!artdata, (int)RC_sent, (int)RC_missing);
       art->ipf->counts[art->state][ artdata ? RC_sent : RC_missing ]++;
 
       if (conn->stream) {
@@ -1554,6 +1569,7 @@ static void conn_make_some_xmits(Conn *conn) {
       XMIT_LITERAL("\r\n");
 
       assert(art->state == art_Unchecked);
+fprintf(stderr,"INC %d %d\n",(int)art->state,(int)RC_sent);
       art->ipf->counts[art->state][RC_sent]++;
       LIST_ADDTAIL(conn->sent, art);
     }
@@ -1651,6 +1667,7 @@ static void update_nocheck(int accepted) {
 }
 
 static void article_done(Conn *conn, Article *art, int whichcount) {
+fprintf(stderr,"INC %d %d\n",(int)art->state,whichcount);
   if (!art->missing) art->ipf->counts[art->state][whichcount]++;
 
   if (whichcount == RC_accepted) update_nocheck(1);
@@ -1660,6 +1677,11 @@ static void article_done(Conn *conn, Article *art, int whichcount) {
 
   while (art->blanklen) {
     static const char spaces[]=
+      "                                                                "
+      "                                                                "
+      "                                                                "
+      "                                                                "
+      "                                                                "
       "                                                                "
       "                                                                "
       "                                                                "
@@ -1756,6 +1778,7 @@ static void *peer_rd_ok(oop_source *lp, oop_read *oread, oop_rd_event ev,
   case 335: /* IHAVE says send it */
     GET_ARTICLE(-1);
     assert(art->state == art_Unchecked);
+fprintf(stderr,"INC %d %d\n",(int)art->state,(int)RC_accepted);
     art->ipf->counts[art->state][RC_accepted]++;
     art->state= art_Wanted;
     LIST_ADDTAIL(conn->priority, art);
@@ -1798,7 +1821,7 @@ static void feedfile_eof(InputFile *ipf) {
 }
 
 static InputFile *open_input_file(const char *path) {
-  int fd= open(path, O_RDONLY);
+  int fd= open(path, O_RDWR);
   if (fd<0) {
     if (errno==ENOENT) return 0;
     sysfatal("unable to open input file %s", path);
@@ -2394,8 +2417,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,
@@ -2419,7 +2442,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)) {
@@ -2441,7 +2464,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();
 
@@ -2453,7 +2476,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();
@@ -2891,7 +2914,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) {
@@ -2901,7 +2924,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,