Page MenuHomePhabricator

D3719.id11705.diff
No OneTemporary

D3719.id11705.diff

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
@@ -8,6 +8,7 @@
class ClientBidiReactorBase
: public grpc::ClientBidiReactor<Request, Response> {
std::shared_ptr<Response> response = nullptr;
+ bool terminated = false;
bool done = false;
bool initialized = 0;
@@ -20,6 +21,7 @@
void nextWrite();
void terminate(const grpc::Status &status);
+ bool isTerminated();
bool isDone();
void OnWriteDone(bool ok) override;
void OnReadDone(bool ok) override;
@@ -63,7 +65,7 @@
if (!this->status.ok()) {
std::cout << "error: " << this->status.error_message() << std::endl;
}
- if (this->done) {
+ if (this->terminated) {
return;
}
this->terminateCallback();
@@ -73,7 +75,12 @@
this->status = grpc::Status(grpc::StatusCode::INTERNAL, e.what());
}
this->StartWritesDone();
- this->done = true;
+ this->terminated = true;
+}
+
+template <class Request, class Response>
+bool ClientBidiReactorBase<Request, Response>::isTerminated() {
+ return this->terminated;
}
template <class Request, class Response>
@@ -105,6 +112,7 @@
void ClientBidiReactorBase<Request, Response>::OnDone(
const grpc::Status &status) {
this->terminate(status);
+ this->done = true;
this->doneCallback();
}
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
@@ -7,12 +7,15 @@
template <class Request, class Response>
class ClientReadReactorBase : public grpc::ClientReadReactor<Response> {
Response response;
- grpc::Status status = grpc::Status::OK;
bool done = false;
+ bool terminated = false;
bool initialized = false;
void terminate(const grpc::Status &status);
+protected:
+ grpc::Status status = grpc::Status::OK;
+
public:
Request request;
grpc::ClientContext context;
@@ -21,6 +24,7 @@
void OnReadDone(bool ok) override;
void OnDone(const grpc::Status &status) override;
bool isDone();
+ bool isTerminated();
virtual std::unique_ptr<grpc::Status> readResponse(Response &response) = 0;
virtual void validate(){};
@@ -37,7 +41,7 @@
if (!this->status.ok()) {
std::cout << "error: " << this->status.error_message() << std::endl;
}
- if (this->done) {
+ if (this->terminated) {
return;
}
this->terminateCallback();
@@ -46,7 +50,7 @@
} catch (std::runtime_error &e) {
this->status = grpc::Status(grpc::StatusCode::INTERNAL, e.what());
}
- this->done = true;
+ this->terminated = true;
}
template <class Request, class Response>
@@ -82,6 +86,7 @@
template <class Request, class Response>
void ClientReadReactorBase<Request, Response>::OnDone(
const grpc::Status &status) {
+ this->terminated = true;
this->terminate(status);
this->doneCallback();
}
@@ -91,6 +96,11 @@
return this->done;
}
+template <class Request, class Response>
+bool ClientReadReactorBase<Request, Response>::isTerminated() {
+ return this->terminated;
+}
+
} // namespace reactor
} // namespace network
} // namespace comm
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
@@ -8,6 +8,7 @@
class ClientWriteReactorBase : public grpc::ClientWriteReactor<Request> {
grpc::Status status = grpc::Status::OK;
bool done = false;
+ bool terminated = false;
bool initialized = 0;
Request request;
@@ -19,6 +20,7 @@
void OnWriteDone(bool ok) override;
void terminate(const grpc::Status &status);
bool isDone();
+ bool isTerminated();
void OnDone(const grpc::Status &status) override;
virtual std::unique_ptr<grpc::Status> prepareRequest(Request &request) = 0;
@@ -64,7 +66,7 @@
if (!this->status.ok()) {
std::cout << "error: " << this->status.error_message() << std::endl;
}
- if (this->done) {
+ if (this->terminated) {
return;
}
this->terminateCallback();
@@ -73,7 +75,7 @@
} catch (std::runtime_error &e) {
this->status = grpc::Status(grpc::StatusCode::INTERNAL, e.what());
}
- this->done = true;
+ this->terminated = true;
this->StartWritesDone();
}
@@ -82,10 +84,16 @@
return this->done;
}
+template <class Request, class Response>
+bool ClientWriteReactorBase<Request, Response>::isTerminated() {
+ return this->terminated;
+}
+
template <class Request, class Response>
void ClientWriteReactorBase<Request, Response>::OnDone(
const grpc::Status &status) {
this->terminate(status);
+ this->done = true;
this->doneCallback();
}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 3:24 PM (21 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2576556
Default Alt Text
D3719.id11705.diff (5 KB)

Event Timeline