Merge branch 'master' into new-torrent

This commit is contained in:
nikk gitanes
2021-08-24 08:56:16 +03:00
16 changed files with 67 additions and 17 deletions

View File

@@ -214,7 +214,7 @@ func SetSettings(set *sets.BTSets) {
}
lockApi.Lock()
defer lockApi.Unlock()
log.TLogln("drop all")
log.TLogln("drop all torrents")
dropAllTorrent()
time.Sleep(time.Second * 2)
log.TLogln("disconect")
@@ -222,6 +222,7 @@ func SetSettings(set *sets.BTSets) {
sets.SetBTSets(set)
log.TLogln("connect")
bts.Connect()
time.Sleep(time.Second * 2)
log.TLogln("end set settings")
}
@@ -231,11 +232,16 @@ func SetDefSettings() {
}
lockApi.Lock()
defer lockApi.Unlock()
log.TLogln("drop all torrents")
dropAllTorrent()
time.Sleep(time.Second * 2)
log.TLogln("disconect")
bts.Disconnect()
sets.SetDefault()
log.TLogln("connect")
bts.Connect()
time.Sleep(time.Second * 5)
time.Sleep(time.Second * 2)
log.TLogln("end set default settings")
}
func dropAllTorrent() {

View File

@@ -75,7 +75,8 @@ func (p *Piece) Release() {
p.dPiece.Release()
}
if !p.cache.isClosed {
p.cache.torrent.Piece(p.Id).SetPriority(torrent.PiecePriorityNone)
// UpdateCompletion() also handle PiecePriority
//p.cache.torrent.Piece(p.Id).SetPriority(torrent.PiecePriorityNone)
p.cache.torrent.Piece(p.Id).UpdateCompletion()
}
}