multi: don't access loop variables in goroutines
This commit makes sure that no loop variables or other temporary variables are accessed directly in a goroutine but are instead passed into the goroutine through a parameter. This makes sure a copy of the value is put on the stack and is not changed while the outside loop continues.
This commit is contained in:
7 files changed
+33
-21
No files matched your search
+2
-2
@@ -5214,7 +5214,7 @@ sendLoop:
|
||||
// payment so we can continue to serve requests while
|
||||
// this payment is being dispatched.
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
go func(payIntent *rpcPaymentIntent) {
|
||||
defer wg.Done()
|
||||
|
||||
// Attempt to grab a free semaphore slot, using
|
||||
@@ -5292,7 +5292,7 @@ sendLoop:
|
||||
}
|
||||
return
|
||||
}
|
||||
}()
|
||||
}(payIntent)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user