Mercurial > dovecot > core-2.2
diff src/doveadm/dsync/dsync-ibc-stream.c @ 15594:5bb80a6491eb
dsync: Fixes to handling output stream buffering.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 08 Jan 2013 07:43:29 +0200 |
parents | 0949ddc3a892 |
children | 40dd9a080b6e |
line wrap: on
line diff
--- a/src/doveadm/dsync/dsync-ibc-stream.c Tue Jan 08 07:42:38 2013 +0200 +++ b/src/doveadm/dsync/dsync-ibc-stream.c Tue Jan 08 07:43:29 2013 +0200 @@ -170,7 +170,9 @@ if (dsync_ibc_stream_read_mail_stream(ibc) == 0) return; } + o_stream_cork(ibc->output); ibc->ibc.io_callback(ibc->ibc.io_context); + o_stream_uncork(ibc->output); } static int dsync_ibc_stream_send_mail_stream(struct dsync_ibc_stream *ibc) @@ -295,8 +297,7 @@ } } T_END; o_stream_nsend_str(ibc->output, ".\n"); - - dsync_ibc_flush(&ibc->ibc); + o_stream_uncork(ibc->output); } static void dsync_ibc_stream_deinit(struct dsync_ibc *_ibc) @@ -1390,11 +1391,7 @@ ibc->mail_output_last = '\0'; ibc->mail_output = mail->input; i_stream_ref(ibc->mail_output); - if (dsync_ibc_stream_send_mail_stream(ibc) == 0) { - /* flush callback isn't being called while output - stream is corked */ - o_stream_uncork(ibc->output); - } + (void)dsync_ibc_stream_send_mail_stream(ibc); } } @@ -1492,15 +1489,6 @@ return DSYNC_IBC_RECV_RET_OK; } -static void dsync_ibc_stream_flush(struct dsync_ibc *_ibc) -{ - struct dsync_ibc_stream *ibc = (struct dsync_ibc_stream *)_ibc; - - o_stream_uncork(ibc->output); - if (ibc->mail_output == NULL) - o_stream_cork(ibc->output); -} - static bool dsync_ibc_stream_is_send_queue_full(struct dsync_ibc *_ibc) { struct dsync_ibc_stream *ibc = (struct dsync_ibc_stream *)_ibc; @@ -1543,7 +1531,6 @@ dsync_ibc_stream_recv_mail_request, dsync_ibc_stream_send_mail, dsync_ibc_stream_recv_mail, - dsync_ibc_stream_flush, dsync_ibc_stream_is_send_queue_full, dsync_ibc_stream_has_pending_data };