server.go: Optimize newAddressFunc

Change the order of conditions to avoid calling fmt.Sprintf
unnecessarily.
This commit is contained in:
David de Kloet 2016-12-06 21:58:20 +01:00
parent f65788d0a1
commit 4021ae2f6e

View File

@ -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
}