Count peers added from DHT for logging
This commit is contained in:
parent
d7c549d2e4
commit
f5d2ba37bc
10
torrent.go
10
torrent.go
@ -1538,17 +1538,23 @@ func (t *Torrent) consumeDhtAnnouncePeers(pvs <-chan dht.PeersValues) {
|
|||||||
cl := t.cl
|
cl := t.cl
|
||||||
for v := range pvs {
|
for v := range pvs {
|
||||||
cl.lock()
|
cl.lock()
|
||||||
|
added := 0
|
||||||
for _, cp := range v.Peers {
|
for _, cp := range v.Peers {
|
||||||
if cp.Port == 0 {
|
if cp.Port == 0 {
|
||||||
// Can't do anything with this.
|
// Can't do anything with this.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
t.addPeer(PeerInfo{
|
if t.addPeer(PeerInfo{
|
||||||
Addr: ipPortAddr{cp.IP, cp.Port},
|
Addr: ipPortAddr{cp.IP, cp.Port},
|
||||||
Source: PeerSourceDhtGetPeers,
|
Source: PeerSourceDhtGetPeers,
|
||||||
})
|
}) {
|
||||||
|
added++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cl.unlock()
|
cl.unlock()
|
||||||
|
if added != 0 {
|
||||||
|
//log.Printf("added %v peers from dht for %v", added, t.InfoHash().HexString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user