chiark
/
gitweb
/
~ian
/
inn-innduct.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix writev rs iovec loop
[inn-innduct.git]
/
backends
/
innduct.c
diff --git
a/backends/innduct.c
b/backends/innduct.c
index f8af279a37693ddabec10495c1ab7ef4d2ddbfd8..85e5d6541ebb036da8709f265597b1f0c090b782 100644
(file)
--- a/
backends/innduct.c
+++ b/
backends/innduct.c
@@
-1119,7
+1119,7
@@
static void vconnfail(Conn *conn, const char *fmt, va_list al) {
LIST_REMOVE(conns,conn);
char *m= xvasprintf(fmt,al);
LIST_REMOVE(conns,conn);
char *m= xvasprintf(fmt,al);
- warn("C%d
[%d]
connection failed requeueing " RCI_TRIPLE_FMT_BASE ": %s",
+ 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);
conn->fd, conns.count, RCI_TRIPLE_VALS_BASE(requeue, /*nothing*/), m);
free(m);
@@
-1300,8
+1300,8
@@
static void *connchild_event(oop_source *lp, int fd, oop_event e, void *u) {
if (r) sysdie("oop_rd_read for peer (fd=%d)",conn->fd);
LIST_ADDHEAD(conns, conn);
if (r) sysdie("oop_rd_read for peer (fd=%d)",conn->fd);
LIST_ADDHEAD(conns, conn);
- notice("C%d
[%d]
connected %s",
- conn
s.count, conn->fd
, conn->stream ? "streaming" : "plain");
+ notice("C%d
(now %d)
connected %s",
+ conn
->fd, conns.count
, conn->stream ? "streaming" : "plain");
connect_attempt_discard();
check_assign_articles();
connect_attempt_discard();
check_assign_articles();
@@
-1663,15
+1663,18
@@
static void *conn_write_some_xmits(Conn *conn) {
assert(rs > 0);
int done;
assert(rs > 0);
int done;
- for (done=0; rs && done<conn->xmitu; done++) {
+ for (done=0; rs; ) {
+ assert(done<conn->xmitu);
struct iovec *vp= &conn->xmit[done];
XmitDetails *dp= &conn->xmitd[done];
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;
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;
} else {
vp->iov_base= (char*)vp->iov_base + rs;
vp->iov_len -= rs;
+ break; /* rs -= rs */
}
}
int newu= conn->xmitu - done;
}
}
int newu= conn->xmitu - done;
@@
-1902,7
+1905,8
@@
static void *peer_rd_ok(oop_source *lp, oop_read *oread, oop_rd_event ev,
connfail(conn, "peer gave unexpected response to QUIT: %s", sani);
} else {
LIST_REMOVE(conns,conn);
connfail(conn, "peer gave unexpected response to QUIT: %s", sani);
} else {
LIST_REMOVE(conns,conn);
- notice("C%d[%d] idle connection closed by us", conns.count, conn->fd);
+ notice("C%d (now %d) idle connection closed by us",
+ conn->fd, conns.count);
assert(!conn_busy);
conn_dispose(conn);
}
assert(!conn_busy);
conn_dispose(conn);
}
@@
-1939,7
+1943,8
@@
static void *peer_rd_ok(oop_source *lp, oop_read *oread, oop_rd_event ev,
PEERBADMSG("peer timed us out or stopped accepting articles");
LIST_REMOVE(conns,conn);
PEERBADMSG("peer timed us out or stopped accepting articles");
LIST_REMOVE(conns,conn);
- notice("C%d[%d] idle connection closed by peer", conns.count, conn->fd);
+ notice("C%d (now %d) idle connection closed by peer",
+ conns.count, conn->fd);
conn_dispose(conn);
return OOP_CONTINUE;
conn_dispose(conn);
return OOP_CONTINUE;