mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 18:45:40 +08:00
Fix bandlim handling
This commit is contained in:
parent
ff67464aa1
commit
021314d6f5
@ -575,7 +575,7 @@ unsigned bandlimitfunc(struct clientparam *param, unsigned nbytesin, unsigned nb
|
|||||||
param->bandlims[i]->nexttime - now : 0;
|
param->bandlims[i]->nexttime - now : 0;
|
||||||
sleeptime = (nsleeptime > sleeptime)? nsleeptime : sleeptime;
|
sleeptime = (nsleeptime > sleeptime)? nsleeptime : sleeptime;
|
||||||
param->bandlims[i]->basetime = sec;
|
param->bandlims[i]->basetime = sec;
|
||||||
param->bandlims[i]->nexttime = msec + nsleeptime + (nbytesin > 512)? ((nbytesin+32)/64)*(((64*8*1000000)/param->bandlims[i]->rate)) : ((nbytesin+1) * (8*1000000))/param->bandlims[i]->rate;
|
param->bandlims[i]->nexttime = msec + nsleeptime + ((nbytesin > 512)? ((nbytesin+32)/64)*(((64*8*1000000)/param->bandlims[i]->rate)) : ((nbytesin+1) * (8*1000000))/param->bandlims[i]->rate);
|
||||||
}
|
}
|
||||||
for(i=0; nbytesout && i<MAXBANDLIMS && param->bandlimsout[i]; i++){
|
for(i=0; nbytesout && i<MAXBANDLIMS && param->bandlimsout[i]; i++){
|
||||||
if( !param->bandlimsout[i]->basetime ||
|
if( !param->bandlimsout[i]->basetime ||
|
||||||
@ -592,7 +592,7 @@ unsigned bandlimitfunc(struct clientparam *param, unsigned nbytesin, unsigned nb
|
|||||||
param->bandlimsout[i]->nexttime - now : 0;
|
param->bandlimsout[i]->nexttime - now : 0;
|
||||||
sleeptime = (nsleeptime > sleeptime)? nsleeptime : sleeptime;
|
sleeptime = (nsleeptime > sleeptime)? nsleeptime : sleeptime;
|
||||||
param->bandlimsout[i]->basetime = sec;
|
param->bandlimsout[i]->basetime = sec;
|
||||||
param->bandlimsout[i]->nexttime = msec + nsleeptime + (nbytesout > 512)? ((nbytesout+32)/64)*((64*8*1000000)/param->bandlimsout[i]->rate) : ((nbytesout+1)* (8*1000000))/param->bandlimsout[i]->rate;
|
param->bandlimsout[i]->nexttime = msec + nsleeptime + ((nbytesout > 512)? ((nbytesout+32)/64)*((64*8*1000000)/param->bandlimsout[i]->rate) : ((nbytesout+1)* (8*1000000))/param->bandlimsout[i]->rate);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&bandlim_mutex);
|
pthread_mutex_unlock(&bandlim_mutex);
|
||||||
return sleeptime/1000;
|
return sleeptime/1000;
|
||||||
|
@ -355,7 +355,7 @@ log("done read from server to pipe\n");
|
|||||||
if(inserverpipe >= MAXSPLICE) TOSERVERPIPE = 0;
|
if(inserverpipe >= MAXSPLICE) TOSERVERPIPE = 0;
|
||||||
if(param->bandlimfunc) {
|
if(param->bandlimfunc) {
|
||||||
int sl1;
|
int sl1;
|
||||||
sl1 = (*param->bandlimfunc)(param, 1, res);
|
sl1 = (*param->bandlimfunc)(param, res, 0);
|
||||||
if(sl1 > sleeptime) sleeptime = sl1;
|
if(sl1 > sleeptime) sleeptime = sl1;
|
||||||
}
|
}
|
||||||
if(param->operation == UDPASSOC && param->srv->singlepacket){
|
if(param->operation == UDPASSOC && param->srv->singlepacket){
|
||||||
@ -418,7 +418,7 @@ log("done read from server to buf");
|
|||||||
param->srvinbuf += res;
|
param->srvinbuf += res;
|
||||||
if(param->bandlimfunc) {
|
if(param->bandlimfunc) {
|
||||||
int sl1;
|
int sl1;
|
||||||
sl1 = (*param->bandlimfunc)(param, 1, res);
|
sl1 = (*param->bandlimfunc)(param, res, 0);
|
||||||
if(sl1 > sleeptime) sleeptime = sl1;
|
if(sl1 > sleeptime) sleeptime = sl1;
|
||||||
}
|
}
|
||||||
if(param->srvbufsize == param->srvinbuf) TOSERVERBUF = 0;
|
if(param->srvbufsize == param->srvinbuf) TOSERVERBUF = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user