]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: Remove cached line from global server-state tree when found
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 16 Feb 2021 08:58:01 +0000 (09:58 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 25 Feb 2021 09:02:39 +0000 (10:02 +0100)
When a server for a given backend is found in the tree containing all lines
of the global server-state file, the node is removed from the tree. It is
useless to keep it longer. It is a small improvement, but it may also be
usefull to track the orphan lines (not used for now).

src/server.c

index 245451baf4802122ec70580183c7c9a00ac2ea30..38356030d5782c30be821e5559eb15896b38214c 100644 (file)
@@ -3327,6 +3327,11 @@ void apply_server_state(void)
                                        continue; /* next server */
                                st_line = eb64_entry(node, typeof(*st_line), node);
                                srv_update_state(srv, global_vsn, st_line->params+4);
+
+                               /* the node may be released now */
+                               eb64_delete(node);
+                               free(st_line->line);
+                               free(st_line);
                        }
 
                        continue; /* next proxy */