MEDIUM: receivers: add an rx_unbind() method in the protocols
This is used as a generic way to unbind a receiver at the end of
do_unbind_listener(). This allows to considerably simplify that function
since we can now let the protocol perform the cleanup. The generic code
was moved to sock.c, along with the conditional rx_disable() call. Now
the code also supports that the ->disable() function of the protocol
which acts on the listener performs the close itself and adjusts the
RX_F_BUOND flag accordingly.
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index b12cf72..33eacbc 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -66,6 +66,7 @@
.disable = tcp_disable_listener,
.rx_enable = sock_enable,
.rx_disable = sock_disable,
+ .rx_unbind = sock_unbind,
.rx_suspend = tcp_suspend_receiver,
.rx_resume = tcp_resume_receiver,
.accept = &listener_accept,
@@ -90,6 +91,7 @@
.disable = tcp_disable_listener,
.rx_enable = sock_enable,
.rx_disable = sock_disable,
+ .rx_unbind = sock_unbind,
.rx_suspend = tcp_suspend_receiver,
.rx_resume = tcp_resume_receiver,
.accept = &listener_accept,