Mercurial > dovecot > core-2.2
changeset 15463:f9e8cbb2792d
dsync: Fixed hangs with remote dsyncing
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 14 Dec 2012 11:17:19 +0200 |
parents | b1267f135417 |
children | af3b86a16ac3 |
files | src/doveadm/dsync/dsync-ibc-stream.c |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/dsync/dsync-ibc-stream.c Thu Dec 13 12:24:32 2012 +0200 +++ b/src/doveadm/dsync/dsync-ibc-stream.c Fri Dec 14 11:17:19 2012 +0200 @@ -143,7 +143,11 @@ static int dsync_ibc_stream_read_mail_stream(struct dsync_ibc_stream *ibc) { - if (i_stream_read(ibc->mail_input) < 0) { + while (i_stream_read(ibc->mail_input) > 0) { + i_stream_skip(ibc->mail_input, + i_stream_get_data_size(ibc->mail_input)); + } + if (ibc->mail_input->eof) { if (ibc->mail_input->stream_errno != 0) { errno = ibc->mail_input->stream_errno; i_error("dsync(%s): read() failed: %m", ibc->name); @@ -153,10 +157,10 @@ /* finished reading the mail stream */ i_assert(ibc->mail_input->eof); i_stream_seek(ibc->mail_input, 0); + ibc->has_pending_data = TRUE; ibc->mail_input = NULL; return 1; } - i_stream_skip(ibc->mail_input, i_stream_get_data_size(ibc->mail_input)); return 0; }