Repair adjustments

This commit is contained in:
Ben Sarmiento
2024-04-28 11:06:01 +02:00
parent 5da8170c93
commit 96fd72ba88
2 changed files with 4 additions and 3 deletions

View File

@@ -262,6 +262,7 @@ func (t *TorrentManager) repair(torrent *Torrent) {
}
func (t *TorrentManager) assignUnassignedLinks(torrent *Torrent) bool {
t.log.Infof("Trying to assign links to incomplete torrent %s", t.GetKey(torrent))
// handle torrents with incomplete links for selected files
assignedCount := 0
rarCount := 0

View File

@@ -319,14 +319,14 @@ func backoffFunc(attempt int) time.Duration {
}
func (r *HTTPClient) CanFetchFirstByte(url string) bool {
timeout := time.Duration(r.timeoutSecs) * time.Second
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return false
}
req.Header.Set("Range", "bytes=0-0")
timeout := time.Duration(r.timeoutSecs) * time.Second
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
req = req.WithContext(ctx)
resp, err := r.Do(req)