MINOR: lbprm: Add method to deinit server and proxy

Add two new methods to lbprm, server_deinit() and proxy_deinit(),
in case something should be done at the lbprm level when
removing servers and proxies.
This commit is contained in:
Olivier Houchard 2025-03-25 16:24:46 +00:00 committed by Olivier Houchard
parent 17059098e7
commit 2a9436f96b
3 changed files with 8 additions and 0 deletions

View File

@ -181,6 +181,8 @@ struct lbprm {
void (*server_take_conn)(struct server *); /* to be called when connection is assigned */
void (*server_drop_conn)(struct server *); /* to be called when connection is dropped */
void (*server_requeue)(struct server *); /* function used to place the server where it must be */
void (*proxy_deinit)(struct proxy *); /* to be called when we're destroying the proxy */
void (*server_deinit)(struct server *); /* to be called when we're destroying the server */
};
#endif /* _HAPROXY_BACKEND_T_H */

View File

@ -372,6 +372,9 @@ void free_proxy(struct proxy *p)
*/
srv_free_params(&p->defsrv);
if (p->lbprm.proxy_deinit)
p->lbprm.proxy_deinit(p);
list_for_each_entry_safe(l, l_next, &p->conf.listeners, by_fe) {
guid_remove(&l->guid);
LIST_DELETE(&l->by_fe);

View File

@ -3114,6 +3114,9 @@ struct server *srv_drop(struct server *srv)
EXTRA_COUNTERS_FREE(srv->extra_counters);
if (srv->proxy->lbprm.server_deinit)
srv->proxy->lbprm.server_deinit(srv);
ha_free(&srv);
end: