Skip to content
Snippets Groups Projects
Commit 5445d0bc authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

fixed non local access to the output of a for loop

parent f12bb7e3
Branches
Tags
No related merge requests found
...@@ -15,6 +15,7 @@ import ( ...@@ -15,6 +15,7 @@ import (
ds "gitlab.com/elixxir/comms/network/dataStructures" ds "gitlab.com/elixxir/comms/network/dataStructures"
"gitlab.com/elixxir/primitives/format" "gitlab.com/elixxir/primitives/format"
"gitlab.com/elixxir/primitives/states" "gitlab.com/elixxir/primitives/states"
"gitlab.com/xx_network/primitives/id"
"time" "time"
) )
...@@ -83,7 +84,8 @@ func (m *Manager) criticalMessages() { ...@@ -83,7 +84,8 @@ func (m *Manager) criticalMessages() {
param := params.GetDefaultCMIX() param := params.GetDefaultCMIX()
//raw critical messages //raw critical messages
for msg, rid, has := critRawMsgs.Next(); has; msg, rid, has = critRawMsgs.Next() { for msg, rid, has := critRawMsgs.Next(); has; msg, rid, has = critRawMsgs.Next() {
go func(msg format.Message) { localRid := rid.DeepCopy()
go func(msg format.Message, rid *id.ID) {
//send the message //send the message
round, _, err := m.SendCMIX(msg, rid, param) round, _, err := m.SendCMIX(msg, rid, param)
//if the message fail to send, notify the buffer so it can be handled //if the message fail to send, notify the buffer so it can be handled
...@@ -112,7 +114,7 @@ func (m *Manager) criticalMessages() { ...@@ -112,7 +114,7 @@ func (m *Manager) criticalMessages() {
return return
} }
critRawMsgs.Succeeded(msg, rid) critRawMsgs.Succeeded(msg, rid)
}(msg) }(msg, localRid)
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment