Prevent double repairs
This commit is contained in:
@@ -77,7 +77,7 @@ func (gf *GetFile) HandleGetRequest(directory, torrentName, fileName string, res
|
||||
if unrestrict == nil {
|
||||
log.Warnf("File %s cannot be unrestricted (link=%s)", fileName, link)
|
||||
if cfg.EnableRepair() {
|
||||
file.Link = "repairing"
|
||||
file.Link = "repair"
|
||||
torMgr.Repair(torrent)
|
||||
} else {
|
||||
log.Infof("Repair is disabled, skipping repair for unavailable file %s (link=%s)", fileName, link)
|
||||
@@ -169,7 +169,7 @@ func (gf *GetFile) streamFileToResponse(torrent *intTor.Torrent, file *intTor.Fi
|
||||
if file != nil && unrestrict.Streamable == 1 {
|
||||
log.Warnf("Cannot download file %s: %v", file.Path, err)
|
||||
if cfg.EnableRepair() {
|
||||
file.Link = "repairing"
|
||||
file.Link = "repair"
|
||||
torMgr.Repair(torrent)
|
||||
} else {
|
||||
log.Infof("Repair is disabled, skipping repair for unavailable file %s (link=%s)", file.Path, file.Link)
|
||||
@@ -184,7 +184,7 @@ func (gf *GetFile) streamFileToResponse(torrent *intTor.Torrent, file *intTor.Fi
|
||||
if file != nil && unrestrict.Streamable == 1 {
|
||||
log.Warnf("Received a %s status code for file %s", download.Status, file.Path)
|
||||
if cfg.EnableRepair() {
|
||||
file.Link = "repairing"
|
||||
file.Link = "repair"
|
||||
torMgr.Repair(torrent)
|
||||
} else {
|
||||
log.Infof("Repair is disabled, skipping repair for unavailable file %s (link=%s)", file.Path, file.Link)
|
||||
|
||||
Reference in New Issue
Block a user