From: Willy Tarreau Date: Fri, 5 Mar 2021 09:41:48 +0000 (+0100) Subject: CLEANUP: lua: set a dummy file name and line number on the dummy servers X-Git-Tag: v2.4-dev11~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0f143afe1b3fc71c5ea50118ed6413be55c66b40;p=thirdparty%2Fhaproxy.git CLEANUP: lua: set a dummy file name and line number on the dummy servers 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. --- diff --git a/src/hlua.c b/src/hlua.c index 857e8856af..52c4295069 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -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);