From: Ian Jackson Date: Tue, 4 May 2010 08:44:31 +0000 (+0100) Subject: Merge branch 'master' of login.chiark.greenend.org.uk:public-git/inn-innduct X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=f4edee10297eb6cf34c745a1a68ed796339abe5e;hp=-c;p=inn-innduct.git Merge branch 'master' of login.chiark.greenend.org.uk:public-git/inn-innduct --- f4edee10297eb6cf34c745a1a68ed796339abe5e diff --combined backends/innduct.c index 0ed8f2e,85e5d65..561ff00 --- a/backends/innduct.c +++ b/backends/innduct.c @@@ -23,13 -23,6 +23,13 @@@ * with GPLv3. If not then please let me know. -Ian Jackson.) */ +/* + * todo + * + * don't mind reconnecting if we just disconnected due to idle + * some weird disconnection event still investigating + */ + /* * Newsfeeds file entries should look like this: * host.name.of.site[/exclude,exclude,...]\ @@@ -1123,12 -1116,13 +1123,13 @@@ static void vconnfail(Conn *conn, cons for (i=0, d=conn->xmitd; ixmitu; i++, d++) xmit_free(d); + LIST_REMOVE(conns,conn); + char *m= xvasprintf(fmt,al); - warn("C%d connection failed requeueing " RCI_TRIPLE_FMT_BASE ": %s", - conn->fd, RCI_TRIPLE_VALS_BASE(requeue, /*nothing*/), m); + warn("C%d (now %d) connection failed requeueing " RCI_TRIPLE_FMT_BASE ": %s", + conn->fd, conns.count, RCI_TRIPLE_VALS_BASE(requeue, /*nothing*/), m); free(m); - LIST_REMOVE(conns,conn); conn_dispose(conn); check_assign_articles(); } @@@ -1305,8 -1299,9 +1306,9 @@@ static void *connchild_event(oop_sourc &peer_rd_err, conn); if (r) sysdie("oop_rd_read for peer (fd=%d)",conn->fd); - notice("C%d connected %s", conn->fd, conn->stream ? "streaming" : "plain"); LIST_ADDHEAD(conns, conn); + notice("C%d (now %d) connected %s", + conn->fd, conns.count, conn->stream ? "streaming" : "plain"); connect_attempt_discard(); check_assign_articles(); @@@ -1668,15 -1663,18 +1670,18 @@@ static void *conn_write_some_xmits(Con assert(rs > 0); int done; - for (done=0; rs && donexmitu; done++) { + for (done=0; rs; ) { + assert(donexmitu); struct iovec *vp= &conn->xmit[done]; XmitDetails *dp= &conn->xmitd[done]; - if (rs > vp->iov_len) { + if (rs >= vp->iov_len) { rs -= vp->iov_len; - xmit_free(dp); + xmit_free(dp); /* vp->iov_len -= vp->iov_len, etc. */ + done++; } else { vp->iov_base= (char*)vp->iov_base + rs; vp->iov_len -= rs; + break; /* rs -= rs */ } } int newu= conn->xmitu - done; @@@ -1906,9 -1904,10 +1911,10 @@@ static void *peer_rd_ok(oop_source *lp if (code!=205 && code!=503) { connfail(conn, "peer gave unexpected response to QUIT: %s", sani); } else { - notice("C%d idle connection closed by us", conn->fd); - assert(!conn_busy); LIST_REMOVE(conns,conn); + notice("C%d (now %d) idle connection closed by us", + conn->fd, conns.count); + assert(!conn_busy); conn_dispose(conn); } return OOP_CONTINUE; @@@ -1943,8 -1942,9 +1949,9 @@@ if (conn_busy) PEERBADMSG("peer timed us out or stopped accepting articles"); - notice("C%d idle connection closed by peer", conn->fd); LIST_REMOVE(conns,conn); + notice("C%d (now %d) idle connection closed by peer", + conns.count, conn->fd); conn_dispose(conn); return OOP_CONTINUE; @@@ -3089,10 -3089,10 +3096,10 @@@ static void *inndcomm_event(oop_source " to site %s in newsfeeds)", feedfile, sitename); if (flushing_input_file) { - SMS(SEPARATED, max_separated_periods, "recovery flush complete"); + SMS(SEPARATED, max_separated_periods, "flush complete"); } else { close_defer(); - SMS(NORMAL, spontaneous_flush_periods, "flush complete"); + SMS(NORMAL, spontaneous_flush_periods, "recovery flush complete"); } return OOP_CONTINUE;