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
80370f06
Commit
80370f06
authored
May 16, 2018
by
Brendan McMillion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove leftover bits of code.
License: MIT Signed-off-by:
Brendan McMillion
<
brendan@cloudflare.com
>
parent
b3faaad1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
43 deletions
+10
-43
cmd/ipfs/daemon.go
cmd/ipfs/daemon.go
+0
-4
cmd/ipfs/ipfs.go
cmd/ipfs/ipfs.go
+0
-5
cmd/ipfs/main.go
cmd/ipfs/main.go
+8
-21
core/core.go
core/core.go
+2
-13
No files found.
cmd/ipfs/daemon.go
View file @
80370f06
...
...
@@ -301,10 +301,6 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
}
routingOption
,
_
:=
req
.
Options
[
routingOptionKwd
]
.
(
string
)
if
err
!=
nil
{
re
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
}
if
routingOption
==
routingOptionDefaultKwd
{
cfg
,
err
:=
repo
.
Config
()
if
err
!=
nil
{
...
...
cmd/ipfs/ipfs.go
View file @
80370f06
...
...
@@ -26,7 +26,6 @@ var localCommands = map[string]*cmds.Command{
"init"
:
initCmd
,
"commands"
:
commandsClientCmd
,
}
var
localMap
=
make
(
map
[
*
cmds
.
Command
]
bool
)
func
init
()
{
// setting here instead of in literal to prevent initialization loop
...
...
@@ -38,10 +37,6 @@ func init() {
Root
.
Subcommands
[
k
]
=
v
}
}
for
_
,
v
:=
range
localCommands
{
localMap
[
v
]
=
true
}
}
// NB: when necessary, properties are described using negatives in order to
...
...
cmd/ipfs/main.go
View file @
80370f06
...
...
@@ -92,6 +92,7 @@ func mainRet() int {
os
.
Args
[
0
]
=
"ipfs"
buildEnv
:=
func
(
ctx
context
.
Context
,
req
*
cmds
.
Request
)
(
cmds
.
Environment
,
error
)
{
checkDebug
(
req
)
repoPath
,
err
:=
getRepoPath
(
req
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -151,12 +152,7 @@ func checkDebug(req *cmds.Request) {
}
func
makeExecutor
(
req
*
cmds
.
Request
,
env
interface
{})
(
cmds
.
Executor
,
error
)
{
checkDebug
(
req
)
details
,
err
:=
commandDetails
(
req
.
Path
,
Root
)
if
err
!=
nil
{
return
nil
,
err
}
details
:=
commandDetails
(
req
.
Path
)
client
,
err
:=
commandShouldRunOnDaemon
(
*
details
,
req
,
env
.
(
*
oldcmds
.
Context
))
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -200,25 +196,16 @@ func checkPermissions(path string) (bool, error) {
return
true
,
nil
}
// commandDetails returns a command's details for the command given by |path|
// within the |root| command tree.
//
// Returns an error if the command is not found in the Command tree.
func
commandDetails
(
path
[]
string
,
root
*
cmds
.
Command
)
(
*
cmdDetails
,
error
)
{
// commandDetails returns a command's details for the command given by |path|.
func
commandDetails
(
path
[]
string
)
*
cmdDetails
{
var
details
cmdDetails
// find the last command in path that has a cmdDetailsMap entry
cmd
:=
root
for
_
,
cmp
:=
range
path
{
cmd
=
cmd
.
Subcommands
[
cmp
]
if
cmd
==
nil
{
return
nil
,
fmt
.
Errorf
(
"subcommand %s should be in root"
,
cmp
)
}
if
cmdDetails
,
found
:=
cmdDetailsMap
[
strings
.
Join
(
path
,
"/"
)];
found
{
for
i
:=
range
path
{
if
cmdDetails
,
found
:=
cmdDetailsMap
[
strings
.
Join
(
path
[
:
i
+
1
],
"/"
)];
found
{
details
=
cmdDetails
}
}
return
&
details
,
nil
return
&
details
}
// commandShouldRunOnDaemon determines, from command details, whether a
...
...
@@ -318,7 +305,7 @@ func startProfiling() (func(), error) {
stopProfiling
:=
func
()
{
pprof
.
StopCPUProfile
()
defer
ofi
.
Close
()
// captured by the closure
ofi
.
Close
()
// captured by the closure
}
return
stopProfiling
,
nil
}
...
...
core/core.go
View file @
80370f06
...
...
@@ -597,12 +597,7 @@ func (n *IpfsNode) teardown() error {
// OnlineMode returns whether or not the IpfsNode is in OnlineMode.
func
(
n
*
IpfsNode
)
OnlineMode
()
bool
{
switch
n
.
mode
{
case
onlineMode
:
return
true
default
:
return
false
}
return
n
.
mode
==
onlineMode
}
// SetLocal will set the IpfsNode to local mode
...
...
@@ -619,17 +614,11 @@ func (n *IpfsNode) LocalMode() bool {
// programmer error should not happen
panic
(
"local mode not set"
)
}
switch
n
.
mode
{
case
localMode
:
return
true
default
:
return
false
}
return
n
.
mode
==
localMode
}
// Bootstrap will set and call the IpfsNodes bootstrap function.
func
(
n
*
IpfsNode
)
Bootstrap
(
cfg
BootstrapConfig
)
error
{
// TODO what should return value be when in offlineMode?
if
n
.
Routing
==
nil
{
return
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