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_udp.c b/src/proto_udp.c
index 1dc7317..8c53c62 100644
--- a/src/proto_udp.c
+++ b/src/proto_udp.c
@@ -62,6 +62,7 @@
.disable = udp_disable_listener,
.rx_enable = sock_enable,
.rx_disable = sock_disable,
+ .rx_unbind = sock_unbind,
.rx_suspend = udp_suspend_receiver,
.rx_resume = udp_resume_receiver,
.receivers = LIST_HEAD_INIT(proto_udp4.receivers),
@@ -84,6 +85,7 @@
.disable = udp_disable_listener,
.rx_enable = sock_enable,
.rx_disable = sock_disable,
+ .rx_unbind = sock_unbind,
.rx_suspend = udp_suspend_receiver,
.rx_resume = udp_resume_receiver,
.receivers = LIST_HEAD_INIT(proto_udp6.receivers),