MINOR: protocol: make proto_tcp & proto_uxst report listening sockets
Now we introdce a new .rx_listening() function to report if a receiver is
actually a listening socket. The reason for this is to help detect shared
sockets that might have been broken by sibling processes.
diff --git a/include/haproxy/protocol-t.h b/include/haproxy/protocol-t.h
index 2dea732..ae7ec19 100644
--- a/include/haproxy/protocol-t.h
+++ b/include/haproxy/protocol-t.h
@@ -101,6 +101,7 @@
void (*rx_unbind)(struct receiver *rx); /* unbind the receiver, most often closing the FD */
int (*rx_suspend)(struct receiver *rx); /* temporarily suspend this receiver for a soft restart */
int (*rx_resume)(struct receiver *rx); /* try to resume a temporarily suspended receiver */
+ int (*rx_listening)(const struct receiver *rx); /* is the receiver listening ? 0=no, >0=OK, <0=unrecoverable */
/* functions acting on connections */
void (*accept)(int fd); /* generic accept function */
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index aadac7c..fbc99c9 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -72,6 +72,7 @@
.rx_unbind = sock_unbind,
.rx_suspend = tcp_suspend_receiver,
.rx_resume = tcp_resume_receiver,
+ .rx_listening = sock_accept_conn,
.accept = &listener_accept,
.connect = tcp_connect_server,
.receivers = LIST_HEAD_INIT(proto_tcpv4.receivers),
@@ -100,6 +101,7 @@
.rx_unbind = sock_unbind,
.rx_suspend = tcp_suspend_receiver,
.rx_resume = tcp_resume_receiver,
+ .rx_listening = sock_accept_conn,
.accept = &listener_accept,
.connect = tcp_connect_server,
.receivers = LIST_HEAD_INIT(proto_tcpv6.receivers),
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index 047b759..d9d5a07 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -65,6 +65,7 @@
.rx_disable = sock_disable,
.rx_unbind = sock_unbind,
.rx_suspend = uxst_suspend_receiver,
+ .rx_listening = sock_accept_conn,
.accept = &listener_accept,
.connect = &uxst_connect_server,
.receivers = LIST_HEAD_INIT(proto_unix.receivers),