Remove separate postedKeepalives expvar

This commit is contained in:
Matt Joiner 2021-05-10 12:30:16 +10:00
parent 4ab20f60b6
commit 1080c837b9
2 changed files with 1 additions and 2 deletions

View File

@ -36,7 +36,6 @@ var (
// Count of connections to peer with same client ID.
connsToSelf = expvar.NewInt("connsToSelf")
receivedKeepalives = expvar.NewInt("receivedKeepalives")
postedKeepalives = expvar.NewInt("postedKeepalives")
// Requests received for pieces we don't have.
requestsReceivedForMissingPieces = expvar.NewInt("requestsReceivedForMissingPieces")
requestedChunkLengths = expvar.NewMap("requestedChunkLengths")

View File

@ -680,7 +680,7 @@ func (cn *PeerConn) writer(keepAliveTimeout time.Duration) {
}
if cn.writeBuffer.Len() == 0 && time.Since(lastWrite) >= keepAliveTimeout && cn.useful() {
cn.writeBuffer.Write(pp.Message{Keepalive: true}.MustMarshalBinary())
postedKeepalives.Add(1)
torrent.Add("written keepalives", 1)
}
if cn.writeBuffer.Len() == 0 {
// TODO: Minimize wakeups....