mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
legacy counters code removed
This commit is contained in:
1 parent
5543b3052d
commit
f4c6c9d962
16 files changed
+3
-483
No files matched your search
-65
@@ -115,11 +115,7 @@ int clientnegotiate(struct chain * redir, struct clientparam * param, unsigned l
|
||||
len += sprintf((char *)buf + len, "\r\n");
|
||||
if(socksend(param->remsock, buf, len, conf.timeouts[CHAIN_TO]) != (int)strlen((char *)buf))
|
||||
return 31;
|
||||
#ifndef NOPSTDINT
|
||||
param->statssrv64+=len;
|
||||
#else
|
||||
param->statssrv+=len;
|
||||
#endif
|
||||
param->nwrites++;
|
||||
if((res = sockgetlinebuf(param, SERVER,buf,13,'\n',conf.timeouts[CHAIN_TO])) < 13)
|
||||
return 32;
|
||||
@@ -156,11 +152,7 @@ int clientnegotiate(struct chain * redir, struct clientparam * param, unsigned l
|
||||
if(socksend(param->remsock, buf, len, conf.timeouts[CHAIN_TO]) < len){
|
||||
return 41;
|
||||
}
|
||||
#ifndef NOPSTDINT
|
||||
param->statssrv64+=len;
|
||||
#else
|
||||
param->statssrv+=len;
|
||||
#endif
|
||||
param->nwrites++;
|
||||
if((len = sockgetlinebuf(param, SERVER, buf, (redir->type == R_SOCKS4B)? 3:8, EOF, conf.timeouts[CHAIN_TO])) != ((redir->type == R_SOCKS4B)? 3:8)){
|
||||
return 42;
|
||||
@@ -183,11 +175,7 @@ int clientnegotiate(struct chain * redir, struct clientparam * param, unsigned l
|
||||
if(socksend(param->remsock, buf, 3, conf.timeouts[CHAIN_TO]) != 3){
|
||||
return 51;
|
||||
}
|
||||
#ifndef NOPSTDINT
|
||||
param->statssrv64+=len;
|
||||
#else
|
||||
param->statssrv+=len;
|
||||
#endif
|
||||
param->nwrites++;
|
||||
if(sockgetlinebuf(param, SERVER, buf, 2, EOF, conf.timeouts[CHAIN_TO]) != 2){
|
||||
return 52;
|
||||
@@ -209,11 +197,7 @@ int clientnegotiate(struct chain * redir, struct clientparam * param, unsigned l
|
||||
if(socksend(param->remsock, buf, inbuf, conf.timeouts[CHAIN_TO]) != inbuf){
|
||||
return 51;
|
||||
}
|
||||
#ifndef NOPSTDINT
|
||||
param->statssrv64+=inbuf;
|
||||
#else
|
||||
param->statssrv+=inbuf;
|
||||
#endif
|
||||
param->nwrites++;
|
||||
if(sockgetlinebuf(param, SERVER, buf, 2, EOF, 60) != 2){
|
||||
return 55;
|
||||
@@ -243,11 +227,7 @@ int clientnegotiate(struct chain * redir, struct clientparam * param, unsigned l
|
||||
if(socksend(param->remsock, buf, len, conf.timeouts[CHAIN_TO]) != len){
|
||||
return 51;
|
||||
}
|
||||
#ifndef NOPSTDINT
|
||||
param->statssrv64+=len;
|
||||
#else
|
||||
param->statssrv+=len;
|
||||
#endif
|
||||
param->nwrites++;
|
||||
if(sockgetlinebuf(param, SERVER, buf, 4, EOF, conf.timeouts[CHAIN_TO]) != 4){
|
||||
return 57;
|
||||
@@ -561,7 +541,6 @@ unsigned bandlimitfunc(struct clientparam *param, unsigned nbytesin, unsigned nb
|
||||
|
||||
void trafcountfunc(struct clientparam *param){
|
||||
struct trafcount * tc;
|
||||
unsigned long val;
|
||||
int countout = 0;
|
||||
|
||||
pthread_mutex_lock(&tc_mutex);
|
||||
@@ -573,13 +552,7 @@ void trafcountfunc(struct clientparam *param){
|
||||
countout = 1;
|
||||
continue;
|
||||
}
|
||||
#ifndef NOPSTDINT
|
||||
tc->traf64 += param->statssrv64;
|
||||
#else
|
||||
val = tc->traf + param->statssrv;
|
||||
if(val < tc->traf) tc->trafgb++;
|
||||
tc->traf = val;
|
||||
#endif
|
||||
time(&t);
|
||||
tc->updated = t;
|
||||
}
|
||||
@@ -591,13 +564,7 @@ void trafcountfunc(struct clientparam *param){
|
||||
if(tc->ace->action != COUNTOUT) {
|
||||
continue;
|
||||
}
|
||||
#ifndef NOPSTDINT
|
||||
tc->traf64 += param->statscli64;
|
||||
#else
|
||||
val = tc->traf + param->statscli;
|
||||
if(val < tc->traf) tc->trafgb++;
|
||||
tc->traf = val;
|
||||
#endif
|
||||
time(&t);
|
||||
tc->updated = t;
|
||||
}
|
||||
@@ -624,21 +591,9 @@ int alwaysauth(struct clientparam * param){
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifndef NOPSTDINT
|
||||
if(tc->traflim64 <= tc->traf64) return 10;
|
||||
param->trafcountfunc = conf.trafcountfunc;
|
||||
param->maxtrafin64 = tc->traflim64 - tc->traf64;
|
||||
#else
|
||||
if((tc->traflimgb < tc->trafgb) ||
|
||||
((tc->traflimgb == tc->trafgb) && (tc->traflim < tc->traf))
|
||||
) return 10;
|
||||
param->trafcountfunc = conf.trafcountfunc;
|
||||
if(tc->traflimgb - tc->trafgb < 1 || ((tc->traflimgb - tc->trafgb) == 1 && tc->traf > tc->traflim)){
|
||||
unsigned maxtraf = tc->traflim - tc->traf;
|
||||
if(!param->maxtrafin || param->maxtrafin > maxtraf) param->maxtrafin = maxtraf;
|
||||
}
|
||||
if((tc->trafgb > tc->traflimgb) || (tc->trafgb == tc->traflimgb && tc->traf >= tc->traflim)) param->maxtrafin = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if(countout)for(tc = conf.trafcounter; tc; tc = tc->next) {
|
||||
@@ -649,21 +604,9 @@ int alwaysauth(struct clientparam * param){
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifndef NOPSTDINT
|
||||
if(tc->traflim64 <= tc->traf64) return 10;
|
||||
param->trafcountfunc = conf.trafcountfunc;
|
||||
param->maxtrafout64 = tc->traflim64 - tc->traf64;
|
||||
#else
|
||||
if((tc->traflimgb < tc->trafgb) ||
|
||||
((tc->traflimgb == tc->trafgb) && (tc->traflim < tc->traf))
|
||||
) return 10;
|
||||
param->trafcountfunc = conf.trafcountfunc;
|
||||
if(tc->traflimgb - tc->trafgb < 1 || ((tc->traflimgb - tc->trafgb) == 1 && tc->traf > tc->traflim)){
|
||||
unsigned maxtraf = tc->traflim - tc->traf;
|
||||
if(!param->maxtrafout || param->maxtrafout > maxtraf) param->maxtrafout = maxtraf;
|
||||
}
|
||||
if((tc->trafgb > tc->traflimgb) || (tc->trafgb == tc->traflimgb && tc->traf >= tc->traflim)) param->maxtrafout = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1129,20 +1072,12 @@ unsigned long udpresolve(unsigned char * name, unsigned *retttl, struct clientpa
|
||||
so._closesocket(sock);
|
||||
continue;
|
||||
}
|
||||
#ifndef NOPSTDINT
|
||||
if(param) param->statscli64 += len;
|
||||
#else
|
||||
if(param) param->statscli += len;
|
||||
#endif
|
||||
len = sockrecvfrom(sock, sinsp, buf, 4096, 15000);
|
||||
so._shutdown(sock, SHUT_RDWR);
|
||||
so._closesocket(sock);
|
||||
if(len <= 13) continue;
|
||||
#ifndef NOPSTDINT
|
||||
if(param) param->statssrv64 += len;
|
||||
#else
|
||||
if(param) param->statssrv += len;
|
||||
#endif
|
||||
if(*(unsigned short *)buf != nquery)continue;
|
||||
if((na = buf[7] + (((unsigned short)buf[6])<<8)) < 1) {
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user