From 70bef36f64de419ae13d60555a512a28a41ad5c6 Mon Sep 17 00:00:00 2001 From: arches Date: Tue, 26 Jul 2016 10:06:33 -0400 Subject: [PATCH] Updated waitResponse --- v3/src/AsyncWatchAction.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/v3/src/AsyncWatchAction.cpp b/v3/src/AsyncWatchAction.cpp index 88bc9af..e9fbab3 100644 --- a/v3/src/AsyncWatchAction.cpp +++ b/v3/src/AsyncWatchAction.cpp @@ -36,22 +36,24 @@ void etcdv3::AsyncWatchAction::waitForResponse() { void* got_tag; bool ok = false; - + while(cq_.Next(&got_tag, &ok)) { + if(ok == false || (got_tag == (void*)"writes done")) + { + break; + } if(got_tag == (void*)this) // read tag { if(reply.events_size()) { - stream->WritesDone((void*)this); - cq_.Next(&got_tag, &ok); - break; + stream->WritesDone((void*)"writes done"); } else { stream->Read(&reply, (void*)this); } - } + } } }