Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3377982
D3719.id11417.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D3719.id11417.diff
View Options
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>
@@ -104,6 +111,7 @@
template <class Request, class Response>
void ClientBidiReactorBase<Request, Response>::OnDone(
const grpc::Status &status) {
+ this->done = true;
this->terminate(status);
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,9 +84,15 @@
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->done = true;
this->terminate(status);
this->doneCallback();
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 28, 8:30 AM (21 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2593402
Default Alt Text
D3719.id11417.diff (5 KB)
Attached To
Mode
D3719: [services] Backup - client reactors - distinguish terminated from done
Attached
Detach File
Event Timeline
Log In to Comment