packages/hyprspace: PeXService: immediately connect to discovered peers

This commit is contained in:
Max Headroom 2023-01-28 13:21:06 +01:00
parent e7d7e5e80f
commit 92f1e8b71d

View file

@ -128,6 +128,7 @@ func PeXService(ctx context.Context, host host.Host, cfg *config.Config) {
if err != nil { if err != nil {
for _, addrInfo := range addrInfos { for _, addrInfo := range addrInfos {
host.Peerstore().AddAddrs(addrInfo.ID, addrInfo.Addrs, 30*time.Second) host.Peerstore().AddAddrs(addrInfo.ID, addrInfo.Addrs, 30*time.Second)
go host.Connect(ctx, addrInfo)
} }
} }
}() }()
@ -141,6 +142,7 @@ func PeXService(ctx context.Context, host host.Host, cfg *config.Config) {
if err != nil { if err != nil {
for _, addrInfo := range addrInfos { for _, addrInfo := range addrInfos {
host.Peerstore().AddAddrs(addrInfo.ID, addrInfo.Addrs, 30*time.Second) host.Peerstore().AddAddrs(addrInfo.ID, addrInfo.Addrs, 30*time.Second)
go host.Connect(ctx, addrInfo)
} }
} }
}() }()