Browse Source

update putPacketBuffer

Darien Raymond 7 years ago
parent
commit
e99dd29946
1 changed files with 4 additions and 3 deletions
  1. 4 3
      vendor/github.com/lucas-clemente/quic-go/buffer_pool.go

+ 4 - 3
vendor/github.com/lucas-clemente/quic-go/buffer_pool.go

@@ -16,10 +16,11 @@ func getPacketBuffer() *[]byte {
 }
 
 func putPacketBuffer(buf *[]byte) {
-	if cap(*buf) < int(protocol.MaxReceivePacketSize) {
-		panic("putPacketBuffer called with packet of wrong size!")
+	b := *buf
+	if cap(b) < 2048 {
+		return
 	}
-	bufferPool.Put(*buf)
+	bufferPool.Put(b[:cap(b)])
 }
 
 func init() {