Rewrite state machines

This commit is contained in:
Ben Sarmiento
2024-05-21 17:07:40 +02:00
parent 6c24d74f61
commit 0743b01223
12 changed files with 69 additions and 55 deletions

View File

@@ -79,7 +79,7 @@ func ServeFilesList(directory, torrentName string, torMgr *torrent.TorrentManage
sort.Strings(filenames)
for _, filename := range filenames {
file, _ := tor.SelectedFiles.Get(filename)
if !file.State.Is("ok") {
if !file.State.Is("ok_file") {
continue
}
if dirCfg.OnlyShowTheBiggestFile && file.Bytes < biggestFileSize {
@@ -107,7 +107,7 @@ func HandleSingleFile(directory, torrentName, fileName string, torMgr *torrent.T
return nil, fmt.Errorf("cannot find torrent %s", torrentName)
}
file, ok := tor.SelectedFiles.Get(fileName)
if !ok || !file.State.Is("ok") {
if !ok || !file.State.Is("ok_file") {
return nil, fmt.Errorf("cannot find file %s", fileName)
}