Mercurial > dovecot > core-2.2
diff src/doveadm/dsync/dsync-brain.c @ 15464:af3b86a16ac3
dsync: Added debugging and rawlogging support.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 14 Dec 2012 11:20:04 +0200 |
parents | b52f4852e5f8 |
children | 05d83c4df130 |
line wrap: on
line diff
--- a/src/doveadm/dsync/dsync-brain.c Fri Dec 14 11:17:19 2012 +0200 +++ b/src/doveadm/dsync/dsync-brain.c Fri Dec 14 11:20:04 2012 +0200 @@ -8,6 +8,20 @@ #include "dsync-ibc.h" #include "dsync-brain-private.h" +static const char *dsync_state_names[DSYNC_STATE_DONE+1] = { + "recv_handshake", + "send_last_common", + "recv_last_common", + "send_mailbox_tree", + "send_mailbox_tree_deletes", + "recv_mailbox_tree", + "recv_mailbox_tree_deletes", + "master_send_mailbox", + "slave_recv_mailbox", + "sync_mails", + "done" +}; + static void dsync_brain_run_io(void *context) { struct dsync_brain *brain = context; @@ -62,6 +76,7 @@ (flags & DSYNC_BRAIN_FLAG_MAILS_HAVE_GUIDS) != 0; brain->backup_send = (flags & DSYNC_BRAIN_FLAG_BACKUP_SEND) != 0; brain->backup_recv = (flags & DSYNC_BRAIN_FLAG_BACKUP_RECV) != 0; + brain->debug = (flags & DSYNC_BRAIN_FLAG_DEBUG) != 0; } struct dsync_brain * @@ -244,6 +259,10 @@ if (brain->failed) return FALSE; + if (brain->debug) { + i_debug("brain %c: in state=%s", brain->master_brain ? 'M' : 'S', + dsync_state_names[brain->state]); + } switch (brain->state) { case DSYNC_STATE_SLAVE_RECV_HANDSHAKE: changed = dsync_brain_slave_recv_handshake(brain); @@ -284,6 +303,11 @@ ret = FALSE; break; } + if (brain->debug) { + i_debug("brain %c: out state=%s changed=%d", + brain->master_brain ? 'M' : 'S', + dsync_state_names[brain->state], changed); + } *changed_r = changed; return brain->failed ? FALSE : ret;