Skip to content
Snippets Groups Projects
Commit 2d6f7faf authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Minor cleanup

parent b845b6d9
No related branches found
No related tags found
No related merge requests found
...@@ -356,12 +356,6 @@ func parseNDF(ndfString string) (*ndf.NetworkDefinition, error) { ...@@ -356,12 +356,6 @@ func parseNDF(ndfString string) (*ndf.NetworkDefinition, error) {
return ndf, nil return ndf, nil
} }
func (c *Client) getCMIXPrimeSize() int {
ndf := c.network.GetInstance().GetPartialNdf().Get()
cmixGrp, _ := decodeGroups(ndf)
return len(cmixGrp.GetPBytes())
}
// decodeGroups returns the e2e and cmix groups from the ndf // decodeGroups returns the e2e and cmix groups from the ndf
func decodeGroups(ndf *ndf.NetworkDefinition) (cmixGrp, e2eGrp *cyclic.Group) { func decodeGroups(ndf *ndf.NetworkDefinition) (cmixGrp, e2eGrp *cyclic.Group) {
largeIntBits := 16 largeIntBits := 16
......
...@@ -46,7 +46,8 @@ func (c *Client) SendCMIX(msg format.Message, param params.CMIX) (id.Round, ...@@ -46,7 +46,8 @@ func (c *Client) SendCMIX(msg format.Message, param params.CMIX) (id.Round,
// FIXME: this is weird and shouldn't be necessary, but it is. // FIXME: this is weird and shouldn't be necessary, but it is.
func (c *Client) NewCMIXMessage(recipient *id.ID, func (c *Client) NewCMIXMessage(recipient *id.ID,
contents []byte) format.Message { contents []byte) format.Message {
msg := format.NewMessage(c.getCMIXPrimeSize()) primeSize := len(c.storage.Cmix().GetGroup().GetPBytes())
msg := format.NewMessage(primeSize)
msg.SetContents(contents) msg.SetContents(contents)
msg.SetRecipientID(recipient) msg.SetRecipientID(recipient)
return msg return msg
......
...@@ -163,7 +163,7 @@ var rootCmd = &cobra.Command{ ...@@ -163,7 +163,7 @@ var rootCmd = &cobra.Command{
connected := make(chan bool, 1) connected := make(chan bool, 1)
client.GetHealth().AddChannel(connected) client.GetHealth().AddChannel(connected)
waitTimeout := time.Duration(viper.GetUint("waitTimeout")) waitTimeout := time.Duration(viper.GetUint("waitTimeout"))
timeoutTick := time.NewTicker(waitTimeout * time.Second) timeoutTimer := time.NewTimer(waitTimeout * time.Second)
isConnected := false isConnected := false
for !isConnected { for !isConnected {
select { select {
...@@ -171,7 +171,7 @@ var rootCmd = &cobra.Command{ ...@@ -171,7 +171,7 @@ var rootCmd = &cobra.Command{
jww.INFO.Printf("health status: %v\n", jww.INFO.Printf("health status: %v\n",
isConnected) isConnected)
break break
case <-timeoutTick.C: case <-timeoutTimer.C:
jww.FATAL.Panic("timeout on connection") jww.FATAL.Panic("timeout on connection")
} }
} }
...@@ -198,11 +198,11 @@ var rootCmd = &cobra.Command{ ...@@ -198,11 +198,11 @@ var rootCmd = &cobra.Command{
// Wait until message timeout or we receive enough then exit // Wait until message timeout or we receive enough then exit
// TODO: Actually check for how many messages we've received // TODO: Actually check for how many messages we've received
receiveCnt := viper.GetUint("receiveCount") receiveCnt := viper.GetUint("receiveCount")
timeoutTick = time.NewTicker(waitTimeout * time.Second) timeoutTimer = time.NewTimer(waitTimeout * time.Second)
done := false done := false
for !done { for !done {
select { select {
case <-timeoutTick.C: case <-timeoutTimer.C:
fmt.Println("Timed out!") fmt.Println("Timed out!")
done = true done = true
break break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment