diff --git a/peer/peer.go b/peer/peer.go index a174c5e9..4a57bc5f 100644 --- a/peer/peer.go +++ b/peer/peer.go @@ -947,11 +947,13 @@ func (p *Peer) handlePongMsg(msg *wire.MsgPong) { // and overlapping pings will be ignored. It is unlikely to occur // without large usage of the ping rpc call since we ping infrequently // enough that if they overlap we would have timed out the peer. + p.statsMtx.Lock() if p.lastPingNonce != 0 && msg.Nonce == p.lastPingNonce { p.lastPingMicros = time.Since(p.lastPingTime).Nanoseconds() p.lastPingMicros /= 1000 // convert to usec. p.lastPingNonce = 0 } + p.statsMtx.Unlock() } // readMessage reads the next wire message from the peer with logging.