dovecot-2.1: director: If user's weak-flag appears to have gotte...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 22 15:29:38 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/7352d48b4071
changeset: 14777:7352d48b4071
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 22 15:29:27 2012 +0300
description:
director: If user's weak-flag appears to have gotten stuck, unset it.

diffstat:

 src/director/director-request.c |   7 +++++++
 src/director/user-directory.c   |  17 ++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletions(-)

diffs (44 lines):

diff -r 10fae591707c -r 7352d48b4071 src/director/director-request.c
--- a/src/director/director-request.c	Mon Oct 22 15:23:25 2012 +0300
+++ b/src/director/director-request.c	Mon Oct 22 15:29:27 2012 +0300
@@ -91,6 +91,13 @@
 					     request->username_hash);
 		errormsg = director_request_get_timeout_error(request,
 							      user, str);
+		if (user != NULL &&
+		    request->delay_reason == REQUEST_DELAY_WEAK) {
+			/* weakness appears to have gotten stuck. this is a
+			   bug, but try to fix it for future requests by
+			   removing the weakness. */
+			user->weak = FALSE;
+		}
 
 		array_delete(&dir->pending_requests, 0, 1);
 		T_BEGIN {
diff -r 10fae591707c -r 7352d48b4071 src/director/user-directory.c
--- a/src/director/user-directory.c	Mon Oct 22 15:23:25 2012 +0300
+++ b/src/director/user-directory.c	Mon Oct 22 15:29:27 2012 +0300
@@ -65,7 +65,22 @@
 {
 	time_t expire_timestamp = user->timestamp + dir->timeout_secs;
 
-	return expire_timestamp >= ioloop_time;
+	if (expire_timestamp >= ioloop_time)
+		return TRUE;
+
+	if (user->kill_state != USER_KILL_STATE_NONE) {
+		/* don't free this user until the kill is finished */
+		return TRUE;
+	}
+
+	if (user->weak) {
+		if (expire_timestamp + USER_NEAR_EXPIRING_MAX >= ioloop_time)
+			return TRUE;
+
+		i_warning("User %u weakness appears to be stuck, removing it",
+			  user->username_hash);
+	}
+	return FALSE;
 }
 
 static void user_directory_drop_expired(struct user_directory *dir)


More information about the dovecot-cvs mailing list