network: minor code refactoring

We need to handle IPv6 addresses correctly and net.JoinHostPort takes it
into account.
This commit is contained in:
Anna Shaleva 2020-05-26 19:49:25 +03:00
parent 8c5c248e79
commit 7547a3efe1

View file

@ -149,7 +149,7 @@ func NewServer(config ServerConfig, chain blockchainer.Blockchainer, log *zap.Lo
s.AttemptConnPeers = defaultAttemptConnPeers s.AttemptConnPeers = defaultAttemptConnPeers
} }
s.transport = NewTCPTransport(s, fmt.Sprintf("%s:%d", config.Address, config.Port), s.log) s.transport = NewTCPTransport(s, net.JoinHostPort(config.Address, strconv.Itoa(int(config.Port))), s.log)
s.discovery = NewDefaultDiscovery( s.discovery = NewDefaultDiscovery(
s.DialTimeout, s.DialTimeout,
s.transport, s.transport,