don't load identity in offline mode (temp)
**For now**, we don't need to load/parse the private key (which causes a signficant delay in commands) when doing things entirely offline. This may change, and in that case the private key should be loaded on demand.
Juan Batiz-Benet committed
Sep 23, 2014 at 05:02 UTC
f2db4b77ac03e6785ea1feabbe8263b8968a282a
1 file changed
+8
-5
core/core.go
+8
-5
@@ -74,11 +74,6 @@ func NewIpfsNode(cfg *config.Config, online bool) (*IpfsNode, error) {
74
return nil, err
75
}
76
77
- local, err := initIdentity(cfg)
78
- if err != nil {
79
- return nil, err
80
- }
81
-
77
peerstore := peer.NewPeerstore()
78
79
// FIXME(brian): This is a bit dangerous. If any of the vars declared in
@@ -90,12 +85,20 @@ func NewIpfsNode(cfg *config.Config, online bool) (*IpfsNode, error) {
85
// TODO: refactor so we can use IpfsRouting interface instead of being DHT-specific
86
route *dht.IpfsDHT
87
exchangeSession exchange.Interface
88
+ local *peer.Peer
89
)
90
91
if online {
92
// add protocol services here.
93
ctx := context.TODO() // derive this from a higher context.
94
95
+ // when not online, don't need to parse private keys (yet)
96
+ local, err := initIdentity(cfg)
97
+ if err != nil {
98
+ cancel()
99
+ return nil, err
100
+ }
101
+
102
dhtService := netservice.NewService(nil) // nil handler for now, need to patch it
103
exchangeService := netservice.NewService(nil) // nil handler for now, need to patch it
104