diff options
author | Sree Kuchibhotla <sreek@google.com> | 2017-01-09 14:58:12 -0800 |
---|---|---|
committer | Sree Kuchibhotla <sreek@google.com> | 2017-01-09 14:58:12 -0800 |
commit | e93b028f07addb13240e636aaea837e3f0eaa9c4 (patch) | |
tree | 2c0c502c9ca42413c1d87210cfe9cedcb7b2bcef /src/cpp/common | |
parent | d191d31e4963b23255840ffe648290ab92d5e8bc (diff) | |
parent | 6cf58c81731343e0ffb134febd3e576425399e5e (diff) |
Merge branch 'master' into tweak_slice_buffer
Diffstat (limited to 'src/cpp/common')
-rw-r--r-- | src/cpp/common/channel_arguments.cc | 7 | ||||
-rw-r--r-- | src/cpp/common/channel_filter.cc | 8 | ||||
-rw-r--r-- | src/cpp/common/channel_filter.h | 3 |
3 files changed, 13 insertions, 5 deletions
diff --git a/src/cpp/common/channel_arguments.cc b/src/cpp/common/channel_arguments.cc index 0301b5b8ec..1fdd106130 100644 --- a/src/cpp/common/channel_arguments.cc +++ b/src/cpp/common/channel_arguments.cc @@ -38,8 +38,11 @@ #include <grpc++/resource_quota.h> #include <grpc/impl/codegen/grpc_types.h> #include <grpc/support/log.h> +extern "C" { #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/socket_mutator.h" +} namespace grpc { ChannelArguments::ChannelArguments() { @@ -94,13 +97,15 @@ void ChannelArguments::SetSocketMutator(grpc_socket_mutator* mutator) { } grpc_arg mutator_arg = grpc_socket_mutator_to_arg(mutator); bool replaced = false; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; for (auto it = args_.begin(); it != args_.end(); ++it) { if (it->type == mutator_arg.type && grpc::string(it->key) == grpc::string(mutator_arg.key)) { - it->value.pointer.vtable->destroy(it->value.pointer.p); + it->value.pointer.vtable->destroy(&exec_ctx, it->value.pointer.p); it->value.pointer = mutator_arg.value.pointer; } } + grpc_exec_ctx_finish(&exec_ctx); if (!replaced) { args_.push_back(mutator_arg); } diff --git a/src/cpp/common/channel_filter.cc b/src/cpp/common/channel_filter.cc index ad2c0f2295..c0dc9dd63e 100644 --- a/src/cpp/common/channel_filter.cc +++ b/src/cpp/common/channel_filter.cc @@ -40,11 +40,12 @@ namespace grpc { // MetadataBatch -grpc_linked_mdelem *MetadataBatch::AddMetadata(const string &key, +grpc_linked_mdelem *MetadataBatch::AddMetadata(grpc_exec_ctx *exec_ctx, + const string &key, const string &value) { grpc_linked_mdelem *storage = new grpc_linked_mdelem; memset(storage, 0, sizeof(grpc_linked_mdelem)); - storage->md = grpc_mdelem_from_strings(key.c_str(), value.c_str()); + storage->md = grpc_mdelem_from_strings(exec_ctx, key.c_str(), value.c_str()); grpc_metadata_batch_link_head(batch_, storage); return storage; } @@ -89,7 +90,8 @@ std::vector<FilterRecord> *channel_filters; namespace { -bool MaybeAddFilter(grpc_channel_stack_builder *builder, void *arg) { +bool MaybeAddFilter(grpc_exec_ctx *exec_ctx, + grpc_channel_stack_builder *builder, void *arg) { const FilterRecord &filter = *(FilterRecord *)arg; if (filter.include_filter) { const grpc_channel_args *args = diff --git a/src/cpp/common/channel_filter.h b/src/cpp/common/channel_filter.h index c9f50df732..5de8f5e463 100644 --- a/src/cpp/common/channel_filter.h +++ b/src/cpp/common/channel_filter.h @@ -70,7 +70,8 @@ class MetadataBatch { /// Adds metadata and returns the newly allocated storage. /// The caller takes ownership of the result, which must exist for the /// lifetime of the gRPC call. - grpc_linked_mdelem *AddMetadata(const string &key, const string &value); + grpc_linked_mdelem *AddMetadata(grpc_exec_ctx *exec_ctx, const string &key, + const string &value); class const_iterator : public std::iterator<std::bidirectional_iterator_tag, const grpc_mdelem> { |