downstream: rejigger hostname logic in newDOwnstreamConn

I find it easier to read this way.
This commit is contained in:
Simon Ser 2022-03-21 16:33:58 +01:00
parent e403b88a3d
commit 069625d30d

View file

@ -341,9 +341,10 @@ func newDownstreamConn(srv *Server, ic ircConn, id uint64) *downstreamConn {
registration: new(downstreamRegistration), registration: new(downstreamRegistration),
} }
dc.monitored.SetCasemapping(casemapASCII) dc.monitored.SetCasemapping(casemapASCII)
dc.hostname = remoteAddr if host, _, err := net.SplitHostPort(remoteAddr); err == nil {
if host, _, err := net.SplitHostPort(dc.hostname); err == nil {
dc.hostname = host dc.hostname = host
} else {
dc.hostname = remoteAddr
} }
for k, v := range permanentDownstreamCaps { for k, v := range permanentDownstreamCaps {
dc.caps.Available[k] = v dc.caps.Available[k] = v