From f3bfdb8673048b4d6fb446d5d135153dec072d67 Mon Sep 17 00:00:00 2001 From: Roberto D'Auria Date: Wed, 17 Jan 2024 17:14:57 +0100 Subject: [PATCH] Require -streams to be between 1 and 4 in every client (#42) --- cmd/minimal-download/main.go | 4 ++++ cmd/msak-client/client.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/cmd/minimal-download/main.go b/cmd/minimal-download/main.go index 605fd93..a8a1a00 100644 --- a/cmd/minimal-download/main.go +++ b/cmd/minimal-download/main.go @@ -325,6 +325,10 @@ outer: func main() { flag.Parse() + if *flagStreams < 1 || *flagStreams > 4 { + log.Fatal("Invalid configuration: the number of streams must be between 1 and 4.") + } + ctx, cancel := context.WithTimeout(context.Background(), *flagMaxDuration) defer cancel() diff --git a/cmd/msak-client/client.go b/cmd/msak-client/client.go index 2f65ebb..ebc0557 100644 --- a/cmd/msak-client/client.go +++ b/cmd/msak-client/client.go @@ -38,6 +38,10 @@ func main() { log.Fatal("Invalid configuration: please check streams, delay and duration and make sure they make sense.") } + if *flagStreams < 1 || *flagStreams > 4 { + log.Fatal("Invalid configuration: the number of streams must be between 1 and 4.") + } + config := client.Config{ Server: *flagServer, Scheme: *flagScheme,