mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
p2p: revert back lookup discovery task
This commit is contained in:
parent
1a02c4c091
commit
dcc389a472
1 changed files with 5 additions and 4 deletions
|
|
@ -208,7 +208,8 @@ func (s *dialstate) newTasks(nRunning int, peers map[enode.ID]*Peer, now time.Ti
|
||||||
// scenario is useful for the testnet (and private networks) where the discovery
|
// scenario is useful for the testnet (and private networks) where the discovery
|
||||||
// table might be full of mostly bad peers, making it hard to find good ones.
|
// table might be full of mostly bad peers, making it hard to find good ones.
|
||||||
log.Trace("before if", "len(s.bootnodes)", len(s.bootnodes), "needdyndials", needDynDials, "bool", now.Sub(s.start) > fallbackInterval)
|
log.Trace("before if", "len(s.bootnodes)", len(s.bootnodes), "needdyndials", needDynDials, "bool", now.Sub(s.start) > fallbackInterval)
|
||||||
if len(peers) == 0 && len(s.bootnodes) > 0 && needDynDials > 0 && now.Sub(s.start) > fallbackInterval {
|
//if len(peers) == 0 && len(s.bootnodes) > 0 && needDynDials > 0 && now.Sub(s.start) > fallbackInterval {
|
||||||
|
if len(peers) == 0 && len(s.bootnodes) > 0 && needDynDials > 0 {
|
||||||
bootnode := s.bootnodes[0]
|
bootnode := s.bootnodes[0]
|
||||||
s.bootnodes = append(s.bootnodes[:0], s.bootnodes[1:]...)
|
s.bootnodes = append(s.bootnodes[:0], s.bootnodes[1:]...)
|
||||||
s.bootnodes = append(s.bootnodes, bootnode)
|
s.bootnodes = append(s.bootnodes, bootnode)
|
||||||
|
|
@ -231,8 +232,8 @@ func (s *dialstate) newTasks(nRunning int, peers map[enode.ID]*Peer, now time.Ti
|
||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
// Create dynamic dials from random lookup results, removing tried
|
//Create dynamic dials from random lookup results, removing tried
|
||||||
// items from the result buffer.
|
//items from the result buffer.
|
||||||
//i := 0
|
//i := 0
|
||||||
//for ; i < len(s.lookupBuf) && needDynDials > 0; i++ {
|
//for ; i < len(s.lookupBuf) && needDynDials > 0; i++ {
|
||||||
//if addDial(dynDialedConn, s.lookupBuf[i]) {
|
//if addDial(dynDialedConn, s.lookupBuf[i]) {
|
||||||
|
|
@ -240,7 +241,7 @@ func (s *dialstate) newTasks(nRunning int, peers map[enode.ID]*Peer, now time.Ti
|
||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
//s.lookupBuf = s.lookupBuf[:copy(s.lookupBuf, s.lookupBuf[i:])]
|
//s.lookupBuf = s.lookupBuf[:copy(s.lookupBuf, s.lookupBuf[i:])]
|
||||||
// Launch a discovery lookup if more candidates are needed.
|
////Launch a discovery lookup if more candidates are needed.
|
||||||
//if len(s.lookupBuf) < needDynDials && !s.lookupRunning {
|
//if len(s.lookupBuf) < needDynDials && !s.lookupRunning {
|
||||||
//s.lookupRunning = true
|
//s.lookupRunning = true
|
||||||
//newtasks = append(newtasks, &discoverTask{})
|
//newtasks = append(newtasks, &discoverTask{})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue