mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
Services and their clients read their own configuration
A service keeps the configuration it was started with (srvparam.config) and its threads and its clients' read it there: limits and counters (alwaysauth, the limiter), RADIUS, dnspr's name servers, and the checks for a reload in the accept loop and in sockmap(). The configuration is still reloaded in place, so it is the current one for now; this is what lets a reload build a new one while the old one still serves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
737bdc7d24
commit
7ec05ff372
7 files changed
+47
-45
No files matched your search
+13
-13
@@ -16,7 +16,7 @@ int startconnlims (struct clientparam *param){
|
||||
|
||||
param->connlim = 1;
|
||||
_3proxy_mutex_lock(&connlim_mutex);
|
||||
for(ce = conf->connlimiter; ce; ce = ce->next) {
|
||||
for(ce = param->srv->config->connlimiter; ce; ce = ce->next) {
|
||||
if(ACLmatches(ce->ace, param)){
|
||||
if(ce->ace->action == NOCONNLIM)break;
|
||||
if(!ce->period){
|
||||
@@ -44,7 +44,7 @@ int startconnlims (struct clientparam *param){
|
||||
}
|
||||
if(ret) {
|
||||
struct connlim * cee;
|
||||
for(cee = conf->connlimiter; cee != ce; cee = cee->next) {
|
||||
for(cee = param->srv->config->connlimiter; cee != ce; cee = cee->next) {
|
||||
if(ACLmatches(cee->ace, param) && !cee->period && cee->rating) {
|
||||
cee->rating--;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ void stopconnlims (struct clientparam *param){
|
||||
struct connlim * ce;
|
||||
|
||||
_3proxy_mutex_lock(&connlim_mutex);
|
||||
for(ce = conf->connlimiter; ce; ce = ce->next) {
|
||||
for(ce = param->srv->config->connlimiter; ce; ce = ce->next) {
|
||||
if(ACLmatches(ce->ace, param)){
|
||||
if(ce->ace->action == NOCONNLIM)break;
|
||||
if(!ce->period && ce->rating){
|
||||
@@ -78,28 +78,28 @@ void initbandlims (struct clientparam *param){
|
||||
param->bandlimfunc = NULL;
|
||||
param->bandlims[0] = NULL;
|
||||
param->bandlimsout[0] = NULL;
|
||||
if(!conf->bandlimfunc || (!conf->bandlimiter && !conf->bandlimiterout)) return;
|
||||
for(i=0, be = conf->bandlimiter; be && i<MAXBANDLIMS; be = be->next) {
|
||||
if(!param->srv->config->bandlimfunc || (!param->srv->config->bandlimiter && !param->srv->config->bandlimiterout)) return;
|
||||
for(i=0, be = param->srv->config->bandlimiter; be && i<MAXBANDLIMS; be = be->next) {
|
||||
if(ACLmatches(be->ace, param)){
|
||||
if(be->ace->action == NOBANDLIM) {
|
||||
break;
|
||||
}
|
||||
param->bandlims[i++] = be;
|
||||
param->bandlimfunc = conf->bandlimfunc;
|
||||
param->bandlimfunc = param->srv->config->bandlimfunc;
|
||||
}
|
||||
}
|
||||
if(i<MAXBANDLIMS)param->bandlims[i] = NULL;
|
||||
for(i=0, be = conf->bandlimiterout; be && i<MAXBANDLIMS; be = be->next) {
|
||||
for(i=0, be = param->srv->config->bandlimiterout; be && i<MAXBANDLIMS; be = be->next) {
|
||||
if(ACLmatches(be->ace, param)){
|
||||
if(be->ace->action == NOBANDLIM) {
|
||||
break;
|
||||
}
|
||||
param->bandlimsout[i++] = be;
|
||||
param->bandlimfunc = conf->bandlimfunc;
|
||||
param->bandlimfunc = param->srv->config->bandlimfunc;
|
||||
}
|
||||
}
|
||||
if(i<MAXBANDLIMS)param->bandlimsout[i] = NULL;
|
||||
param->bandlimver = conf->bandlimver;
|
||||
param->bandlimver = param->srv->config->bandlimver;
|
||||
}
|
||||
|
||||
unsigned bandlimitfunc(struct clientparam *param, unsigned nbytesin, unsigned nbytesout){
|
||||
@@ -125,9 +125,9 @@ unsigned bandlimitfunc(struct clientparam *param, unsigned nbytesin, unsigned nb
|
||||
|
||||
if(!nbytesin && !nbytesout) return 0;
|
||||
_3proxy_mutex_lock(&bandlim_mutex);
|
||||
if(param->bandlimver != conf->bandlimver){
|
||||
if(param->bandlimver != param->srv->config->bandlimver){
|
||||
initbandlims(param);
|
||||
param->bandlimver = conf->bandlimver;
|
||||
param->bandlimver = param->srv->config->bandlimver;
|
||||
}
|
||||
for(i=0; nbytesin&& i<MAXBANDLIMS && param->bandlims[i]; i++){
|
||||
if( !param->bandlims[i]->basetime ||
|
||||
@@ -172,7 +172,7 @@ void trafcountfunc(struct clientparam *param){
|
||||
int countout = 0;
|
||||
|
||||
_3proxy_mutex_lock(&tc_mutex);
|
||||
for(tc = conf->trafcounter; tc; tc = tc->next) {
|
||||
for(tc = param->srv->config->trafcounter; tc; tc = tc->next) {
|
||||
if(ACLmatches(tc->ace, param)){
|
||||
|
||||
if(tc->ace->action == NOCOUNTIN) {
|
||||
@@ -188,7 +188,7 @@ void trafcountfunc(struct clientparam *param){
|
||||
tc->v->updated = curtime;
|
||||
}
|
||||
}
|
||||
if(countout) for(tc = conf->trafcounter; tc; tc = tc->next) {
|
||||
if(countout) for(tc = param->srv->config->trafcounter; tc; tc = tc->next) {
|
||||
if(ACLmatches(tc->ace, param)){
|
||||
if(tc->ace->action == NOCOUNTOUT || tc->ace->action == NOCOUNTALL) break;
|
||||
if(tc->ace->action != COUNTOUT && tc->ace->action != COUNTALL ) {
|
||||
|
||||
Reference in new issue
Block a user