connection.go | 2 ++ global.go | 2 ++ diff --git a/connection.go b/connection.go index 28152d5a60c13630423f84dcd94ef1cd523d5706..6d11f8ab1334e09e9574b9e9c3830a344e8208dd 100644 --- a/connection.go +++ b/connection.go @@ -1326,6 +1326,8 @@ err := func() error { cl.unlock() defer cl.lock() + concurrentChunkWrites.Add(1) + defer concurrentChunkWrites.Add(-1) // Write the chunk out. Note that the upper bound on chunk writing // concurrency will be the number of connections. We write inline with // receiving the chunk (with this lock dance), because we want to diff --git a/global.go b/global.go index b66dd9dd816dd76cd27ceb522894190f1694da71..b9950cb2ef6d23b35ba627d40d9f1e0c12736365 100644 --- a/global.go +++ b/global.go @@ -49,4 +49,6 @@ // Track the effectiveness of Torrent.connPieceInclinationPool. pieceInclinationsReused = expvar.NewInt("pieceInclinationsReused") pieceInclinationsNew = expvar.NewInt("pieceInclinationsNew") pieceInclinationsPut = expvar.NewInt("pieceInclinationsPut") + + concurrentChunkWrites = expvar.NewInt("torrentConcurrentChunkWrites") )