Skip to content
Snippets Groups Projects
Commit ee3ecd1f authored by Jonah Husson's avatar Jonah Husson
Browse files

Use outer channel variable

parent e03394e6
No related branches found
No related tags found
2 merge requests!510Release,!305Use outer channel variable
...@@ -72,10 +72,9 @@ var broadcastCmd = &cobra.Command{ ...@@ -72,10 +72,9 @@ var broadcastCmd = &cobra.Command{
jww.FATAL.Panicf("description cannot be empty") jww.FATAL.Panicf("description cannot be empty")
} }
var cryptChannel *crypto.Channel
if viper.GetBool(broadcastNewFlag) { if viper.GetBool(broadcastNewFlag) {
// Create a new broadcast channel // Create a new broadcast channel
cryptChannel, pk, err = crypto.NewChannel(name, desc, user.GetRng().GetStream()) channel, pk, err = crypto.NewChannel(name, desc, user.GetRng().GetStream())
if err != nil { if err != nil {
jww.FATAL.Panicf("Failed to create new channel: %+v", err) jww.FATAL.Panicf("Failed to create new channel: %+v", err)
} }
...@@ -103,7 +102,7 @@ var broadcastCmd = &cobra.Command{ ...@@ -103,7 +102,7 @@ var broadcastCmd = &cobra.Command{
jww.FATAL.Panicf("Failed to generate channel ID: %+v", err) jww.FATAL.Panicf("Failed to generate channel ID: %+v", err)
} }
cryptChannel = &crypto.Channel{ channel = &crypto.Channel{
ReceptionID: rid, ReceptionID: rid,
Name: name, Name: name,
Description: desc, Description: desc,
...@@ -113,7 +112,7 @@ var broadcastCmd = &cobra.Command{ ...@@ -113,7 +112,7 @@ var broadcastCmd = &cobra.Command{
} }
// Save channel to disk // Save channel to disk
cBytes, err := cryptChannel.Marshal() cBytes, err := channel.Marshal()
if err != nil { if err != nil {
jww.ERROR.Printf("Failed to marshal channel to bytes: %+v", err) jww.ERROR.Printf("Failed to marshal channel to bytes: %+v", err)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment