From a04cefaa287c99d6d0d26efe6bfe4ca72039d80b Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Wed, 23 Dec 2020 13:13:49 -0500 Subject: [PATCH] Remove an unnecessary else --- agent/agent.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index 79ec38fadf..1d48cd85de 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -658,14 +658,14 @@ func (a *Agent) listenAndServeGRPC() error { AuthCheckFrequency: xds.DefaultAuthCheckFrequency, } - 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 = xdsServer.GRPCServer(a.tlsConfigurator) - } else { - a.grpcServer, err = xdsServer.GRPCServer(nil) + tlsConfig := a.tlsConfigurator + // gRPC uses the same TLS settings as the HTTPS API. If HTTPS is not enabled + // then gRPC should not use TLS. + if a.config.HTTPSPort <= 0 { + tlsConfig = nil } + var err error + a.grpcServer, err = xdsServer.GRPCServer(tlsConfig) if err != nil { return err }