Skip to content

Commit 620ee7f

Browse files
committed
fix construction in core
1 parent ec9c421 commit 620ee7f

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

core/core.go

+11-7
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ func NewIPFSNode(parent context.Context, option ConfigOption) (*IpfsNode, error)
141141
node.Pinning = pin.NewPinner(node.Repo.Datastore(), node.DAG)
142142
}
143143
node.Resolver = &path.Resolver{DAG: node.DAG}
144+
145+
// Setup the mutable ipns filesystem structure
146+
fs, err := ipnsfs.NewFilesystem(ctx, node.DAG, node.Namesys, node.Pinning, node.PrivateKey)
147+
if err != nil {
148+
return nil, debugerror.Wrap(err)
149+
}
150+
node.IpnsFs = fs
151+
144152
success = true
145153
return node, nil
146154
}
@@ -272,12 +280,6 @@ func (n *IpfsNode) startOnlineServicesWithHost(ctx context.Context, host p2phost
272280
// setup name system
273281
n.Namesys = namesys.NewNameSystem(n.Routing)
274282

275-
// Setup the mutable ipns filesystem structure
276-
fs, err := ipnsfs.NewFilesystem(n.Context(), n.DAG, n.Namesys, n.Pinning, n.PrivateKey)
277-
if err != nil {
278-
return debugerror.Wrap(err)
279-
}
280-
n.IpnsFs = fs
281283
return nil
282284
}
283285

@@ -288,7 +290,6 @@ func (n *IpfsNode) teardown() error {
288290
// owned objects are closed in this teardown to ensure that they're closed
289291
// regardless of which constructor was used to add them to the node.
290292
closers := []io.Closer{
291-
n.Blocks,
292293
n.Exchange,
293294
n.Repo,
294295
}
@@ -298,6 +299,9 @@ func (n *IpfsNode) teardown() error {
298299
}
299300
}
300301

302+
if n.Blocks != nil {
303+
addCloser(n.Blocks)
304+
}
301305
if n.IpnsFs != nil {
302306
addCloser(n.IpnsFs)
303307
}

0 commit comments

Comments
 (0)