Client Speed limit algorithm?

Moderator: Project members

Post Reply
Message
Author
GrantFei
500 Command not understood
Posts: 1
Joined: 2006-05-22 13:20

Client Speed limit algorithm?

#1 Post by GrantFei » 2006-05-22 13:23

Firstly, thanks for this project team! Well,I have a problem with the downlaod speed limit algorithm in the source code.
Assuming ,there are three transfer socket A, transfer socket B, and transfer socket C.
Now the speed limt is 3kb. A's nBytesAvialble is now 0 after some download transmission.B' and C' nBytesAvailbale is 1*1024 respectively .In source code,the average of 3kb among A,B,C is 1*1024 .and Because A's nBytesAvailable is zero ,A's nBytesAvailble is 1*1024 plus (B's and C'left nBytesAvailbale)/2 .So A's is (1*1024+1*1024).But A's nBytesAvailalbe exceeds the average 1*1024. To sum all of A,B and C 'nBytesAvailable,it exceeds the limit 3 kb.Why is it? I am curiously to fetch the answer.
Sincerely
Grant Fei

User avatar
botg
Site Admin
Posts: 35558
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

#2 Post by botg » 2006-05-25 20:37

I've fixed a bug with the speed limit code in CVS. I'll release a fixed version during the next few days.

Anyhow, it's still possible for the total sum of nBytesAvailable to become greater than the limit. This happens if a transfer did not use up its assigned bandwidth. Assuming that this will be the case again in future, this is no problem.
In case speed did recover, in one time unit (currently one second) a little bit more than the assigned quota will exceed, by exactly the amount of bytes not transferred in the time unit before. So averaged about two time units the speed never exceeds the set limit.

Post Reply