Skip to content

Commit

Permalink
increase the size of the send queue
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Jan 20, 2021
1 parent 53b1cbb commit 3733759
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion send_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type sendQueue struct {

var _ sender = &sendQueue{}

const sendQueueCapacity = 1
const sendQueueCapacity = 8

func newSendQueue(conn sendConn) sender {
return &sendQueue{
Expand Down
8 changes: 5 additions & 3 deletions send_queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 3733759

Please sign in to comment.