2
0
mirror of synced 2025-02-24 14:48:27 +00:00

dht: Fix "good" node determination

This commit is contained in:
Matt Joiner 2014-11-17 18:02:16 -06:00
parent 6d05994c2c
commit e4822769ee

View File

@ -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