]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Log dropping of bad peers in debug mode only
authorMatt Joiner <anacrolix@gmail.com>
Sun, 3 Dec 2017 02:44:37 +0000 (13:44 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 3 Dec 2017 02:44:37 +0000 (13:44 +1100)
torrent.go

index d6846dbef762ec5670f630fced1cedaa0f0d28d3..b2e5dea520e7d52fbfa6904f8b7f4a3f0c3b8fde 100644 (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()