history and gossip length are named constants

This commit is contained in:
vyzo 2018-02-20 16:10:53 +02:00 committed by Steven Allen
parent c5fe290389
commit bd29e81e3a
1 changed files with 5 additions and 1 deletions

View File

@ -19,6 +19,10 @@ const (
GossipSubD = 6 GossipSubD = 6
GossipSubDlo = 4 GossipSubDlo = 4
GossipSubDhi = 12 GossipSubDhi = 12
// gossip parameters
GossipSubHistoryLength = 5
GossipSubHistoryGossip = 3
) )
func NewGossipSub(ctx context.Context, h host.Host, opts ...Option) (*PubSub, error) { func NewGossipSub(ctx context.Context, h host.Host, opts ...Option) (*PubSub, error) {
@ -28,7 +32,7 @@ func NewGossipSub(ctx context.Context, h host.Host, opts ...Option) (*PubSub, er
fanout: make(map[string]map[peer.ID]struct{}), fanout: make(map[string]map[peer.ID]struct{}),
gossip: make(map[peer.ID][]*pb.ControlIHave), gossip: make(map[peer.ID][]*pb.ControlIHave),
control: make(map[peer.ID]*pb.ControlMessage), control: make(map[peer.ID]*pb.ControlMessage),
mcache: NewMessageCache(3, 5), mcache: NewMessageCache(GossipSubHistoryGossip, GossipSubHistoryLength),
} }
return NewPubSub(ctx, h, rt, opts...) return NewPubSub(ctx, h, rt, opts...)
} }