MINOR: receiver: add a receiver-specific flag to indicate the socket is bound
In order to split the receiver from the listener, we'll need to know that
a socket is already bound and ready to receive. We used to do that via
tha LI_O_ASSIGNED state but that's not sufficient anymore since the
receiver might not belong to a listener anymore. The new RX_F_BOUND flag
is used for this.
diff --git a/src/proto_udp.c b/src/proto_udp.c
index 9325ba8..64ea639 100644
--- a/src/proto_udp.c
+++ b/src/proto_udp.c
@@ -195,6 +195,9 @@
err = ERR_NONE;
+ if (listener->rx.flags & RX_F_BOUND)
+ goto bound;
+
/* TODO: Implement reuse fd. Take care that to identify fd to reuse
* listeners uses a special AF_CUST_ family and we MUST consider
* IPPROTO (sockaddr is not enough)
@@ -276,7 +279,9 @@
msg = "cannot bind socket";
goto udp_close_return;
}
+ listener->rx.flags |= RX_F_BOUND;
+ bound:
/* the socket is ready */
listener->rx.fd = fd;
listener->state = LI_LISTEN;