dovecot-2.2: director: Forward DIRECTOR commands to other connec...
dovecot at dovecot.org
dovecot at dovecot.org
Sun May 20 03:26:33 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/1856e9085f94
changeset: 14493:1856e9085f94
user: Timo Sirainen <tss at iki.fi>
date: Fri Apr 20 19:08:25 2012 +0300
description:
director: Forward DIRECTOR commands to other connected directors.
They can use it to realize that the director was restarted and its sequences
start from 1.
diffstat:
src/director/director-connection.c | 29 +++++++++++++++++++++--------
1 files changed, 21 insertions(+), 8 deletions(-)
diffs (49 lines):
diff -r f880cf0efa0a -r 1856e9085f94 src/director/director-connection.c
--- a/src/director/director-connection.c Fri Apr 20 19:05:38 2012 +0300
+++ b/src/director/director-connection.c Fri Apr 20 19:08:25 2012 +0300
@@ -562,24 +562,37 @@
struct director_host *host;
struct ip_addr ip;
unsigned int port;
+ bool forward = FALSE;
if (!director_args_parse_ip_port(conn, args, &ip, &port))
return FALSE;
host = director_host_lookup(conn->dir, &ip, port);
if (host != NULL) {
+ if (host == conn->dir->self_host) {
+ /* ignore updates to ourself */
+ return TRUE;
+ }
+
/* already have this. just reset its last_network_failure
timestamp, since it might be up now. */
host->last_network_failure = 0;
- /* it also may have been restarted, so reset last_seq */
- host->last_seq = 0;
- return TRUE;
+ if (host->last_seq != 0) {
+ /* it also may have been restarted, reset last_seq */
+ host->last_seq = 0;
+ forward = TRUE;
+ }
+ } else {
+ /* save the director and forward it */
+ director_host_add(conn->dir, &ip, port);
+ forward = TRUE;
}
-
- /* save the director and forward it */
- director_host_add(conn->dir, &ip, port);
- director_update_send(conn->dir, director_connection_get_host(conn),
- t_strdup_printf("DIRECTOR\t%s\t%u\n", net_ip2addr(&ip), port));
+ if (forward) {
+ director_update_send(conn->dir,
+ director_connection_get_host(conn),
+ t_strdup_printf("DIRECTOR\t%s\t%u\n",
+ net_ip2addr(&ip), port));
+ }
return TRUE;
}
More information about the dovecot-cvs
mailing list