Skip to content
This repository was archived by the owner on Dec 20, 2024. It is now read-only.

Commit 0ec8e8d

Browse files
committed
bugfix: delete the default value for supernodes from dfdaemon
Signed-off-by: Starnop <[email protected]>
1 parent 6bc6db4 commit 0ec8e8d

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

cmd/dfdaemon/app/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func init() {
9595
rf.String("localrepo", filepath.Join(os.Getenv("HOME"), ".small-dragonfly/dfdaemon/data/"), "temp output dir of dfdaemon")
9696
rf.String("dfpath", defaultDfgetPath, "dfget path")
9797
rf.Var(netutils.NetLimit(), "ratelimit", "net speed limit")
98-
rf.StringSlice("node", []string{"127.0.0.1:8002"}, "specify the addresses(host:port) of supernodes that will be passed to dfget.")
98+
rf.StringSlice("node", nil, "specify the addresses(host:port) of supernodes that will be passed to dfget.")
9999

100100
exitOnError(bindRootFlags(viper.GetViper()), "bind root command flags")
101101
}

cmd/dfdaemon/app/root_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (ts *rootTestSuite) TestNodeFlag() {
7676
r.Equal([]string{"127.0.0.1:6666"}, cfg.SuperNodes)
7777
}
7878

79-
// flag not set, config file doesn't exist, should use default
79+
// flag not set, config file doesn't exist, should be nil
8080
{
8181
v := viper.New()
8282
v.SetFs(fs)
@@ -86,7 +86,7 @@ func (ts *rootTestSuite) TestNodeFlag() {
8686
r.NotNil(readConfigFile(v, rootCmd))
8787
cfg, err := getConfigFromViper(rootCmd, v)
8888
r.Nil(err)
89-
r.Equal([]string{"127.0.0.1:8002"}, cfg.SuperNodes)
89+
r.EqualValues([]string(nil), cfg.SuperNodes)
9090
}
9191

9292
// when --node flag is set, should always use the flag

dfdaemon/downloader/dfget/dfget.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ func (dfGetter *DFGetter) getCommand(
7777
}
7878
add("-s", dfGetter.config.RateLimit)
7979
add("--totallimit", dfGetter.config.RateLimit)
80-
add("--node", strings.Join(dfGetter.config.SuperNodes, ","))
80+
if len(dfGetter.config.SuperNodes) > 0 {
81+
add("--node", strings.Join(dfGetter.config.SuperNodes, ","))
82+
}
8183

8284
for key, value := range header {
8385
// discard HTTP host header for backing to source successfully

0 commit comments

Comments
 (0)