fix(downloader): request uploadLength/uploadSpeed/connections/numSeeders from aria2 tellStatus

aria2's tellStatus only returns the keys it's asked for, but aria2StatusKeys
omitted uploadLength, uploadSpeed, connections and numSeeders — while
aria2Detail reads status.UploadLength/UploadSpeed/Connections/NumSeeders. So the
runtime reported them all as 0: during seeding the Overview showed 0 B/s upload
and 0 B uploaded, even though the Peers list had per-peer upload activity (that
comes from a separate getPeers call). Confirmed on live aria2: the seeding
torrent reported uploadSpeed ~3.26MB/s and uploadLength ~2.5GB when those keys
were requested. Adds the missing keys + a guard test.
This commit is contained in:
saltbo
2026-06-19 15:10:43 -04:00
parent 9afa8f1bb6
commit fc6ee38e51
2 changed files with 23 additions and 0 deletions
+4
View File
@@ -57,6 +57,10 @@ var aria2StatusKeys = []string{
"totalLength",
"completedLength",
"downloadSpeed",
"uploadLength",
"uploadSpeed",
"connections",
"numSeeders",
"dir",
"files",
"bittorrent",
+19
View File
@@ -170,6 +170,25 @@ func TestAria2StartArgsSetsMaxConcurrentDownloads(t *testing.T) {
}
}
func TestAria2StatusKeysCoverReportedFields(t *testing.T) {
// aria2's tellStatus only returns the keys it's asked for. aria2Detail reads
// these fields, so they must be requested or the runtime reports zeros
// (e.g. seeding upload speed/total showing 0 while peers upload).
required := []string{
"status", "totalLength", "completedLength", "downloadSpeed",
"uploadLength", "uploadSpeed", "connections", "numSeeders",
}
have := map[string]bool{}
for _, key := range aria2StatusKeys {
have[key] = true
}
for _, key := range required {
if !have[key] {
t.Fatalf("aria2StatusKeys missing %q — tellStatus won't return it, so aria2Detail reports 0", key)
}
}
}
func TestAria2SeedTimeMinutes(t *testing.T) {
if got := aria2SeedTimeMinutes(time.Hour); got != 60 {
t.Fatalf("expected 1h to map to 60 minutes, got %d", got)