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.
This commit is contained in:
Willy Tarreau 2020-10-13 17:26:00 +02:00
parent 5ced3e8879
commit 29185140db
3 changed files with 4 additions and 0 deletions

View File

@ -101,6 +101,7 @@ struct protocol {
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 */

View File

@ -72,6 +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,
.accept = &listener_accept,
.connect = tcp_connect_server,
.receivers = LIST_HEAD_INIT(proto_tcpv4.receivers),
@ -100,6 +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,
.accept = &listener_accept,
.connect = tcp_connect_server,
.receivers = LIST_HEAD_INIT(proto_tcpv6.receivers),

View File

@ -65,6 +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,
.accept = &listener_accept,
.connect = &uxst_connect_server,
.receivers = LIST_HEAD_INIT(proto_unix.receivers),