Skip to content

Commit 6c285ed

Browse files
committed
remove limiting in peer tracker
1 parent 6d0f9a4 commit 6c285ed

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,
@@ -174,13 +170,6 @@ func (p *peerTracker) connected(pID libpeer.ID) {
174170

175171
p.peerLk.Lock()
176172
defer p.peerLk.Unlock()
177-
// skip adding the peer to avoid overfilling of the peerTracker with unused peers if:
178-
// peerTracker reaches the maxTrackerSize and there are more connected peers
179-
// than disconnected peers.
180-
if len(p.trackedPeers)+len(p.disconnectedPeers) > maxPeerTrackerSize &&
181-
len(p.trackedPeers) > len(p.disconnectedPeers) {
182-
return
183-
}
184173

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

0 commit comments

Comments
 (0)