mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
Reach the configuration through a pointer
conf is now a pointer to the current configuration rather than the structure itself: at first confboot, which exists before main() runs, as plugins and the standalone services use it too; later configurations will start from confdefaults. Both are made from confinit.h, the one list of initial values. The timeouts are an array of the configuration instead of a pointer to a global one. Nothing behaves differently yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8bd5c0f0fa
commit
737bdc7d24
19 files changed
+398
-389
No files matched your search
+7
-7
@@ -17,7 +17,7 @@ int alwaysauth(struct clientparam * param){
|
||||
int countout = 0;
|
||||
|
||||
|
||||
if(conf.connlimiter && !param->connlim && startconnlims(param)) return 10;
|
||||
if(conf->connlimiter && !param->connlim && startconnlims(param)) return 10;
|
||||
#ifdef WITH_HTTPSRV
|
||||
/* The http server answers the request itself, so authorization must not
|
||||
try to reach a destination that does not exist. A request it has handed
|
||||
@@ -27,15 +27,15 @@ int alwaysauth(struct clientparam * param){
|
||||
res = doconnect(param);
|
||||
#endif
|
||||
if(!res){
|
||||
if(conf.bandlimfunc && (conf.bandlimiter||conf.bandlimiterout)){
|
||||
if(conf->bandlimfunc && (conf->bandlimiter||conf->bandlimiterout)){
|
||||
_3proxy_mutex_lock(&bandlim_mutex);
|
||||
initbandlims(param);
|
||||
_3proxy_mutex_unlock(&bandlim_mutex);
|
||||
}
|
||||
|
||||
if(conf.trafcountfunc && conf.trafcounter) {
|
||||
if(conf->trafcountfunc && conf->trafcounter) {
|
||||
_3proxy_mutex_lock(&tc_mutex);
|
||||
for(tc = conf.trafcounter; tc; tc = tc->next) {
|
||||
for(tc = conf->trafcounter; tc; tc = tc->next) {
|
||||
if(tc->disabled) continue;
|
||||
if(ACLmatches(tc->ace, param)){
|
||||
if(tc->ace->action == NOCOUNTIN) {
|
||||
@@ -51,11 +51,11 @@ int alwaysauth(struct clientparam * param){
|
||||
_3proxy_mutex_unlock(&tc_mutex);
|
||||
return 10;
|
||||
}
|
||||
param->trafcountfunc = conf.trafcountfunc;
|
||||
param->trafcountfunc = conf->trafcountfunc;
|
||||
param->maxtrafin64 = tc->traflim64 - tc->v->traf64;
|
||||
}
|
||||
}
|
||||
if(countout)for(tc = conf.trafcounter; tc; tc = tc->next) {
|
||||
if(countout)for(tc = conf->trafcounter; tc; tc = tc->next) {
|
||||
if(tc->disabled) continue;
|
||||
if(ACLmatches(tc->ace, param)){
|
||||
if(tc->ace->action == NOCOUNTOUT || tc->ace->action == NOCOUNTALL) break;
|
||||
@@ -66,7 +66,7 @@ int alwaysauth(struct clientparam * param){
|
||||
_3proxy_mutex_unlock(&tc_mutex);
|
||||
return 10;
|
||||
}
|
||||
param->trafcountfunc = conf.trafcountfunc;
|
||||
param->trafcountfunc = conf->trafcountfunc;
|
||||
param->maxtrafout64 = tc->traflim64 - tc->v->traf64;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user