diff options
author | 2016-06-03 14:18:01 -0700 | |
---|---|---|
committer | 2016-06-03 14:18:01 -0700 | |
commit | 55c08f81cff3d8231d4ae18b2a8f9e4abccc2d76 (patch) | |
tree | 0ad9cdab1db83fe008829bdcfedf2525ab94d860 /include/grpc++/impl | |
parent | 3e4f49f88d611efb9573972a18ca727f50292d14 (diff) | |
parent | 84f71932eaf8b601355189896fc5b91449ac82d2 (diff) |
Merge branch 'master' of github.com:grpc/grpc into compression_md_level_bis
Diffstat (limited to 'include/grpc++/impl')
-rw-r--r-- | include/grpc++/impl/codegen/channel_interface.h | 10 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/completion_queue.h | 13 |
2 files changed, 21 insertions, 2 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; diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index 56864d6d53..1b84b44705 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -222,9 +222,18 @@ class CompletionQueue : private GrpcLibraryCodegen { /// A specific type of completion queue used by the processing of notifications /// by servers. Instantiated by \a ServerBuilder. class ServerCompletionQueue : public CompletionQueue { + public: + bool IsFrequentlyPolled() { return is_frequently_polled_; } + private: + bool is_frequently_polled_; friend class ServerBuilder; - ServerCompletionQueue() {} + /// \param is_frequently_polled Informs the GPRC library about whether the + /// server completion queue would be actively polled (by calling Next() or + /// AsyncNext()). By default all server completion queues are assumed to be + /// frequently polled. + ServerCompletionQueue(bool is_frequently_polled = true) + : is_frequently_polled_(is_frequently_polled) {} }; } // namespace grpc |