Mercurial > dovecot > original-hg > dovecot-1.2
changeset 3392:e8c0736ec5be HEAD
Don't forget o_stream_set_flush_pending() call if it's called in flush
callback which returns 1.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 25 May 2005 14:39:57 +0300 |
parents | d01de9d362c1 |
children | 2e7359e17b4c |
files | src/lib/ostream-file.c |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/ostream-file.c Tue May 24 01:40:39 2005 +0300 +++ b/src/lib/ostream-file.c Wed May 25 14:39:57 2005 +0300 @@ -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); }