Commit 0449555d authored by Henrique Dias's avatar Henrique Dias

make BaseConnMgrScore const

License: MIT
Signed-off-by: default avatarHenrique Dias <hacdias@gmail.com>
parent e4dae1c9
...@@ -37,6 +37,8 @@ import ( ...@@ -37,6 +37,8 @@ import (
var logger = logging.Logger("dht") var logger = logging.Logger("dht")
const BaseConnMgrScore = 5
// IpfsDHT is an implementation of Kademlia with S/Kademlia modifications. // IpfsDHT is an implementation of Kademlia with S/Kademlia modifications.
// It is used to implement the base Routing module. // It is used to implement the base Routing module.
type IpfsDHT struct { type IpfsDHT struct {
...@@ -150,7 +152,7 @@ func makeDHT(ctx context.Context, h host.Host, dstore ds.Batching, protocols []p ...@@ -150,7 +152,7 @@ func makeDHT(ctx context.Context, h host.Host, dstore ds.Batching, protocols []p
rt.PeerAdded = func(p peer.ID) { rt.PeerAdded = func(p peer.ID) {
commonPrefixLen := kb.CommonPrefixLen(self, kb.ConvertPeerID(p)) 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) { rt.PeerRemoved = func(p peer.ID) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment