@cryptotaxi247 / kubo / commits / 8d29a3255

core bugfix -- connect ctx

Juan Batiz-Benet committed Sep 21, 2014 at 19:17 UTC 8d29a3255ff3f39f96f25585a93792998fb4f9f3
1 file changed +3 -3
core/core.go
+3 -3
@@ -121,7 +121,7 @@ func NewIpfsNode(cfg *config.Config, online bool) (*IpfsNode, error) {
121 exchangeSession = bitswap.NetMessageSession(ctx, exchangeService, local, d, route)
122
123 // TODO(brian): pass a context to initConnections
124 - go initConnections(cfg, peerstore, route)
124 + go initConnections(ctx, cfg, peerstore, route)
125 }
126
127 // TODO(brian): when offline instantiate the BlockService with a bitswap
@@ -184,7 +184,7 @@ func initIdentity(cfg *config.Config) (*peer.Peer, error) {
184 }, nil
185 }
186
187 -func initConnections(cfg *config.Config, pstore peer.Peerstore, route *dht.IpfsDHT) {
187 +func initConnections(ctx context.Context, cfg *config.Config, pstore peer.Peerstore, route *dht.IpfsDHT) {
188 for _, p := range cfg.Peers {
189 if p.PeerID == "" {
190 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
205 continue
206 }
207
208 - if _, err = route.Connect(npeer); err != nil {
208 + if _, err = route.Connect(ctx, npeer); err != nil {
209 u.PErr("Bootstrapping error: %v\n", err)
210 }
211 }