]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Remove separate postedKeepalives expvar
authorMatt Joiner <anacrolix@gmail.com>
Mon, 10 May 2021 02:30:16 +0000 (12:30 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Fri, 14 May 2021 05:38:38 +0000 (15:38 +1000)
global.go
peerconn.go

index 63ac303f5d0857496979429f4caa9d27c0398fcf..6542ac393daaf324d9b2427db851b559d707aea1 100644 (file)
--- 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")
index 0c276808f37d8d5e36dbf636e460b719e3fa2d37..535ba737fca0765413868c03bed9d03b5b8cbff0 100644 (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....