Skip to content

Commit

Permalink
Do not treat API client EOF as a network error (#2518)
Browse files Browse the repository at this point in the history
  • Loading branch information
cthulhu-rider authored Aug 18, 2023
2 parents e1d4532 + 4909a08 commit 27623c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cmd/neofs-cli/internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package internal
import (
"bytes"
"context"
"errors"
"fmt"
"io"

Expand Down Expand Up @@ -439,7 +440,7 @@ func PutObject(ctx context.Context, prm PutObjectPrm) (*PutObjectRes, error) {
buf := make([]byte, sz)

_, err = io.CopyBuffer(wrt, prm.rdr, buf)
if err != nil {
if err != nil && !errors.Is(err, io.EOF) {
return nil, fmt.Errorf("copy data into object stream: %w", err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/object/internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ func PutObject(prm PutObjectPrm) (*PutObjectRes, error) {
}

_, err = w.Write(prm.obj.Payload())
if err != nil {
if err != nil && !errors.Is(err, io.EOF) {
return nil, fmt.Errorf("write object payload into stream: %w", err)
}

Expand Down

0 comments on commit 27623c5

Please sign in to comment.