don't wrap io.EOF errors during gRPC streaming

Signed-off-by: Steve Kriss <krisss@vmware.com>
pull/1322/head
Steve Kriss 2019-03-27 16:22:28 -06:00
parent 3f2c28f6bb
commit 86293b68b3
2 changed files with 12 additions and 0 deletions

View File

@ -112,6 +112,12 @@ func (c *ObjectStoreGRPCClient) GetObject(bucket, key string) (io.ReadCloser, er
receive := func() ([]byte, error) {
data, err := stream.Recv()
if err == io.EOF {
// we need to return io.EOF errors unwrapped so that
// calling code sees them as io.EOF and knows to stop
// reading.
return nil, err
}
if err != nil {
return nil, fromGRPCError(err)
}

View File

@ -101,6 +101,12 @@ func (s *ObjectStoreGRPCServer) PutObject(stream proto.ObjectStore_PutObjectServ
}
data, err := stream.Recv()
if err == io.EOF {
// we need to return io.EOF errors unwrapped so that
// calling code sees them as io.EOF and knows to stop
// reading.
return nil, err
}
if err != nil {
return nil, errors.WithStack(err)
}