dovecot-2.2: dsync: When initializing via doveadm-server, change...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 23 16:20:56 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/98d3020ea144
changeset: 17251:98d3020ea144
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 23 19:20:23 2014 +0300
description:
dsync: When initializing via doveadm-server, change the iostream buffer sizes to unlimited.

diffstat:

 src/doveadm/dsync/doveadm-dsync.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r 6abe16ff8108 -r 98d3020ea144 src/doveadm/dsync/doveadm-dsync.c
--- a/src/doveadm/dsync/doveadm-dsync.c	Wed Apr 23 19:19:24 2014 +0300
+++ b/src/doveadm/dsync/doveadm-dsync.c	Wed Apr 23 19:20:23 2014 +0300
@@ -69,6 +69,7 @@
 	struct io *io_err;
 	struct istream *input, *err_stream;
 	struct ostream *output;
+	size_t input_orig_bufsize, output_orig_bufsize;
 
 	struct ssl_iostream_context *ssl_ctx;
 	struct ssl_iostream *ssl_iostream;
@@ -462,6 +463,11 @@
 		fd_set_nonblock(ctx->fd_out, TRUE);
 		ctx->input = i_stream_create_fd(ctx->fd_in, (size_t)-1, FALSE);
 		ctx->output = o_stream_create_fd(ctx->fd_out, (size_t)-1, FALSE);
+	} else {
+		ctx->input_orig_bufsize = i_stream_get_max_buffer_size(ctx->input);
+		ctx->output_orig_bufsize = o_stream_get_max_buffer_size(ctx->output);
+		i_stream_set_max_buffer_size(ctx->input, (size_t)-1);
+		o_stream_set_max_buffer_size(ctx->output, (size_t)-1);
 	}
 	if (ctx->rawlog_path != NULL) {
 		iostream_rawlog_create_path(ctx->rawlog_path,
@@ -615,10 +621,14 @@
 		ssl_iostream_destroy(&ctx->ssl_iostream);
 	if (ctx->ssl_ctx != NULL)
 		ssl_iostream_context_deinit(&ctx->ssl_ctx);
-	if (ctx->input != NULL)
+	if (ctx->input != NULL) {
+		i_stream_set_max_buffer_size(ctx->input, ctx->input_orig_bufsize);
 		i_stream_unref(&ctx->input);
-	if (ctx->output != NULL)
+	}
+	if (ctx->output != NULL) {
+		o_stream_set_max_buffer_size(ctx->output, ctx->output_orig_bufsize);
 		o_stream_unref(&ctx->output);
+	}
 	if (ctx->fd_in != -1) {
 		if (ctx->fd_out != ctx->fd_in)
 			i_close_fd(&ctx->fd_out);


More information about the dovecot-cvs mailing list