download: free the -j slot once a torrent starts seeding

This commit is contained in:
2026-06-22 01:57:03 +09:00
parent 6e77cde4cc
commit b632f37e3d
4 changed files with 149 additions and 2 deletions

View File

@@ -64,3 +64,14 @@ type Download interface {
Run(ctx context.Context) error
Stat() Stat
}
// Seeder is an optional capability of a Download whose work continues after its
// content is fully downloaded — a torrent that keeps running to seed.
// SeedingStarted is closed at that download->seed transition. The engine uses it
// to free the concurrency slot the moment a download stops downloading: a
// seed-only torrent is no longer a download, so it must not count against
// --max-concurrent-downloads (-j) and block a queued download. HTTP downloads do
// not implement this, so they hold their slot until they finish.
type Seeder interface {
SeedingStarted() <-chan struct{}
}