Skip to content

Commit

Permalink
make BaseConnMgrScore const
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
  • Loading branch information
hacdias committed Dec 12, 2019
1 parent e4dae1c commit 0449555
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import (

var logger = logging.Logger("dht")

const BaseConnMgrScore = 5

// IpfsDHT is an implementation of Kademlia with S/Kademlia modifications.
// It is used to implement the base Routing module.
type IpfsDHT struct {
Expand Down Expand Up @@ -150,7 +152,7 @@ func makeDHT(ctx context.Context, h host.Host, dstore ds.Batching, protocols []p

rt.PeerAdded = func(p peer.ID) {
commonPrefixLen := kb.CommonPrefixLen(self, kb.ConvertPeerID(p))
cmgr.TagPeer(p, "kbucket", 5+commonPrefixLen)
cmgr.TagPeer(p, "kbucket", BaseConnMgrScore+commonPrefixLen)
}

rt.PeerRemoved = func(p peer.ID) {
Expand Down

0 comments on commit 0449555

Please sign in to comment.