mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
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:
1 parent
df09565fe4
commit
ae27a5cf90
8 files changed
+137
-13
No files matched your search
+20
-1
@@ -233,7 +233,26 @@ struct extparam confboot = {
|
||||
whatever runs meanwhile without a service of its own. */
|
||||
struct extparam *conf = &confboot;
|
||||
struct extparam *runconf = &confboot;
|
||||
int (*reattachfunc)(struct clientparam *param) = NULL;
|
||||
int (*reattachfunc)(struct clientparam *param, int auth) = NULL;
|
||||
|
||||
/* Authorizes a request on a connection which may outlive a reload, an HTTP
|
||||
one kept alive: as a client of the service whose rules apply now, the
|
||||
newest one on its listener after a reload (unless noforce). */
|
||||
int clientauth(struct clientparam *param){
|
||||
struct srvparam *orig;
|
||||
int res;
|
||||
|
||||
if(param->version < runconf->version){
|
||||
if(param->srv->noforce || !reattachfunc) param->version = runconf->version;
|
||||
else if((res = (*reattachfunc)(param, 0))) return res;
|
||||
}
|
||||
if(!param->newsrv) return (*param->srv->authfunc)(param);
|
||||
orig = param->srv;
|
||||
param->srv = param->newsrv;
|
||||
res = (*param->srv->authfunc)(param);
|
||||
param->srv = orig;
|
||||
return res;
|
||||
}
|
||||
_3proxy_mutex_t confref_mutex;
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user