Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async connect to bootstrappers #4785

Merged
merged 2 commits into from
Nov 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/peermgr/peermgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,17 @@ func (pmgr *PeerMgr) doExpand(ctx context.Context) {
}

log.Info("connecting to bootstrap peers")
wg := sync.WaitGroup{}
for _, bsp := range pmgr.bootstrappers {
if err := pmgr.h.Connect(ctx, bsp); err != nil {
log.Warnf("failed to connect to bootstrap peer: %s", err)
}
wg.Add(1)
go func(bsp peer.AddrInfo) {
defer wg.Done()
if err := pmgr.h.Connect(ctx, bsp); err != nil {
log.Warnf("failed to connect to bootstrap peer: %s", err)
}
}(bsp)
}
wg.Wait()
return
}

Expand Down