diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerBidiReactorBase.h b/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerBidiReactorBase.h --- a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerBidiReactorBase.h +++ b/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerBidiReactorBase.h @@ -64,8 +64,8 @@ void ServerBidiReactorBase::terminate( ServerBidiReactorStatus status) { this->status = status; - this->terminateCallback(); try { + this->terminateCallback(); this->validate(); } catch (std::runtime_error &e) { this->status = ServerBidiReactorStatus( diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerReadReactorBase.h b/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerReadReactorBase.h --- a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerReadReactorBase.h +++ b/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerReadReactorBase.h @@ -37,8 +37,8 @@ template void ServerReadReactorBase::terminate(grpc::Status status) { this->status = status; - this->terminateCallback(); try { + this->terminateCallback(); this->validate(); } catch (std::runtime_error &e) { this->status = grpc::Status(grpc::StatusCode::INTERNAL, e.what()); @@ -49,7 +49,7 @@ if (this->finished) { return; } - this->Finish(status); + this->Finish(this->status); this->finished = true; } diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerWriteReactorBase.h b/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerWriteReactorBase.h --- a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerWriteReactorBase.h +++ b/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerWriteReactorBase.h @@ -32,21 +32,27 @@ virtual std::unique_ptr writeResponse(Response *response) = 0; virtual void initialize(){}; + virtual void validate(){}; virtual void doneCallback(){}; virtual void terminateCallback(){}; }; template void ServerWriteReactorBase::terminate(grpc::Status status) { - this->terminateCallback(); + this->status = status; + try { + this->terminateCallback(); + this->validate(); + } catch (std::runtime_error &e) { + this->status = grpc::Status(grpc::StatusCode::INTERNAL, e.what()); + } if (!this->status.ok()) { std::cout << "error: " << this->status.error_message() << std::endl; } - this->status = status; if (this->finished) { return; } - this->Finish(status); + this->Finish(this->status); this->finished = true; } diff --git a/services/blob/src/Reactors/server/base-reactors/ServerBidiReactorBase.h b/services/blob/src/Reactors/server/base-reactors/ServerBidiReactorBase.h --- a/services/blob/src/Reactors/server/base-reactors/ServerBidiReactorBase.h +++ b/services/blob/src/Reactors/server/base-reactors/ServerBidiReactorBase.h @@ -64,8 +64,8 @@ void ServerBidiReactorBase::terminate( ServerBidiReactorStatus status) { this->status = status; - this->terminateCallback(); try { + this->terminateCallback(); this->validate(); } catch (std::runtime_error &e) { this->status = ServerBidiReactorStatus( diff --git a/services/blob/src/Reactors/server/base-reactors/ServerReadReactorBase.h b/services/blob/src/Reactors/server/base-reactors/ServerReadReactorBase.h --- a/services/blob/src/Reactors/server/base-reactors/ServerReadReactorBase.h +++ b/services/blob/src/Reactors/server/base-reactors/ServerReadReactorBase.h @@ -37,8 +37,8 @@ template void ServerReadReactorBase::terminate(grpc::Status status) { this->status = status; - this->terminateCallback(); try { + this->terminateCallback(); this->validate(); } catch (std::runtime_error &e) { this->status = grpc::Status(grpc::StatusCode::INTERNAL, e.what()); @@ -49,7 +49,7 @@ if (this->finished) { return; } - this->Finish(status); + this->Finish(this->status); this->finished = true; } diff --git a/services/blob/src/Reactors/server/base-reactors/ServerWriteReactorBase.h b/services/blob/src/Reactors/server/base-reactors/ServerWriteReactorBase.h --- a/services/blob/src/Reactors/server/base-reactors/ServerWriteReactorBase.h +++ b/services/blob/src/Reactors/server/base-reactors/ServerWriteReactorBase.h @@ -32,21 +32,27 @@ virtual std::unique_ptr writeResponse(Response *response) = 0; virtual void initialize(){}; + virtual void validate(){}; virtual void doneCallback(){}; virtual void terminateCallback(){}; }; template void ServerWriteReactorBase::terminate(grpc::Status status) { - this->terminateCallback(); + this->status = status; + try { + this->terminateCallback(); + this->validate(); + } catch (std::runtime_error &e) { + this->status = grpc::Status(grpc::StatusCode::INTERNAL, e.what()); + } if (!this->status.ok()) { std::cout << "error: " << this->status.error_message() << std::endl; } - this->status = status; if (this->finished) { return; } - this->Finish(status); + this->Finish(this->status); this->finished = true; }