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

feature: allow dfdaemon to listen port on 0~65535 #1300

Merged
merged 1 commit into from
Apr 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dfdaemon/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ type Properties struct {

// Validate validates the config
func (p *Properties) Validate() error {
if p.Port <= 2000 || p.Port > 65535 {
if p.Port <= 0 || p.Port > 65535 {
return dferr.Newf(
constant.CodeExitPortInvalid,
"invalid port %d", p.Port,
Expand Down
4 changes: 2 additions & 2 deletions dfdaemon/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (ts *configTestSuite) TestValidatePort() {
c := defaultConfig()
r := ts.Require()

for _, p := range []uint{0, 80, 2000, 65536} {
for _, p := range []uint{0, 65536} {
c.Port = p
err := c.Validate()
r.NotNil(err)
Expand All @@ -66,7 +66,7 @@ func (ts *configTestSuite) TestValidatePort() {
r.Equal(constant.CodeExitPortInvalid, de.Code)
}

for _, p := range []uint{2001, 65001, 65535} {
for _, p := range []uint{80, 2001, 65001, 65535} {
c.Port = p
r.Nil(c.Validate())
}
Expand Down