From 5e01e2ac977655aa074faf7fde0a74298f5e4c55 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 20 Jan 2017 18:11:52 -0800 Subject: Revert "Metadata handling rewrite" --- src/cpp/client/channel_cc.cc | 18 ++++-------------- src/cpp/client/secure_credentials.cc | 9 +++------ src/cpp/client/secure_credentials.h | 2 +- 3 files changed, 8 insertions(+), 21 deletions(-) (limited to 'src/cpp/client') diff --git a/src/cpp/client/channel_cc.cc b/src/cpp/client/channel_cc.cc index c985183ae7..357d8317ad 100644 --- a/src/cpp/client/channel_cc.cc +++ b/src/cpp/client/channel_cc.cc @@ -107,20 +107,10 @@ Call Channel::CreateCall(const RpcMethod& method, ClientContext* context, } else if (!host_.empty()) { host_str = host_.c_str(); } - grpc_slice method_slice = SliceFromCopiedString(method.name()); - grpc_slice host_slice; - if (host_str != nullptr) { - host_slice = SliceFromCopiedString(host_str); - } - c_call = grpc_channel_create_call( - c_channel_, context->propagate_from_call_, - context->propagation_options_.c_bitmask(), cq->cq(), method_slice, - host_str == nullptr ? nullptr : &host_slice, context->raw_deadline(), - nullptr); - grpc_slice_unref(method_slice); - if (host_str != nullptr) { - grpc_slice_unref(host_slice); - } + c_call = grpc_channel_create_call(c_channel_, context->propagate_from_call_, + context->propagation_options_.c_bitmask(), + cq->cq(), method.name(), host_str, + context->raw_deadline(), nullptr); } grpc_census_call_set_context(c_call, context->census_context()); context->set_call(c_call, shared_from_this()); diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index 25f6bab7f2..269c523bba 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -206,18 +206,15 @@ void MetadataCredentialsPluginWrapper::InvokePlugin( std::vector md; for (auto it = metadata.begin(); it != metadata.end(); ++it) { grpc_metadata md_entry; - md_entry.key = SliceFromCopiedString(it->first); - md_entry.value = SliceFromCopiedString(it->second); + md_entry.key = it->first.c_str(); + md_entry.value = it->second.data(); + md_entry.value_length = it->second.size(); md_entry.flags = 0; md.push_back(md_entry); } cb(user_data, md.empty() ? nullptr : &md[0], md.size(), static_cast(status.error_code()), status.error_message().c_str()); - for (auto it = md.begin(); it != md.end(); ++it) { - grpc_slice_unref(it->key); - grpc_slice_unref(it->value); - } } MetadataCredentialsPluginWrapper::MetadataCredentialsPluginWrapper( diff --git a/src/cpp/client/secure_credentials.h b/src/cpp/client/secure_credentials.h index 713654ad5b..281db17e98 100644 --- a/src/cpp/client/secure_credentials.h +++ b/src/cpp/client/secure_credentials.h @@ -70,7 +70,7 @@ class SecureCallCredentials final : public CallCredentials { grpc_call_credentials* const c_creds_; }; -class MetadataCredentialsPluginWrapper final : private GrpcLibraryCodegen { +class MetadataCredentialsPluginWrapper final { public: static void Destroy(void* wrapper); static void GetMetadata(void* wrapper, grpc_auth_metadata_context context, -- cgit v1.2.3