Merge pull request #3248 from joostjager/querymc-binding-bug
routerrpc: fix loop variable binding bug in querymc
This commit is contained in:
commit
3c4c4f873b
@ -445,7 +445,10 @@ func (s *Server) QueryMissionControl(ctx context.Context,
|
|||||||
snapshot := s.cfg.RouterBackend.MissionControl.GetHistorySnapshot()
|
snapshot := s.cfg.RouterBackend.MissionControl.GetHistorySnapshot()
|
||||||
|
|
||||||
rpcNodes := make([]*NodeHistory, len(snapshot.Nodes))
|
rpcNodes := make([]*NodeHistory, len(snapshot.Nodes))
|
||||||
for i, node := range snapshot.Nodes {
|
for i, n := range snapshot.Nodes {
|
||||||
|
// Copy node struct to prevent loop variable binding bugs.
|
||||||
|
node := n
|
||||||
|
|
||||||
channels := make([]*ChannelHistory, len(node.Channels))
|
channels := make([]*ChannelHistory, len(node.Channels))
|
||||||
for j, channel := range node.Channels {
|
for j, channel := range node.Channels {
|
||||||
channels[j] = &ChannelHistory{
|
channels[j] = &ChannelHistory{
|
||||||
|
Loading…
Reference in New Issue
Block a user