From: Ian Jackson Date: Thu, 29 Apr 2010 19:34:34 +0000 (+0100) Subject: fixes, including RC_missing X-Git-Tag: innduct-0.1~100 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=innduct.git;a=commitdiff_plain;h=667a612ad0362ca5a2fef3ec30c1b33f5e9858d4 fixes, including RC_missing --- diff --git a/backends/innduct.c b/backends/innduct.c index bc954f4..7f40725 100644 --- a/backends/innduct.c +++ b/backends/innduct.c @@ -291,6 +291,8 @@ static void statemc_setstate(StateMachineState newsms, int periods, static void statemc_start_flush(const char *why); /* Normal => Flushing */ static void spawn_inndcomm_flush(const char *why); /* Moved => Flushing */ +static void article_done(Conn *conn, Article *art, int whichcount); + static void check_assign_articles(void); static void queue_check_input_done(void); @@ -359,7 +361,7 @@ typedef enum { /* in queue in conn->sent */ art_Unchecked, /* not checked, not sent checking */ art_Wanted, /* checked, wanted sent body as requested */ art_Unsolicited, /* - sent body without check */ - art_MaxState + art_MaxState, } ArtState; #define RESULT_COUNTS(RCS,RCN) \ @@ -368,9 +370,10 @@ typedef enum { /* in queue in conn->sent */ RCN(unwanted) \ RCN(rejected) \ RCN(deferred) \ + RCN(missing) \ RCN(connretry) -#define RCI_TRIPLE_FMT_BASE "%d(id%d+bd%d+nc%d)" +#define RCI_TRIPLE_FMT_BASE "%d(%did+%dbd+%dnc)" #define RCI_TRIPLE_VALS_BASE(counts,x) \ counts[art_Unchecked] x \ + counts[art_Wanted] x \ @@ -427,7 +430,7 @@ struct InputFile { struct Article { ISNODE(Article); ArtState state; - int midlen; + int midlen, missing; InputFile *ipf; TOKEN token; off_t offset; @@ -1039,6 +1042,7 @@ static void *conn_exception(oop_source *lp, int fd, static void vconnfail(Conn *conn, const char *fmt, va_list al) { int requeue[art_MaxState]; + memset(requeue,0,sizeof(requeue)); Article *art; while ((art= LIST_REMHEAD(conn->priority))) LIST_ADDTAIL(queue, art); @@ -1242,7 +1246,7 @@ static void *connchild_event(oop_source *lp, int fd, oop_event e, void *u) { connect_attempt_discard(); check_assign_articles(); - return 0; + return OOP_CONTINUE; x: conn_dispose(conn); @@ -1510,12 +1514,23 @@ static void conn_make_some_xmits(Conn *conn) { ARTHANDLE *artdata= SMretrieve(art->token, RETR_ALL); + art->state= + art->state == art_Unchecked ? art_Unsolicited : + art->state == art_Wanted ? art_Wanted : + (abort(),-1); + + if (!artdata) art->missing= 1; + art->ipf->counts[art->state][ artdata ? RC_sent : RC_missing ]++; + if (conn->stream) { if (artdata) { XMIT_LITERAL("TAKETHIS "); xmit_noalloc(conn, art->messageid, art->midlen); XMIT_LITERAL("\r\n"); xmit_artbody(conn, artdata); + } else { + article_done(conn, art, -1); + continue; } } else { /* we got 235 from IHAVE */ @@ -1526,20 +1541,15 @@ static void conn_make_some_xmits(Conn *conn) { } } - art->state= - art->state == art_Unchecked ? art_Unsolicited : - art->state == art_Wanted ? art_Wanted : - (abort(),-1); - art->ipf->counts[art->state][RC_sent]++; LIST_ADDTAIL(conn->sent, art); } else { /* check it */ if (conn->stream) - XMIT_LITERAL("IHAVE "); - else XMIT_LITERAL("CHECK "); + else + XMIT_LITERAL("IHAVE "); xmit_noalloc(conn, art->messageid, art->midlen); XMIT_LITERAL("\r\n"); @@ -1641,7 +1651,8 @@ static void update_nocheck(int accepted) { } static void article_done(Conn *conn, Article *art, int whichcount) { - art->ipf->counts[art->state][whichcount]++; + if (!art->missing) art->ipf->counts[art->state][whichcount]++; + if (whichcount == RC_accepted) update_nocheck(1); else if (whichcount == RC_unwanted) update_nocheck(0); @@ -1713,7 +1724,7 @@ static void *peer_rd_ok(oop_source *lp, oop_read *oread, oop_rd_event ev, Article *art; #define GET_ARTICLE(musthavesent) \ - art= article_reply_check(conn, data, musthavesent, code_streaming, sani); \ + art= article_reply_check(conn, data, code_streaming, musthavesent, sani); \ if (art) ; else return OOP_CONTINUE /* reply_check has failed the conn */ #define ARTICLE_DEALTWITH(streaming,musthavesent,how) \