1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-03 04:25:23 +00:00

no compacting buffers

This commit is contained in:
Darien Raymond 2016-08-25 11:41:05 +02:00
parent 59125f665b
commit e49fb2f50d
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -65,13 +65,6 @@ func (this *SendingWindow) First() *DataSegment {
return this.data[this.start]
}
func (this *SendingWindow) Last() *DataSegment {
if this.IsEmpty() {
return nil
}
return this.data[this.last]
}
func (this *SendingWindow) Clear(una uint32) {
for !this.IsEmpty() && this.data[this.start].Number < una {
this.Remove(0)
@ -266,19 +259,7 @@ func (this *SendingWorker) Push(b []byte) int {
nBytes := 0
this.Lock()
defer this.Unlock()
if !this.window.IsEmpty() {
lastSeg := this.window.Last()
dataLen := lastSeg.Data.Len()
if dataLen < int(this.conn.mss) {
delta := int(this.conn.mss) - dataLen
if delta > len(b) {
delta = len(b)
}
lastSeg.Data.Append(b[:delta])
b = b[delta:]
nBytes += delta
}
}
for len(b) > 0 && !this.window.IsFull() {
var size int
if len(b) > int(this.conn.mss) {