Skip to content

Commit

Permalink
reset cc var to abs value
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottyPoi committed Sep 11, 2023
1 parent bbc017c commit 06999e8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class CongestionControl extends EventEmitter {
const rtt = timestamp - sentTime
// Updates Round Trip Time (Time between sending DATA packet and receiving ACK packet)
const delta = this.rtt - rtt
this.rtt_var = this.rtt_var + Math.floor((delta - this.rtt_var) / 4)
this.rtt_var = this.rtt_var + Math.abs(Math.floor((delta - this.rtt_var) / 4))
this.rtt = Math.floor(this.rtt + (rtt - this.rtt) / 8)
this.timeout = this.rtt + this.rtt_var * 4 > 500 ? this.rtt + this.rtt_var * 4 : 500
clearTimeout(this.timeoutCounter)
Expand Down

0 comments on commit 06999e8

Please sign in to comment.