Skip to content
Snippets Groups Projects
Commit 7b0a6b91 authored by Josh Brooks's avatar Josh Brooks
Browse files

Fix minor stylistic MR comments

parent b5597c01
No related branches found
No related tags found
2 merge requests!510Release,!331Hotfix/dummy message clean up
This commit is part of merge request !331. Comments created here will be created in the context of that merge request.
...@@ -48,7 +48,6 @@ func (m *Manager) newRandomCmixMessage(rng csprng.Source) ( ...@@ -48,7 +48,6 @@ func (m *Manager) newRandomCmixMessage(rng csprng.Source) (
errors.Errorf(recipientRngErr, err) errors.Errorf(recipientRngErr, err)
} }
// todo: use error constants above?
// Generate random message payload // Generate random message payload
payloadSize := m.store.GetCmixGroup().GetP().ByteLen() payloadSize := m.store.GetCmixGroup().GetP().ByteLen()
payload, err = newRandomPayload(payloadSize, rng) payload, err = newRandomPayload(payloadSize, rng)
...@@ -124,7 +123,7 @@ func newRandomMAC(rng csprng.Source) ([]byte, error) { ...@@ -124,7 +123,7 @@ func newRandomMAC(rng csprng.Source) ([]byte, error) {
} }
////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////
// Random Duration functions // Miscellaneous
////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////
// randomDuration returns a duration that is the base duration plus or minus a // randomDuration returns a duration that is the base duration plus or minus a
...@@ -141,10 +140,6 @@ func randomDuration(base, randomRange time.Duration, rng csprng.Source) ( ...@@ -141,10 +140,6 @@ func randomDuration(base, randomRange time.Duration, rng csprng.Source) (
return base + randomRange - time.Duration(delta), nil return base + randomRange - time.Duration(delta), nil
} }
//////////////////////////////////////////////////////////////////////////////////
// Miscellaneous
//////////////////////////////////////////////////////////////////////////////////
// randomInt returns, as an int, a non-negative, non-zero random number in [1, n) // randomInt returns, as an int, a non-negative, non-zero random number in [1, n)
// from the csprng.Source. // from the csprng.Source.
func randomInt(n int, rng csprng.Source) (int, error) { func randomInt(n int, rng csprng.Source) (int, error) {
......
...@@ -101,7 +101,8 @@ func (m *Manager) sendMessages() error { ...@@ -101,7 +101,8 @@ func (m *Manager) sendMessages() error {
err = m.sendMessage(localIndex, totalMessages, rng) err = m.sendMessage(localIndex, totalMessages, rng)
if err != nil { if err != nil {
jww.ERROR.Printf(err.Error()) jww.ERROR.Printf("Failed to send message %d/%d: %+v",
localIndex, numMessages, err)
} }
// Add to counter of successful sends // Add to counter of successful sends
atomic.AddInt64(&sent, 1) atomic.AddInt64(&sent, 1)
...@@ -119,16 +120,14 @@ func (m *Manager) sendMessage(index, totalMessages int, rng csprng.Source) error ...@@ -119,16 +120,14 @@ func (m *Manager) sendMessage(index, totalMessages int, rng csprng.Source) error
// Generate message data // Generate message data
recipient, fp, service, payload, mac, err := m.newRandomCmixMessage(rng) recipient, fp, service, payload, mac, err := m.newRandomCmixMessage(rng)
if err != nil { if err != nil {
return errors.Errorf("Failed to create dummy message %d/%d: %+v", return errors.Errorf("Failed to create random data: %+v", err)
index, totalMessages, err)
} }
// Send message // Send message
p := cmix.GetDefaultCMIXParams() p := cmix.GetDefaultCMIXParams()
_, _, err = m.net.Send(recipient, fp, service, payload, mac, p) _, _, err = m.net.Send(recipient, fp, service, payload, mac, p)
if err != nil { if err != nil {
return errors.Errorf("Failed to send dummy message %d/%d: %+v", return errors.Errorf("Failed to send message: %+v", err)
index, totalMessages, err)
} }
return nil return nil
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment