MINOR: sock: rename sock_accept_conn() to sock_accepting_conn()

This call was introduced by commit 5ced3e887 ("MINOR: sock: add
sock_accept_conn() to test a listening socket") but is actually quite
confusing because it makes one think the socket will accept a connection
(which is what we want to have in a new function) while it only tells
whether it's configured to accept connections. Let's call it
sock_accepting_conn() instead.

The same change was applied to sockpair which had the same issue.
This commit is contained in:
Willy Tarreau 2020-10-15 09:19:43 +02:00
parent 65ed143841
commit 7d053e4211
5 changed files with 11 additions and 11 deletions

View File

@ -40,7 +40,7 @@ int sock_get_src(int fd, struct sockaddr *sa, socklen_t salen, int dir);
int sock_get_dst(int fd, struct sockaddr *sa, socklen_t salen, int dir);
int sock_get_old_sockets(const char *unixsocket);
int sock_find_compatible_fd(const struct receiver *rx);
int sock_accept_conn(const struct receiver *rx);
int sock_accepting_conn(const struct receiver *rx);
#endif /* _HAPROXY_SOCK_H */

View File

@ -47,7 +47,7 @@ static int sockpair_bind_listener(struct listener *listener, char *errmsg, int e
static void sockpair_enable_listener(struct listener *listener);
static void sockpair_disable_listener(struct listener *listener);
static int sockpair_connect_server(struct connection *conn, int flags);
static int sockpair_accept_conn(const struct receiver *rx);
static int sockpair_accepting_conn(const struct receiver *rx);
struct proto_fam proto_fam_sockpair = {
.name = "sockpair",
@ -77,7 +77,7 @@ static struct protocol proto_sockpair = {
.rx_unbind = sock_unbind,
.rx_enable = sock_enable,
.rx_disable = sock_disable,
.rx_listening = sockpair_accept_conn,
.rx_listening = sockpair_accepting_conn,
.accept = &listener_accept,
.connect = &sockpair_connect_server,
.receivers = LIST_HEAD_INIT(proto_sockpair.receivers),
@ -440,7 +440,7 @@ int recv_fd_uxst(int sock)
* The real test consists in verifying we have a connected SOCK_STREAM of
* family AF_UNIX.
*/
static int sockpair_accept_conn(const struct receiver *rx)
static int sockpair_accepting_conn(const struct receiver *rx)
{
struct sockaddr sa;
socklen_t len;

View File

@ -72,7 +72,7 @@ static struct protocol proto_tcpv4 = {
.rx_unbind = sock_unbind,
.rx_suspend = tcp_suspend_receiver,
.rx_resume = tcp_resume_receiver,
.rx_listening = sock_accept_conn,
.rx_listening = sock_accepting_conn,
.accept = &listener_accept,
.connect = tcp_connect_server,
.receivers = LIST_HEAD_INIT(proto_tcpv4.receivers),
@ -101,7 +101,7 @@ static struct protocol proto_tcpv6 = {
.rx_unbind = sock_unbind,
.rx_suspend = tcp_suspend_receiver,
.rx_resume = tcp_resume_receiver,
.rx_listening = sock_accept_conn,
.rx_listening = sock_accepting_conn,
.accept = &listener_accept,
.connect = tcp_connect_server,
.receivers = LIST_HEAD_INIT(proto_tcpv6.receivers),
@ -678,7 +678,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
}
#endif
ready = sock_accept_conn(&listener->rx) > 0;
ready = sock_accepting_conn(&listener->rx) > 0;
if (!ready && /* only listen if not already done by external process */
listen(fd, listener_backlog(listener)) == -1) {
@ -783,7 +783,7 @@ static int tcp_suspend_receiver(struct receiver *rx)
* dealing with a socket that is shared with other processes doing the
* same. Let's check if it's still accepting connections.
*/
ret = sock_accept_conn(rx);
ret = sock_accepting_conn(rx);
if (ret <= 0) {
/* unrecoverable or paused by another process */
fd_stop_recv(rx->fd);

View File

@ -65,7 +65,7 @@ static struct protocol proto_unix = {
.rx_disable = sock_disable,
.rx_unbind = sock_unbind,
.rx_suspend = uxst_suspend_receiver,
.rx_listening = sock_accept_conn,
.rx_listening = sock_accepting_conn,
.accept = &listener_accept,
.connect = &uxst_connect_server,
.receivers = LIST_HEAD_INIT(proto_unix.receivers),
@ -111,7 +111,7 @@ static int uxst_bind_listener(struct listener *listener, char *errmsg, int errle
}
fd = listener->rx.fd;
ready = sock_accept_conn(&listener->rx) > 0;
ready = sock_accepting_conn(&listener->rx) > 0;
if (!ready && /* only listen if not already done by external process */
listen(fd, listener_backlog(listener)) < 0) {

View File

@ -471,7 +471,7 @@ int sock_find_compatible_fd(const struct receiver *rx)
* rationale behind this is that inherited FDs may be broken and that shared
* FDs might have been paused by another process.
*/
int sock_accept_conn(const struct receiver *rx)
int sock_accepting_conn(const struct receiver *rx)
{
int opt_val = 0;
socklen_t opt_len = sizeof(opt_val);