]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: mark servers referenced by LUA script as non purgeable
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 23 Aug 2021 12:06:31 +0000 (14:06 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 25 Aug 2021 13:53:54 +0000 (15:53 +0200)
Each server that is retrieved by a LUA script is marked as non
purgeable. Note that for this to work, the script must have been
executed already once.

src/hlua_fcn.c

index 26aa509842cce9c818b1a8d6ecd015d2fdb8bee8..f7120f23faa01ae9fd6385829055b3aa662f6936 100644 (file)
@@ -910,7 +910,9 @@ int hlua_fcn_new_server(lua_State *L, struct server *srv)
 
 static struct server *hlua_check_server(lua_State *L, int ud)
 {
-       return hlua_checkudata(L, ud, class_server_ref);
+       struct server *srv = hlua_checkudata(L, ud, class_server_ref);
+       srv->flags |= SRV_F_NON_PURGEABLE;
+       return srv;
 }
 
 int hlua_server_get_stats(lua_State *L)