unsigned int received_error:1;
unsigned int restart:1;
unsigned int shutdown:1;
+ unsigned int timeout_pending_resume:1;
};
static ARRAY(struct auth_worker_connection *) connections = ARRAY_INIT;
timeout_reset(conn->to);
} else {
conn->request = NULL;
+ conn->timeout_pending_resume = FALSE;
timeout_remove(&conn->to);
conn->to = timeout_add(AUTH_WORKER_MAX_IDLE_SECS * 1000,
auth_worker_idle_timeout, conn);
}
if (!request->callback(line, request->context) && conn->io != NULL) {
+ conn->timeout_pending_resume = FALSE;
timeout_remove(&conn->to);
io_remove(&conn->io);
return FALSE;
static void worker_input_resume(struct auth_worker_connection *conn)
{
+ conn->timeout_pending_resume = FALSE;
timeout_remove(&conn->to);
conn->to = timeout_add(AUTH_WORKER_LOOKUP_TIMEOUT_SECS * 1000,
auth_worker_call_timeout, conn);
{
if (conn->io == NULL)
conn->io = io_add(conn->fd, IO_READ, worker_input, conn);
- if (conn->to != NULL)
- timeout_remove(&conn->to);
- conn->to = timeout_add_short(0, worker_input_resume, conn);
+ if (!conn->timeout_pending_resume) {
+ conn->timeout_pending_resume = TRUE;
+ if (conn->to != NULL)
+ timeout_remove(&conn->to);
+ conn->to = timeout_add_short(0, worker_input_resume, conn);
+ }
}
void auth_worker_server_init(void)