dovecot-2.2: login proxy: Always keep proxy->state_rec available.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Sep 3 22:48:23 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/1a4445b58279
changeset: 19087:1a4445b58279
user: Timo Sirainen <tss at iki.fi>
date: Fri Sep 04 01:21:28 2015 +0300
description:
login proxy: Always keep proxy->state_rec available.
diffstat:
src/login-common/login-proxy.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diffs (69 lines):
diff -r c98fbc17fa4e -r 1a4445b58279 src/login-common/login-proxy.c
--- a/src/login-common/login-proxy.c Fri Sep 04 01:18:04 2015 +0300
+++ b/src/login-common/login-proxy.c Fri Sep 04 01:21:28 2015 +0300
@@ -53,6 +53,7 @@
unsigned int connected:1;
unsigned int destroying:1;
unsigned int disconnecting:1;
+ unsigned int num_waiting_connections_updated:1;
};
static struct login_proxy_state *proxy_state;
@@ -204,7 +205,7 @@
}
i_assert(proxy->state_rec->num_waiting_connections > 0);
proxy->state_rec->num_waiting_connections--;
- proxy->state_rec = NULL;
+ proxy->num_waiting_connections_updated = TRUE;
}
static void
@@ -278,10 +279,10 @@
return;
}
proxy->connected = TRUE;
+ proxy->num_waiting_connections_updated = TRUE;
proxy->state_rec->last_success = ioloop_timeval;
i_assert(proxy->state_rec->num_waiting_connections > 0);
proxy->state_rec->num_waiting_connections--;
- proxy->state_rec = NULL;
if ((proxy->ssl_flags & PROXY_SSL_FLAG_YES) != 0 &&
(proxy->ssl_flags & PROXY_SSL_FLAG_STARTTLS) == 0) {
@@ -306,9 +307,8 @@
static int login_proxy_connect(struct login_proxy *proxy)
{
- struct login_proxy_record *rec;
+ struct login_proxy_record *rec = proxy->state_rec;
- rec = login_proxy_state_get(proxy_state, &proxy->ip, proxy->port);
if (rec->last_success.tv_sec == 0) {
/* first connect to this IP. don't start immediately failing
the check below. */
@@ -339,6 +339,7 @@
proxy_connect_timeout, proxy);
}
+ proxy->num_waiting_connections_updated = FALSE;
proxy->state_rec = rec;
proxy->state_rec->num_waiting_connections++;
return 0;
@@ -375,6 +376,8 @@
proxy->connect_timeout_msecs = set->connect_timeout_msecs;
proxy->notify_refresh_secs = set->notify_refresh_secs;
proxy->ssl_flags = set->ssl_flags;
+ proxy->state_rec = login_proxy_state_get(proxy_state, &proxy->ip,
+ proxy->port);
client_ref(client);
if (set->ip.family == 0 &&
@@ -401,7 +404,7 @@
if (proxy->to_notify != NULL)
timeout_remove(&proxy->to_notify);
- if (proxy->state_rec != NULL) {
+ if (!proxy->num_waiting_connections_updated) {
i_assert(proxy->state_rec->num_waiting_connections > 0);
proxy->state_rec->num_waiting_connections--;
}
More information about the dovecot-cvs
mailing list