style(core) signature
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
Brian Tiger Chow committed
Dec 8, 2014 at 00:11 UTC
6c419e6af4dcef34405791a046e6aa3de18ee33a
1 file changed
+9
-3
core/core.go
+9
-3
@@ -179,7 +179,13 @@ func NewIpfsNode(cfg *config.Config, online bool) (n *IpfsNode, err error) {
179
180
n.Exchange = bitswap.New(ctx, n.Identity, bitswapNetwork, n.Routing, blockstore, alwaysSendToPeer)
181
182
- go initConnections(ctx, n.Config, n.Peerstore, dhtRouting)
182
+ // TODO consider connection supervision into the Network. We've
183
+ // discussed improvements to this Node constructor. One improvement
184
+ // would be to make the node configurable, allowing clients to inject
185
+ // an Exchange, Network, or Routing component and have the constructor
186
+ // manage the wiring. In that scenario, this dangling function is a bit
187
+ // awkward.
188
+ go initConnections(ctx, n.Config.Bootstrap, n.Peerstore, dhtRouting)
189
}
190
191
// TODO(brian): when offline instantiate the BlockService with a bitswap
@@ -250,10 +256,10 @@ func initIdentity(cfg *config.Identity, peers peer.Peerstore, online bool) (peer
256
return self, nil
257
}
258
253
-func initConnections(ctx context.Context, cfg *config.Config, pstore peer.Peerstore, route *dht.IpfsDHT) {
259
+func initConnections(ctx context.Context, bootstrap []*config.BootstrapPeer, pstore peer.Peerstore, route *dht.IpfsDHT) {
260
// TODO consider stricter error handling
261
// TODO consider Criticalf error logging
256
- for _, p := range cfg.Bootstrap {
262
+ for _, p := range bootstrap {
263
if p.PeerID == "" {
264
log.Criticalf("error: peer does not include PeerID. %v", p)
265
}