Skip to content

Commit f345521

Browse files
adamthesaxAdam Sax
and
Adam Sax
authored
Use Empty rather than Any for message processing (#62)
Co-authored-by: Adam Sax <[email protected]>
1 parent db34e7b commit f345521

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

proxy/handler.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"google.golang.org/grpc"
1111
"google.golang.org/grpc/codes"
1212
"google.golang.org/grpc/status"
13-
"google.golang.org/protobuf/types/known/anypb"
13+
"google.golang.org/protobuf/types/known/emptypb"
1414
)
1515

1616
var (
@@ -53,7 +53,7 @@ type handler struct {
5353
}
5454

5555
// handler is where the real magic of proxying happens.
56-
// It is invoked like any gRPC server stream and uses the anypb.Any type server
56+
// It is invoked like any gRPC server stream and uses the emptypb.Empty type server
5757
// to proxy calls between the input and output streams.
5858
func (s *handler) handler(srv interface{}, serverStream grpc.ServerStream) error {
5959
// little bit of gRPC internals never hurt anyone
@@ -112,7 +112,7 @@ func (s *handler) handler(srv interface{}, serverStream grpc.ServerStream) error
112112
func (s *handler) forwardClientToServer(src grpc.ClientStream, dst grpc.ServerStream) chan error {
113113
ret := make(chan error, 1)
114114
go func() {
115-
f := &anypb.Any{}
115+
f := &emptypb.Empty{}
116116
for i := 0; ; i++ {
117117
if err := src.RecvMsg(f); err != nil {
118118
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
144144
func (s *handler) forwardServerToClient(src grpc.ServerStream, dst grpc.ClientStream) chan error {
145145
ret := make(chan error, 1)
146146
go func() {
147-
f := &anypb.Any{}
147+
f := &emptypb.Empty{}
148148
for i := 0; ; i++ {
149149
if err := src.RecvMsg(f); err != nil {
150150
ret <- err // this can be io.EOF which is happy case

0 commit comments

Comments
 (0)