|
@@ -20,6 +20,7 @@
|
|
|
|
|
|
|
|
#include <chrono>
|
|
#include <chrono>
|
|
|
#include <condition_variable>
|
|
#include <condition_variable>
|
|
|
|
|
+#include <cstring>
|
|
|
#include <memory>
|
|
#include <memory>
|
|
|
#include <mutex>
|
|
#include <mutex>
|
|
|
|
|
|
|
@@ -64,6 +65,10 @@ Channel::~Channel() {
|
|
|
|
|
|
|
|
namespace {
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
+inline grpc_slice SliceFromArray(const char* arr, size_t len) {
|
|
|
|
|
+ return g_core_codegen_interface->grpc_slice_from_copied_buffer(arr, len);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
grpc::string GetChannelInfoField(grpc_channel* channel,
|
|
grpc::string GetChannelInfoField(grpc_channel* channel,
|
|
|
grpc_channel_info* channel_info,
|
|
grpc_channel_info* channel_info,
|
|
|
char*** channel_info_field) {
|
|
char*** channel_info_field) {
|
|
@@ -110,16 +115,17 @@ internal::Call Channel::CreateCall(const internal::RpcMethod& method,
|
|
|
context->propagation_options_.c_bitmask(), cq->cq(),
|
|
context->propagation_options_.c_bitmask(), cq->cq(),
|
|
|
method.channel_tag(), context->raw_deadline(), nullptr);
|
|
method.channel_tag(), context->raw_deadline(), nullptr);
|
|
|
} else {
|
|
} else {
|
|
|
- const char* host_str = nullptr;
|
|
|
|
|
- if (!context->authority().empty()) {
|
|
|
|
|
- host_str = context->authority_.c_str();
|
|
|
|
|
|
|
+ const string* host_str = nullptr;
|
|
|
|
|
+ if (!context->authority_.empty()) {
|
|
|
|
|
+ host_str = &context->authority_;
|
|
|
} else if (!host_.empty()) {
|
|
} else if (!host_.empty()) {
|
|
|
- host_str = host_.c_str();
|
|
|
|
|
|
|
+ host_str = &host_;
|
|
|
}
|
|
}
|
|
|
- grpc_slice method_slice = SliceFromCopiedString(method.name());
|
|
|
|
|
|
|
+ grpc_slice method_slice =
|
|
|
|
|
+ SliceFromArray(method.name(), strlen(method.name()));
|
|
|
grpc_slice host_slice;
|
|
grpc_slice host_slice;
|
|
|
if (host_str != nullptr) {
|
|
if (host_str != nullptr) {
|
|
|
- host_slice = SliceFromCopiedString(host_str);
|
|
|
|
|
|
|
+ host_slice = SliceFromCopiedString(*host_str);
|
|
|
}
|
|
}
|
|
|
c_call = grpc_channel_create_call(
|
|
c_call = grpc_channel_create_call(
|
|
|
c_channel_, context->propagate_from_call_,
|
|
c_channel_, context->propagate_from_call_,
|