From 1a02c4c091882343fad34abf0a9967c5d68d6e65 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Fri, 18 Jan 2019 14:35:21 +0100 Subject: [PATCH] p2p: traces --- p2p/dial.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/p2p/dial.go b/p2p/dial.go index 5fd4648965..9b99a61432 100644 --- a/p2p/dial.go +++ b/p2p/dial.go @@ -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: