From f3f640b6bcf10ba463fc81cec97cfa212c520cfe Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Wed, 28 Oct 2026 17:08:17 +0100 Subject: Performance improvement, where it works: Let different udp worker threads have their own socket --- ot_socket.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'ot_socket.h') diff --git a/ot_socket.h b/ot_socket.h index aa4e2d2..f73a5c9 100644 --- a/ot_socket.h +++ b/ot_socket.h @@ -16,8 +16,18 @@ as the v4 mapped address */ /* 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; + so differs between kernels, which is socket_set_sharing's business. + + SHARED lets another socket bind the same address. BALANCED asks the kernel + to spread arriving datagrams over the sockets that did, which is a + different thing and not everywhere available: ask socket_can_balance + before binding a group that depends on it. */ +typedef enum { SOCKET_EXCLUSIVE, SOCKET_SHARED, SOCKET_BALANCED } socket_sharing; + +/* Whether this kernel spreads datagrams over a group of sockets bound to one + address. Where it does not, binding a group is worse than one socket with + several readers, so the caller wants to know first. */ +int socket_can_balance(void); /* Create, bind and, for TCP, listen. The returned socket is non blocking Returns -1 on failure with errno set */ -- cgit v1.3