Skip to content

Commit 61513d0

Browse files
committed
remove limiting in peer tracker
1 parent 3b63466 commit 61513d0

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

p2p/peer_tracker.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ import (
1212
"github.com/libp2p/go-libp2p/p2p/net/conngater"
1313
)
1414

15-
const (
16-
// defaultScore specifies the score for newly connected peers.
17-
defaultScore float32 = 1
18-
// maxPeerTrackerSize specifies the max amount of peers that can be added to the peerTracker.
19-
maxPeerTrackerSize = 100
20-
)
15+
// defaultScore specifies the score for newly connected peers.
16+
const defaultScore float32 = 1
2117

2218
var (
2319
// maxAwaitingTime specifies the duration that gives to the disconnected peer to be back online,
@@ -177,13 +173,6 @@ func (p *peerTracker) connected(pID libpeer.ID) {
177173

178174
p.peerLk.Lock()
179175
defer p.peerLk.Unlock()
180-
// skip adding the peer to avoid overfilling of the peerTracker with unused peers if:
181-
// peerTracker reaches the maxTrackerSize and there are more connected peers
182-
// than disconnected peers.
183-
if len(p.trackedPeers)+len(p.disconnectedPeers) > maxPeerTrackerSize &&
184-
len(p.trackedPeers) > len(p.disconnectedPeers) {
185-
return
186-
}
187176

188177
// additional check in p.trackedPeers should be done,
189178
// because libp2p does not emit multiple Connected events per 1 peer

0 commit comments

Comments
 (0)