dovecot-2.2: login proxy: Added asserts to track that num_waitin...
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/c98fbc17fa4e
changeset: 19086:c98fbc17fa4e
user: Timo Sirainen <tss at iki.fi>
date: Fri Sep 04 01:18:04 2015 +0300
description:
login proxy: Added asserts to track that num_waiting_connections are correct.
diffstat:
src/login-common/login-proxy-state.c | 8 ++++++++
src/login-common/login-proxy.c | 6 +++++-
2 files changed, 13 insertions(+), 1 deletions(-)
diffs (52 lines):
diff -r 6b901abc1819 -r c98fbc17fa4e src/login-common/login-proxy-state.c
--- a/src/login-common/login-proxy-state.c Fri Sep 04 01:10:29 2015 +0300
+++ b/src/login-common/login-proxy-state.c Fri Sep 04 01:18:04 2015 +0300
@@ -66,9 +66,17 @@
void login_proxy_state_deinit(struct login_proxy_state **_state)
{
struct login_proxy_state *state = *_state;
+ struct hash_iterate_context *iter;
+ struct login_proxy_record *rec;
*_state = NULL;
+ /* sanity check: */
+ iter = hash_table_iterate_init(state->hash);
+ while (hash_table_iterate(iter, state->hash, &rec, &rec))
+ i_assert(rec->num_waiting_connections == 0);
+ hash_table_iterate_deinit(&iter);
+
if (state->to_reopen != NULL)
timeout_remove(&state->to_reopen);
login_proxy_state_close(state);
diff -r 6b901abc1819 -r c98fbc17fa4e src/login-common/login-proxy.c
--- a/src/login-common/login-proxy.c Fri Sep 04 01:10:29 2015 +0300
+++ b/src/login-common/login-proxy.c Fri Sep 04 01:18:04 2015 +0300
@@ -202,6 +202,7 @@
} else {
proxy->state_rec->last_failure = ioloop_timeval;
}
+ i_assert(proxy->state_rec->num_waiting_connections > 0);
proxy->state_rec->num_waiting_connections--;
proxy->state_rec = NULL;
}
@@ -278,6 +279,7 @@
}
proxy->connected = 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;
@@ -399,8 +401,10 @@
if (proxy->to_notify != NULL)
timeout_remove(&proxy->to_notify);
- if (proxy->state_rec != NULL)
+ if (proxy->state_rec != NULL) {
+ i_assert(proxy->state_rec->num_waiting_connections > 0);
proxy->state_rec->num_waiting_connections--;
+ }
if (proxy->server_io != NULL)
io_remove(&proxy->server_io);
More information about the dovecot-cvs
mailing list