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);
} 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;
}
}
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;
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);