mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-26 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
@@ -353,9 +353,9 @@ static char * admin_open(struct printparam *pp, struct clientparam *param)
|
||||
buf = malloc(LINESIZE);
|
||||
if(!buf) return NULL;
|
||||
|
||||
sprintf(buf, ok, conf.stringtable?(char *)conf.stringtable[2]:"3proxy",
|
||||
conf.stringtable?(char *)conf.stringtable[2]:"3[APA3A] tiny proxy",
|
||||
conf.stringtable?(char *)conf.stringtable[3]:"");
|
||||
sprintf(buf, ok, conf->stringtable?(char *)conf->stringtable[2]:"3proxy",
|
||||
conf->stringtable?(char *)conf->stringtable[2]:"3[APA3A] tiny proxy",
|
||||
conf->stringtable?(char *)conf->stringtable[3]:"");
|
||||
printstr(pp, buf);
|
||||
return buf;
|
||||
}
|
||||
@@ -374,7 +374,7 @@ int op_admin(struct httpreq *r, const unsigned char *params)
|
||||
|
||||
buf = admin_open(&pp, r->param);
|
||||
if(!buf) return 1;
|
||||
printstr(&pp, (char *)conf.stringtable[WEBBANNERS]);
|
||||
printstr(&pp, (char *)conf->stringtable[WEBBANNERS]);
|
||||
admin_close(&pp, buf);
|
||||
return 0;
|
||||
}
|
||||
@@ -398,7 +398,7 @@ int op_admin_counters(struct httpreq *r, const unsigned char *params)
|
||||
{
|
||||
struct trafcount *cp;
|
||||
int num = 0;
|
||||
for(cp = conf.trafcounter; cp; cp = cp->next, num++){
|
||||
for(cp = conf->trafcounter; cp; cp = cp->next, num++){
|
||||
int inbuf = 0;
|
||||
|
||||
if(cp->ace && (limited || param->redirected)){
|
||||
@@ -489,7 +489,7 @@ int op_admin_reload(struct httpreq *r, const unsigned char *params)
|
||||
buf = admin_open(&pp, r->param);
|
||||
if(!buf) return 1;
|
||||
|
||||
if(r->param->srv->s_option) printstr(&pp, (char *)conf.stringtable[WEBBANNERS]);
|
||||
if(r->param->srv->s_option) printstr(&pp, (char *)conf->stringtable[WEBBANNERS]);
|
||||
else {
|
||||
needreload = 1;
|
||||
printstr(&pp, "<h3>Reload scheduled</h3>");
|
||||
@@ -520,7 +520,7 @@ int op_admin_services(struct httpreq *r, const unsigned char *params)
|
||||
printstr(&pp, "<threadpool>");
|
||||
printval(&tpool, TYPE_THREADPOOL, 0, &pp);
|
||||
printstr(&pp, "</threadpool>\r\n");
|
||||
printval(conf.services, TYPE_SERVER, 0, &pp);
|
||||
printval(conf->services, TYPE_SERVER, 0, &pp);
|
||||
printstr(&pp, postxml);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user