]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: unix: make use of sock_accept_conn() where relevant
authorWilly Tarreau <w@1wt.eu>
Tue, 13 Oct 2020 15:42:21 +0000 (17:42 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 13 Oct 2020 16:15:33 +0000 (18:15 +0200)
This allows to get rid of one getsockopt(SO_ACCEPTCONN) in the binding
code.

src/proto_uxst.c

index d9d5a07b00d55f8688d0621c38221385737e515e..5cf16a7ad46095b9f8300776abcf4ec78ad53ab9 100644 (file)
@@ -94,7 +94,6 @@ static int uxst_bind_listener(struct listener *listener, char *errmsg, int errle
 {
        int fd, err;
        int ready;
-       socklen_t ready_len;
        char *msg = NULL;
 
        err = ERR_NONE;
@@ -112,11 +111,7 @@ static int uxst_bind_listener(struct listener *listener, char *errmsg, int errle
        }
 
        fd = listener->rx.fd;
-
-       ready = 0;
-       ready_len = sizeof(ready);
-       if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &ready, &ready_len) == -1)
-               ready = 0;
+       ready = sock_accept_conn(&listener->rx) > 0;
 
        if (!ready && /* only listen if not already done by external process */
            listen(fd, listener_backlog(listener)) < 0) {