]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix panic in Torrent.addrActive if there are closed connections
authorMatt Joiner <anacrolix@gmail.com>
Fri, 1 Dec 2017 23:01:27 +0000 (10:01 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Fri, 1 Dec 2017 23:01:27 +0000 (10:01 +1100)
Fixes #214

torrent.go

index 4c5fd153b7aa441379b09de7488b6a01168cf328..d6846dbef762ec5670f630fced1cedaa0f0d28d3 100644 (file)
@@ -207,7 +207,11 @@ func (t *Torrent) addrActive(addr string) bool {
                return true
        }
        for c := range t.conns {
-               if c.remoteAddr().String() == addr {
+               ra := c.remoteAddr()
+               if ra == nil {
+                       continue
+               }
+               if ra.String() == addr {
                        return true
                }
        }