mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-07-05 05:25:23 +00:00
no compacting buffers
This commit is contained in:
parent
59125f665b
commit
e49fb2f50d
|
@ -65,13 +65,6 @@ func (this *SendingWindow) First() *DataSegment {
|
||||||
return this.data[this.start]
|
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) {
|
func (this *SendingWindow) Clear(una uint32) {
|
||||||
for !this.IsEmpty() && this.data[this.start].Number < una {
|
for !this.IsEmpty() && this.data[this.start].Number < una {
|
||||||
this.Remove(0)
|
this.Remove(0)
|
||||||
|
@ -266,19 +259,7 @@ func (this *SendingWorker) Push(b []byte) int {
|
||||||
nBytes := 0
|
nBytes := 0
|
||||||
this.Lock()
|
this.Lock()
|
||||||
defer this.Unlock()
|
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() {
|
for len(b) > 0 && !this.window.IsFull() {
|
||||||
var size int
|
var size int
|
||||||
if len(b) > int(this.conn.mss) {
|
if len(b) > int(this.conn.mss) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user