mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
update node last ping/pong time
This commit is contained in:
parent
1611815b8d
commit
37efcfc8e8
1 changed files with 6 additions and 0 deletions
|
|
@ -1112,6 +1112,9 @@ func (net *Network) ping(n *Node, addr *net.UDPAddr) {
|
|||
n.pingTopics = net.ticketStore.regTopicSet()
|
||||
n.pingEcho = net.conn.sendPing(n, addr, n.pingTopics)
|
||||
net.timedEvent(respTimeout, n, pongTimeout)
|
||||
|
||||
//update last ping sent to Node n
|
||||
net.db.updateLastPing(n.ID, time.Now())
|
||||
}
|
||||
|
||||
func (net *Network) handlePing(n *Node, pkt *ingressPacket) {
|
||||
|
|
@ -1140,6 +1143,9 @@ func (net *Network) handleKnownPong(n *Node, pkt *ingressPacket) error {
|
|||
} else {
|
||||
log.Trace("Failed to convert pong to ticket", "err", err)
|
||||
}
|
||||
//update Node n last seen pong time
|
||||
net.db.updateLastPong(n.ID, time.Now())
|
||||
|
||||
n.pingEcho = nil
|
||||
n.pingTopics = nil
|
||||
return err
|
||||
|
|
|
|||
Loading…
Reference in a new issue