Mercurial > dovecot > original-hg > dovecot-1.2
changeset 3337:b47043d0d131 HEAD
Try to flush output before uncorking
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 26 Apr 2005 14:08:16 +0300 |
parents | a3a72d5bdfce |
children | e5ce49c8524a |
files | src/lib/ostream-file.c |
diffstat | 1 files changed, 13 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/ostream-file.c Tue Apr 26 13:43:54 2005 +0300 +++ b/src/lib/ostream-file.c Tue Apr 26 14:08:16 2005 +0300 @@ -216,27 +216,26 @@ static void _cork(struct _ostream *stream, int set) { struct file_ostream *fstream = (struct file_ostream *)stream; + int ret; if (fstream->corked != set && !stream->ostream.closed) { + if (set && fstream->io != NULL) { + io_remove(fstream->io); + fstream->io = NULL; + } else if (!set) { + ret = buffer_flush(fstream); + if (fstream->io == NULL && + (ret == 0 || fstream->flush_pending)) { + fstream->io = io_add(fstream->fd, IO_WRITE, + stream_send_io, fstream); + } + } + if (!fstream->no_socket_cork) { if (net_set_cork(fstream->fd, set) < 0) fstream->no_socket_cork = TRUE; } fstream->corked = set; - - if (set && fstream->io != NULL) { - io_remove(fstream->io); - fstream->io = NULL; - } else if (!set) { - if (fstream->file) - buffer_flush(fstream); - else if (fstream->io == NULL && - (!IS_STREAM_EMPTY(fstream) || - fstream->flush_pending)) { - fstream->io = io_add(fstream->fd, IO_WRITE, - stream_send_io, fstream); - } - } } }