peer: Protect handlePongMsg with p.statsMtx
This commit is contained in:
parent
999ee7d863
commit
00a3f0eb60
@ -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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user