Skip to content

Commit

Permalink
cli, node: Do not treat EOF as a network error
Browse files Browse the repository at this point in the history
That is the only possible way `client.Client` can say stream has been closed
(because of internal logic, not the network/unexpected errors) in the current
API. It returned `bool` in the previous versions.
Closes #2513, closes #2502.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
  • Loading branch information
carpawell committed Aug 17, 2023
1 parent 66bc5b2 commit 4909a08
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 4909a08

Please sign in to comment.