X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=innduct.git;a=blobdiff_plain;f=statemc.c;h=04f0a1d82628a2ab291d8cfe498a54eb1ad40e2d;hp=78912e72893eae5d73de865539e77598dbc41df6;hb=229c6d070b1ddb2cebb0a3f12bc71713795cd627;hpb=c2ec61d4f426a04f288559c5ad50df822b7dcfb8 diff --git a/statemc.c b/statemc.c index 78912e7..04f0a1d 100644 --- a/statemc.c +++ b/statemc.c @@ -190,8 +190,12 @@ int trigger_flush_ok(const char *why) { case sm_SEPARATED: case sm_DROPPING: - warn("abandoning old feedfile after flush (%s), autodeferring", - why ? why : "took too long to complete"); + if (conns.count) + warn("abandoning old feedfile after flush (%s), autodeferring", + why ? why : "took too long to complete"); + else + info("autodeferring after flush (%s)", + why ? why : "no connections"); assert(flushing_input_file); autodefer_input_file(flushing_input_file); return 1; @@ -219,29 +223,29 @@ static int inputfile_is_done(InputFile *ipf) { } static void notice_processed_counts(Counts *counts, int completed, - InputFile *ipf, const char *what) { + InputFile *ipf_xtra, const char *what) { #define RCI_NOTHING(x) /* nothing */ #define RCI_TRIPLE_FMT(x) " " #x "=" RCI_TRIPLE_FMT_BASE -#define RCI_TRIPLE_VALS(x) ,RCI_TRIPLE_VALS_BASE(ipf->counts.results, [RC_##x]) +#define RCI_TRIPLE_VALS(x) , RCI_TRIPLE_VALS_BASE(counts->results, [RC_##x]) -#define CNT(art,rc) (ipf->counts.results[art_##art][RC_##rc]) +#define CNT(art,rc) (counts->results[art_##art][RC_##rc]) - char *inprog= completed - ? xasprintf("%s","") /* GCC produces a stupid warning for printf("") ! */ - : xasprintf(" inprogress=%ld", ipf->inprogress); - char *autodefer= ipf && ipf->autodefer >= 0 - ? xasprintf(" autodeferred=%ld", ipf->autodefer) - : xasprintf("%s",""); + char *inprog= ipf_xtra && !completed + ? masprintf(" inprogress=%ld", ipf_xtra->inprogress) + : masprintf("%s",""); /* GCC produces a stupid warning for printf("") ! */ + char *autodefer= ipf_xtra && ipf_xtra->autodefer >= 0 + ? masprintf(" autodeferred=%ld", ipf_xtra->autodefer) + : masprintf("%s",""); - info("%s %s read=%d (+bl=%d,+err=%d)%s%s" + notice("%s %s read=%d (+bl=%d,+err=%d)%s%s" " missing=%d offered=%d (ch=%d,nc=%d) accepted=%d (ch=%d,nc=%d)" RESULT_COUNTS(RCI_NOTHING, RCI_TRIPLE_FMT) , completed?"completed":"processed", what, - ipf->counts.events[read_ok], ipf->counts.events[read_blank], - ipf->counts.events[read_err], - inprog, autodefer, ipf->counts.events[nooffer_missing], + counts->events[read_ok], counts->events[read_blank], + counts->events[read_err], + inprog, autodefer, counts->events[nooffer_missing], CNT(Unchecked,sent) + CNT(Unsolicited,sent) , CNT(Unchecked,sent), CNT(Unsolicited,sent), CNT(Wanted,accepted) + CNT(Unsolicited,accepted) @@ -249,7 +253,7 @@ static void notice_processed_counts(Counts *counts, int completed, RESULT_COUNTS(RCI_NOTHING, RCI_TRIPLE_VALS) ); - memset(&ipf->counts, 0, sizeof(ipf->counts)); + memset(counts, 0, sizeof(*counts)); free(inprog); free(autodefer); @@ -282,6 +286,7 @@ void statemc_check_backlog_done(void) { InputFile *ipf= backlog_input_file; if (!inputfile_is_done(ipf)) return; + dbg("backlog file %p %s complete", ipf, ipf->path); backlog_accumulate_counts(ipf); close_input_file(ipf); if (unlink(ipf->path)) { @@ -303,7 +308,7 @@ void statemc_check_flushing_done(void) { assert(sms==sm_SEPARATED || sms==sm_DROPPING); - notice_processed_inputfile(ipf,1,"feedfile"); + notice_processed_inputfile(ipf,1,"batch"); close_defer(); @@ -500,6 +505,7 @@ void preterminate(void) { } void showstats(void) { + notice_conns_stats(); notice_processed_inputfile(main_input_file, 0, "feedfile"); notice_processed_inputfile(flushing_input_file, 0, "flushing");