clientconn: override authority with address's ServerName, if set (#3073)

This commit is contained in:
Joe Betz
2019-10-08 13:59:02 -07:00
committed by Doug Fawley
parent d08614fd39
commit 2e7984e2c0
3 changed files with 58 additions and 2 deletions

View File

@ -1210,10 +1210,16 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne
onCloseCalled := make(chan struct{})
reconnect := grpcsync.NewEvent()
authority := ac.cc.authority
// addr.ServerName takes precedent over ClientConn authority, if present.
if addr.ServerName != "" {
authority = addr.ServerName
}
target := transport.TargetInfo{
Addr: addr.Addr,
Metadata: addr.Metadata,
Authority: ac.cc.authority,
Authority: authority,
}
once := sync.Once{}