From: Timo Sirainen Date: Fri, 30 Oct 2009 17:52:24 +0000 (-0400) Subject: dsync: Message bodies were saved only partially. X-Git-Tag: 2.0.alpha3~59 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=64d157a0e296788fe99f5dd04cf73c8cbdc44bd7;p=thirdparty%2Fdovecot%2Fcore.git dsync: Message bodies were saved only partially. --HG-- branch : HEAD --- diff --git a/src/dsync/dsync-brain-msgs-new.c b/src/dsync/dsync-brain-msgs-new.c index d09de600d9..c11023ea6f 100644 --- a/src/dsync/dsync-brain-msgs-new.c +++ b/src/dsync/dsync-brain-msgs-new.c @@ -26,19 +26,11 @@ static void msg_get_callback(enum dsync_msg_get_result result, { struct dsync_brain_msg_save_context *ctx = context; struct istream *input; - const unsigned char *idata; - size_t size; switch (result) { case DSYNC_MSG_GET_RESULT_SUCCESS: input = data->input; dsync_worker_msg_save(ctx->iter->worker, ctx->msg, data); - - /* if input is coming from proxy, we'll need to read the input - until EOF or we'll start treating the input as commands. - make sure saving read everything. */ - while ((i_stream_read_data(input, &idata, &size, 0)) > 0) - i_stream_skip(input, size); i_stream_unref(&input); break; case DSYNC_MSG_GET_RESULT_EXPUNGED: diff --git a/src/dsync/dsync-proxy-client.c b/src/dsync/dsync-proxy-client.c index 8c9c64814b..940ce2438a 100644 --- a/src/dsync/dsync-proxy-client.c +++ b/src/dsync/dsync-proxy-client.c @@ -101,11 +101,20 @@ proxy_client_worker_read_line(struct proxy_client_dsync_worker *worker, static void proxy_client_worker_msg_get_done(struct proxy_client_dsync_worker *worker) { + struct istream *input = worker->msg_get_data.input; + const unsigned char *data; + size_t size; + i_assert(worker->io == NULL); worker->msg_get_data.input = NULL; worker->io = io_add(worker->fd_in, IO_READ, proxy_client_worker_input, worker); + + /* we'll need to read the input until EOF or we'll start treating the + input as commands. make sure saving read everything. */ + while ((i_stream_read_data(input, &data, &size, 0)) > 0) + i_stream_skip(input, size); } static bool