Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pause mechanism added #441

Merged
merged 5 commits into from
Mar 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cited control fix
  • Loading branch information
ucwong committed Mar 18, 2024
commit 53195124e7f957532081c8d5d705fa4e3458872e
9 changes: 7 additions & 2 deletions backend/handler.go
Original file line number Diff line number Diff line change
@@ -1237,19 +1237,24 @@ func (tm *TorrentManager) activeLoop() {
for {
select {
case <-timer.C:
if t := tm.getTorrent(i); t != nil { //&& t.Ready() {
if t.Cited() <= 0 {
if t := tm.getTorrent(i); t != nil {
if t.Cited() == 0 {
if t.Paused() || t.IsSeeding() || tm.mode == params.LAZY {
tm.Dropping(i)
return
} else {
t.CitedDec()
log.Info("File can't be dropped for leeching", "ih", i, "request", t.BytesRequested(), "complete", t.Torrent.BytesCompleted(), "total", t.Length(), "status", t.Status())
}
} else if t.Cited() < 0 {
tm.Dropping(i)
return
} else {
t.CitedDec()
log.Debug("Seed cited has been decreased", "ih", i, "cited", t.Cited(), "n", n, "status", t.Status(), "elapsed", common.PrettyDuration(time.Duration(mclock.Now())-time.Duration(t.Birth())))
}
} else {
log.Error("Nil tor found", "ih", i)
return
}
case <-tm.closeAll: