dovecot-2.1: director: Fixed handling weak users when there were...
dovecot at dovecot.org
dovecot at dovecot.org
Thu May 8 14:56:18 UTC 2014
details: http://hg.dovecot.org/dovecot-2.1/rev/89c0689ab00b
changeset: 15017:89c0689ab00b
user: Timo Sirainen <tss at iki.fi>
date: Wed Apr 23 23:26:49 2014 +0300
description:
director: Fixed handling weak users when there were exactly 2 director servers in the ring.
diffstat:
src/director/director-connection.c | 2 +-
src/director/director-request.c | 2 +-
src/director/director.c | 26 +++++++++++++++++++++++---
src/director/director.h | 1 +
4 files changed, 26 insertions(+), 5 deletions(-)
diffs (82 lines):
diff -r 5162c2051642 -r 89c0689ab00b src/director/director-connection.c
--- a/src/director/director-connection.c Thu May 08 11:29:34 2014 +0300
+++ b/src/director/director-connection.c Wed Apr 23 23:26:49 2014 +0300
@@ -798,7 +798,7 @@
if (!user->weak)
director_update_user(conn->dir, src_host, user);
else {
- director_update_user_weak(conn->dir, src_host,
+ director_update_user_weak(conn->dir, src_host, conn,
dir_host, user);
}
}
diff -r 5162c2051642 -r 89c0689ab00b src/director/director-request.c
--- a/src/director/director-request.c Thu May 08 11:29:34 2014 +0300
+++ b/src/director/director-request.c Wed Apr 23 23:26:49 2014 +0300
@@ -241,7 +241,7 @@
return TRUE;
} else {
user->weak = TRUE;
- director_update_user_weak(dir, dir->self_host, NULL, user);
+ director_update_user_weak(dir, dir->self_host, NULL, NULL, user);
request->delay_reason = REQUEST_DELAY_WEAK;
dir_debug("request: %u set to weak", request->username_hash);
return FALSE;
diff -r 5162c2051642 -r 89c0689ab00b src/director/director.c
--- a/src/director/director.c Thu May 08 11:29:34 2014 +0300
+++ b/src/director/director.c Wed Apr 23 23:26:49 2014 +0300
@@ -566,9 +566,12 @@
}
void director_update_user_weak(struct director *dir, struct director_host *src,
+ struct director_connection *src_conn,
struct director_host *orig_src,
struct user *user)
{
+ const char *cmd;
+
i_assert(src != NULL);
i_assert(user->weak);
@@ -577,10 +580,27 @@
orig_src->last_seq++;
}
- director_update_send(dir, src, t_strdup_printf(
- "USER-WEAK\t%s\t%u\t%u\t%u\t%s\n",
+ cmd = t_strdup_printf("USER-WEAK\t%s\t%u\t%u\t%u\t%s\n",
net_ip2addr(&orig_src->ip), orig_src->port, orig_src->last_seq,
- user->username_hash, net_ip2addr(&user->host->ip)));
+ user->username_hash, net_ip2addr(&user->host->ip));
+
+ if (src != dir->self_host && dir->left != NULL && dir->right != NULL &&
+ director_connection_get_host(dir->left) ==
+ director_connection_get_host(dir->right)) {
+ /* only two directors in this ring and we're forwarding
+ USER-WEAK from one director back to itself via another
+ so it sees we've received it. we can't use
+ director_update_send() for this, because it doesn't send
+ data back to the source. */
+ if (dir->right == src_conn)
+ director_connection_send(dir->left, cmd);
+ else if (dir->left == src_conn)
+ director_connection_send(dir->right, cmd);
+ else
+ i_unreached();
+ } else {
+ director_update_send(dir, src, cmd);
+ }
}
struct director_user_kill_finish_ctx {
diff -r 5162c2051642 -r 89c0689ab00b src/director/director.h
--- a/src/director/director.h Thu May 08 11:29:34 2014 +0300
+++ b/src/director/director.h Wed Apr 23 23:26:49 2014 +0300
@@ -124,6 +124,7 @@
void director_update_user(struct director *dir, struct director_host *src,
struct user *user);
void director_update_user_weak(struct director *dir, struct director_host *src,
+ struct director_connection *src_conn,
struct director_host *orig_src,
struct user *user);
void director_move_user(struct director *dir, struct director_host *src,
More information about the dovecot-cvs
mailing list