mirror of
https://github.com/3proxy/3proxy.git
synced 2026-10-29 06:15:48 +08:00
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>
55 lines
1.7 KiB
Makefile
55 lines
1.7 KiB
Makefile
#
|
|
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
|
|
#
|
|
#
|
|
# ODBC support is enabled by default on Windows (/D WITH_ODBC, odbc32.lib)
|
|
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
|
|
|
|
BUILDDIR = ../bin/
|
|
PREFIX = 3proxy_
|
|
CRYPT_PREFIX = 3proxy_
|
|
CC = cl
|
|
VERSION = $(VERSION)
|
|
BUILDDATE = $(BUILDDATE)
|
|
!IFDEF WOLFSSL
|
|
SSL_DEFS = /D "WITH_SSL" /D "WITH_WOLFSSL"
|
|
SSL_LIBS = wolfssl.lib
|
|
!ELSE
|
|
SSL_DEFS = /D "WITH_SSL"
|
|
SSL_LIBS = libcrypto.lib libssl.lib
|
|
!ENDIF
|
|
CFLAGS = /D "WITH_HTTPSRV" /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" $(SSL_DEFS) /D "WITH_PCRE" /D "WITH_ODBC" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /Fp"proxy.pch" /FD /c $(BUILDDATE) $(VERSION)
|
|
COUT = /Fo
|
|
LN = link
|
|
LDFLAGS = /nologo /subsystem:console /incremental:no
|
|
DLFLAGS = /DLL
|
|
DLSUFFICS = .dll
|
|
LIBS = ws2_32.lib mswsock.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib Crypt32.lib $(SSL_LIBS) pcre2-8.lib
|
|
LIBSPREFIX =
|
|
LIBSSUFFIX = .lib
|
|
LIBEXT = .lib
|
|
LNOUT = /out:
|
|
EXESUFFICS = .exe
|
|
OBJSUFFICS = .obj
|
|
DEFINEOPTION = /D
|
|
COMPFILES = *.pch *.idb
|
|
REMOVECOMMAND = del
|
|
TYPECOMMAND = type
|
|
COMPATLIBS =
|
|
MAKEFILE = Makefile.msvc
|
|
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin FilePlugin
|
|
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
|
PCRE_OBJS = pcre$(OBJSUFFICS)
|
|
HTTPSRV_OBJS = srvhttpsrv$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS)
|
|
VERFILE = 3proxy.res $(VERFILE)
|
|
VERSIONDEP = 3proxy.res $(VERSIONDEP)
|
|
AFTERCLEAN = if exist src\*.res (del src\*.res) && if exist src\*.err (del src\*.err)
|
|
|
|
include Makefile.inc
|
|
|
|
3proxy.res:
|
|
rc 3proxy.rc
|
|
|
|
allplugins:
|
|
for /D %%i in ($(PLUGINS)) do (copy Makefile plugins\%%i && copy Makefile.var plugins\%%i && cd plugins\%%i && nmake && del *.obj *.idb &&cd ..\..)
|
|
|