don't wrap io.EOF errors during gRPC streaming
Signed-off-by: Steve Kriss <krisss@vmware.com>pull/1322/head
parent
3f2c28f6bb
commit
86293b68b3
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue