mirror of
https://github.com/btcsuite/btcd.git
synced 2025-01-19 05:33:36 +01:00
server.go: Optimize newAddressFunc
Change the order of conditions to avoid calling fmt.Sprintf unnecessarily.
This commit is contained in:
parent
f65788d0a1
commit
4021ae2f6e
@ -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…
Reference in New Issue
Block a user