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
pieceInclinationsReused = expvar.NewInt("pieceInclinationsReused")
pieceInclinationsNew = expvar.NewInt("pieceInclinationsNew")
pieceInclinationsPut = expvar.NewInt("pieceInclinationsPut")
+
+ concurrentChunkWrites = expvar.NewInt("torrentConcurrentChunkWrites")
)