From: Matt Joiner Date: Tue, 18 Nov 2014 00:02:16 +0000 (-0600) Subject: dht: Fix "good" node determination X-Git-Tag: v1.0.0~1524 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=e4822769eec82fb8bb075f87fcbb9d1322ea4da7;p=btrtrc.git dht: Fix "good" node determination --- diff --git a/dht/dht.go b/dht/dht.go index b8acae4b..c6d84142 100644 --- a/dht/dht.go +++ b/dht/dht.go @@ -119,7 +119,13 @@ func (n *Node) Good() bool { if len(n.id) != 20 { return false } - if time.Now().Sub(n.lastHeardFrom) >= 15*time.Minute { + if n.lastSentTo.IsZero() { + return true + } + if n.lastSentTo.Before(n.lastHeardFrom) { + return true + } + if time.Now().Sub(n.lastHeardFrom) >= 1*time.Minute { return false } return true