Selaa lähdekoodia

no compacting buffers

Darien Raymond 9 vuotta sitten
vanhempi
commit
e49fb2f50d
1 muutettua tiedostoa jossa 1 lisäystä ja 20 poistoa
  1. 1 20
      transport/internet/kcp/sending.go

+ 1 - 20
transport/internet/kcp/sending.go

@@ -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) {