mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
p2p: traces
This commit is contained in:
parent
2131b622ad
commit
1a02c4c091
1 changed files with 6 additions and 0 deletions
|
|
@ -166,6 +166,7 @@ func (s *dialstate) newTasks(nRunning int, peers map[enode.ID]*Peer, now time.Ti
|
|||
|
||||
var newtasks []task
|
||||
addDial := func(flag connFlag, n *enode.Node) bool {
|
||||
log.Trace("addDial func", n.ID())
|
||||
if err := s.checkDial(n, peers); err != nil {
|
||||
log.Trace("Skipping dial candidate", "id", n.ID(), "addr", &net.TCPAddr{IP: n.IP(), Port: n.TCP()}, "err", err)
|
||||
return false
|
||||
|
|
@ -206,13 +207,17 @@ func (s *dialstate) newTasks(nRunning int, peers map[enode.ID]*Peer, now time.Ti
|
|||
// If we don't have any peers whatsoever, try to dial a random bootnode. This
|
||||
// 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.
|
||||
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 {
|
||||
bootnode := s.bootnodes[0]
|
||||
s.bootnodes = append(s.bootnodes[:0], s.bootnodes[1:]...)
|
||||
s.bootnodes = append(s.bootnodes, bootnode)
|
||||
|
||||
log.Trace("inside if", "bootnode", bootnode, "len(s.bootnodes)", len(s.bootnodes))
|
||||
|
||||
if addDial(dynDialedConn, bootnode) {
|
||||
needDynDials--
|
||||
log.Trace("inside addDial if", "needDynDials", needDynDials)
|
||||
}
|
||||
}
|
||||
// Use random nodes from the table for half of the necessary
|
||||
|
|
@ -261,6 +266,7 @@ var (
|
|||
)
|
||||
|
||||
func (s *dialstate) checkDial(n *enode.Node, peers map[enode.ID]*Peer) error {
|
||||
log.Trace("checkDial func", n.ID())
|
||||
_, dialing := s.dialing[n.ID()]
|
||||
switch {
|
||||
case dialing:
|
||||
|
|
|
|||
Loading…
Reference in a new issue