aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++/impl/codegen/channel_interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/grpc++/impl/codegen/channel_interface.h')
-rw-r--r--include/grpc++/impl/codegen/channel_interface.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/grpc++/impl/codegen/channel_interface.h b/include/grpc++/impl/codegen/channel_interface.h
index 6fcd5c315c..cf78438117 100644
--- a/include/grpc++/impl/codegen/channel_interface.h
+++ b/include/grpc++/impl/codegen/channel_interface.h
@@ -85,6 +85,16 @@ class ChannelInterface {
return WaitForStateChangeImpl(last_observed, deadline_tp.raw_time());
}
+ /// Wait for this channel to be connected
+ template <typename T>
+ bool WaitForConnected(T deadline) {
+ grpc_connectivity_state state;
+ while ((state = GetState(true)) != GRPC_CHANNEL_READY) {
+ if (!WaitForStateChange(state, deadline)) return false;
+ }
+ return true;
+ }
+
private:
template <class R>
friend class ::grpc::ClientReader;