aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++/impl/codegen
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-08-31 12:58:47 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-08-31 12:58:47 -0700
commitd58daa2b2f577dbf6c629e9914f405df223aac8d (patch)
tree9130fc793aaef0cedc3384e862b2f993f729d308 /include/grpc++/impl/codegen
parent259f23c99ea4294fb6870958611582975da2ef2c (diff)
parentb85448407ecfd4e633886fa04bb3f334b5064a47 (diff)
Merge branch 'client_crash' of github.com:ctiller/grpc into merge-write
Diffstat (limited to 'include/grpc++/impl/codegen')
-rw-r--r--include/grpc++/impl/codegen/client_context.h6
-rw-r--r--include/grpc++/impl/codegen/server_context.h4
-rw-r--r--include/grpc++/impl/codegen/sync_stream.h37
3 files changed, 39 insertions, 8 deletions
diff --git a/include/grpc++/impl/codegen/client_context.h b/include/grpc++/impl/codegen/client_context.h
index 012bcc2bbe..d77ca4c396 100644
--- a/include/grpc++/impl/codegen/client_context.h
+++ b/include/grpc++/impl/codegen/client_context.h
@@ -271,7 +271,7 @@ class ClientContext {
/// Set \a algorithm to be the compression algorithm used for the client call.
///
- /// \param algorith The compression algorithm used for the client call.
+ /// \param algorithm The compression algorithm used for the client call.
void set_compression_algorithm(grpc_compression_algorithm algorithm);
/// Return the peer uri in a string.
@@ -307,6 +307,10 @@ class ClientContext {
};
static void SetGlobalCallbacks(GlobalCallbacks* callbacks);
+ // Should be used for framework-level extensions only.
+ // Applications never need to call this method.
+ grpc_call* c_call() { return call_; }
+
private:
// Disallow copy and assign.
ClientContext(const ClientContext&);
diff --git a/include/grpc++/impl/codegen/server_context.h b/include/grpc++/impl/codegen/server_context.h
index 08212af861..c9d1f4d69e 100644
--- a/include/grpc++/impl/codegen/server_context.h
+++ b/include/grpc++/impl/codegen/server_context.h
@@ -166,6 +166,10 @@ class ServerContext {
async_notify_when_done_tag_ = tag;
}
+ // Should be used for framework-level extensions only.
+ // Applications never need to call this method.
+ grpc_call* c_call() { return call_; }
+
private:
friend class ::grpc::testing::InteropServerContextInspector;
friend class ::grpc::ServerInterface;
diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h
index b2b972760d..7601ceae92 100644
--- a/include/grpc++/impl/codegen/sync_stream.h
+++ b/include/grpc++/impl/codegen/sync_stream.h
@@ -64,6 +64,15 @@ class ClientStreamingInterface {
virtual Status Finish() = 0;
};
+/// Common interface for all synchronous server side streaming.
+class ServerStreamingInterface {
+ public:
+ virtual ~ServerStreamingInterface() {}
+
+ /// Blocking send initial metadata to client.
+ virtual void SendInitialMetadata() = 0;
+};
+
/// An interface that yields a sequence of messages of type \a R.
template <class R>
class ReaderInterface {
@@ -336,12 +345,17 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> {
Call call_;
};
+/// Server-side interface for streaming reads of message of type \a R.
+template <class R>
+class ServerReaderInterface : public ServerStreamingInterface,
+ public ReaderInterface<R> {};
+
template <class R>
-class ServerReader GRPC_FINAL : public ReaderInterface<R> {
+class ServerReader GRPC_FINAL : public ServerReaderInterface<R> {
public:
ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
- void SendInitialMetadata() {
+ void SendInitialMetadata() GRPC_OVERRIDE {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
CallOpSet<CallOpSendInitialMetadata> ops;
@@ -367,12 +381,17 @@ class ServerReader GRPC_FINAL : public ReaderInterface<R> {
ServerContext* const ctx_;
};
+/// Server-side interface for streaming writes of message of type \a W.
template <class W>
-class ServerWriter GRPC_FINAL : public WriterInterface<W> {
+class ServerWriterInterface : public ServerStreamingInterface,
+ public WriterInterface<W> {};
+
+template <class W>
+class ServerWriter GRPC_FINAL : public ServerWriterInterface<W> {
public:
ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
- void SendInitialMetadata() {
+ void SendInitialMetadata() GRPC_OVERRIDE {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
CallOpSet<CallOpSendInitialMetadata> ops;
@@ -411,12 +430,16 @@ class ServerWriter GRPC_FINAL : public WriterInterface<W> {
/// Server-side interface for bi-directional streaming.
template <class W, class R>
-class ServerReaderWriter GRPC_FINAL : public WriterInterface<W>,
- public ReaderInterface<R> {
+class ServerReaderWriterInterface : public ServerStreamingInterface,
+ public WriterInterface<W>,
+ public ReaderInterface<R> {};
+
+template <class W, class R>
+class ServerReaderWriter GRPC_FINAL : public ServerReaderWriterInterface<W, R> {
public:
ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
- void SendInitialMetadata() {
+ void SendInitialMetadata() GRPC_OVERRIDE {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
CallOpSet<CallOpSendInitialMetadata> ops;