aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorSonic <sonic@dexon.org>2019-04-03 16:28:29 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:59 +0800
commit06112b13838a3ec74b4943819d7a16c526c021e8 (patch)
tree0feb6c190df575f929ea17c434adba55af4889c2 /p2p
parent6d75ecc6fe12cd0f767c9df4cb6fff8a514f4046 (diff)
downloaddexon-06112b13838a3ec74b4943819d7a16c526c021e8.tar.gz
dexon-06112b13838a3ec74b4943819d7a16c526c021e8.tar.zst
dexon-06112b13838a3ec74b4943819d7a16c526c021e8.zip
dex: remove node table (#330)
* dex: remove node table Node table is not so useful, go back to rely on kademlia * p2p: fix direct dial still have resolve delay
Diffstat (limited to 'p2p')
-rw-r--r--p2p/dial.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/p2p/dial.go b/p2p/dial.go
index 583f02f6b..8bb39f9e8 100644
--- a/p2p/dial.go
+++ b/p2p/dial.go
@@ -226,7 +226,9 @@ func (s *dialstate) newTasks(nRunning int, peers map[enode.ID]*Peer, now time.Ti
delete(s.direct, t.dest.ID())
case nil:
s.dialing[id] = t.flags
- newtasks = append(newtasks, t)
+ // New a task instance with no lastResolved, resolveDelay here,
+ // so that we can pass the resolve delay check.
+ newtasks = append(newtasks, &dialTask{flags: t.flags, dest: t.dest})
}
}
@@ -363,12 +365,9 @@ func (t *dialTask) resolve(srv *Server) bool {
resolved := srv.ntab.Resolve(t.dest)
t.lastResolved = time.Now()
if resolved == nil {
- // Only backoff delay if this is not direct connection.
- if t.flags&directDialedConn == 0 {
- t.resolveDelay *= 2
- if t.resolveDelay > maxResolveDelay {
- t.resolveDelay = maxResolveDelay
- }
+ t.resolveDelay *= 2
+ if t.resolveDelay > maxResolveDelay {
+ t.resolveDelay = maxResolveDelay
}
log.Debug("Resolving node failed", "id", t.dest.ID(), "newdelay", t.resolveDelay)
return false