]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: lua: use conn_get_{src,dst} to retrieve connection addresses
authorWilly Tarreau <w@1wt.eu>
Wed, 17 Jul 2019 09:51:35 +0000 (11:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 19 Jul 2019 11:50:09 +0000 (13:50 +0200)
This replaces the previous conn_get_{from,to}_addr() and reuses the
existing error checks.

src/hlua.c

index fe67f045f4a89e3197d33ce5be2d93004ae5e3b3..37d576f0d4b7defce25ad98c4e23e96af106bb47 100644 (file)
@@ -2258,8 +2258,7 @@ __LJMP static int hlua_socket_getpeername(struct lua_State *L)
                return 1;
        }
 
-       conn_get_to_addr(conn);
-       if (!(conn->flags & CO_FL_ADDR_TO_SET)) {
+       if (!conn_get_dst(conn)) {
                xref_unlock(&socket->xref, peer);
                lua_pushnil(L);
                return 1;
@@ -2308,8 +2307,7 @@ static int hlua_socket_getsockname(struct lua_State *L)
                return 1;
        }
 
-       conn_get_from_addr(conn);
-       if (!(conn->flags & CO_FL_ADDR_FROM_SET)) {
+       if (!conn_get_src(conn)) {
                xref_unlock(&socket->xref, peer);
                lua_pushnil(L);
                return 1;