From: Matt Joiner Date: Mon, 10 May 2021 02:30:16 +0000 (+1000) Subject: Remove separate postedKeepalives expvar X-Git-Tag: v1.28.0~16 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=1080c837b987a7bf5c9ef30eef1e3d4f26ef8d05;p=btrtrc.git Remove separate postedKeepalives expvar --- 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....