server: don't re-use existing wait group for loops within initialPeerBootstrap

This commit is contained in:
Olaoluwa Osuntokun 2019-06-27 18:49:48 -07:00
parent 9c957193cf
commit abe73ca6c1
No known key found for this signature in database
GPG Key ID: CE58F7F8E20FD9A2

@ -1719,7 +1719,6 @@ func (s *server) peerBootstrapper(numTargetPeers uint32,
func (s *server) initialPeerBootstrap(ignore map[autopilot.NodeID]struct{}, func (s *server) initialPeerBootstrap(ignore map[autopilot.NodeID]struct{},
numTargetPeers uint32, bootstrappers []discovery.NetworkPeerBootstrapper) { numTargetPeers uint32, bootstrappers []discovery.NetworkPeerBootstrapper) {
var wg sync.WaitGroup
for { for {
// Check if the server has been requested to shut down in order // Check if the server has been requested to shut down in order
@ -1752,6 +1751,7 @@ func (s *server) initialPeerBootstrap(ignore map[autopilot.NodeID]struct{},
// Then, we'll attempt to establish a connection to the // Then, we'll attempt to establish a connection to the
// different peer addresses retrieved by our bootstrappers. // different peer addresses retrieved by our bootstrappers.
var wg sync.WaitGroup
for _, bootstrapAddr := range bootstrapAddrs { for _, bootstrapAddr := range bootstrapAddrs {
wg.Add(1) wg.Add(1)
go func(addr *lnwire.NetAddress) { go func(addr *lnwire.NetAddress) {