From 2e2b4ae858375255151a0081add51cdb7a702c5b Mon Sep 17 00:00:00 2001 From: Tao He Date: Thu, 23 Sep 2021 14:29:48 +0800 Subject: [PATCH] Remove checks in "Watch". Signed-off-by: Tao He --- src/v3/AsyncWatchAction.cpp | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/v3/AsyncWatchAction.cpp b/src/v3/AsyncWatchAction.cpp index 249137f..ef630de 100644 --- a/src/v3/AsyncWatchAction.cpp +++ b/src/v3/AsyncWatchAction.cpp @@ -85,23 +85,10 @@ void etcdv3::AsyncWatchAction::waitForResponse() isCancelled.store(true); 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; 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(); // leave a warning if the response is too large and been fragmented @@ -123,25 +110,10 @@ void etcdv3::AsyncWatchAction::CancelWatch() { std::lock_guard scope_lock(this->protect_is_cancalled); if (!isCancelled.exchange(true)) { - void* got_tag; - bool ok = false; - 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; 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(); }