Skip to content

Commit

Permalink
Downloader threads variable
Browse files Browse the repository at this point in the history
  • Loading branch information
xssnick committed Apr 20, 2024
1 parent 992fddf commit d5b681f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions storage/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import (
"time"
)

var DownloadThreads = 24
var DownloadPrefetch = 200

type fileInfo struct {
path string
info *FileInfo
Expand Down Expand Up @@ -264,7 +267,7 @@ func (t *Torrent) startDownload(report func(Event)) error {
}

if t.downloadOrdered {
fetch := NewPreFetcher(ctx, t, t.downloader, report, downloaded, 60, 200, pieces)
fetch := NewPreFetcher(ctx, t, t.downloader, report, downloaded, DownloadThreads, DownloadPrefetch, pieces)
defer fetch.Stop()

if err := writeOrdered(ctx, t, list, piecesMap, rootPath, report, fetch); err != nil {
Expand All @@ -278,13 +281,13 @@ func (t *Torrent) startDownload(report func(Event)) error {
}

left := len(pieces)
ready := make(chan uint32, 200)
ready := make(chan uint32, DownloadPrefetch)
fetch := NewPreFetcher(ctx, t, t.downloader, func(event Event) {
if event.Name == EventPieceDownloaded {
ready <- event.Value.(uint32)
}
report(event)
}, downloaded, 60, 200, pieces)
}, downloaded, DownloadThreads, DownloadPrefetch, pieces)
defer fetch.Stop()

var currentFile FSFile
Expand Down

0 comments on commit d5b681f

Please sign in to comment.