e_debug(request->event, "handling failure, nodelay=%d",
(int) request->failure_nodelay);
- if (request->failure_nodelay) {
+ if (request->failure_nodelay || shutting_down) {
/* passdb specifically requested not to delay the reply. */
handler->callback(reply, handler->conn);
auth_request_unref(&request);
static unsigned int
auth_request_get_internal_failure_delay(struct auth_request *request)
{
+ if (shutting_down)
+ return 0;
+
unsigned int delay_msecs = request->set->internal_failure_delay;
/* add 0..50% random delay to avoid thundering herd problems */
/* fail it right here and now */
auth_request_fail(ctx->request);
} else if (ctx->type != AUTH_POLICY_CHECK_TYPE_SUCCESS && result > 0 &&
- !ctx->request->fields.no_penalty) {
+ !ctx->request->fields.no_penalty && !shutting_down) {
ctx->request->to_penalty = timeout_add(result * 1000,
auth_request_policy_penalty_finish, context);
} else {
#define AUTH_DNS_IDLE_TIMEOUT_MSECS (1000*60)
#define AUTH_DNS_CACHE_TTL_SECS 10
+bool shutting_down = FALSE;
+
struct event *auth_event;
struct event_category event_category_auth = {
.name = "auth",
struct dns_client *dns_client;
};
+extern bool shutting_down;
struct auth *auth_find_protocol(const char *name);
struct auth *auth_default_protocol(void);
{
struct auth_socket_listener *l;
+ shutting_down = TRUE;
if (auth_penalty != NULL) {
/* cancel all pending anvil penalty lookups */
auth_penalty_deinit(&auth_penalty);