Skip to content
Snippets Groups Projects
Commit 28bb241f authored by Jono Wenger's avatar Jono Wenger
Browse files

Merge branch 'XX-4288/sendManyCmixAttemptTracker' into 'project/Channels'

XX-4288 / Add attempt tracker to sendMany Cmix

See merge request !426
parents 177a4494 3f4fae51
No related branches found
No related tags found
3 merge requests!510Release,!426XX-4288 / Add attempt tracker to sendMany Cmix,!340Project/channels
...@@ -196,8 +196,6 @@ func sendCmixHelper(sender gateway.Sender, assembler messageAssembler, recipient ...@@ -196,8 +196,6 @@ func sendCmixHelper(sender gateway.Sender, assembler messageAssembler, recipient
defer attemptTracker.SubmitProbeAttempt(numAttempts) defer attemptTracker.SubmitProbeAttempt(numAttempts)
} }
jww.INFO.Printf("")
for numRoundTries := uint(0); numRoundTries < cmixParams.RoundTries; numRoundTries, for numRoundTries := uint(0); numRoundTries < cmixParams.RoundTries; numRoundTries,
numAttempts = numRoundTries+1, numAttempts+1 { numAttempts = numRoundTries+1, numAttempts+1 {
elapsed := netTime.Since(timeStart) elapsed := netTime.Since(timeStart)
......
...@@ -9,6 +9,7 @@ package cmix ...@@ -9,6 +9,7 @@ package cmix
import ( import (
"fmt" "fmt"
"gitlab.com/elixxir/client/cmix/attempts"
"gitlab.com/elixxir/client/cmix/rounds" "gitlab.com/elixxir/client/cmix/rounds"
"strings" "strings"
"time" "time"
...@@ -90,7 +91,7 @@ func (c *client) SendMany(messages []TargetedCmixMessage, ...@@ -90,7 +91,7 @@ func (c *client) SendMany(messages []TargetedCmixMessage,
return sendManyCmixHelper(c.Sender, acms, p, return sendManyCmixHelper(c.Sender, acms, p,
c.instance, c.session.GetCmixGroup(), c.Registrar, c.rng, c.events, c.instance, c.session.GetCmixGroup(), c.Registrar, c.rng, c.events,
c.session.GetTransmissionID(), c.comms) c.session.GetTransmissionID(), c.comms, c.attemptTracker)
} }
type assembledCmixMessage struct { type assembledCmixMessage struct {
...@@ -109,11 +110,11 @@ type assembledCmixMessage struct { ...@@ -109,11 +110,11 @@ type assembledCmixMessage struct {
// If the message is successfully sent, the ID of the round sent it is returned, // If the message is successfully sent, the ID of the round sent it is returned,
// which can be registered with the network instance to get a callback on its // which can be registered with the network instance to get a callback on its
// status. // status.
func sendManyCmixHelper(sender gateway.Sender, func sendManyCmixHelper(sender gateway.Sender, msgs []assembledCmixMessage,
msgs []assembledCmixMessage, param CMIXParams, instance *network.Instance, param CMIXParams, instance *network.Instance, grp *cyclic.Group,
grp *cyclic.Group, registrar nodes.Registrar, registrar nodes.Registrar, rng *fastRNG.StreamGenerator,
rng *fastRNG.StreamGenerator, events event.Reporter, events event.Reporter, senderId *id.ID, comms SendCmixCommsInterface,
senderId *id.ID, comms SendCmixCommsInterface) ( attemptTracker attempts.SendAttemptTracker) (
rounds.Round, []ephemeral.Id, error) { rounds.Round, []ephemeral.Id, error) {
timeStart := netTime.Now() timeStart := netTime.Now()
...@@ -141,7 +142,29 @@ func sendManyCmixHelper(sender gateway.Sender, ...@@ -141,7 +142,29 @@ func sendManyCmixHelper(sender gateway.Sender,
cmix.SetGroupBits(msgs[i].Message, grp, stream) cmix.SetGroupBits(msgs[i].Message, grp, stream)
} }
for numRoundTries := uint(0); numRoundTries < param.RoundTries; numRoundTries++ { numAttempts := 0
if !param.Probe {
optimalAttempts, ready := attemptTracker.GetOptimalNumAttempts()
if ready {
numAttempts = optimalAttempts
jww.INFO.Printf("[SendMany-%s] Looking for round to send cMix "+
"messages to %s, sending non probe with %d optimalAttempts",
param.DebugTag, recipientString, numAttempts)
} else {
numAttempts = 4
jww.INFO.Printf("[SendMany-%s] Looking for round to send cMix "+
"messages to %s, sending non probe with %d non optimalAttempts, "+
"insufficient data", param.DebugTag, recipientString, numAttempts)
}
} else {
jww.INFO.Printf("[SendMany-%s] Looking for round to send cMix messages "+
"to %s, sending probe with %d Attempts, insufficient data",
param.DebugTag, recipientString, numAttempts)
defer attemptTracker.SubmitProbeAttempt(numAttempts)
}
for numRoundTries := uint(0); numRoundTries < param.RoundTries; numRoundTries,
numAttempts = numRoundTries+1, numAttempts+1 {
elapsed := netTime.Since(timeStart) elapsed := netTime.Since(timeStart)
if elapsed > param.Timeout { if elapsed > param.Timeout {
...@@ -162,7 +185,7 @@ func sendManyCmixHelper(sender gateway.Sender, ...@@ -162,7 +185,7 @@ func sendManyCmixHelper(sender gateway.Sender,
// Find the best round to send to, excluding attempted rounds // Find the best round to send to, excluding attempted rounds
bestRound, _, _ := instance.GetWaitingRounds().GetUpcomingRealtime( bestRound, _, _ := instance.GetWaitingRounds().GetUpcomingRealtime(
remainingTime, attempted, int(numRoundTries), sendTimeBuffer) remainingTime, attempted, numAttempts, sendTimeBuffer)
if bestRound == nil { if bestRound == nil {
continue continue
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment