librespeed-cli: fix speedtest when server not available
authorRichard Muzik <[email protected]>
Mon, 10 Nov 2025 13:29:51 +0000 (14:29 +0100)
committerJosef Schlehofer <[email protected]>
Tue, 11 Nov 2025 12:13:49 +0000 (13:13 +0100)
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 <[email protected]>
utils/librespeed-cli/patches/0001-speedtest-fix-start-serverIdx-in-pingList-when-some-servers-are-down.patch [new file with mode: 0644]

diff --git a/utils/librespeed-cli/patches/0001-speedtest-fix-start-serverIdx-in-pingList-when-some-servers-are-down.patch b/utils/librespeed-cli/patches/0001-speedtest-fix-start-serverIdx-in-pingList-when-some-servers-are-down.patch
new file mode 100644 (file)
index 0000000..e51a007
--- /dev/null
@@ -0,0 +1,22 @@
+From b8fda15c50575ad7f1086fc8b0561b98e65c9c1e Mon Sep 17 00:00:00 2001
+From: user <[email protected]>
+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