don't spawn a goroutine for scheduling connections

This commit is contained in:
vyzo 2019-12-06 17:22:49 +02:00
parent 0dec90571b
commit ce1970d18d

View File

@ -420,16 +420,14 @@ func (gs *GossipSubRouter) pxConnect(peers []*pb.PeerInfo) {
return
}
// initiate connections, without blocking the event loop
go func() {
for _, ci := range toconnect {
select {
case gs.connect <- ci:
case <-gs.p.ctx.Done():
return
}
for _, ci := range toconnect {
select {
case gs.connect <- ci:
default:
log.Debugf("ignoring peer connection attempt; too many pending connections")
break
}
}()
}
}
func (gs *GossipSubRouter) connector() {