update putPacketBuffer

pull/1435/head
Darien Raymond 2018-11-21 11:03:47 +01:00
parent 649f4da92a
commit e99dd29946
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 4 additions and 3 deletions

View File

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