From 1d06e41f04d75c31334c455063e9ec7b4136bf23 Mon Sep 17 00:00:00 2001 From: ferhat elmas Date: Mon, 4 Dec 2017 11:07:10 +0100 Subject: [PATCH] p2p, swarm/network/kademlia: use IsZero to check for zero time (#15603) --- p2p/dial.go | 2 +- swarm/network/kademlia/kaddb.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/p2p/dial.go b/p2p/dial.go index 8ca3dc5a16..f5ff2c2117 100644 --- a/p2p/dial.go +++ b/p2p/dial.go @@ -157,7 +157,7 @@ func (s *dialstate) removeStatic(n *discover.Node) { } func (s *dialstate) newTasks(nRunning int, peers map[discover.NodeID]*Peer, now time.Time) []task { - if s.start == (time.Time{}) { + if s.start.IsZero() { s.start = now } diff --git a/swarm/network/kademlia/kaddb.go b/swarm/network/kademlia/kaddb.go index cb0869467e..b37ced5ba0 100644 --- a/swarm/network/kademlia/kaddb.go +++ b/swarm/network/kademlia/kaddb.go @@ -330,7 +330,7 @@ func (self *KadDb) load(path string, cb func(*NodeRecord, Node) error) (err erro } } n++ - if (node.After == time.Time{}) { + if node.After.IsZero() { node.After = time.Now() } self.index[node.Addr] = node