disable close torrent on reading it

This commit is contained in:
yourok
2024-01-08 18:24:48 +03:00
parent 72044eca34
commit 068de3c565
2 changed files with 3 additions and 3 deletions

View File

@@ -139,9 +139,6 @@ func SetTorrent(hashHex, title, poster, data string) *Torrent {
} }
func RemTorrent(hashHex string) { func RemTorrent(hashHex string) {
if sets.ReadOnly {
return
}
hash := metainfo.NewHashFromHex(hashHex) hash := metainfo.NewHashFromHex(hashHex)
if sets.BTsets.UseDisk && hashHex != "" && hashHex != "/" { if sets.BTsets.UseDisk && hashHex != "" && hashHex != "/" {
name := filepath.Join(sets.BTsets.TorrentsSavePath, hashHex) name := filepath.Join(sets.BTsets.TorrentsSavePath, hashHex)

View File

@@ -266,6 +266,9 @@ func (t *Torrent) drop() {
} }
func (t *Torrent) Close() { func (t *Torrent) Close() {
if t.cache != nil && t.cache.Readers() > 0 {
return
}
t.Stat = state.TorrentClosed t.Stat = state.TorrentClosed
t.bt.mu.Lock() t.bt.mu.Lock()