update RecivingWindow.Remove

pull/215/head
v2ray 2016-06-27 09:03:05 +02:00
parent 7f661f5215
commit 231f5fc140
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 4 additions and 3 deletions

View File

@ -33,9 +33,6 @@ func (this *ReceivingWindow) Set(idx uint32, value *Segment) bool {
func (this *ReceivingWindow) Remove(idx uint32) *Segment {
pos := this.Position(idx)
if this.list[pos] == nil {
return nil
}
e := this.list[pos]
this.list[pos] = nil
return e

View File

@ -19,6 +19,10 @@ func TestRecivingWindow(t *testing.T) {
assert.Bool(window.Set(0, seg0)).IsTrue()
assert.Pointer(window.RemoveFirst()).Equals(seg0)
e := window.RemoveFirst()
if e != nil {
assert.Fail("Expecting nil.")
}
assert.Bool(window.Set(1, seg1)).IsTrue()
assert.Bool(window.Set(2, seg2)).IsTrue()