mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 16:47:18 +02:00
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:
parent
65ed143841
commit
7d053e4211
@ -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_dst(int fd, struct sockaddr *sa, socklen_t salen, int dir);
|
||||||
int sock_get_old_sockets(const char *unixsocket);
|
int sock_get_old_sockets(const char *unixsocket);
|
||||||
int sock_find_compatible_fd(const struct receiver *rx);
|
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 */
|
#endif /* _HAPROXY_SOCK_H */
|
||||||
|
|
||||||
|
@ -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_enable_listener(struct listener *listener);
|
||||||
static void sockpair_disable_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_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 = {
|
struct proto_fam proto_fam_sockpair = {
|
||||||
.name = "sockpair",
|
.name = "sockpair",
|
||||||
@ -77,7 +77,7 @@ static struct protocol proto_sockpair = {
|
|||||||
.rx_unbind = sock_unbind,
|
.rx_unbind = sock_unbind,
|
||||||
.rx_enable = sock_enable,
|
.rx_enable = sock_enable,
|
||||||
.rx_disable = sock_disable,
|
.rx_disable = sock_disable,
|
||||||
.rx_listening = sockpair_accept_conn,
|
.rx_listening = sockpair_accepting_conn,
|
||||||
.accept = &listener_accept,
|
.accept = &listener_accept,
|
||||||
.connect = &sockpair_connect_server,
|
.connect = &sockpair_connect_server,
|
||||||
.receivers = LIST_HEAD_INIT(proto_sockpair.receivers),
|
.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
|
* The real test consists in verifying we have a connected SOCK_STREAM of
|
||||||
* family AF_UNIX.
|
* family AF_UNIX.
|
||||||
*/
|
*/
|
||||||
static int sockpair_accept_conn(const struct receiver *rx)
|
static int sockpair_accepting_conn(const struct receiver *rx)
|
||||||
{
|
{
|
||||||
struct sockaddr sa;
|
struct sockaddr sa;
|
||||||
socklen_t len;
|
socklen_t len;
|
||||||
|
@ -72,7 +72,7 @@ static struct protocol proto_tcpv4 = {
|
|||||||
.rx_unbind = sock_unbind,
|
.rx_unbind = sock_unbind,
|
||||||
.rx_suspend = tcp_suspend_receiver,
|
.rx_suspend = tcp_suspend_receiver,
|
||||||
.rx_resume = tcp_resume_receiver,
|
.rx_resume = tcp_resume_receiver,
|
||||||
.rx_listening = sock_accept_conn,
|
.rx_listening = sock_accepting_conn,
|
||||||
.accept = &listener_accept,
|
.accept = &listener_accept,
|
||||||
.connect = tcp_connect_server,
|
.connect = tcp_connect_server,
|
||||||
.receivers = LIST_HEAD_INIT(proto_tcpv4.receivers),
|
.receivers = LIST_HEAD_INIT(proto_tcpv4.receivers),
|
||||||
@ -101,7 +101,7 @@ static struct protocol proto_tcpv6 = {
|
|||||||
.rx_unbind = sock_unbind,
|
.rx_unbind = sock_unbind,
|
||||||
.rx_suspend = tcp_suspend_receiver,
|
.rx_suspend = tcp_suspend_receiver,
|
||||||
.rx_resume = tcp_resume_receiver,
|
.rx_resume = tcp_resume_receiver,
|
||||||
.rx_listening = sock_accept_conn,
|
.rx_listening = sock_accepting_conn,
|
||||||
.accept = &listener_accept,
|
.accept = &listener_accept,
|
||||||
.connect = tcp_connect_server,
|
.connect = tcp_connect_server,
|
||||||
.receivers = LIST_HEAD_INIT(proto_tcpv6.receivers),
|
.receivers = LIST_HEAD_INIT(proto_tcpv6.receivers),
|
||||||
@ -678,7 +678,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
|
|||||||
}
|
}
|
||||||
#endif
|
#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 */
|
if (!ready && /* only listen if not already done by external process */
|
||||||
listen(fd, listener_backlog(listener)) == -1) {
|
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
|
* dealing with a socket that is shared with other processes doing the
|
||||||
* same. Let's check if it's still accepting connections.
|
* same. Let's check if it's still accepting connections.
|
||||||
*/
|
*/
|
||||||
ret = sock_accept_conn(rx);
|
ret = sock_accepting_conn(rx);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
/* unrecoverable or paused by another process */
|
/* unrecoverable or paused by another process */
|
||||||
fd_stop_recv(rx->fd);
|
fd_stop_recv(rx->fd);
|
||||||
|
@ -65,7 +65,7 @@ static struct protocol proto_unix = {
|
|||||||
.rx_disable = sock_disable,
|
.rx_disable = sock_disable,
|
||||||
.rx_unbind = sock_unbind,
|
.rx_unbind = sock_unbind,
|
||||||
.rx_suspend = uxst_suspend_receiver,
|
.rx_suspend = uxst_suspend_receiver,
|
||||||
.rx_listening = sock_accept_conn,
|
.rx_listening = sock_accepting_conn,
|
||||||
.accept = &listener_accept,
|
.accept = &listener_accept,
|
||||||
.connect = &uxst_connect_server,
|
.connect = &uxst_connect_server,
|
||||||
.receivers = LIST_HEAD_INIT(proto_unix.receivers),
|
.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;
|
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 */
|
if (!ready && /* only listen if not already done by external process */
|
||||||
listen(fd, listener_backlog(listener)) < 0) {
|
listen(fd, listener_backlog(listener)) < 0) {
|
||||||
|
@ -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
|
* rationale behind this is that inherited FDs may be broken and that shared
|
||||||
* FDs might have been paused by another process.
|
* 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;
|
int opt_val = 0;
|
||||||
socklen_t opt_len = sizeof(opt_val);
|
socklen_t opt_len = sizeof(opt_val);
|
||||||
|
Loading…
Reference in New Issue
Block a user