client.go | 2 +- t.go | 6 ++++++ diff --git a/client.go b/client.go index aaa2ee4da7e9c19e49e894f9b668aa2e4ecb4b47..8621d16425bb65a0adab5e1f1a65867fd95bfff0 100644 --- a/client.go +++ b/client.go @@ -1979,7 +1979,7 @@ t.Trackers = newTrackers } // Don't call this before the info is available. -func (t *torrent) BytesCompleted() int64 { +func (t *torrent) bytesCompleted() int64 { if !t.haveInfo() { return 0 } diff --git a/t.go b/t.go index 419258600a6ca1aedd800dd809c147950a877e6a..8a561661e2198208eaeb601e3b1a4fc82d790aeb 100644 --- a/t.go +++ b/t.go @@ -52,3 +52,9 @@ t.cl.mu.Lock() t.cl.dropTorrent(t.InfoHash) t.cl.mu.Unlock() } + +func (t Torrent) BytesCompleted() int64 { + t.cl.mu.RLock() + defer t.cl.mu.RUnlock() + return t.bytesCompleted() +}