diff --git a/buffer_pool.go b/buffer_pool.go index 40ff3bfc..bb4feb31 100644 --- a/buffer_pool.go +++ b/buffer_pool.go @@ -14,7 +14,6 @@ func getPacketBuffer() []byte { func putPacketBuffer(buf []byte) { if cap(buf) != int(protocol.MaxPacketSize) { - println(buf) panic("putPacketBuffer called with packet of wrong size!") } bufferPool.Put(buf[:0]) diff --git a/buffer_pool_test.go b/buffer_pool_test.go index 9fa1a53f..5d64c6b6 100644 --- a/buffer_pool_test.go +++ b/buffer_pool_test.go @@ -23,4 +23,10 @@ var _ = Describe("Buffer Pool", func() { Expect(buf).To(HaveCap(int(protocol.MaxPacketSize))) } }) + + It("panics if wrong-sized buffers are passed", func() { + Expect(func() { + putPacketBuffer([]byte{0}) + }).To(Panic()) + }) })