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-unixfs
Commits
e311ccbf
Commit
e311ccbf
authored
10 years ago
by
Jeromy
Committed by
Juan Batiz-Benet
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
respect the lock file, also cpu profile
parent
9c221719
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
cmd/ipfs/ipfs.go
cmd/ipfs/ipfs.go
+10
-1
daemon/daemon_client.go
daemon/daemon_client.go
+17
-0
No files found.
cmd/ipfs/ipfs.go
View file @
e311ccbf
...
...
@@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"os"
"runtime/pprof"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
...
...
@@ -67,7 +68,15 @@ func ipfsCmd(c *commander.Command, args []string) error {
func
main
()
{
u
.
Debug
=
true
err
:=
CmdIpfs
.
Dispatch
(
os
.
Args
[
1
:
])
ofi
,
err
:=
os
.
Create
(
"cpu.prof"
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
}
pprof
.
StartCPUProfile
(
ofi
)
defer
ofi
.
Close
()
defer
pprof
.
StopCPUProfile
()
err
=
CmdIpfs
.
Dispatch
(
os
.
Args
[
1
:
])
if
err
!=
nil
{
if
len
(
err
.
Error
())
>
0
{
fmt
.
Fprintf
(
os
.
Stderr
,
"ipfs %s: %v
\n
"
,
os
.
Args
[
1
],
err
)
...
...
This diff is collapsed.
Click to expand it.
daemon/daemon_client.go
View file @
e311ccbf
...
...
@@ -8,7 +8,9 @@ import (
"net"
"os"
lock
"github.com/camlistore/lock"
ma
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
u
"github.com/jbenet/go-ipfs/util"
)
...
...
@@ -46,6 +48,21 @@ func getDaemonAddr(confdir string) (string, error) {
// address of the daemon is retrieved from the configuration directory, where
// live daemons write their addresses to special files.
func
SendCommand
(
command
*
Command
,
confdir
string
)
error
{
//check if daemon is running
log
.
Info
(
"Checking if daemon is running..."
)
var
err
error
confdir
,
err
=
u
.
TildeExpansion
(
confdir
)
if
err
!=
nil
{
return
err
}
lk
,
err
:=
lock
.
Lock
(
confdir
+
"/daemon.lock"
)
if
err
==
nil
{
return
ErrDaemonNotRunning
lk
.
Close
()
}
log
.
Info
(
"Daemon is running! %s"
,
err
)
server
,
err
:=
getDaemonAddr
(
confdir
)
if
err
!=
nil
{
return
err
...
...
This diff is collapsed.
Click to expand it.
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