diff --git a/network/rounds/manager.go b/network/rounds/manager.go index b429201f4dd2b08f0c44f7134560e7aa67f4e5b6..4c1ec87a993afcdcfcf724d7af2ca69bf2ad6b98 100644 --- a/network/rounds/manager.go +++ b/network/rounds/manager.go @@ -14,7 +14,6 @@ import ( "gitlab.com/elixxir/client/network/internal" "gitlab.com/elixxir/client/network/message" "gitlab.com/elixxir/client/stoppable" - "sync" ) type Manager struct { @@ -24,7 +23,6 @@ type Manager struct { historicalRounds chan historicalRoundRequest lookupRoundMessages chan roundLookup - lookupRetryTracker sync.Map messageBundles chan<- message.Bundle } diff --git a/network/rounds/retrieve.go b/network/rounds/retrieve.go index 46c1b6d1da9f1146f8dd860d4a054bff0ee0a2e6..adb4e7c5137891c802bb5f3e5df9aa34a53d53d3 100644 --- a/network/rounds/retrieve.go +++ b/network/rounds/retrieve.go @@ -83,16 +83,13 @@ func (m *Manager) processMessageRetrieval(comms messageRetrievalComms, // randomly not picking up messages (FOR INTEGRATION TEST). Only done if // round has not been ignored before var bundle message.Bundle - _, ok := m.lookupRetryTracker.Load(ri.ID) - jww.INFO.Printf("After adding round %d to tracker entry is %v", ri.ID, ok) - if !ok && m.params.ForceMessagePickupRetry { + if m.params.ForceMessagePickupRetry { bundle, err = m.forceMessagePickupRetry(ri, rl, comms, gwIds) if err != nil { jww.ERROR.Printf("Failed to get pickup round %d "+ "from all gateways (%v): %s", id.Round(ri.ID), gwIds, err) } - m.lookupRetryTracker.Store(ri.ID, struct{}{}) } else { // Attempt to request for this gateway bundle, err = m.getMessagesFromGateway(id.Round(ri.ID), rl.identity, comms, gwIds) @@ -197,24 +194,26 @@ func (m *Manager) getMessagesFromGateway(roundID id.Round, identity reception.Id // not looking up messages func (m *Manager) forceMessagePickupRetry(ri *pb.RoundInfo, rl roundLookup, comms messageRetrievalComms, gwIds []*id.ID) (bundle message.Bundle, err error) { - // Flip a coin to determine whether to pick up message - stream := m.Rng.GetStream() - defer stream.Close() - b := make([]byte, 8) - _, err = stream.Read(b) - if err != nil { - jww.FATAL.Panic(err.Error()) - } - result := binary.BigEndian.Uint64(b) - jww.INFO.Printf("*** Random result: %d", result) - if result%2 == 0 { - jww.INFO.Printf("Forcing a message pickup retry for round %d", ri.ID) - // Do not call get message, leaving the round to be picked up - // in unchecked round scheduler process - return - } - + _, ok := m.Session.UncheckedRounds().GetRound(id.Round(ri.ID)) + if !ok { + // Flip a coin to determine whether to pick up message + stream := m.Rng.GetStream() + defer stream.Close() + b := make([]byte, 8) + _, err = stream.Read(b) + if err != nil { + jww.FATAL.Panic(err.Error()) + } + result := binary.BigEndian.Uint64(b) + jww.INFO.Printf("*** Random result: %d", result) + if result%2 == 0 { + jww.INFO.Printf("Forcing a message pickup retry for round %d", ri.ID) + // Do not call get message, leaving the round to be picked up + // in unchecked round scheduler process + return + } + } // Attempt to request for this gateway return m.getMessagesFromGateway(id.Round(ri.ID), rl.identity, comms, gwIds) }