mirror of
https://github.com/openwrt/packages.git
synced 2025-12-21 17:04:32 +04:00
If the server is down it can still be selected to test on it. This fixes the bug. See: - https://github.com/librespeed/speedtest-cli/pull/94 Signed-off-by: Richard Muzik <richard.muzik@turris.com>
23 lines
649 B
Diff
23 lines
649 B
Diff
From b8fda15c50575ad7f1086fc8b0561b98e65c9c1e Mon Sep 17 00:00:00 2001
|
|
From: user <user@linuxorg.org>
|
|
Date: Wed, 18 Dec 2024 21:36:23 +0800
|
|
Subject: [PATCH] fix start serverIdx in pingList when some servers are down
|
|
|
|
---
|
|
speedtest/speedtest.go | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
--- a/speedtest/speedtest.go
|
|
+++ b/speedtest/speedtest.go
|
|
@@ -321,6 +321,10 @@ func SpeedTest(c *cli.Context) error {
|
|
|
|
// get the fastest server's index in the `servers` array
|
|
var serverIdx int
|
|
+ for serverIdx = range pingList {
|
|
+ break
|
|
+ }
|
|
+
|
|
for idx, ping := range pingList {
|
|
if ping > 0 && ping <= pingList[serverIdx] {
|
|
serverIdx = idx
|