dovecot-2.2: dsync: Fixed -U to send the notification on the rem...

dovecot at dovecot.org dovecot at dovecot.org
Sun Apr 7 17:47:31 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/8b13ef2e9569
changeset: 16224:8b13ef2e9569
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Apr 07 17:47:16 2013 +0300
description:
dsync: Fixed -U to send the notification on the remote server, not local.

diffstat:

 src/doveadm/doveadm-settings.c    |   2 +-
 src/doveadm/dsync/doveadm-dsync.c |  20 +++++++++++++-------
 2 files changed, 14 insertions(+), 8 deletions(-)

diffs (84 lines):

diff -r 3c4712bcf473 -r 8b13ef2e9569 src/doveadm/doveadm-settings.c
--- a/src/doveadm/doveadm-settings.c	Sun Apr 07 16:36:00 2013 +0300
+++ b/src/doveadm/doveadm-settings.c	Sun Apr 07 17:47:16 2013 +0300
@@ -81,7 +81,7 @@
 	.doveadm_password = "",
 	.doveadm_allowed_commands = "",
 	.dsync_alt_char = "_",
-	.dsync_remote_cmd = "ssh -l%{login} %{host} doveadm dsync-server -u%u",
+	.dsync_remote_cmd = "ssh -l%{login} %{host} doveadm dsync-server -u%u -U",
 
 	.plugin_envs = ARRAY_INIT
 };
diff -r 3c4712bcf473 -r 8b13ef2e9569 src/doveadm/dsync/doveadm-dsync.c
--- a/src/doveadm/dsync/doveadm-dsync.c	Sun Apr 07 16:36:00 2013 +0300
+++ b/src/doveadm/dsync/doveadm-dsync.c	Sun Apr 07 17:47:16 2013 +0300
@@ -487,7 +487,6 @@
 	struct mail_namespace *sync_ns = NULL;
 	enum dsync_brain_flags brain_flags;
 	bool remote_errors_logged = FALSE;
-	string_t *state_str = NULL;
 	int status = 0, ret = 0;
 
 	user->admin = TRUE;
@@ -539,7 +538,7 @@
 	}
 
 	if (ctx->state_input != NULL) {
-		state_str = t_str_new(128);
+		string_t *state_str = t_str_new(128);
 		dsync_brain_get_state(brain, state_str);
 		doveadm_print(str_c(state_str));
 	}
@@ -581,10 +580,6 @@
 	ctx->input = NULL;
 	ctx->output = NULL;
 
-	if (ctx->replicator_notify) {
-		dsync_replicator_notify(ctx, state_str == NULL ? "" :
-					str_c(state_str));
-	}
 	return ret;
 }
 
@@ -669,6 +664,8 @@
 	str_append_tabescaped(cmd, ctx->ctx.cur_username);
 	str_append(cmd, "\tdsync-server\t-u");
 	str_append_tabescaped(cmd, ctx->ctx.cur_username);
+	if (ctx->replicator_notify)
+		str_append(cmd, "\t-U");
 	str_append_c(cmd, '\n');
 
 	ctx->tcp_conn = conn;
@@ -945,6 +942,12 @@
 		o_stream_close(_ctx->conn->output);
 	}
 
+	if (ctx->replicator_notify) {
+		string_t *state_str = t_str_new(128);
+		dsync_brain_get_state(brain, state_str);
+		dsync_replicator_notify(ctx, str_c(state_str));
+	}
+
 	return _ctx->exit_code == 0 ? 0 : -1;
 }
 
@@ -961,6 +964,9 @@
 	case 'r':
 		ctx->rawlog_path = optarg;
 		break;
+	case 'U':
+		ctx->replicator_notify = TRUE;
+		break;
 	default:
 		return FALSE;
 	}
@@ -972,7 +978,7 @@
 	struct dsync_cmd_context *ctx;
 
 	ctx = doveadm_mail_cmd_alloc(struct dsync_cmd_context);
-	ctx->ctx.getopt_args = "Er:";
+	ctx->ctx.getopt_args = "Er:U";
 	ctx->ctx.v.parse_arg = cmd_mailbox_dsync_server_parse_arg;
 	ctx->ctx.v.run = cmd_dsync_server_run;
 	ctx->sync_type = DSYNC_BRAIN_SYNC_TYPE_CHANGED;


More information about the dovecot-cvs mailing list