From eae3db3294d76f7f19f2ae4dd01e4014152f6b85 Mon Sep 17 00:00:00 2001 From: Adam Sax Date: Wed, 25 May 2022 16:28:24 -0400 Subject: [PATCH] Use Empty rather than Any for message processing --- proxy/handler.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proxy/handler.go b/proxy/handler.go index 95799a0..745a739 100644 --- a/proxy/handler.go +++ b/proxy/handler.go @@ -10,7 +10,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/anypb" + "google.golang.org/protobuf/types/known/emptypb" ) var ( @@ -53,7 +53,7 @@ type handler struct { } // handler is where the real magic of proxying happens. -// It is invoked like any gRPC server stream and uses the anypb.Any type server +// It is invoked like any gRPC server stream and uses the emptypb.Empty type server // to proxy calls between the input and output streams. func (s *handler) handler(srv interface{}, serverStream grpc.ServerStream) error { // little bit of gRPC internals never hurt anyone @@ -112,7 +112,7 @@ func (s *handler) handler(srv interface{}, serverStream grpc.ServerStream) error func (s *handler) forwardClientToServer(src grpc.ClientStream, dst grpc.ServerStream) chan error { ret := make(chan error, 1) go func() { - f := &anypb.Any{} + f := &emptypb.Empty{} for i := 0; ; i++ { if err := src.RecvMsg(f); err != nil { ret <- err // this can be io.EOF which is happy case @@ -144,7 +144,7 @@ func (s *handler) forwardClientToServer(src grpc.ClientStream, dst grpc.ServerSt func (s *handler) forwardServerToClient(src grpc.ServerStream, dst grpc.ClientStream) chan error { ret := make(chan error, 1) go func() { - f := &anypb.Any{} + f := &emptypb.Empty{} for i := 0; ; i++ { if err := src.RecvMsg(f); err != nil { ret <- err // this can be io.EOF which is happy case