On Wed, 2005-05-25 at 11:03 +0200, Jens Laas wrote:
(05.05.24 kl.20:39) Timo Sirainen skrev följande till Jens Laas:
On 24.5.2005, at 14:42, Jens Laas wrote:
No luck :(
Debug patch please :)
Here's one, writes to /tmp/dovecot* files
Debug output attached.
OK, I was on the right track, but didn't think that calling client_input() in client_output() could break it. This should fix it: Index: src/lib/ostream-file.c =================================================================== RCS file: /var/lib/cvs/dovecot/src/lib/ostream-file.c,v retrieving revision 1.48 diff -u -r1.48 ostream-file.c --- src/lib/ostream-file.c 26 Apr 2005 11:08:16 -0000 1.48 +++ src/lib/ostream-file.c 25 May 2005 11:37:50 -0000 @@ -349,6 +349,12 @@ 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); @@ -360,7 +366,8 @@ io_remove(fstream->io); fstream->io = NULL; } - fstream->flush_pending = ret <= 0; + if (ret == 0) + fstream->flush_pending = TRUE; o_stream_unref(&fstream->ostream.ostream); }