CLEANUP: unix: make use of sock_accept_conn() where relevant

This allows to get rid of one getsockopt(SO_ACCEPTCONN) in the binding
code.
This commit is contained in:
Willy Tarreau 2020-10-13 17:42:21 +02:00
parent 3e12de2cc6
commit 85d2ba6b78

View File

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