X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;ds=sidebyside;f=backends%2Finnduct.c;h=29fe5c10ccdfe294d445269648900fc6edf673df;hb=a2a74dfaf7edbe93c39a6ee8b2d52e3c11f64300;hp=8104fee469826eb8e83f0b0480e3ecdfd35ab660;hpb=d69d12a0e443c2f034a31720e74b40340bc327ff;p=innduct.git diff --git a/backends/innduct.c b/backends/innduct.c index 8104fee..29fe5c1 100644 --- a/backends/innduct.c +++ b/backends/innduct.c @@ -511,6 +511,7 @@ struct Conn { ISNODE(Conn); int fd; /* may be 0, meaning closed (during construction/destruction) */ oop_read *rd; /* likewise */ + int oopwriting; /* since on_fd is not idempotent */ int max_queue, stream; const char *quitting; int since_activity; /* periods */ @@ -1547,12 +1548,16 @@ static void conn_maybe_write(Conn *conn) { conn_make_some_xmits(conn); if (!conn->xmitu) { loop->cancel_fd(loop, conn->fd, OOP_WRITE); + conn->oopwriting= 0; return; } void *rp= conn_write_some_xmits(conn); if (rp==OOP_CONTINUE) { - loop->on_fd(loop, conn->fd, OOP_WRITE, conn_writeable, conn); + if (!conn->oopwriting) { + loop->on_fd(loop, conn->fd, OOP_WRITE, conn_writeable, conn); + conn->oopwriting= 1; + } return; } else if (rp==OOP_HALT) { return;