From a0aa175fcc179d5b067fc3c4d0a1f4b617104010 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 25 Aug 2020 16:35:36 +0300 Subject: [PATCH] [#13] transport/object: Fix io.EOF check in Object gRPC handlers Signed-off-by: Leonard Lyubich --- pkg/network/transport/object/grpc/service.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/network/transport/object/grpc/service.go b/pkg/network/transport/object/grpc/service.go index a993c6758..43245d3df 100644 --- a/pkg/network/transport/object/grpc/service.go +++ b/pkg/network/transport/object/grpc/service.go @@ -6,6 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/object" objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" + "github.com/pkg/errors" ) // Server wraps NeoFS API Object service and @@ -33,7 +34,7 @@ func (s *Server) Get(req *objectGRPC.GetRequest, gStream objectGRPC.ObjectServic for { r, err := stream.Recv() if err != nil { - if err == io.EOF { + if errors.Is(errors.Cause(err), io.EOF) { return nil } @@ -62,7 +63,7 @@ func (s *Server) Put(gStream objectGRPC.ObjectService_PutServer) error { } } - if err == io.EOF { + if errors.Is(errors.Cause(err), io.EOF) { resp, err := stream.CloseAndRecv() if err != nil { return err @@ -109,7 +110,7 @@ func (s *Server) Search(req *objectGRPC.SearchRequest, gStream objectGRPC.Object for { r, err := stream.Recv() if err != nil { - if err == io.EOF { + if errors.Is(errors.Cause(err), io.EOF) { return nil } @@ -134,7 +135,7 @@ func (s *Server) GetRange(req *objectGRPC.GetRangeRequest, gStream objectGRPC.Ob for { r, err := stream.Recv() if err != nil { - if err == io.EOF { + if errors.Is(errors.Cause(err), io.EOF) { return nil }