From 0dd2171ac58aa234c9c19c4d86a95ef6ea5bd422 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Sat, 16 Nov 2019 01:39:12 +0800 Subject: [PATCH] queue size must always be positive --- pubsub.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubsub.go b/pubsub.go index e0db9d0..53e4bc4 100644 --- a/pubsub.go +++ b/pubsub.go @@ -241,8 +241,8 @@ func NewPubSub(ctx context.Context, h host.Host, rt PubSubRouter, opts ...Option // We start dropping messages to a peer if the outbound queue if full func WithPeerOutboundQueueSize(size int) Option { return func(p *PubSub) error { - if size < 0 { - return errors.New("outbound queue size can't be negative") + if size <= 0 { + return errors.New("outbound queue size must always be positive") } p.peerOutboundQueueSize = size return nil