From d647eea2b72731d4af0c28291615769d5976fbad Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 18 Oct 2013 18:50:43 +0100 Subject: [PATCH] update statistics for the time we last send/recieved a message. --- peer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/peer.go b/peer.go index be16a2ac..2007860c 100644 --- a/peer.go +++ b/peer.go @@ -113,6 +113,8 @@ type peer struct { addr string na *btcwire.NetAddress timeConnected time.Time + lastSend time.Time + lastRecv time.Time inbound bool connected int32 disconnect int32 // only to be used atomically @@ -962,6 +964,7 @@ out: } break out } + p.lastRecv = time.Now() // Ensure version message comes first. if _, ok := rmsg.(*btcwire.MsgVersion); !ok && !p.versionKnown { @@ -1111,6 +1114,7 @@ out: pingTimer.Reset(pingTimeoutMinutes * time.Minute) } p.writeMessage(msg.msg) + p.lastSend = time.Now() if msg.doneChan != nil { msg.doneChan <- true }