periodic repair
This commit is contained in:
@@ -57,9 +57,9 @@ func (dl *Downloader) DownloadFile(directory, torrentName, fileName string, resp
|
||||
torrent.BrokenLinks.Add(file.Link)
|
||||
// file.Link = "repair"
|
||||
if cfg.EnableRepair() {
|
||||
torMgr.SetNewLatestState(intTor.LibraryState{})
|
||||
torMgr.TriggerRepair(torrent)
|
||||
} else {
|
||||
log.Infof("Repair is disabled, skipping repair for unavailable file %s (link=%s)", fileName, link)
|
||||
log.Debugf("Repair is disabled, skipping repair for unavailable file %s (link=%s)", fileName, link)
|
||||
}
|
||||
http.Error(resp, "File is not available", http.StatusNotFound)
|
||||
return
|
||||
@@ -167,9 +167,9 @@ func (dl *Downloader) streamFileToResponse(torrent *intTor.Torrent, file *intTor
|
||||
torrent.BrokenLinks.Add(file.Link)
|
||||
// file.Link = "repair"
|
||||
if cfg.EnableRepair() && torrent != nil {
|
||||
torMgr.SetNewLatestState(intTor.LibraryState{})
|
||||
torMgr.TriggerRepair(torrent)
|
||||
} else {
|
||||
log.Infof("Repair is disabled, skipping repair for unavailable file %s (link=%s)", file.Path, file.Link)
|
||||
log.Debugf("Repair is disabled, skipping repair for unavailable file %s (link=%s)", file.Path, file.Link)
|
||||
}
|
||||
}
|
||||
http.Error(resp, "File is not available", http.StatusNotFound)
|
||||
@@ -184,9 +184,9 @@ func (dl *Downloader) streamFileToResponse(torrent *intTor.Torrent, file *intTor
|
||||
torrent.BrokenLinks.Add(file.Link)
|
||||
// file.Link = "repair"
|
||||
if cfg.EnableRepair() && torrent != nil {
|
||||
torMgr.SetNewLatestState(intTor.LibraryState{})
|
||||
torMgr.TriggerRepair(torrent)
|
||||
} else {
|
||||
log.Infof("Repair is disabled, skipping repair for unavailable file %s (link=%s)", file.Path, file.Link)
|
||||
log.Debugf("Repair is disabled, skipping repair for unavailable file %s (link=%s)", file.Path, file.Link)
|
||||
}
|
||||
}
|
||||
http.Error(resp, "File is not available", http.StatusNotFound)
|
||||
@@ -199,7 +199,7 @@ func (dl *Downloader) streamFileToResponse(torrent *intTor.Torrent, file *intTor
|
||||
}
|
||||
}
|
||||
|
||||
log.Infof("Started serving file %s%s", unrestrict.Filename, rangeLog)
|
||||
log.Debugf("Started serving file %s%s", unrestrict.Filename, rangeLog)
|
||||
|
||||
buf := make([]byte, cfg.GetNetworkBufferSize())
|
||||
io.CopyBuffer(resp, download.Body, buf)
|
||||
|
||||
Reference in New Issue
Block a user