From 4021ae2f6e466d6cdd69c6fa84b5f7484986aaea Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Tue, 6 Dec 2016 21:58:20 +0100 Subject: [PATCH] server.go: Optimize newAddressFunc Change the order of conditions to avoid calling fmt.Sprintf unnecessarily. --- server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index ec3e2337c..efa5011a1 100644 --- a/server.go +++ b/server.go @@ -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 }