From bf2151ba5f0851d3f0db5faf7708ae10d7847356 Mon Sep 17 00:00:00 2001 From: vyzo Date: Sat, 13 Jan 2018 20:47:28 +0200 Subject: [PATCH] the sendMsg channel should yield pointers for consistency --- floodsub.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/floodsub.go b/floodsub.go index 563f70c..627a863 100644 --- a/floodsub.go +++ b/floodsub.go @@ -59,7 +59,7 @@ type PubSub struct { topics map[string]map[peer.ID]struct{} // sendMsg handles messages that have been validated - sendMsg chan sendReq + sendMsg chan *sendReq peers map[peer.ID]chan *RPC seenMessages *timecache.TimeCache @@ -100,7 +100,7 @@ func NewFloodSub(ctx context.Context, h host.Host, opts ...Option) (*PubSub, err getPeers: make(chan *listPeerReq), addSub: make(chan *addSubReq), getTopics: make(chan *topicReq), - sendMsg: make(chan sendReq), + sendMsg: make(chan *sendReq), myTopics: make(map[string]map[*Subscription]struct{}), topics: make(map[string]map[peer.ID]struct{}), peers: make(map[peer.ID]chan *RPC), @@ -367,7 +367,7 @@ func (p *PubSub) pushMsg(subs []*Subscription, src peer.ID, msg *Message) { return } - sreq := sendReq{from: src, msg: msg} + sreq := &sendReq{from: src, msg: msg} select { case p.sendMsg <- sreq: default: @@ -422,7 +422,7 @@ loop: } // all validators were successful, send the message - p.sendMsg <- sendReq{ + p.sendMsg <- &sendReq{ from: src, msg: msg, }