On 27.5.2005, at 09:15, Jens Laas wrote:
OK, I was on the right track, but didn't think that calling client_input() in client_output() could break it.
Still no luck.
Well, one more fix :) This is the only patch you need: diff -u -r1.48 -r1.50 --- ostream-file.c 26 Apr 2005 11:08:16 -0000 1.48 +++ ostream-file.c 28 May 2005 11:31:19 -0000 1.50 @@ -349,18 +349,27 @@ struct file_ostream *fstream = context; int ret; + /* Set flush_pending = FALSE first before calling the flush callback, + and change it to TRUE only if callback returns 0. That way the + callback can call o_stream_set_flush_pending() again and we don't + forget it even if flush callback returns 1. */ + fstream->flush_pending = FALSE; + o_stream_ref(&fstream->ostream.ostream); if (fstream->ostream.callback != NULL) ret = fstream->ostream.callback(fstream->ostream.context); else ret = _flush(&fstream->ostream); - if (ret > 0 && IS_STREAM_EMPTY(fstream) && fstream->io != NULL) { + if (ret == 0) + fstream->flush_pending = TRUE; + + if (!fstream->flush_pending && + IS_STREAM_EMPTY(fstream) && fstream->io != NULL) { /* all sent */ io_remove(fstream->io); fstream->io = NULL; } - fstream->flush_pending = ret <= 0; o_stream_unref(&fstream->ostream.ostream); }