agent: Remove xdsServer field

The field is only referenced from a single method, it can be a local var
This commit is contained in:
Daniel Nephin 2020-03-21 14:59:39 -04:00
parent 0665c56c26
commit 266bdf7465
1 changed files with 4 additions and 7 deletions

View File

@ -291,9 +291,6 @@ type Agent struct {
// the centrally configured proxy/service defaults.
serviceManager *ServiceManager
// xdsServer is the Server instance that serves xDS gRPC API.
xdsServer *xds.Server
// grpcServer is the server instance used currently to serve xDS API for
// Envoy.
grpcServer *grpc.Server
@ -736,7 +733,7 @@ func (a *Agent) listenAndServeGRPC() error {
return nil
}
a.xdsServer = &xds.Server{
xdsServer := &xds.Server{
Logger: a.logger,
CfgMgr: a.proxyConfig,
Authz: a,
@ -744,15 +741,15 @@ func (a *Agent) listenAndServeGRPC() error {
CheckFetcher: a,
CfgFetcher: a,
}
a.xdsServer.Initialize()
xdsServer.Initialize()
var err error
if a.config.HTTPSPort > 0 {
// gRPC uses the same TLS settings as the HTTPS API. If HTTPS is
// enabled then gRPC will require HTTPS as well.
a.grpcServer, err = a.xdsServer.GRPCServer(a.tlsConfigurator)
a.grpcServer, err = xdsServer.GRPCServer(a.tlsConfigurator)
} else {
a.grpcServer, err = a.xdsServer.GRPCServer(nil)
a.grpcServer, err = xdsServer.GRPCServer(nil)
}
if err != nil {
return err