diff --git a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientBidiReactorBase.h b/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientBidiReactorBase.h --- a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientBidiReactorBase.h +++ b/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientBidiReactorBase.h @@ -51,15 +51,15 @@ template void ClientBidiReactorBase::terminate( const grpc::Status &status) { + this->status = status; this->terminateCallback(); - if (this->done) { - return; - } if (!this->status.ok()) { std::cout << "error: " << this->status.error_message() << std::endl; } + if (this->done) { + return; + } this->StartWritesDone(); - this->status = status; this->done = true; } @@ -79,7 +79,12 @@ template void ClientBidiReactorBase::OnReadDone(bool ok) { if (!ok) { - this->terminate(grpc::Status(grpc::StatusCode::UNKNOWN, "read error")); + // we should suppress this as we want to have an ability to gracefully end a + // connection on the other side. This will result in `!ok` here. I think it + // is somehow broken and simple bool flag doesn't give us enough information + // on what happened. + // We should manually check if the data we received is valid + this->terminate(grpc::Status::OK); return; } this->nextWrite(); diff --git a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientReadReactorBase.h b/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientReadReactorBase.h --- a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientReadReactorBase.h +++ b/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientReadReactorBase.h @@ -31,14 +31,11 @@ template void ClientReadReactorBase::terminate( const grpc::Status &status) { + this->status = status; this->terminateCallback(); - if (this->done) { - return; - } if (!this->status.ok()) { std::cout << "error: " << this->status.error_message() << std::endl; } - this->status = status; this->done = true; } @@ -54,7 +51,12 @@ template void ClientReadReactorBase::OnReadDone(bool ok) { if (!ok) { - this->terminate(grpc::Status(grpc::StatusCode::UNKNOWN, "read error")); + // we should suppress this as we want to have an ability to gracefully end a + // connection on the other side. This will result in `!ok` here. I think it + // is somehow broken and simple bool flag doesn't give us enough information + // on what happened. + // We should manually check if the data we received is valid + this->terminate(grpc::Status::OK); return; } std::unique_ptr status = this->readResponse(this->response); diff --git a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientWriteReactorBase.h b/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientWriteReactorBase.h --- a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientWriteReactorBase.h +++ b/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientWriteReactorBase.h @@ -53,14 +53,14 @@ template void ClientWriteReactorBase::terminate( const grpc::Status &status) { + this->status = status; this->terminateCallback(); - if (this->done) { - return; - } if (!this->status.ok()) { std::cout << "error: " << this->status.error_message() << std::endl; } - this->status = status; + if (this->done) { + return; + } this->done = true; this->StartWritesDone(); }