]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: init: completely deallocate unused peers
authorWilly Tarreau <w@1wt.eu>
Mon, 28 Sep 2015 14:39:25 +0000 (16:39 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 28 Sep 2015 14:43:48 +0000 (16:43 +0200)
When peers are stopped due to not being running on the appropriate
process, we want to completely release them and unregister their signals
and task in order to ensure there's no way they may be called in the
future.

Note: ideally we should have a list of all tables attached to a peers
section being disabled in order to unregister them and void their
sync_task. It doesn't appear to be *that* easy for now.

src/haproxy.c

index 12269324864e24901a66f9d1725435bd6363c511..ebc7177140ed2b40274d51738c0b5c62060e1fa6 100644 (file)
@@ -1858,6 +1858,12 @@ int main(int argc, char **argv)
 
                        stop_proxy(curpeers->peers_fe);
                        /* disable this peer section so that it kills itself */
+                       signal_unregister_handler(curpeers->sighandler);
+                       task_delete(curpeers->sync_task);
+                       task_free(curpeers->sync_task);
+                       curpeers->sync_task = NULL;
+                       task_free(curpeers->peers_fe->task);
+                       curpeers->peers_fe->task = NULL;
                        curpeers->peers_fe = NULL;
                }