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 @@ -25,6 +25,7 @@ : public grpc::ServerBidiReactor { Request request; Response response; + bool finished = false; protected: ServerBidiReactorStatus status; @@ -66,12 +67,16 @@ if (!this->status.status.ok()) { std::cout << "error: " << this->status.status.error_message() << std::endl; } + if (finished) { + return; + } if (this->status.sendLastResponse) { this->StartWriteAndFinish( &this->response, grpc::WriteOptions(), this->status.status); } else { this->Finish(this->status.status); } + finished = true; } template 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 @@ -13,6 +13,7 @@ template class ServerReadReactorBase : public grpc::ServerReadReactor { Request request; + bool finished = false; void terminate(grpc::Status status); @@ -39,7 +40,11 @@ if (!this->status.ok()) { std::cout << "error: " << this->status.error_message() << std::endl; } + if (finished) { + return; + } this->Finish(status); + finished = true; } template 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 @@ -14,6 +14,7 @@ class ServerWriteReactorBase : public grpc::ServerWriteReactor { Response response; bool initialized = false; + bool finished = false; void terminate(grpc::Status status); @@ -42,7 +43,11 @@ std::cout << "error: " << this->status.error_message() << std::endl; } this->status = status; + if (finished) { + return; + } this->Finish(status); + finished = true; } template 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 @@ -25,6 +25,7 @@ : public grpc::ServerBidiReactor { Request request; Response response; + bool finished = false; protected: ServerBidiReactorStatus status; @@ -66,12 +67,16 @@ if (!this->status.status.ok()) { std::cout << "error: " << this->status.status.error_message() << std::endl; } + if (finished) { + return; + } if (this->status.sendLastResponse) { this->StartWriteAndFinish( &this->response, grpc::WriteOptions(), this->status.status); } else { this->Finish(this->status.status); } + finished = true; } template 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 @@ -13,6 +13,7 @@ template class ServerReadReactorBase : public grpc::ServerReadReactor { Request request; + bool finished = false; void terminate(grpc::Status status); @@ -39,7 +40,11 @@ if (!this->status.ok()) { std::cout << "error: " << this->status.error_message() << std::endl; } + if (finished) { + return; + } this->Finish(status); + finished = true; } template 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 @@ -14,6 +14,7 @@ class ServerWriteReactorBase : public grpc::ServerWriteReactor { Response response; bool initialized = false; + bool finished = false; void terminate(grpc::Status status); @@ -42,7 +43,11 @@ std::cout << "error: " << this->status.error_message() << std::endl; } this->status = status; + if (finished) { + return; + } this->Finish(status); + finished = true; } template