1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -05:00

remove duplicated code

This commit is contained in:
v2ray 2016-07-15 21:41:15 +02:00
parent f6d4e599bd
commit d5cd919cec
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -294,17 +294,7 @@ func (this *SendingWorker) ProcessAck(number uint32) {
this.FindFirstUnacknowledged()
}
func (this *SendingWorker) ProcessSegment(current uint32, seg *AckSegment) {
defer seg.Release()
this.Lock()
defer this.Unlock()
if this.remoteNextNumber < seg.ReceivingWindow {
this.remoteNextNumber = seg.ReceivingWindow
}
this.ProcessReceivingNextWithoutLock(seg.ReceivingNext)
func (this *SendingWorker) FillWindow(current uint32) {
for !this.queue.IsEmpty() && !this.window.IsFull() {
seg := NewDataSegment()
seg.Data = this.queue.Pop()
@ -315,6 +305,19 @@ func (this *SendingWorker) ProcessSegment(current uint32, seg *AckSegment) {
this.window.Push(seg)
this.nextNumber++
}
}
func (this *SendingWorker) ProcessSegment(current uint32, seg *AckSegment) {
defer seg.Release()
this.Lock()
defer this.Unlock()
if this.remoteNextNumber < seg.ReceivingWindow {
this.remoteNextNumber = seg.ReceivingWindow
}
this.ProcessReceivingNextWithoutLock(seg.ReceivingNext)
this.FillWindow(current)
var maxack uint32
for i := 0; i < int(seg.Count); i++ {
@ -409,17 +412,7 @@ func (this *SendingWorker) Flush(current uint32) {
cwnd = this.firstUnacknowledged + this.controlWindow
}
for !this.queue.IsEmpty() && !this.window.IsFull() {
seg := NewDataSegment()
seg.Data = this.queue.Pop()
seg.Number = this.nextNumber
seg.timeout = current
seg.ackSkipped = 0
seg.transmit = 0
this.window.Push(seg)
this.nextNumber++
}
this.FillWindow(current)
this.window.Flush(current, this.conn.fastresend, this.conn.roundTrip.Timeout(), cwnd)
}