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) {
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
func decodeGroups(ndf *ndf.NetworkDefinition) (cmixGrp, e2eGrp *cyclic.Group) {
largeIntBits := 16
......
......@@ -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.
func (c *Client) NewCMIXMessage(recipient *id.ID,
contents []byte) format.Message {
msg := format.NewMessage(c.getCMIXPrimeSize())
primeSize := len(c.storage.Cmix().GetGroup().GetPBytes())
msg := format.NewMessage(primeSize)
msg.SetContents(contents)
msg.SetRecipientID(recipient)
return msg
......
......@@ -163,7 +163,7 @@ var rootCmd = &cobra.Command{
connected := make(chan bool, 1)
client.GetHealth().AddChannel(connected)
waitTimeout := time.Duration(viper.GetUint("waitTimeout"))
timeoutTick := time.NewTicker(waitTimeout * time.Second)
timeoutTimer := time.NewTimer(waitTimeout * time.Second)
isConnected := false
for !isConnected {
select {
......@@ -171,7 +171,7 @@ var rootCmd = &cobra.Command{
jww.INFO.Printf("health status: %v\n",
isConnected)
break
case <-timeoutTick.C:
case <-timeoutTimer.C:
jww.FATAL.Panic("timeout on connection")
}
}
......@@ -198,11 +198,11 @@ var rootCmd = &cobra.Command{
// Wait until message timeout or we receive enough then exit
// TODO: Actually check for how many messages we've received
receiveCnt := viper.GetUint("receiveCount")
timeoutTick = time.NewTicker(waitTimeout * time.Second)
timeoutTimer = time.NewTimer(waitTimeout * time.Second)
done := false
for !done {
select {
case <-timeoutTick.C:
case <-timeoutTimer.C:
fmt.Println("Timed out!")
done = true
break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment