dovecot-2.2: login proxy: Stop proxy_timeout only after successf...

dovecot at dovecot.org dovecot at dovecot.org
Thu Mar 21 23:51:27 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/a4ea6946c621
changeset: 16085:a4ea6946c621
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Mar 21 23:50:53 2013 +0200
description:
login proxy: Stop proxy_timeout only after successfully logged in (not after connected).

diffstat:

 src/login-common/login-proxy.c |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (55 lines):

diff -r 38774adaddaf -r a4ea6946c621 src/login-common/login-proxy.c
--- a/src/login-common/login-proxy.c	Thu Mar 21 14:48:33 2013 +0200
+++ b/src/login-common/login-proxy.c	Thu Mar 21 23:50:53 2013 +0200
@@ -48,6 +48,7 @@
 
 	proxy_callback_t *callback;
 
+	unsigned int connected:1;
 	unsigned int destroying:1;
 	unsigned int disconnecting:1;
 };
@@ -202,9 +203,15 @@
 	struct ip_addr local_ip;
 	unsigned int local_port;
 
-	str_printfa(str, "proxy(%s): connect(%s, %u) failed: %m (after %u secs",
-		    proxy->client->virtual_user,
-		    proxy->host, proxy->port,
+	str_printfa(str, "proxy(%s): ", proxy->client->virtual_user);
+	if (!proxy->connected) {
+		str_printfa(str, "connect(%s, %u) failed: %m",
+			    proxy->host, proxy->port);
+	} else {
+		str_printfa(str, "Login for %s:%u timed out",
+			    proxy->host, proxy->port);
+	}
+	str_printfa(str, " (after %u secs",
 		    (unsigned int)(ioloop_time - proxy->created.tv_sec));
 
 	if (proxy->server_fd != -1 &&
@@ -226,13 +233,11 @@
                 login_proxy_free(&proxy);
 		return;
 	}
+	proxy->connected = TRUE;
 	proxy->state_rec->last_success = ioloop_timeval;
 	proxy->state_rec->num_waiting_connections--;
 	proxy->state_rec = NULL;
 
-	if (proxy->to != NULL)
-		timeout_remove(&proxy->to);
-
 	if ((proxy->ssl_flags & PROXY_SSL_FLAG_YES) != 0 &&
 	    (proxy->ssl_flags & PROXY_SSL_FLAG_STARTTLS) == 0) {
 		if (login_proxy_starttls(proxy) < 0) {
@@ -464,6 +469,9 @@
 	i_assert(proxy->client_fd == -1);
 	i_assert(proxy->server_output != NULL);
 
+	if (proxy->to != NULL)
+		timeout_remove(&proxy->to);
+
 	proxy->client_fd = i_stream_get_fd(client->input);
 	proxy->client_output = client->output;
 


More information about the dovecot-cvs mailing list