projects
/
btrtrc.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6d05994
)
dht: Fix "good" node determination
author
Matt Joiner <anacrolix@gmail.com>
Tue, 18 Nov 2014 00:02:16 +0000 (18:02 -0600)
committer
Matt Joiner <anacrolix@gmail.com>
Tue, 18 Nov 2014 00:02:16 +0000 (18:02 -0600)
dht/dht.go
patch
|
blob
|
history
diff --git
a/dht/dht.go
b/dht/dht.go
index b8acae4b8fe857d132e31f19806c0d9e2c67c530..c6d84142d51e3eb83ad6ea279c82dc6a5e409573 100644
(file)
--- 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