t.go | 9 ++++++--- torrent.go | 7 ------- diff --git a/t.go b/t.go index c76d92737a4a7310ed768717bfcf117207534634..cd8bc10cd88b9e9be2bcad880756005fdf515af4 100644 --- a/t.go +++ b/t.go @@ -107,9 +107,12 @@ // Clobbers the torrent display name. The display name is used as the torrent // name if the metainfo is not available. func (t *Torrent) SetDisplayName(dn string) { - t.cl.lock() - defer t.cl.unlock() - t.setDisplayName(dn) + t.nameMu.Lock() + defer t.nameMu.Unlock() + if t.haveInfo() { + return + } + t.displayName = dn } // The current working name for the torrent. Either the name in the info dict, diff --git a/torrent.go b/torrent.go index 6f609206d3ebaf2dbd7f82a83a33b6e7d10caa67..c9ccaa9f042531d300f3aacf2234905caa134a83 100644 --- a/torrent.go +++ b/torrent.go @@ -196,13 +196,6 @@ }, } } -func (t *Torrent) setDisplayName(dn string) { - if t.haveInfo() { - return - } - t.displayName = dn -} - func (t *Torrent) pieceComplete(piece pieceIndex) bool { return t.completedPieces.Get(bitmap.BitIndex(piece)) }