From: YenForYang Date: Wed, 15 Sep 2021 00:27:52 +0000 (-0500) Subject: Inlineable `(*Torrent).SetDisplayName()` (#625) X-Git-Tag: v1.32.0~55 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=e105d8b57ac16f32b652fdeec39d60b9fa12f652;p=btrtrc.git Inlineable `(*Torrent).SetDisplayName()` (#625) --- diff --git a/t.go b/t.go index 02d62979..5fa9f3dd 100644 --- a/t.go +++ b/t.go @@ -130,15 +130,14 @@ func (t *Torrent) Seeding() bool { return t.seeding() } -// Clobbers the torrent display name. The display name is used as the torrent -// name if the metainfo is not available. +// Clobbers the torrent display name if metainfo is unavailable. +// The display name is used as the torrent name while the metainfo is unavailable. func (t *Torrent) SetDisplayName(dn string) { t.nameMu.Lock() - defer t.nameMu.Unlock() - if t.haveInfo() { - return + if !t.haveInfo() { + t.displayName = dn } - t.displayName = dn + t.nameMu.Unlock() } // The current working name for the torrent. Either the name in the info dict,