From 37337597bd84cad377339c45e10ecff3cde8c463 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 20 Jan 2021 14:45:18 +0800 Subject: [PATCH] increase the size of the send queue --- send_queue.go | 2 +- send_queue_test.go | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/send_queue.go b/send_queue.go index 4d31a276..bf25dded 100644 --- a/send_queue.go +++ b/send_queue.go @@ -18,7 +18,7 @@ type sendQueue struct { var _ sender = &sendQueue{} -const sendQueueCapacity = 1 +const sendQueueCapacity = 8 func newSendQueue(conn sendConn) sender { return &sendQueue{ diff --git a/send_queue_test.go b/send_queue_test.go index 416c264b..dc3179c4 100644 --- a/send_queue_test.go +++ b/send_queue_test.go @@ -43,10 +43,12 @@ var _ = Describe("Send Queue", func() { }) It("panics when Send() is called although there's no space in the queue", func() { - Expect(q.WouldBlock()).To(BeFalse()) - q.Send(getPacket([]byte("foobar1"))) + for i := 0; i < sendQueueCapacity; i++ { + Expect(q.WouldBlock()).To(BeFalse()) + q.Send(getPacket([]byte("foobar"))) + } Expect(q.WouldBlock()).To(BeTrue()) - Expect(func() { q.Send(getPacket([]byte("foobar2"))) }).To(Panic()) + Expect(func() { q.Send(getPacket([]byte("raboof"))) }).To(Panic()) }) It("signals when sending is possible again", func() {