aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpp')
-rw-r--r--src/cpp/common/channel_filter.cc6
-rw-r--r--src/cpp/common/channel_filter.h43
-rw-r--r--src/cpp/common/completion_queue_cc.cc7
-rw-r--r--src/cpp/server/server_cc.cc4
-rw-r--r--src/cpp/server/server_context.cc1
5 files changed, 28 insertions, 33 deletions
diff --git a/src/cpp/common/channel_filter.cc b/src/cpp/common/channel_filter.cc
index 253614ca9b..a7b3c2c0da 100644
--- a/src/cpp/common/channel_filter.cc
+++ b/src/cpp/common/channel_filter.cc
@@ -69,9 +69,9 @@ void ChannelData::GetInfo(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem,
// CallData
-void CallData::StartTransportStreamOp(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
- TransportStreamOp *op) {
+void CallData::StartTransportStreamOpBatch(grpc_exec_ctx *exec_ctx,
+ grpc_call_element *elem,
+ TransportStreamOpBatch *op) {
grpc_call_next_op(exec_ctx, elem, op->op());
}
diff --git a/src/cpp/common/channel_filter.h b/src/cpp/common/channel_filter.h
index 59dffb5007..8d800b87d9 100644
--- a/src/cpp/common/channel_filter.h
+++ b/src/cpp/common/channel_filter.h
@@ -42,7 +42,6 @@
#include <vector>
#include "src/core/lib/channel/channel_stack.h"
-#include "src/core/lib/security/context/security_context.h"
#include "src/core/lib/surface/channel_init.h"
#include "src/core/lib/transport/metadata_batch.h"
@@ -141,13 +140,13 @@ class TransportOp {
grpc_transport_op *op_; // Not owned.
};
-/// A C++ wrapper for the \c grpc_transport_stream_op struct.
-class TransportStreamOp {
+/// A C++ wrapper for the \c grpc_transport_stream_op_batch struct.
+class TransportStreamOpBatch {
public:
/// Borrows a pointer to \a op, but does NOT take ownership.
/// The caller must ensure that \a op continues to exist for as
- /// long as the TransportStreamOp object does.
- explicit TransportStreamOp(grpc_transport_stream_op *op)
+ /// long as the TransportStreamOpBatch object does.
+ explicit TransportStreamOpBatch(grpc_transport_stream_op_batch *op)
: op_(op),
send_initial_metadata_(
op->send_initial_metadata
@@ -166,7 +165,7 @@ class TransportStreamOp {
? op->payload->recv_trailing_metadata.recv_trailing_metadata
: nullptr) {}
- grpc_transport_stream_op *op() const { return op_; }
+ grpc_transport_stream_op_batch *op() const { return op_; }
grpc_closure *on_complete() const { return op_->on_complete; }
void set_on_complete(grpc_closure *closure) { op_->on_complete = closure; }
@@ -209,24 +208,12 @@ class TransportStreamOp {
op_->payload->send_message.send_message = send_message;
}
- /// To be called only on clients and servers, respectively.
- grpc_client_security_context *client_security_context() const {
- return (grpc_client_security_context *)op_->payload
- ->context[GRPC_CONTEXT_SECURITY]
- .value;
- }
- grpc_server_security_context *server_security_context() const {
- return (grpc_server_security_context *)op_->payload
- ->context[GRPC_CONTEXT_SECURITY]
- .value;
- }
-
census_context *get_census_context() const {
return (census_context *)op_->payload->context[GRPC_CONTEXT_TRACING].value;
}
private:
- grpc_transport_stream_op *op_; // Not owned.
+ grpc_transport_stream_op_batch *op_; // Not owned.
MetadataBatch send_initial_metadata_;
MetadataBatch send_trailing_metadata_;
MetadataBatch recv_initial_metadata_;
@@ -270,9 +257,9 @@ class CallData {
// TODO(roth): Find a way to avoid passing elem into these methods.
/// Starts a new stream operation.
- virtual void StartTransportStreamOp(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
- TransportStreamOp *op);
+ virtual void StartTransportStreamOpBatch(grpc_exec_ctx *exec_ctx,
+ grpc_call_element *elem,
+ TransportStreamOpBatch *op);
/// Sets a pollset or pollset set.
virtual void SetPollsetOrPollsetSet(grpc_exec_ctx *exec_ctx,
@@ -342,12 +329,12 @@ class ChannelFilter final {
reinterpret_cast<CallDataType *>(elem->call_data)->~CallDataType();
}
- static void StartTransportStreamOp(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
- grpc_transport_stream_op *op) {
+ static void StartTransportStreamOpBatch(grpc_exec_ctx *exec_ctx,
+ grpc_call_element *elem,
+ grpc_transport_stream_op_batch *op) {
CallDataType *call_data = (CallDataType *)elem->call_data;
- TransportStreamOp op_wrapper(op);
- call_data->StartTransportStreamOp(exec_ctx, elem, &op_wrapper);
+ TransportStreamOpBatch op_wrapper(op);
+ call_data->StartTransportStreamOpBatch(exec_ctx, elem, &op_wrapper);
}
static void SetPollsetOrPollsetSet(grpc_exec_ctx *exec_ctx,
@@ -399,7 +386,7 @@ void RegisterChannelFilter(
stack_type,
priority,
include_filter,
- {FilterType::StartTransportStreamOp, FilterType::StartTransportOp,
+ {FilterType::StartTransportStreamOpBatch, FilterType::StartTransportOp,
FilterType::call_data_size, FilterType::InitCallElement,
FilterType::SetPollsetOrPollsetSet, FilterType::DestroyCallElement,
FilterType::channel_data_size, FilterType::InitChannelElement,
diff --git a/src/cpp/common/completion_queue_cc.cc b/src/cpp/common/completion_queue_cc.cc
index 0408a41085..14c51f63c5 100644
--- a/src/cpp/common/completion_queue_cc.cc
+++ b/src/cpp/common/completion_queue_cc.cc
@@ -43,7 +43,12 @@ namespace grpc {
static internal::GrpcLibraryInitializer g_gli_initializer;
-CompletionQueue::CompletionQueue(grpc_completion_queue* take) : cq_(take) {
+// 'CompletionQueue' constructor can safely call GrpcLibraryCodegen(false) here
+// i.e not have GrpcLibraryCodegen call grpc_init(). This is because, to create
+// a 'grpc_completion_queue' instance (which is being passed as the input to
+// this constructor), one must have already called grpc_init().
+CompletionQueue::CompletionQueue(grpc_completion_queue* take)
+ : GrpcLibraryCodegen(false), cq_(take) {
InitialAvalanching();
}
diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc
index e874892e73..ce173a1ee2 100644
--- a/src/cpp/server/server_cc.cc
+++ b/src/cpp/server/server_cc.cc
@@ -489,7 +489,9 @@ void Server::RegisterAsyncGenericService(AsyncGenericService* service) {
int Server::AddListeningPort(const grpc::string& addr,
ServerCredentials* creds) {
GPR_ASSERT(!started_);
- return creds->AddPortToServer(addr, server_);
+ int port = creds->AddPortToServer(addr, server_);
+ global_callbacks_->AddPort(this, port);
+ return port;
}
bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) {
diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc
index 05c05c8695..3a408eb23e 100644
--- a/src/cpp/server/server_context.cc
+++ b/src/cpp/server/server_context.cc
@@ -42,6 +42,7 @@
#include <grpc++/support/time.h>
#include <grpc/compression.h>
#include <grpc/grpc.h>
+#include <grpc/load_reporting.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>