mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 18:13:54 +08:00
core bugfix -- connect ctx
This commit is contained in:

committed by
Brian Tiger Chow

parent
52cefb16cd
commit
8d29a3255f
@ -121,7 +121,7 @@ func NewIpfsNode(cfg *config.Config, online bool) (*IpfsNode, error) {
|
||||
exchangeSession = bitswap.NetMessageSession(ctx, exchangeService, local, d, route)
|
||||
|
||||
// TODO(brian): pass a context to initConnections
|
||||
go initConnections(cfg, peerstore, route)
|
||||
go initConnections(ctx, cfg, peerstore, route)
|
||||
}
|
||||
|
||||
// TODO(brian): when offline instantiate the BlockService with a bitswap
|
||||
@ -184,7 +184,7 @@ func initIdentity(cfg *config.Config) (*peer.Peer, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func initConnections(cfg *config.Config, pstore peer.Peerstore, route *dht.IpfsDHT) {
|
||||
func initConnections(ctx context.Context, cfg *config.Config, pstore peer.Peerstore, route *dht.IpfsDHT) {
|
||||
for _, p := range cfg.Peers {
|
||||
if p.PeerID == "" {
|
||||
u.PErr("error: peer does not include PeerID. %v\n", p)
|
||||
@ -205,7 +205,7 @@ func initConnections(cfg *config.Config, pstore peer.Peerstore, route *dht.IpfsD
|
||||
continue
|
||||
}
|
||||
|
||||
if _, err = route.Connect(npeer); err != nil {
|
||||
if _, err = route.Connect(ctx, npeer); err != nil {
|
||||
u.PErr("Bootstrapping error: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user