Apply the new configuration to UDP sessions and kept-alive requests

UDP sessions check for a reload in udpsockmap() as TCP connections do
in sockmap(): unless noforce, a session goes by the newest service on
its listener, re-authenticated as its client, or is dropped.

A request on a connection that outlives a reload, an HTTP one kept
alive, is authorized by clientauth(): it moves the connection to the
newest service on its listener first if a reload came since, then
authorizes as the service whose rules apply (PSRV). The proxy uses it
for every request, so a request of a user the new configuration
removed is answered 407 rather than authorized by the old rules and
cut while relayed. reattach() takes whether to authenticate: sockmap()
and udpsockmap() move and authenticate at once, clientauth() moves and
then authorizes the request.

A test case covers the drops: with one slot free in the new service one
of two downloads moves on and the other is cut (27; a service keeps one
of its maxconn slots for the next connection it accepts), and a proxy
download is cut when a socks service takes its port (26). The reload
case checks the kept-alive request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vladimir DubrovinandClaude Opus 5.5 committed 2026-10-15 00:46:20 +03:00
1 parent df09565fe4
commit ae27a5cf90
8 files changed
+137 -13

No files matched your search

+13
View File
@@ -90,6 +90,19 @@ def run(t):
t.eq(2000000, kept.get("length"),
"a download of a user the new configuration keeps finishes whole")
# a connection kept alive: each request is authorized by the rules in
# force, so alice's next request after she is removed is refused
keep = t.connection("127.0.0.1", origin, proxy=proxy)
t.eq(200, t.http(url, proxy=proxy, proxy_auth=("alice", "one"), conn=keep).status,
"a kept-alive connection serves alice")
t.write_config("reload", config(origin, first, adm, "bob:CL:two"))
reload_and_wait()
r = t.http(url, proxy=proxy, proxy_auth=("alice", "one"), conn=keep)
t.eq(407, r.status, "after she is removed, her next request on it is refused "
"with a request for credentials, authorized by the new rules")
t.write_config("reload", config(origin, first, adm, "alice:CL:one bob:CL:two"))
reload_and_wait()
# alice is removed: her download is cut, being re-authenticated
th, cut = during_reload("bob:CL:two", first)
th.join(20)