mirror of https://github.com/v2ray/v2ray-core
fix a bug in length calculation
parent
6ca4eaf3b6
commit
2169dcd7da
|
@ -60,16 +60,17 @@ func (this *SendingWindow) Remove(idx uint32) {
|
||||||
}
|
}
|
||||||
seg.Release()
|
seg.Release()
|
||||||
this.data[pos] = nil
|
this.data[pos] = nil
|
||||||
if pos == this.start {
|
if pos == this.start && pos == this.last {
|
||||||
if this.start == this.last {
|
|
||||||
this.len = 0
|
this.len = 0
|
||||||
this.start = 0
|
this.start = 0
|
||||||
this.last = 0
|
this.last = 0
|
||||||
} else {
|
} else if pos == this.start {
|
||||||
delta := this.next[pos] - this.start
|
delta := this.next[pos] - this.start
|
||||||
|
if this.next[pos] < this.start {
|
||||||
|
delta = this.next[pos] + this.cap - this.start
|
||||||
|
}
|
||||||
this.start = this.next[pos]
|
this.start = this.next[pos]
|
||||||
this.len -= delta
|
this.len -= delta
|
||||||
}
|
|
||||||
} else if pos == this.last {
|
} else if pos == this.last {
|
||||||
this.last = this.prev[pos]
|
this.last = this.prev[pos]
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue