Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
e01f1ba8
Commit
e01f1ba8
authored
Oct 29, 2014
by
Matt Bell
Committed by
Juan Batiz-Benet
Nov 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/ipfs2: daemon command: Handle lock before initializing node
parent
decda218
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
cmd/ipfs2/daemon.go
cmd/ipfs2/daemon.go
+6
-6
No files found.
cmd/ipfs2/daemon.go
View file @
e01f1ba8
...
...
@@ -23,19 +23,19 @@ var daemonCmd = &cmds.Command{
func
daemonFunc
(
res
cmds
.
Response
,
req
cmds
.
Request
)
{
ctx
:=
req
.
Context
()
node
,
err
:=
core
.
NewIpfsNode
(
ctx
.
Config
,
true
)
lk
,
err
:=
daemon
.
Lock
(
ctx
.
Config
Root
)
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
res
.
SetError
(
fmt
.
Errorf
(
"Couldn't obtain lock. Is another daemon already running?"
)
,
cmds
.
ErrNormal
)
return
}
ctx
.
Node
=
node
defer
lk
.
Close
()
lk
,
err
:=
daemon
.
Lock
(
ctx
.
Config
Root
)
node
,
err
:=
core
.
NewIpfsNode
(
ctx
.
Config
,
true
)
if
err
!=
nil
{
res
.
SetError
(
fmt
.
Errorf
(
"Couldn't obtain lock. Is another daemon already running?"
)
,
cmds
.
ErrNormal
)
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
defer
lk
.
Close
()
ctx
.
Node
=
node
addr
,
err
:=
ma
.
NewMultiaddr
(
ctx
.
Config
.
Addresses
.
API
)
if
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment