]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Torrent.Stats: RLock instead of Lock
authorMatt Joiner <anacrolix@gmail.com>
Sat, 16 Jun 2018 06:38:14 +0000 (16:38 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Sat, 16 Jun 2018 06:38:14 +0000 (16:38 +1000)
torrent.go

index 3c6c3d5291f83fdfd15ea28a0e1570db384cf099..62c61a10edcdf0a8afa9ffabe8b81adb1044a88f 100644 (file)
@@ -1436,8 +1436,8 @@ func (t *Torrent) addPeers(peers []Peer) {
 }
 
 func (t *Torrent) Stats() TorrentStats {
-       t.cl.mu.Lock()
-       defer t.cl.mu.Unlock()
+       t.cl.mu.RLock()
+       defer t.cl.mu.RUnlock()
        return t.statsLocked()
 }