From 2c7659ec930277981b6333b5b3aff7840d11933c Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sun, 25 Oct 2026 18:51:51 +0100 Subject: Decouple config parsing from binding and worker spawning * Options are parsed now into a listener description list before binding them at once and starting the workers later * UDP workers can now be configured per connection * socket reuse is now done more sensibly, mcast sockets always reused * Hold-off logic after spawning udp workers removed --- ot_socket.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ot_socket.h') diff --git a/ot_socket.h b/ot_socket.h index 20fd839..21d04b1 100644 --- a/ot_socket.h +++ b/ot_socket.h @@ -15,13 +15,14 @@ cleared, so one descriptor serves both families and an IPv4 peer arrives as the v4 mapped address */ -/* Ask the kernel to let several processes bind the same address */ -extern int g_socket_reuseport; +/* How an address may be shared with other sockets. Which socket option says + so differs between kernels, which is socket_set_sharing's business */ +typedef enum { SOCKET_EXCLUSIVE, SOCKET_SHARED } socket_sharing; /* Create, bind and, for TCP, listen. The returned socket is non blocking Returns -1 on failure with errno set */ -int socket_tcp_listen(const ot_ip6 ip, uint16_t port); -int socket_udp_bind(const ot_ip6 ip, uint16_t port); +int socket_tcp_listen(const ot_ip6 ip, uint16_t port, socket_sharing sharing); +int socket_udp_bind(const ot_ip6 ip, uint16_t port, socket_sharing sharing); int socket_tcp_connect(const ot_ip6 srcip, uint16_t srcport, const ot_ip6 dstip, uint16_t dstport); int socket_is_connected(int s); -- cgit v1.3