p2p: revert back lookup discovery task

This commit is contained in:
Anton Evangelatov 2019-01-18 14:45:08 +01:00
parent 1a02c4c091
commit dcc389a472

View file

@ -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)
@ -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{})