dovecot-2.0: doveadm director: Give up waiting for handshake aft...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jul 19 21:05:40 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/be3663900ea8
changeset: 11860:be3663900ea8
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jul 19 19:05:36 2010 +0100
description:
doveadm director: Give up waiting for handshake after 5 seconds.

diffstat:

 src/doveadm/doveadm-director.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (25 lines):

diff -r f178792fb820 -r be3663900ea8 src/doveadm/doveadm-director.c
--- a/src/doveadm/doveadm-director.c	Mon Jul 19 17:37:55 2010 +0100
+++ b/src/doveadm/doveadm-director.c	Mon Jul 19 19:05:36 2010 +0100
@@ -50,9 +50,19 @@
 	ctx->input = i_stream_create_fd(fd, (size_t)-1, TRUE);
 	director_send(ctx, DIRECTOR_HANDSHAKE);
 
+	alarm(5);
 	line = i_stream_read_next_line(ctx->input);
-	if (line == NULL)
-		i_fatal("%s disconnected", ctx->socket_path);
+	alarm(0);
+	if (line == NULL) {
+		if (ctx->input->stream_errno != 0)
+			i_fatal("read(%s) failed: %m", ctx->socket_path);
+		else if (ctx->input->eof)
+			i_fatal("%s disconnected", ctx->socket_path);
+		else {
+			i_fatal("read(%s) timed out (is director configured?)",
+				ctx->socket_path);
+		}
+	}
 	if (!version_string_verify(line, "director-doveadm", 1)) {
 		i_fatal("%s not a compatible director-doveadm socket",
 			ctx->socket_path);


More information about the dovecot-cvs mailing list