]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: peers: unregister peers that were never started
authorWilly Tarreau <w@1wt.eu>
Fri, 1 May 2015 16:32:13 +0000 (18:32 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 May 2015 18:16:31 +0000 (20:16 +0200)
The peers initialization sequence is a bit complex, they're attached
to stick-tables and initialized very early in the boot process. When
we fork, if some must not start, it's too late to find them. Instead,
simply add a guard in their respective tasks to stop them once they
want to start.

src/peers.c

index d39898a5746f6cfacaa4fecdf0719c6fc6dcee66..59f934d780e5500bd8a9324790193c22d3e276fa 100644 (file)
@@ -1204,6 +1204,15 @@ static struct task *process_peer_sync(struct task * task)
 
        task->expire = TICK_ETERNITY;
 
+       if (!st->sessions->peer->peers->peers_fe) {
+               /* this one was never started, kill it */
+               signal_unregister_handler(st->sighandler);
+               st->table->sync_task = NULL;
+               task_delete(st->sync_task);
+               task_free(st->sync_task);
+               return NULL;
+       }
+
        if (!stopping) {
                /* Normal case (not soft stop)*/
                if (((st->flags & SHTABLE_RESYNC_STATEMASK) == SHTABLE_RESYNC_FROMLOCAL) &&