mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
correctly calculate len of sending window
This commit is contained in:
parent
5714ae3935
commit
829355e6bf
@ -61,7 +61,7 @@ func (this *SendingWindow) Remove(idx uint32) {
|
||||
seg.Release()
|
||||
this.data[pos] = nil
|
||||
if pos == this.start {
|
||||
if this.len == 1 {
|
||||
if this.start == this.last {
|
||||
this.len = 0
|
||||
this.start = 0
|
||||
this.last = 0
|
||||
|
@ -94,4 +94,15 @@ func TestSendingWindow(t *testing.T) {
|
||||
})
|
||||
assert.Int(window.Len()).Equals(1)
|
||||
assert.Uint32(window.First().Number).Equals(4)
|
||||
|
||||
window.Push(&DataSegment{
|
||||
Number: 5,
|
||||
})
|
||||
assert.Int(window.Len()).Equals(2)
|
||||
|
||||
window.Remove(1)
|
||||
assert.Int(window.Len()).Equals(2)
|
||||
|
||||
window.Remove(0)
|
||||
assert.Int(window.Len()).Equals(0)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user