diff --git a/cmd/root.go b/cmd/root.go index 1d6d3c922dc686d24b47432170fca6493f3d9e7b..5d9cd10007b81a8dd2c92bfee2c819c374be9d71 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -1040,9 +1040,9 @@ func init() { "Ensure successful message sending by checking for round completion") viper.BindPFlag("verify-sends", rootCmd.Flags().Lookup("verify-sends")) - rootCmd.Flags().UintP("receiveCount", + rootCmd.PersistentFlags().UintP("receiveCount", "", 1, "How many messages we should wait for before quitting") - viper.BindPFlag("receiveCount", rootCmd.Flags().Lookup("receiveCount")) + viper.BindPFlag("receiveCount", rootCmd.PersistentFlags().Lookup("receiveCount")) rootCmd.PersistentFlags().UintP("waitTimeout", "", 15, "The number of seconds to wait for messages to arrive") viper.BindPFlag("waitTimeout", diff --git a/cmd/symmetric.go b/cmd/symmetric.go index e61b87195e22132b04a57bd93c5517a795a1a85d..20505235b1bc6d3b9caea76f58ab7f727fdd2e5e 100644 --- a/cmd/symmetric.go +++ b/cmd/symmetric.go @@ -140,18 +140,18 @@ var symmetricCmd = &cobra.Command{ if message != "" { broadcastMessage, err := broadcast.NewSizedBroadcast(scl.MaxPayloadSize(), []byte(message)) if err != nil { - + jww.ERROR.Printf("Failed to create sized broadcast: %+v", err) } rid, eid, err := scl.Broadcast(broadcastMessage, cmix.GetDefaultCMIXParams()) if err != nil { - jww.ERROR.Printf("Failed to send symmentric broadcast message: %+v", err) + jww.ERROR.Printf("Failed to send symmetric broadcast message: %+v", err) } jww.INFO.Printf("Sent symmetric broadcast message to %s over round %d", eid, rid) } // Receive messages over the channel - expectedCnt := viper.GetUint("receiveCount") waitSecs := viper.GetUint("waitTimeout") + expectedCnt := viper.GetUint("receiveCount") waitTimeout := time.Duration(waitSecs) * time.Second receivedCount := uint(0) done := false @@ -165,7 +165,7 @@ var symmetricCmd = &cobra.Command{ jww.ERROR.Printf("Failed to decode sized broadcast: %+v", err) continue } - fmt.Printf("Symmetric broadcast message received: %s\n", string(receivedBroadcast)) + fmt.Printf("Symmetric broadcast message %d/%d received: %s\n", receivedCount, expectedCnt, string(receivedBroadcast)) if receivedCount == expectedCnt { done = true } @@ -177,6 +177,7 @@ var symmetricCmd = &cobra.Command{ } jww.INFO.Printf("Received %d/%d Messages!", receivedCount, expectedCnt) + scl.Stop() err = client.StopNetworkFollower() if err != nil { jww.WARN.Printf(