forked from TrueCloudLab/frostfs-node
[#13] transport/object: Fix io.EOF check in Object gRPC handlers
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
da1961cdf9
commit
a0aa175fcc
1 changed files with 5 additions and 4 deletions
|
@ -6,6 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||||
objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc"
|
objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc"
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server wraps NeoFS API Object service and
|
// Server wraps NeoFS API Object service and
|
||||||
|
@ -33,7 +34,7 @@ func (s *Server) Get(req *objectGRPC.GetRequest, gStream objectGRPC.ObjectServic
|
||||||
for {
|
for {
|
||||||
r, err := stream.Recv()
|
r, err := stream.Recv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == io.EOF {
|
if errors.Is(errors.Cause(err), io.EOF) {
|
||||||
return nil
|
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()
|
resp, err := stream.CloseAndRecv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -109,7 +110,7 @@ func (s *Server) Search(req *objectGRPC.SearchRequest, gStream objectGRPC.Object
|
||||||
for {
|
for {
|
||||||
r, err := stream.Recv()
|
r, err := stream.Recv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == io.EOF {
|
if errors.Is(errors.Cause(err), io.EOF) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +135,7 @@ func (s *Server) GetRange(req *objectGRPC.GetRangeRequest, gStream objectGRPC.Ob
|
||||||
for {
|
for {
|
||||||
r, err := stream.Recv()
|
r, err := stream.Recv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == io.EOF {
|
if errors.Is(errors.Cause(err), io.EOF) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue