Remove checks in "Watch".

Signed-off-by: Tao He <sighingnow@gmail.com>
This commit is contained in:
Tao He 2021-09-23 14:29:48 +08:00
parent ea0557dd6d
commit 2e2b4ae858
1 changed files with 0 additions and 28 deletions

View File

@ -85,23 +85,10 @@ void etcdv3::AsyncWatchAction::waitForResponse()
isCancelled.store(true); isCancelled.store(true);
stream->WritesDone((void*)etcdv3::WATCH_WRITES_DONE); stream->WritesDone((void*)etcdv3::WATCH_WRITES_DONE);
if (cq_.Next(&got_tag, &ok) && ok && got_tag == (void *)etcdv3::WATCH_WRITES_DONE) {
// ok
} else {
std::cerr << "WARN: Failed to mark a watch connection as DONE" << std::endl;
}
grpc::Status status; grpc::Status status;
stream->Finish(&status, (void *)this); stream->Finish(&status, (void *)this);
// n.b., don't wait, as there might be another extra "Read" action on the fly.
//
// if (cq_.Next(&got_tag, &ok) && ok && got_tag == (void *)this) {
// // ok
// } else {
// std::cerr << "WARN: Failed to finish a watch connection" << std::endl;
// }
cq_.Shutdown(); cq_.Shutdown();
// leave a warning if the response is too large and been fragmented // leave a warning if the response is too large and been fragmented
@ -123,25 +110,10 @@ void etcdv3::AsyncWatchAction::CancelWatch()
{ {
std::lock_guard<std::mutex> scope_lock(this->protect_is_cancalled); std::lock_guard<std::mutex> scope_lock(this->protect_is_cancalled);
if (!isCancelled.exchange(true)) { if (!isCancelled.exchange(true)) {
void* got_tag;
bool ok = false;
stream->WritesDone((void*)etcdv3::WATCH_WRITES_DONE); stream->WritesDone((void*)etcdv3::WATCH_WRITES_DONE);
if (cq_.Next(&got_tag, &ok) && ok && got_tag == (void *)etcdv3::WATCH_WRITES_DONE) {
// ok
} else {
std::cerr << "WARN: Failed to mark a watch connection as DONE" << std::endl;
}
grpc::Status status; grpc::Status status;
stream->Finish(&status, (void *)this); stream->Finish(&status, (void *)this);
// n.b., don't wait, as there might be another extra "Read" action on the fly.
//
// if (cq_.Next(&got_tag, &ok) && ok && got_tag == (void *)this) {
// // ok
// } else {
// std::cerr << "WARN: Failed to finish a watch connection" << std::endl;
// }
cq_.Shutdown(); cq_.Shutdown();
} }