server.go: Optimize newAddressFunc
Change the order of conditions to avoid calling fmt.Sprintf unnecessarily.
This commit is contained in:
parent
f65788d0a1
commit
4021ae2f6e
1 changed files with 2 additions and 2 deletions
|
@ -2434,8 +2434,8 @@ func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Param
|
|||
}
|
||||
|
||||
// allow nondefault ports after 50 failed tries.
|
||||
if fmt.Sprintf("%d", addr.NetAddress().Port) !=
|
||||
activeNetParams.DefaultPort && tries < 50 {
|
||||
if tries < 50 && fmt.Sprintf("%d", addr.NetAddress().Port) !=
|
||||
activeNetParams.DefaultPort {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue