From a2a74dfaf7edbe93c39a6ee8b2d52e3c11f64300 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 8 May 2010 14:45:05 +0100 Subject: [PATCH] Do not assume that loop->on_fd is idempotent --- backends/innduct.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- 2.30.2