send more ack seg

pull/314/head
Darien Raymond 8 years ago
parent 2dc74faf19
commit 3be9519ed4
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -104,7 +104,7 @@ func (v *AckList) Flush(current uint32, rto uint32) {
v.flushCandidates = v.flushCandidates[:0] v.flushCandidates = v.flushCandidates[:0]
seg := NewAckSegment() seg := NewAckSegment()
for i := 0; i < len(v.numbers) && !seg.IsFull(); i++ { for i := 0; i < len(v.numbers); i++ {
if v.nextFlush[i] > current { if v.nextFlush[i] > current {
if len(v.flushCandidates) < cap(v.flushCandidates) { if len(v.flushCandidates) < cap(v.flushCandidates) {
v.flushCandidates = append(v.flushCandidates, v.numbers[i]) v.flushCandidates = append(v.flushCandidates, v.numbers[i])
@ -118,6 +118,12 @@ func (v *AckList) Flush(current uint32, rto uint32) {
timeout = 20 timeout = 20
} }
v.nextFlush[i] = current + timeout v.nextFlush[i] = current + timeout
if seg.IsFull() {
v.writer.Write(seg)
seg.Release()
seg = NewAckSegment()
}
} }
if seg.Count > 0 { if seg.Count > 0 {
for _, number := range v.flushCandidates { for _, number := range v.flushCandidates {

Loading…
Cancel
Save