forked from TrueCloudLab/frostfs-node
[#1662] object: Fix CloseAndRecv
for patch streamer
* A client may open stream to server, not send anything and close the open stream immediatly. This shouldn't cause a panic; * Return the error if `s.patcher` is uninitialized. Uninitialized patcher cannot be closed, this causes a panic. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
bf8914fedc
commit
4c8f9580a1
1 changed files with 3 additions and 0 deletions
|
@ -214,6 +214,9 @@ func (s *Streamer) Send(ctx context.Context, req *objectV2.PatchRequest) error {
|
|||
}
|
||||
|
||||
func (s *Streamer) CloseAndRecv(ctx context.Context) (*objectV2.PatchResponse, error) {
|
||||
if s.patcher == nil {
|
||||
return nil, errors.New("uninitialized patch streamer")
|
||||
}
|
||||
patcherResp, err := s.patcher.Close(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Reference in a new issue