dovecot-2.0: director: Fixed finding the director's own IP in ca...

dovecot at dovecot.org dovecot at dovecot.org
Wed May 19 19:14:56 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/ed633bfb8c59
changeset: 11339:ed633bfb8c59
user:      Timo Sirainen <tss at iki.fi>
date:      Wed May 19 18:14:53 2010 +0200
description:
director: Fixed finding the director's own IP in case system has multiple.

diffstat:

 src/director/director.c |  15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diffs (37 lines):

diff -r 098f517e902c -r ed633bfb8c59 src/director/director.c
--- a/src/director/director.c	Wed May 19 17:46:06 2010 +0200
+++ b/src/director/director.c	Wed May 19 18:14:53 2010 +0200
@@ -35,16 +35,14 @@
 
 	hosts = array_get(&dir->dir_hosts, &count);
 	for (i = 0; i < count; i++) {
-		fd = net_connect_ip(&hosts[i]->ip, hosts[i]->port, NULL);
+		fd = net_connect_ip(&hosts[i]->ip, hosts[i]->port,
+				    &hosts[i]->ip);
 		if (fd != -1)
 			break;
 	}
 
-	if (fd == -1) {
-		i_fatal("Couldn't connect to any servers listed in "
-			"director_servers (we should have been able to "
-			"connect at least to ourself)");
-	}
+	if (fd == -1)
+		i_fatal("director_servers doesn't list ourself");
 
 	if (net_getsockname(fd, &dir->self_ip, NULL) < 0)
 		i_fatal("getsockname() failed: %m");
@@ -56,11 +54,8 @@
 	if (dir->self_host != NULL)
 		return;
 
-	if (!director_is_self_ip_set(dir)) {
-		/* our IP isn't known yet. have to connect to some other
-		   server before we know it. */
+	if (!director_is_self_ip_set(dir))
 		director_find_self_ip(dir);
-	}
 
 	dir->self_host = director_host_lookup(dir, &dir->self_ip,
 					      dir->self_port);


More information about the dovecot-cvs mailing list