From 1080c837b987a7bf5c9ef30eef1e3d4f26ef8d05 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 10 May 2021 12:30:16 +1000 Subject: [PATCH] Remove separate postedKeepalives expvar --- global.go | 1 - peerconn.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/global.go b/global.go index 63ac303f..6542ac39 100644 --- a/global.go +++ b/global.go @@ -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") diff --git a/peerconn.go b/peerconn.go index 0c276808..535ba737 100644 --- a/peerconn.go +++ b/peerconn.go @@ -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....