]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: lua: set a dummy file name and line number on the dummy servers
authorWilly Tarreau <w@1wt.eu>
Fri, 5 Mar 2021 09:41:48 +0000 (10:41 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 5 Mar 2021 14:00:24 +0000 (15:00 +0100)
The "socket_tcp" and "socket_ssl" servers had no config file name nor
line number, but this is sometimes annoying during debugging or later
in error messages, while all other places using new_server() or
parse_server() make sure to have a valid file:line set. Let's set
something to address this.

src/hlua.c

index 857e8856afa9605da904e950a55e9337d07a5c73..52c429506901a631ce6b713180689e5a0a901b2e 100644 (file)
@@ -9181,6 +9181,8 @@ void hlua_init(void) {
        socket_tcp.safe_conns_tree = NULL;
        socket_tcp.next_state = SRV_ST_RUNNING; /* early server setup */
        socket_tcp.last_change = 0;
+       socket_tcp.conf.file = strdup("HLUA_INTERNAL");
+       socket_tcp.conf.line = 1;
        socket_tcp.id = "LUA-TCP-CONN";
        socket_tcp.check.state &= ~CHK_ST_ENABLED; /* Disable health checks. */
        socket_tcp.agent.state &= ~CHK_ST_ENABLED; /* Disable health checks. */
@@ -9226,6 +9228,8 @@ void hlua_init(void) {
        socket_ssl.safe_conns_tree = NULL;
        socket_ssl.next_state = SRV_ST_RUNNING; /* early server setup */
        socket_ssl.last_change = 0;
+       socket_ssl.conf.file = strdup("HLUA_INTERNAL");
+       socket_ssl.conf.line = 2;
        socket_ssl.id = "LUA-SSL-CONN";
        socket_ssl.check.state &= ~CHK_ST_ENABLED; /* Disable health checks. */
        socket_ssl.agent.state &= ~CHK_ST_ENABLED; /* Disable health checks. */
@@ -9290,6 +9294,10 @@ static void hlua_deinit()
                if (hlua_states[thr])
                        lua_close(hlua_states[thr]);
        }
+       ha_free((char**)&socket_tcp.conf.file);
+#ifdef USE_OPENSSL
+       ha_free((char**)&socket_ssl.conf.file);
+#endif
 }
 
 REGISTER_POST_DEINIT(hlua_deinit);