]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
OPTIM/MINOR: mark the source address as already known on accept()
authorWilly Tarreau <w@1wt.eu>
Fri, 15 Nov 2013 23:15:40 +0000 (00:15 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 Nov 2013 23:17:59 +0000 (00:17 +0100)
Commit 986a9d2d12 moved the source address from the stream interface
to the session, but it did not set the flag on the connection to
report that the source address is known. Thus when logs are enabled,
we had a call to getpeername() which is redundant with the result
from accept(). This patch simply sets the flag.

src/session.c

index 76bc8f3990eb87af39c0b194281803fd142549f9..9ed68b1c6080115abbe1dd706c4c079720342fe3 100644 (file)
@@ -107,7 +107,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
        /* OK, we're keeping the session, so let's properly initialize the session */
        s->si[0].conn->t.sock.fd = cfd;
        s->si[0].conn->ctrl = l->proto;
-       s->si[0].conn->flags = CO_FL_NONE;
+       s->si[0].conn->flags = CO_FL_NONE | CO_FL_ADDR_FROM_SET;
        s->si[0].conn->err_code = CO_ER_NONE;
        s->si[0].conn->addr.from = *addr;
        s->si[0].conn->target = &l->obj_type;