Log dropping of bad peers in debug mode only

This commit is contained in:
Matt Joiner 2017-12-03 13:44:37 +11:00
parent b9a1cb5b8b
commit 54a7d83c45
1 changed files with 8 additions and 6 deletions

View File

@ -1484,12 +1484,14 @@ func (t *Torrent) pieceHashed(piece int, correct bool) {
c.badPiecesDirtied++
}
slices.Sort(touchers, connLessTrusted)
log.Printf("dropping first corresponding conn from trust: %v", func() (ret []int) {
for _, c := range touchers {
ret = append(ret, c.netGoodPiecesDirtied())
}
return
}())
if t.cl.config.Debug {
log.Printf("dropping first corresponding conn from trust: %v", func() (ret []int) {
for _, c := range touchers {
ret = append(ret, c.netGoodPiecesDirtied())
}
return
}())
}
c := touchers[0]
t.cl.banPeerIP(missinggo.AddrIP(c.remoteAddr()))
c.Drop()