File tree Expand file tree Collapse file tree 3 files changed +13
-17
lines changed
internal/mode/static/nginx/agent Expand file tree Collapse file tree 3 files changed +13
-17
lines changed Original file line number Diff line number Diff line change @@ -47,10 +47,10 @@ func (cs *commandService) CreateConnection(
4747 return nil , agentgrpc .ErrStatusInvalidConnection
4848 }
4949
50- hostname := req .GetResource ().GetContainerInfo ().GetHostname ()
50+ podName := req .GetResource ().GetContainerInfo ().GetHostname ()
5151
52- cs .logger .Info (fmt .Sprintf ("Creating connection for nginx pod: %s" , hostname ))
53- cs .connTracker .Track (gi .IPAddress , hostname )
52+ cs .logger .Info (fmt .Sprintf ("Creating connection for nginx pod: %s" , podName ))
53+ cs .connTracker .Track (gi .IPAddress , podName )
5454
5555 return & pb.CreateConnectionResponse {
5656 Response : & pb.CommandResponse {
@@ -72,7 +72,7 @@ func (cs *commandService) Subscribe(in pb.CommandService_SubscribeServer) error
7272
7373 go cs .listenForDataPlaneResponse (ctx , in )
7474
75- // wait for connection to be established
75+ // wait for the agent to report itself
7676 podName , err := cs .waitForConnection (ctx , gi )
7777 if err != nil {
7878 cs .logger .Error (err , "error waiting for connection" )
Original file line number Diff line number Diff line change @@ -46,9 +46,5 @@ func (c *ConnectionsTracker) GetConnection(address string) string {
4646 c .lock .Lock ()
4747 defer c .lock .Unlock ()
4848
49- if val , ok := c .connections [address ]; ok {
50- return val
51- }
52-
53- return ""
49+ return c .connections [address ]
5450}
Original file line number Diff line number Diff line change @@ -13,12 +13,6 @@ import (
1313 grpcContext "github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/nginx/agent/grpc/context"
1414)
1515
16- type ContextSetter struct {}
17-
18- func NewContextSetter () * ContextSetter {
19- return & ContextSetter {}
20- }
21-
2216// streamHandler is a struct that implements StreamHandler, allowing the interceptor to replace the context.
2317type streamHandler struct {
2418 grpc.ServerStream
@@ -29,7 +23,13 @@ func (sh *streamHandler) Context() context.Context {
2923 return sh .ctx
3024}
3125
32- func (c * ContextSetter ) Stream () grpc.StreamServerInterceptor {
26+ type ContextSetter struct {}
27+
28+ func NewContextSetter () ContextSetter {
29+ return ContextSetter {}
30+ }
31+
32+ func (c ContextSetter ) Stream () grpc.StreamServerInterceptor {
3333 return func (
3434 srv interface {},
3535 ss grpc.ServerStream ,
@@ -47,7 +47,7 @@ func (c *ContextSetter) Stream() grpc.StreamServerInterceptor {
4747 }
4848}
4949
50- func (c * ContextSetter ) Unary () grpc.UnaryServerInterceptor {
50+ func (c ContextSetter ) Unary () grpc.UnaryServerInterceptor {
5151 return func (
5252 ctx context.Context ,
5353 req interface {},
You can’t perform that action at this time.
0 commit comments