3proxy/src
Vladimir Dubrovin 7cdfd87aa6 UDP services in one thread: udppm and dnspr without client threads
A UDP service now runs in its own thread alone (udploop()): it reads the
service's socket and the sockets of its sessions towards their
destinations, keeps their deadlines, and answers every client from the
service's socket. A session is a struct clientparam as a client thread's
would be, with a slot of maxchild, among the service's children and
counted on its listener, but without a thread. The services supply
handlers (struct udpservice, childdef.udp): udppm keeps a session per
client address, forwarding its datagrams, behind the headers of a
parent chain, from a socket of its own and answering what comes back,
until STRING_L of silence or, with -s, the first answer; dnspr makes a
session of each query, answered at once from the fake address, the
name cache or the resolver, or sent on to the first name server over
UDP, whose answer is waited for in the loop up to DNS_TO (a name server
over TCP is still waited for in place). Authentication stays in the
loop for now; datagrams over a bandwidth limit, or of a client without
a free slot, are dropped.

On a reload the old service goes on serving the socket until it sees
its configuration replaced, then hands its sessions to the listener;
the newest service of its kind there, which until then does not read
the socket so that no client gets two sessions, adopts them: a slot of
its own, the old one given back, its filters and limits, and
re-authentication. A session is ended with 26 if the newest service is
of another kind, 27 without a slot, or with what the authentication
says; sessions nobody is left to adopt are ended by the last service to
stop on the listener.

On Windows a send on a socket waited while another thread polled it,
which delayed udppm's answers by up to a second, and old UDP services
did not exit after a reload; with one thread per socket neither
happens, and the second socket bound to the service's address
(NO_SHARE_UDP_SOCKET) is gone from the code and the build files.

udpinit, the global udp_table, udpnext(), udppmchild() and
dnsprchild() are gone; udpsockmap() serves SOCKS5 UDP ASSOCIATE only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:57:35 +03:00
..
libs fix wolfSSL, switch minimal/busybox to musl+wolfssl 2026-07-31 11:27:10 +03:00
plugins Keep the values of numbered traffic counters across reloads 2026-10-13 19:05:59 +03:00
3proxy_crypt.c wolfSSL support added 2026-07-13 20:24:51 +03:00
3proxy.c Count the traffic of each listener 2026-10-15 16:02:14 +03:00
3proxy.ico build rc file from res 2020-11-22 02:14:53 +03:00
3proxy.rc Copyright update 2021-07-02 11:50:33 +03:00
acl.c Make filtermaxsize, parentretries, delimchar and maxseg per service 2026-10-13 15:33:35 +03:00
auth.c Reload the configuration atomically 2026-10-14 20:15:14 +03:00
authradius.c Services and their clients read their own configuration 2026-10-13 19:19:03 +03:00
auto.c Pre-allocate client/server/tmp/etc buffers with client structure 2026-10-12 17:19:55 +03:00
base64.c Add outsize parameter to en64 2026-08-08 17:58:49 +03:00
common.c Count the traffic of each listener 2026-10-15 16:02:14 +03:00
conf.c UDP services in one thread: udppm and dnspr without client threads 2026-10-18 14:57:35 +03:00
confinit.h Reach the configuration through a pointer 2026-10-13 19:12:54 +03:00
datatypes.c Count the traffic of each listener 2026-10-15 16:02:14 +03:00
dnspr.c UDP services in one thread: udppm and dnspr without client threads 2026-10-18 14:57:35 +03:00
ftp.c Authorize FTP commands and data connections by the rules in force 2026-10-15 00:49:53 +03:00
ftppr.c Authorize FTP commands and data connections by the rules in force 2026-10-15 00:49:53 +03:00
hash.c Keep the clock, timetoexit and needreload out of conf 2026-10-13 16:05:33 +03:00
hashtables.c Reload the configuration atomically 2026-10-14 20:15:14 +03:00
httpsrv.c Fix memory leaks found under AddressSanitizer 2026-10-14 20:15:01 +03:00
imapp.c per-service timeouts 2026-10-13 15:12:05 +03:00
limiter.c Re-authenticate clients of old services against the new configuration 2026-10-14 23:16:00 +03:00
log.c Count the traffic of each listener 2026-10-15 16:02:14 +03:00
Makefile initial import to git 2014-04-08 13:03:21 +04:00
Makefile.inc Reorganize service config parsing / main loop 2026-10-12 13:08:55 +03:00
mdhash.c fix wolfSSL build 2026-07-13 20:50:27 +03:00
mdhash.h wolfSSL support added 2026-07-13 20:24:51 +03:00
pcre.c Pre-allocate client/server/tmp/etc buffers with client structure 2026-10-12 17:19:55 +03:00
pcre.h Move PCRE/SSL to main code 2026-05-01 15:11:08 +03:00
plugins.c UDP services in one thread: udppm and dnspr without client threads 2026-10-18 14:57:35 +03:00
pop3p.c per-service timeouts 2026-10-13 15:12:05 +03:00
proxy.c Apply the new configuration to UDP sessions and kept-alive requests 2026-10-15 00:46:20 +03:00
proxy.h UDP services in one thread: udppm and dnspr without client threads 2026-10-18 14:57:35 +03:00
proxymain.c UDP services in one thread: udppm and dnspr without client threads 2026-10-18 14:57:35 +03:00
redirect.c per-service timeouts 2026-10-13 15:12:05 +03:00
resolve.c Reload the configuration atomically 2026-10-14 20:15:14 +03:00
sem.c Change waiting loops to semaphores for child counters 2026-10-10 23:10:57 +03:00
smtpp.c per-service timeouts 2026-10-13 15:12:05 +03:00
sockgetchar.c Unix sockets: no addresses on streams, abstract names, tcppm port 0 2026-10-18 12:05:27 +03:00
sockmap.c Unix sockets: no addresses on streams, abstract names, tcppm port 0 2026-10-18 12:05:27 +03:00
socks.c Unix sockets: no addresses on streams, abstract names, tcppm port 0 2026-10-18 12:05:27 +03:00
sql.c Reach the configuration through a pointer 2026-10-13 19:12:54 +03:00
ssl.c Fix memory leaks found under AddressSanitizer 2026-10-14 20:15:01 +03:00
ssl.h Optional kernel TLS with OpenSSL (ssl_ktls) 2026-10-14 17:29:21 +03:00
ssllib.c Read TLS records ahead with OpenSSL 1.1.0 and later 2026-10-13 12:21:23 +03:00
stringtable.c Name the HTTPSRV service in the string table 2026-10-15 15:36:13 +03:00
structures.h UDP services in one thread: udppm and dnspr without client threads 2026-10-18 14:57:35 +03:00
tcppm.c per-service timeouts 2026-10-13 15:12:05 +03:00
tlspr.c per-service timeouts 2026-10-13 15:12:05 +03:00
transparent.c Pre-allocate client/server/tmp/etc buffers with client structure 2026-10-12 17:19:55 +03:00
udppm.c UDP services in one thread: udppm and dnspr without client threads 2026-10-18 14:57:35 +03:00
udpsockmap.c UDP services in one thread: udppm and dnspr without client threads 2026-10-18 14:57:35 +03:00
version.h Update version files for 1.0.0 2026-08-22 12:13:00 +00:00
webadmin.c Reload the configuration atomically 2026-10-14 20:15:14 +03:00