Compare commits
10 Commits
test_64077
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
ccfc163607 | |
|
|
301bb28782 | |
|
|
ce220f01a5 | |
|
|
d167fe7467 | |
|
|
f3c0a9e344 | |
|
|
cf90fc7f73 | |
|
|
65be93cae3 | |
|
|
905c2b25fc | |
|
|
e3da1e7ab6 | |
|
|
73d016e399 |
2
BUILD
2
BUILD
|
|
@ -229,7 +229,7 @@ python_config_settings()
|
|||
# This should be updated along with build_handwritten.yaml
|
||||
g_stands_for = "gnarly" # @unused
|
||||
|
||||
core_version = "41.0.0" # @unused
|
||||
core_version = "42.0.0" # @unused
|
||||
|
||||
version = "1.65.0-dev" # @unused
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ cmake_minimum_required(VERSION 3.13)
|
|||
|
||||
set(PACKAGE_NAME "grpc")
|
||||
set(PACKAGE_VERSION "1.65.0-dev")
|
||||
set(gRPC_CORE_VERSION "41.0.0")
|
||||
set(gRPC_CORE_SOVERSION "41")
|
||||
set(gRPC_CORE_VERSION "42.0.0")
|
||||
set(gRPC_CORE_SOVERSION "42")
|
||||
set(gRPC_CPP_VERSION "1.65.0-dev")
|
||||
set(gRPC_CPP_SOVERSION "1.65")
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ E = @echo
|
|||
Q = @
|
||||
endif
|
||||
|
||||
CORE_VERSION = 41.0.0
|
||||
CORE_VERSION = 42.0.0
|
||||
CPP_VERSION = 1.65.0-dev
|
||||
|
||||
CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
|
||||
|
|
@ -404,7 +404,7 @@ SHARED_EXT_CORE = dll
|
|||
SHARED_EXT_CPP = dll
|
||||
|
||||
SHARED_PREFIX =
|
||||
SHARED_VERSION_CORE = -41
|
||||
SHARED_VERSION_CORE = -42
|
||||
SHARED_VERSION_CPP = -1
|
||||
else ifeq ($(SYSTEM),Darwin)
|
||||
EXECUTABLE_SUFFIX =
|
||||
|
|
@ -1833,8 +1833,8 @@ $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_
|
|||
ifeq ($(SYSTEM),Darwin)
|
||||
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libcares.a $(OPENSSL_MERGE_LIBS) $(ZLIB_MERGE_LIBS) $(LDLIBS_SECURE) $(LDLIBS)
|
||||
else
|
||||
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.41 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libcares.a $(OPENSSL_MERGE_LIBS) $(ZLIB_MERGE_LIBS) $(LDLIBS_SECURE) $(LDLIBS)
|
||||
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.41
|
||||
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.42 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libcares.a $(OPENSSL_MERGE_LIBS) $(ZLIB_MERGE_LIBS) $(LDLIBS_SECURE) $(LDLIBS)
|
||||
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.42
|
||||
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so
|
||||
endif
|
||||
endif
|
||||
|
|
|
|||
12
WORKSPACE
12
WORKSPACE
|
|
@ -128,6 +128,12 @@ load("@com_github_google_benchmark//:bazel/benchmark_deps.bzl", "benchmark_deps"
|
|||
|
||||
benchmark_deps()
|
||||
|
||||
# This is a transitive dependency from google_cloud_cpp
|
||||
bind(
|
||||
name = "cares",
|
||||
actual = "@com_github_cares_cares//:ares",
|
||||
)
|
||||
|
||||
load("@io_opentelemetry_cpp//bazel:repository.bzl", "opentelemetry_cpp_deps")
|
||||
|
||||
opentelemetry_cpp_deps()
|
||||
|
|
@ -136,6 +142,12 @@ load("@io_opentelemetry_cpp//bazel:extra_deps.bzl", "opentelemetry_extra_deps")
|
|||
|
||||
opentelemetry_extra_deps()
|
||||
|
||||
# Transitive dependency of opentelemetry_extra_deps()
|
||||
bind(
|
||||
name = "madler_zlib",
|
||||
actual = "@zlib//:zlib",
|
||||
)
|
||||
|
||||
# TODO: Enable below once https://github.com/bazel-xcode/PodToBUILD/issues/232 is resolved
|
||||
#
|
||||
#http_archive(
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ EXPERIMENT_ENABLES = {
|
|||
"trace_record_callops": "trace_record_callops",
|
||||
"unconstrained_max_quota_buffer_size": "unconstrained_max_quota_buffer_size",
|
||||
"work_serializer_clears_time_cache": "work_serializer_clears_time_cache",
|
||||
"work_serializer_dispatch": "event_engine_client,work_serializer_dispatch",
|
||||
"work_serializer_dispatch": "work_serializer_dispatch",
|
||||
}
|
||||
|
||||
EXPERIMENT_POLLERS = [
|
||||
|
|
@ -55,16 +55,10 @@ EXPERIMENTS = {
|
|||
"dbg": {
|
||||
},
|
||||
"off": {
|
||||
"core_end2end_test": [
|
||||
"event_engine_client",
|
||||
],
|
||||
"endpoint_test": [
|
||||
"tcp_frame_size_tuning",
|
||||
"tcp_rcv_lowat",
|
||||
],
|
||||
"event_engine_client_test": [
|
||||
"event_engine_client",
|
||||
],
|
||||
"flow_control_test": [
|
||||
"multiping",
|
||||
"peer_state_based_framing",
|
||||
|
|
@ -82,11 +76,15 @@ EXPERIMENTS = {
|
|||
"event_engine_dns",
|
||||
],
|
||||
"core_end2end_test": [
|
||||
"event_engine_client",
|
||||
"event_engine_listener",
|
||||
],
|
||||
"cpp_lb_end2end_test": [
|
||||
"pick_first_new",
|
||||
],
|
||||
"event_engine_client_test": [
|
||||
"event_engine_client",
|
||||
],
|
||||
"event_engine_listener_test": [
|
||||
"event_engine_listener",
|
||||
],
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ def _get_external_deps(external_deps):
|
|||
elif dep == "cares":
|
||||
ret += select({
|
||||
"//:grpc_no_ares": [],
|
||||
"//conditions:default": ["//external:cares"],
|
||||
"//conditions:default": ["//third_party:cares"],
|
||||
})
|
||||
elif dep == "cronet_c_for_grpc":
|
||||
ret.append("//third_party/objective_c/Cronet:cronet_c_for_grpc")
|
||||
|
|
@ -84,7 +84,7 @@ def _get_external_deps(external_deps):
|
|||
elif dep == "libprotobuf_mutator":
|
||||
ret.append("@com_google_libprotobuf_mutator//:libprotobuf_mutator")
|
||||
else:
|
||||
ret.append("//external:" + dep)
|
||||
ret.append("//third_party:" + dep)
|
||||
return ret
|
||||
|
||||
def _update_visibility(visibility):
|
||||
|
|
|
|||
|
|
@ -14,167 +14,12 @@
|
|||
"""Load dependencies needed to compile and test the grpc library as a 3rd-party consumer."""
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps")
|
||||
load("//bazel:grpc_python_deps.bzl", "grpc_python_deps")
|
||||
|
||||
# buildifier: disable=unnamed-macro
|
||||
def grpc_deps():
|
||||
"""Loads dependencies need to compile and test the grpc library."""
|
||||
|
||||
native.bind(
|
||||
name = "libssl",
|
||||
actual = "@boringssl//:ssl",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "libcrypto",
|
||||
actual = "@boringssl//:crypto",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "madler_zlib",
|
||||
actual = "@zlib//:zlib",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "protobuf",
|
||||
actual = "@com_google_protobuf//:protobuf",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "protobuf_clib",
|
||||
actual = "@com_google_protobuf//:protoc_lib",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "protobuf_headers",
|
||||
actual = "@com_google_protobuf//:protobuf_headers",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "protocol_compiler",
|
||||
actual = "@com_google_protobuf//:protoc",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "cares",
|
||||
actual = "@com_github_cares_cares//:ares",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "gtest",
|
||||
actual = "@com_google_googletest//:gtest",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "fuzztest",
|
||||
actual = "@com_google_fuzztest//fuzztest",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "fuzztest_main",
|
||||
actual = "@com_google_fuzztest//fuzztest:fuzztest_gtest_main",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "benchmark",
|
||||
actual = "@com_github_google_benchmark//:benchmark",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "re2",
|
||||
actual = "@com_googlesource_code_re2//:re2",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "grpc_cpp_plugin",
|
||||
actual = "@com_github_grpc_grpc//src/compiler:grpc_cpp_plugin",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "grpc++_codegen_proto",
|
||||
actual = "@com_github_grpc_grpc//:grpc++_codegen_proto",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "opencensus-context",
|
||||
actual = "@io_opencensus_cpp//opencensus/context:context",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "opencensus-trace",
|
||||
actual = "@io_opencensus_cpp//opencensus/trace:trace",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "opencensus-trace-context_util",
|
||||
actual = "@io_opencensus_cpp//opencensus/trace:context_util",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "opencensus-trace-propagation",
|
||||
actual = "@io_opencensus_cpp//opencensus/trace:grpc_trace_bin",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "opencensus-trace-span_context",
|
||||
actual = "@io_opencensus_cpp//opencensus/trace:span_context",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "opencensus-stats",
|
||||
actual = "@io_opencensus_cpp//opencensus/stats:stats",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "opencensus-stats-test",
|
||||
actual = "@io_opencensus_cpp//opencensus/stats:test_utils",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "opencensus-with-tag-map",
|
||||
actual = "@io_opencensus_cpp//opencensus/tags:with_tag_map",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "opencensus-tags",
|
||||
actual = "@io_opencensus_cpp//opencensus/tags:tags",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "opencensus-tags-context_util",
|
||||
actual = "@io_opencensus_cpp//opencensus/tags:context_util",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "opencensus-trace-stackdriver_exporter",
|
||||
actual = "@io_opencensus_cpp//opencensus/exporters/trace/stackdriver:stackdriver_exporter",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "opencensus-stats-stackdriver_exporter",
|
||||
actual = "@io_opencensus_cpp//opencensus/exporters/stats/stackdriver:stackdriver_exporter",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "googleapis_trace_grpc_service",
|
||||
actual = "@com_google_googleapis//google/devtools/cloudtrace/v2:cloudtrace_cc_grpc",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "googleapis_monitoring_grpc_service",
|
||||
actual = "@com_google_googleapis//google/monitoring/v3:monitoring_cc_grpc",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "googleapis_logging_grpc_service",
|
||||
actual = "@com_google_googleapis//google/logging/v2:logging_cc_grpc",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "googleapis_logging_cc_proto",
|
||||
actual = "@com_google_googleapis//google/logging/v2:logging_cc_proto",
|
||||
)
|
||||
|
||||
if "platforms" not in native.existing_rules():
|
||||
http_archive(
|
||||
name = "platforms",
|
||||
|
|
@ -496,15 +341,6 @@ def grpc_test_only_deps():
|
|||
|
||||
Loads dependencies that are only needed to run grpc library's tests.
|
||||
"""
|
||||
native.bind(
|
||||
name = "twisted",
|
||||
actual = "@com_github_twisted_twisted//:twisted",
|
||||
)
|
||||
|
||||
native.bind(
|
||||
name = "yaml",
|
||||
actual = "@com_github_yaml_pyyaml//:yaml",
|
||||
)
|
||||
|
||||
if "com_github_twisted_twisted" not in native.existing_rules():
|
||||
http_archive(
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@
|
|||
# limitations under the License.
|
||||
|
||||
module GrpcBuildConfig
|
||||
CORE_WINDOWS_DLL = '/tmp/libs/opt/grpc-41.dll'
|
||||
CORE_WINDOWS_DLL = '/tmp/libs/opt/grpc-42.dll'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ settings:
|
|||
'#08': Use "-preN" suffixes to identify pre-release versions
|
||||
'#09': Per-language overrides are possible with (eg) ruby_version tag here
|
||||
'#10': See the expand_version.py for all the quirks here
|
||||
core_version: 41.0.0
|
||||
core_version: 42.0.0
|
||||
csharp_major_version: 2
|
||||
g_stands_for: gnarly
|
||||
protobuf_version: 3.26.1
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
# Copyright 2024 the gRPC authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
cc_library(
|
||||
name = "helper",
|
||||
srcs = ["helper.cc"],
|
||||
hdrs = ["helper.h"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "ssl_client",
|
||||
srcs = ["ssl_client.cc"],
|
||||
data = [
|
||||
"credentials/root.crt",
|
||||
],
|
||||
defines = ["BAZEL_BUILD"],
|
||||
deps = [
|
||||
":helper",
|
||||
"//:grpc++",
|
||||
"//examples/protos:helloworld_cc_grpc",
|
||||
"@com_google_absl//absl/flags:flag",
|
||||
"@com_google_absl//absl/flags:parse",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "ssl_server",
|
||||
srcs = ["ssl_server.cc"],
|
||||
data = [
|
||||
"credentials/localhost.crt",
|
||||
"credentials/localhost.key",
|
||||
],
|
||||
defines = ["BAZEL_BUILD"],
|
||||
deps = [
|
||||
":helper",
|
||||
"//:grpc++",
|
||||
"//examples/protos:helloworld_cc_grpc",
|
||||
"@com_google_absl//absl/flags:flag",
|
||||
"@com_google_absl//absl/flags:parse",
|
||||
],
|
||||
)
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
# Copyright 2024 the gRPC authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# cmake build file for C++ keyvaluestore example.
|
||||
# Assumes protobuf and gRPC have been installed using cmake.
|
||||
# See cmake_externalproject/CMakeLists.txt for all-in-one cmake build
|
||||
# that automatically builds all the dependencies before building keyvaluestore.
|
||||
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
project(Cancellation C CXX)
|
||||
|
||||
include(../cmake/common.cmake)
|
||||
|
||||
# Proto files
|
||||
get_filename_component(hw_proto "../../protos/helloworld.proto" ABSOLUTE)
|
||||
get_filename_component(hw_proto_path "${hw_proto}" PATH)
|
||||
|
||||
# Generated sources
|
||||
set(hw_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.cc")
|
||||
set(hw_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.h")
|
||||
set(hw_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.cc")
|
||||
set(hw_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.h")
|
||||
add_custom_command(
|
||||
OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}" "${hw_grpc_srcs}" "${hw_grpc_hdrs}"
|
||||
COMMAND ${_PROTOBUF_PROTOC}
|
||||
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
-I "${hw_proto_path}"
|
||||
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
|
||||
"${hw_proto}"
|
||||
DEPENDS "${hw_proto}")
|
||||
|
||||
# Include generated *.pb.h files
|
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
# hw_grpc_proto
|
||||
add_library(hw_grpc_proto
|
||||
${hw_grpc_srcs}
|
||||
${hw_grpc_hdrs}
|
||||
${hw_proto_srcs}
|
||||
${hw_proto_hdrs})
|
||||
target_link_libraries(hw_grpc_proto
|
||||
${_REFLECTION}
|
||||
${_GRPC_GRPCPP}
|
||||
${_PROTOBUF_LIBPROTOBUF})
|
||||
|
||||
# example helper
|
||||
add_library(helper
|
||||
"helper.h"
|
||||
"helper.cc")
|
||||
|
||||
# Targets greeter_(client|server)
|
||||
foreach(_target
|
||||
ssl_client ssl_server)
|
||||
add_executable(${_target} "${_target}.cc")
|
||||
target_link_libraries(${_target}
|
||||
helper
|
||||
hw_grpc_proto
|
||||
absl::flags
|
||||
absl::flags_parse
|
||||
absl::strings
|
||||
${_REFLECTION}
|
||||
${_GRPC_GRPCPP}
|
||||
${_PROTOBUF_LIBPROTOBUF})
|
||||
endforeach()
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
# Authentication Example
|
||||
|
||||
## Overview
|
||||
|
||||
SSL is a commonly used cryptographic protocol to provide end-to-end
|
||||
communication security. In the example, we show how to set up a server
|
||||
authenticated SSL connection to transmit RPC.
|
||||
|
||||
We provide `grpc::SslServerCredentials` and `grpc::SslCredentials` types
|
||||
to use SSL conections.
|
||||
|
||||
In our example, we use the public/private keys created ahead:
|
||||
* "localhost.crt" contains the server certificate (public key).
|
||||
* "localhost.key" contains the server private key.
|
||||
* "root.crt" contains the certificate (certificate authority)
|
||||
that can verify the server's certificate.
|
||||
|
||||
### Try it!
|
||||
|
||||
Once you have working gRPC, you can build this example using either bazel or cmake.
|
||||
Make sure to run those at this directory so that they can read credential files properly.
|
||||
|
||||
Run the server, which will listen on port 50051:
|
||||
|
||||
```sh
|
||||
$ ./ssl_server
|
||||
```
|
||||
|
||||
Run the client (in a different terminal):
|
||||
|
||||
```sh
|
||||
$ ./ssl_client
|
||||
```
|
||||
|
||||
If things go smoothly, you will see the client output:
|
||||
|
||||
```
|
||||
Greeter received: Hello world
|
||||
```
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIDFjCCAf4CCQCzrLIhrWa55zANBgkqhkiG9w0BAQsFADBCMQswCQYDVQQGEwJV
|
||||
UzETMBEGA1UECAwKQ2FsaWZvcm5pYTEPMA0GA1UECgwGR29vZ2xlMQ0wCwYDVQQL
|
||||
DARnUlBDMCAXDTE5MDYyNDIyMjIzM1oYDzIxMTkwNTMxMjIyMjMzWjBWMQswCQYD
|
||||
VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEPMA0GA1UECgwGR29vZ2xlMQ0w
|
||||
CwYDVQQLDARnUlBDMRIwEAYDVQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEB
|
||||
AQUAA4IBDwAwggEKAoIBAQCtCW0TjugnIUu8BEVIYvdMP+/2GENQDjZhZ8eKR5C6
|
||||
toDGbgjsDtt/GxISAg4cg70fIvy0XolnGPZodvfHDM4lJ7yHBOdZD8TXQoE6okR7
|
||||
HZuLUJ20M0pXgWqtRewKRUjuYsSDXBnzLiZw1dcv9nGpo+Bqa8NonpiGRRpEkshF
|
||||
D6T9KU9Ts/x+wMQBIra2Gj0UMh79jPhUuxcYAQA0JQGivnOtdwuPiumpnUT8j8h6
|
||||
tWg5l01EsCZWJecCF85KnGpJEVYPyPqBqGsy0nGS9plGotOWF87+jyUQt+KD63xA
|
||||
aBmTro86mKDDKEK4JvzjVeMGz2UbVcLPiiZnErTFaiXJAgMBAAEwDQYJKoZIhvcN
|
||||
AQELBQADggEBAKsDgOPCWp5WCy17vJbRlgfgk05sVNIHZtzrmdswjBmvSg8MUpep
|
||||
XqcPNUpsljAXsf9UM5IFEMRdilUsFGWvHjBEtNAW8WUK9UV18WRuU//0w1Mp5HAN
|
||||
xUEKb4BoyZr65vlCnTR+AR5c9FfPvLibhr5qHs2RA8Y3GyLOcGqBWed87jhdQLCc
|
||||
P1bxB+96le5JeXq0tw215lxonI2/3ZYVK4/ok9gwXrQoWm8YieJqitk/ZQ4S17/4
|
||||
pynHtDfdxLn23EXeGx+UTxJGfpRmhEZdJ+MN7QGYoomzx5qS5XoYKxRNrDlirJpr
|
||||
OqXIn8E1it+6d5gOZfuHawcNGhRLplE/pfA=
|
||||
-----END CERTIFICATE-----
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEogIBAAKCAQEArQltE47oJyFLvARFSGL3TD/v9hhDUA42YWfHikeQuraAxm4I
|
||||
7A7bfxsSEgIOHIO9HyL8tF6JZxj2aHb3xwzOJSe8hwTnWQ/E10KBOqJEex2bi1Cd
|
||||
tDNKV4FqrUXsCkVI7mLEg1wZ8y4mcNXXL/ZxqaPgamvDaJ6YhkUaRJLIRQ+k/SlP
|
||||
U7P8fsDEASK2tho9FDIe/Yz4VLsXGAEANCUBor5zrXcLj4rpqZ1E/I/IerVoOZdN
|
||||
RLAmViXnAhfOSpxqSRFWD8j6gahrMtJxkvaZRqLTlhfO/o8lELfig+t8QGgZk66P
|
||||
OpigwyhCuCb841XjBs9lG1XCz4omZxK0xWolyQIDAQABAoIBADeq/Kh6JT3RfGf0
|
||||
h8WN8TlaqHxnueAbcmtL0+oss+cdp7gu1jf7X6o4r0uT1a5ew40s2Fe+wj2kzkE1
|
||||
ZOlouTlC22gkr7j7Vbxa7PBMG/Pvxoa/XL0IczZLsGImSJXVTG1E4SvRiZeulTdf
|
||||
1GbdxhtpWV1jZe5Wd4Na3+SHxF5S7m3PrHiZlYdz1ND+8XZs1NlL9+ej72qSFul9
|
||||
t/QjMWJ9pky/Wad5abnRLRyOsg+BsgnXbkUy2rD89ZxFMLda9pzXo3TPyAlBHonr
|
||||
mkEsE4eRMWMpjBM79JbeyDdHn/cs/LjAZrzeDf7ugXr2CHQpKaM5O0PsNHezJII9
|
||||
L5kCfzECgYEA4M/rz1UP1/BJoSqigUlSs0tPAg8a5UlkVsh6Osuq72IPNo8qg/Fw
|
||||
oV/IiIS+q+obRcFj1Od3PGdTpCJwW5dzd2fXBQGmGdj0HucnCrs13RtBh91JiF5i
|
||||
y/YYI9KfgOG2ZT9gG68T0gTs6jRrS3Qd83npqjrkJqMOd7s00MK9tUcCgYEAxQq7
|
||||
T541oCYHSBRIIb0IrR25krZy9caxzCqPDwOcuuhaCqCiaq+ATvOWlSfgecm4eH0K
|
||||
PCH0xlWxG0auPEwm4pA8+/WR/XJwscPZMuoht1EoKy1his4eKx/s7hHNeO6KOF0V
|
||||
Y/zqIiuZnEwUoKbn7EqqNFSTT65PJKyGsICJFG8CgYAfaw9yl1myfQNdQb8aQGwN
|
||||
YJ33FLNWje427qeeZe5KrDKiFloDvI9YDjHRWnPnRL1w/zj7fSm9yFb5HlMDieP6
|
||||
MQnsyjEzdY2QcA+VwVoiv3dmDHgFVeOKy6bOAtaFxYWfGr9MvygO9t9BT/gawGyb
|
||||
JVORlc9i0vDnrMMR1dV7awKBgBpTWLtGc/u1mPt0Wj7HtsUKV6TWY32a0l5owTxM
|
||||
S0BdksogtBJ06DukJ9Y9wawD23WdnyRxlPZ6tHLkeprrwbY7dypioOKvy4a0l+xJ
|
||||
g7+uRCOgqIuXBkjUtx8HmeAyXp0xMo5tWArAsIFFWOwt4IadYygitJvMuh44PraO
|
||||
NcJZAoGADEiV0dheXUCVr8DrtSom8DQMj92/G/FIYjXL8OUhh0+F+YlYP0+F8PEU
|
||||
yYIWEqL/S5tVKYshimUXQa537JcRKsTVJBG/ZKD2kuqgOc72zQy3oplimXeJDCXY
|
||||
h2eAQ0u8GN6tN9C4t8Kp4a3y6FGsxgu+UTxdnL3YQ+yHAVhtCzo=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIDWTCCAkGgAwIBAgIJAPOConZMwykwMA0GCSqGSIb3DQEBCwUAMEIxCzAJBgNV
|
||||
BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMQ8wDQYDVQQKDAZHb29nbGUxDTAL
|
||||
BgNVBAsMBGdSUEMwIBcNMTkwNjI0MjIyMDA3WhgPMjExOTA1MzEyMjIwMDdaMEIx
|
||||
CzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMQ8wDQYDVQQKDAZHb29n
|
||||
bGUxDTALBgNVBAsMBGdSUEMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
|
||||
AQCwqei3TfyLidnQNDJ2lierMYo229K92DuORni7nSjJQ59Jc3dNMsmqGQJjCD8o
|
||||
6mTlKM/oCbs27Wpx+OxcOLvT95j2kiDGca1fCvaMdguIod09SWiyMpv/hp0trLv7
|
||||
NJIKHznath6rHYX2Ii3fZ1yCPzyQbEPSAA+GNpoNm1v1ZWmWKke9v7vLlS3inNlW
|
||||
Mt9jepK7DrtbNZnVDjeItnppBSbVYRMxIyNHkepFbqXx5TpkCvl4M4XQZw9bfSxQ
|
||||
i3WZ3q+T1Tw//OUdPNc+OfMhu0MA0QoMwikskP0NaIC3dbJZ5Ogx0RcnaB4E+9C6
|
||||
O/znUEh3WuKVl5HXBF+UwWoFAgMBAAGjUDBOMB0GA1UdDgQWBBRm3JIgzgK4G97J
|
||||
fbMGatWMZc7V3jAfBgNVHSMEGDAWgBRm3JIgzgK4G97JfbMGatWMZc7V3jAMBgNV
|
||||
HRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCNiV8x41if094ry2srS0YucpiN
|
||||
3rTPk08FOLsENTMYai524TGXJti1P6ofGr5KXCL0uxTByHE3fEiMMud2TIY5iHQo
|
||||
Y4mzDTTcb+Q7yKHwYZMlcp6nO8W+NeY5t+S0JPHhb8deKWepcN2UpXBUYQLw7AiE
|
||||
l96T9Gi+vC9h/XE5IVwHFQXTxf5UYzXtW1nfapvrOONg/ms41dgmrRKIi+knWfiJ
|
||||
FdHpHX2sfDAoJtnpEISX+nxRGNVTLY64utXWm4yxaZJshvy2s8zWJgRg7rtwAhTT
|
||||
Np9E9MnihXLEmDI4Co9XlLPJyZFmqImsbmVuKFeQOCiLAoPJaMI2lbi7fiTo
|
||||
-----END CERTIFICATE-----
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2024 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "helper.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
std::string LoadStringFromFile(std::string path) {
|
||||
std::ifstream file(path);
|
||||
if (!file.is_open()) {
|
||||
std::cout << "Failed to open " << path << std::endl;
|
||||
abort();
|
||||
}
|
||||
std::stringstream sstr;
|
||||
sstr << file.rdbuf();
|
||||
return sstr.str();
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2024 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_EXAMPLES_CPP_AUTH_HELPER_H_
|
||||
#define GRPC_EXAMPLES_CPP_AUTH_HELPER_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
std::string LoadStringFromFile(std::string path);
|
||||
|
||||
#endif // GRPC_EXAMPLES_CPP_AUTH_HELPER_H_
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2024 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <condition_variable>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#include "absl/flags/flag.h"
|
||||
#include "absl/flags/parse.h"
|
||||
#include "helper.h"
|
||||
|
||||
#include <grpcpp/grpcpp.h>
|
||||
|
||||
#ifdef BAZEL_BUILD
|
||||
#include "examples/protos/helloworld.grpc.pb.h"
|
||||
#else
|
||||
#include "helloworld.grpc.pb.h"
|
||||
#endif
|
||||
|
||||
ABSL_FLAG(uint16_t, port, 50051, "Server port for the service");
|
||||
|
||||
using grpc::Channel;
|
||||
using grpc::ClientContext;
|
||||
using grpc::Status;
|
||||
using helloworld::Greeter;
|
||||
using helloworld::HelloReply;
|
||||
using helloworld::HelloRequest;
|
||||
|
||||
class GreeterClient {
|
||||
public:
|
||||
GreeterClient(std::shared_ptr<Channel> channel)
|
||||
: stub_(Greeter::NewStub(channel)) {}
|
||||
|
||||
// Assembles the client's payload, sends it and presents the response back
|
||||
// from the server.
|
||||
std::string SayHello(const std::string& user) {
|
||||
// Data we are sending to the server.
|
||||
HelloRequest request;
|
||||
request.set_name(user);
|
||||
|
||||
// Container for the data we expect from the server.
|
||||
HelloReply reply;
|
||||
|
||||
// Context for the client. It could be used to convey extra information to
|
||||
// the server and/or tweak certain RPC behaviors.
|
||||
ClientContext context;
|
||||
|
||||
// The actual RPC.
|
||||
std::mutex mu;
|
||||
std::condition_variable cv;
|
||||
bool done = false;
|
||||
Status status;
|
||||
stub_->async()->SayHello(&context, &request, &reply,
|
||||
[&mu, &cv, &done, &status](Status s) {
|
||||
status = std::move(s);
|
||||
std::lock_guard<std::mutex> lock(mu);
|
||||
done = true;
|
||||
cv.notify_one();
|
||||
});
|
||||
|
||||
std::unique_lock<std::mutex> lock(mu);
|
||||
while (!done) {
|
||||
cv.wait(lock);
|
||||
}
|
||||
|
||||
// Act upon its status.
|
||||
if (status.ok()) {
|
||||
return reply.message();
|
||||
} else {
|
||||
std::cout << status.error_code() << ": " << status.error_message()
|
||||
<< std::endl;
|
||||
return "RPC failed";
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<Greeter::Stub> stub_;
|
||||
};
|
||||
|
||||
#ifdef BAZEL_BUILD
|
||||
constexpr char kRootCertificate[] = "examples/cpp/auth/credentials/root.crt";
|
||||
#else
|
||||
constexpr char kRootCertificate[] = "credentials/root.crt";
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
// Instantiate the client. It requires a channel, out of which the actual RPCs
|
||||
// are created. This channel models a connection to an endpoint specified by
|
||||
// the argument "--target=" which is the only expected argument.
|
||||
std::string target_str =
|
||||
absl::StrFormat("localhost:%d", absl::GetFlag(FLAGS_port));
|
||||
// Build a SSL options for the channel
|
||||
grpc::SslCredentialsOptions ssl_options;
|
||||
ssl_options.pem_root_certs = LoadStringFromFile(kRootCertificate);
|
||||
// Create a channel with SSL credentials
|
||||
GreeterClient greeter(
|
||||
grpc::CreateChannel(target_str, grpc::SslCredentials(ssl_options)));
|
||||
std::string user("world");
|
||||
std::string reply = greeter.SayHello(user);
|
||||
std::cout << "Greeter received: " << reply << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
// Copyright 2024 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/flags/flag.h"
|
||||
#include "absl/flags/parse.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "helper.h"
|
||||
|
||||
#include <grpcpp/grpcpp.h>
|
||||
|
||||
#ifdef BAZEL_BUILD
|
||||
#include "examples/protos/helloworld.grpc.pb.h"
|
||||
#else
|
||||
#include "helloworld.grpc.pb.h"
|
||||
#endif
|
||||
|
||||
ABSL_FLAG(uint16_t, port, 50051, "Server port for the service");
|
||||
|
||||
using grpc::CallbackServerContext;
|
||||
using grpc::Server;
|
||||
using grpc::ServerBuilder;
|
||||
using grpc::ServerUnaryReactor;
|
||||
using grpc::Status;
|
||||
using helloworld::Greeter;
|
||||
using helloworld::HelloReply;
|
||||
using helloworld::HelloRequest;
|
||||
|
||||
// Logic and data behind the server's behavior.
|
||||
class GreeterServiceImpl final : public Greeter::CallbackService {
|
||||
ServerUnaryReactor* SayHello(CallbackServerContext* context,
|
||||
const HelloRequest* request,
|
||||
HelloReply* reply) override {
|
||||
std::string prefix("Hello ");
|
||||
reply->set_message(prefix + request->name());
|
||||
|
||||
ServerUnaryReactor* reactor = context->DefaultReactor();
|
||||
reactor->Finish(Status::OK);
|
||||
return reactor;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef BAZEL_BUILD
|
||||
constexpr char kServerCertPath[] =
|
||||
"examples/cpp/auth/credentials/localhost.crt";
|
||||
constexpr char kServerKeyPath[] = "examples/cpp/auth/credentials/localhost.key";
|
||||
#else
|
||||
constexpr char kServerCertPath[] = "credentials/localhost.crt";
|
||||
constexpr char kServerKeyPath[] = "credentials/localhost.key";
|
||||
#endif
|
||||
|
||||
void RunServer(uint16_t port) {
|
||||
std::string server_address = absl::StrFormat("0.0.0.0:%d", port);
|
||||
GreeterServiceImpl service;
|
||||
ServerBuilder builder;
|
||||
// Load SSL credentials and build a SSL credential options
|
||||
grpc::SslServerCredentialsOptions::PemKeyCertPair key_cert_pair = {
|
||||
LoadStringFromFile(kServerKeyPath), LoadStringFromFile(kServerCertPath)};
|
||||
grpc::SslServerCredentialsOptions ssl_options;
|
||||
ssl_options.pem_key_cert_pairs.emplace_back(key_cert_pair);
|
||||
// Listen on the given address with SSL credentials
|
||||
builder.AddListeningPort(server_address,
|
||||
grpc::SslServerCredentials(ssl_options));
|
||||
// Register "service" as the instance through which we'll communicate with
|
||||
// clients. In this case it corresponds to an *synchronous* service.
|
||||
builder.RegisterService(&service);
|
||||
// Finally assemble the server.
|
||||
std::unique_ptr<Server> server(builder.BuildAndStart());
|
||||
std::cout << "Server listening on " << server_address << std::endl;
|
||||
|
||||
// Wait for the server to shutdown. Note that some other thread must be
|
||||
// responsible for shutting down the server for this call to ever return.
|
||||
server->Wait();
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
RunServer(absl::GetFlag(FLAGS_port));
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -27,10 +27,10 @@ objc_grpc_library(
|
|||
deps = ["//examples/protos:helloworld_proto"],
|
||||
)
|
||||
|
||||
# This one works with import "external/com_github_grpc_grpc/examples/protos/Keyvaluestore.pbrpc.h"
|
||||
# This one works with import "third_party/com_github_grpc_grpc/examples/protos/Keyvaluestore.pbrpc.h"
|
||||
objc_grpc_library(
|
||||
name = "Keyvaluestore_grpc_proto_external",
|
||||
srcs = ["//external/com_github_grpc_grpc/examples/protos:keyvaluestore.proto"],
|
||||
srcs = ["//third_party/com_github_grpc_grpc/examples/protos:keyvaluestore.proto"],
|
||||
tags = ["manual"],
|
||||
deps = ["@com_github_grpc_grpc//examples/protos:keyvaluestore_proto"],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -88,6 +88,18 @@ GPRAPI void gpr_set_log_function(gpr_log_func func);
|
|||
GPRAPI void gpr_assertion_failed(const char* filename, int line,
|
||||
const char* message) GPR_ATTRIBUTE_NORETURN;
|
||||
|
||||
/** abort() the process if x is zero, having written a line to the log.
|
||||
|
||||
Intended for internal invariants. If the error can be recovered from,
|
||||
without the possibility of corruption, or might best be reflected via
|
||||
an exception in a higher-level language, consider returning error code. */
|
||||
#define GPR_ASSERT(x) \
|
||||
do { \
|
||||
if (GPR_UNLIKELY(!(x))) { \
|
||||
gpr_assertion_failed(__FILE__, __LINE__, #x); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4870,6 +4870,7 @@ grpc_cc_library(
|
|||
"absl/container:inlined_vector",
|
||||
"absl/functional:function_ref",
|
||||
"absl/log:check",
|
||||
"absl/log:globals",
|
||||
"absl/log:log",
|
||||
"absl/status",
|
||||
"absl/status:statusor",
|
||||
|
|
|
|||
|
|
@ -52,7 +52,9 @@ class ChaoticGoodTransport : public RefCounted<ChaoticGoodTransport> {
|
|||
}
|
||||
|
||||
auto WriteFrame(const FrameInterface& frame) {
|
||||
auto buffers = frame.Serialize(&encoder_);
|
||||
bool saw_encoding_errors = false;
|
||||
auto buffers = frame.Serialize(&encoder_, saw_encoding_errors);
|
||||
// ignore encoding errors: they will be logged separately already
|
||||
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
|
||||
gpr_log(GPR_INFO, "CHAOTIC_GOOD: WriteFrame to:%s %s",
|
||||
ResolvedAddressToString(control_endpoint_.GetPeerAddress())
|
||||
|
|
|
|||
|
|
@ -114,7 +114,10 @@ auto ChaoticGoodConnector::DataEndpointWriteSettingsFrame(
|
|||
frame.headers = SettingsMetadata{SettingsMetadata::ConnectionType::kData,
|
||||
self->connection_id_, kDataAlignmentBytes}
|
||||
.ToMetadataBatch();
|
||||
auto write_buffer = frame.Serialize(&self->hpack_compressor_);
|
||||
bool saw_encoding_errors = false;
|
||||
auto write_buffer =
|
||||
frame.Serialize(&self->hpack_compressor_, saw_encoding_errors);
|
||||
// ignore encoding errors: they will be logged separately already
|
||||
return self->data_endpoint_.Write(std::move(write_buffer.control));
|
||||
}
|
||||
|
||||
|
|
@ -215,7 +218,10 @@ auto ChaoticGoodConnector::ControlEndpointWriteSettingsFrame(
|
|||
frame.headers = SettingsMetadata{SettingsMetadata::ConnectionType::kControl,
|
||||
absl::nullopt, absl::nullopt}
|
||||
.ToMetadataBatch();
|
||||
auto write_buffer = frame.Serialize(&self->hpack_compressor_);
|
||||
bool saw_encoding_errors = false;
|
||||
auto write_buffer =
|
||||
frame.Serialize(&self->hpack_compressor_, saw_encoding_errors);
|
||||
// ignore encoding errors: they will be logged separately already
|
||||
return self->control_endpoint_.Write(std::move(write_buffer.control));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -218,10 +218,12 @@ absl::Status SettingsFrame::Deserialize(HPackParser* parser,
|
|||
return deserializer.Finish();
|
||||
}
|
||||
|
||||
BufferPair SettingsFrame::Serialize(HPackCompressor* encoder) const {
|
||||
BufferPair SettingsFrame::Serialize(HPackCompressor* encoder,
|
||||
bool& saw_encoding_errors) const {
|
||||
FrameSerializer serializer(FrameType::kSettings, 0);
|
||||
if (headers.get() != nullptr) {
|
||||
encoder->EncodeRawHeaders(*headers.get(), serializer.AddHeaders());
|
||||
saw_encoding_errors |=
|
||||
!encoder->EncodeRawHeaders(*headers.get(), serializer.AddHeaders());
|
||||
}
|
||||
return serializer.Finish();
|
||||
}
|
||||
|
|
@ -275,11 +277,13 @@ absl::Status ClientFragmentFrame::Deserialize(HPackParser* parser,
|
|||
return deserializer.Finish();
|
||||
}
|
||||
|
||||
BufferPair ClientFragmentFrame::Serialize(HPackCompressor* encoder) const {
|
||||
BufferPair ClientFragmentFrame::Serialize(HPackCompressor* encoder,
|
||||
bool& saw_encoding_errors) const {
|
||||
CHECK_NE(stream_id, 0u);
|
||||
FrameSerializer serializer(FrameType::kFragment, stream_id);
|
||||
if (headers.get() != nullptr) {
|
||||
encoder->EncodeRawHeaders(*headers.get(), serializer.AddHeaders());
|
||||
saw_encoding_errors |=
|
||||
!encoder->EncodeRawHeaders(*headers.get(), serializer.AddHeaders());
|
||||
}
|
||||
if (message.has_value()) {
|
||||
serializer.AddMessage(message.value());
|
||||
|
|
@ -354,17 +358,20 @@ absl::Status ServerFragmentFrame::Deserialize(HPackParser* parser,
|
|||
return deserializer.Finish();
|
||||
}
|
||||
|
||||
BufferPair ServerFragmentFrame::Serialize(HPackCompressor* encoder) const {
|
||||
BufferPair ServerFragmentFrame::Serialize(HPackCompressor* encoder,
|
||||
bool& saw_encoding_errors) const {
|
||||
CHECK_NE(stream_id, 0u);
|
||||
FrameSerializer serializer(FrameType::kFragment, stream_id);
|
||||
if (headers.get() != nullptr) {
|
||||
encoder->EncodeRawHeaders(*headers.get(), serializer.AddHeaders());
|
||||
saw_encoding_errors |=
|
||||
!encoder->EncodeRawHeaders(*headers.get(), serializer.AddHeaders());
|
||||
}
|
||||
if (message.has_value()) {
|
||||
serializer.AddMessage(message.value());
|
||||
}
|
||||
if (trailers.get() != nullptr) {
|
||||
encoder->EncodeRawHeaders(*trailers.get(), serializer.AddTrailers());
|
||||
saw_encoding_errors |=
|
||||
!encoder->EncodeRawHeaders(*trailers.get(), serializer.AddTrailers());
|
||||
}
|
||||
return serializer.Finish();
|
||||
}
|
||||
|
|
@ -399,7 +406,7 @@ absl::Status CancelFrame::Deserialize(HPackParser*, const FrameHeader& header,
|
|||
return deserializer.Finish();
|
||||
}
|
||||
|
||||
BufferPair CancelFrame::Serialize(HPackCompressor*) const {
|
||||
BufferPair CancelFrame::Serialize(HPackCompressor*, bool&) const {
|
||||
CHECK_NE(stream_id, 0u);
|
||||
FrameSerializer serializer(FrameType::kCancel, stream_id);
|
||||
return serializer.Finish();
|
||||
|
|
|
|||
|
|
@ -55,9 +55,15 @@ class FrameInterface {
|
|||
const FrameHeader& header,
|
||||
absl::BitGenRef bitsrc, Arena* arena,
|
||||
BufferPair buffers, FrameLimits limits) = 0;
|
||||
virtual BufferPair Serialize(HPackCompressor* encoder) const = 0;
|
||||
virtual BufferPair Serialize(HPackCompressor* encoder,
|
||||
bool& saw_encoding_errors) const = 0;
|
||||
virtual std::string ToString() const = 0;
|
||||
|
||||
template <typename Sink>
|
||||
friend void AbslStringify(Sink& sink, const FrameInterface& frame) {
|
||||
sink.Append(frame.ToString());
|
||||
}
|
||||
|
||||
protected:
|
||||
static bool EqVal(const grpc_metadata_batch& a,
|
||||
const grpc_metadata_batch& b) {
|
||||
|
|
@ -72,11 +78,16 @@ class FrameInterface {
|
|||
~FrameInterface() = default;
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, const FrameInterface& frame) {
|
||||
return os << frame.ToString();
|
||||
}
|
||||
|
||||
struct SettingsFrame final : public FrameInterface {
|
||||
absl::Status Deserialize(HPackParser* parser, const FrameHeader& header,
|
||||
absl::BitGenRef bitsrc, Arena* arena,
|
||||
BufferPair buffers, FrameLimits limits) override;
|
||||
BufferPair Serialize(HPackCompressor* encoder) const override;
|
||||
BufferPair Serialize(HPackCompressor* encoder,
|
||||
bool& saw_encoding_errors) const override;
|
||||
ClientMetadataHandle headers;
|
||||
std::string ToString() const override;
|
||||
|
||||
|
|
@ -110,7 +121,8 @@ struct ClientFragmentFrame final : public FrameInterface {
|
|||
absl::Status Deserialize(HPackParser* parser, const FrameHeader& header,
|
||||
absl::BitGenRef bitsrc, Arena* arena,
|
||||
BufferPair buffers, FrameLimits limits) override;
|
||||
BufferPair Serialize(HPackCompressor* encoder) const override;
|
||||
BufferPair Serialize(HPackCompressor* encoder,
|
||||
bool& saw_encoding_errors) const override;
|
||||
std::string ToString() const override;
|
||||
|
||||
uint32_t stream_id;
|
||||
|
|
@ -128,7 +140,8 @@ struct ServerFragmentFrame final : public FrameInterface {
|
|||
absl::Status Deserialize(HPackParser* parser, const FrameHeader& header,
|
||||
absl::BitGenRef bitsrc, Arena* arena,
|
||||
BufferPair buffers, FrameLimits limits) override;
|
||||
BufferPair Serialize(HPackCompressor* encoder) const override;
|
||||
BufferPair Serialize(HPackCompressor* encoder,
|
||||
bool& saw_encoding_errors) const override;
|
||||
std::string ToString() const override;
|
||||
|
||||
uint32_t stream_id;
|
||||
|
|
@ -146,7 +159,8 @@ struct CancelFrame final : public FrameInterface {
|
|||
absl::Status Deserialize(HPackParser* parser, const FrameHeader& header,
|
||||
absl::BitGenRef bitsrc, Arena* arena,
|
||||
BufferPair buffers, FrameLimits limits) override;
|
||||
BufferPair Serialize(HPackCompressor* encoder) const override;
|
||||
BufferPair Serialize(HPackCompressor* encoder,
|
||||
bool& saw_encoding_errors) const override;
|
||||
std::string ToString() const override;
|
||||
|
||||
uint32_t stream_id;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,19 @@ enum class FrameType : uint8_t {
|
|||
kCancel = 0x81,
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& out, FrameType type) {
|
||||
switch (type) {
|
||||
case FrameType::kSettings:
|
||||
return out << "Settings";
|
||||
case FrameType::kFragment:
|
||||
return out << "Fragment";
|
||||
case FrameType::kCancel:
|
||||
return out << "Cancel";
|
||||
default:
|
||||
return out << "Unknown[" << static_cast<int>(type) << "]";
|
||||
}
|
||||
}
|
||||
|
||||
struct FrameHeader {
|
||||
FrameType type = FrameType::kCancel;
|
||||
BitSet<3> flags;
|
||||
|
|
|
|||
|
|
@ -336,7 +336,10 @@ auto ChaoticGoodServerListener::ActiveConnection::HandshakingState::
|
|||
SettingsMetadata{absl::nullopt, self->connection_->connection_id_,
|
||||
absl::nullopt}
|
||||
.ToMetadataBatch();
|
||||
auto write_buffer = frame.Serialize(&self->connection_->hpack_compressor_);
|
||||
bool saw_encoding_errors = false;
|
||||
auto write_buffer = frame.Serialize(&self->connection_->hpack_compressor_,
|
||||
saw_encoding_errors);
|
||||
// ignore encoding errors: they will be logged separately already
|
||||
return TrySeq(
|
||||
self->connection_->endpoint_.Write(std::move(write_buffer.control)),
|
||||
WaitForDataEndpointSetup(self));
|
||||
|
|
@ -350,7 +353,10 @@ auto ChaoticGoodServerListener::ActiveConnection::HandshakingState::
|
|||
SettingsMetadata{absl::nullopt, self->connection_->connection_id_,
|
||||
self->connection_->data_alignment_}
|
||||
.ToMetadataBatch();
|
||||
auto write_buffer = frame.Serialize(&self->connection_->hpack_compressor_);
|
||||
bool saw_encoding_errors = false;
|
||||
auto write_buffer = frame.Serialize(&self->connection_->hpack_compressor_,
|
||||
saw_encoding_errors);
|
||||
// ignore encoding errors: they will be logged separately already
|
||||
return TrySeq(
|
||||
self->connection_->endpoint_.Write(std::move(write_buffer.control)),
|
||||
[self]() mutable {
|
||||
|
|
|
|||
|
|
@ -377,7 +377,8 @@ void Compressor<HttpSchemeMetadata, HttpSchemeCompressor>::EncodeWith(
|
|||
encoder->EmitIndexed(7); // :scheme: https
|
||||
break;
|
||||
case HttpSchemeMetadata::ValueType::kInvalid:
|
||||
Crash("invalid http scheme encoding");
|
||||
LOG(ERROR) << "Not encoding bad http scheme";
|
||||
encoder->NoteEncodingError();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -434,7 +435,8 @@ void Compressor<HttpMethodMetadata, HttpMethodCompressor>::EncodeWith(
|
|||
Slice::FromStaticString(":method"), Slice::FromStaticString("PUT"));
|
||||
break;
|
||||
case HttpMethodMetadata::ValueType::kInvalid:
|
||||
Crash("invalid http method encoding");
|
||||
LOG(ERROR) << "Not encoding bad http method";
|
||||
encoder->NoteEncodingError();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,10 +82,14 @@ class Encoder {
|
|||
const Slice& slice, uint32_t* index,
|
||||
size_t max_compression_size);
|
||||
|
||||
void NoteEncodingError() { saw_encoding_errors_ = true; }
|
||||
bool saw_encoding_errors() const { return saw_encoding_errors_; }
|
||||
|
||||
HPackEncoderTable& hpack_table();
|
||||
|
||||
private:
|
||||
const bool use_true_binary_metadata_;
|
||||
bool saw_encoding_errors_ = false;
|
||||
HPackCompressor* const compressor_;
|
||||
SliceBuffer& output_;
|
||||
};
|
||||
|
|
@ -207,6 +211,7 @@ class Compressor<
|
|||
gpr_log(GPR_ERROR, "%s",
|
||||
absl::StrCat("Not encoding bad ", MetadataTrait::key(), " header")
|
||||
.c_str());
|
||||
encoder->NoteEncodingError();
|
||||
return;
|
||||
}
|
||||
Slice encoded(MetadataTrait::Encode(known_value));
|
||||
|
|
@ -354,19 +359,21 @@ class HPackCompressor {
|
|||
};
|
||||
|
||||
template <typename HeaderSet>
|
||||
void EncodeHeaders(const EncodeHeaderOptions& options,
|
||||
bool EncodeHeaders(const EncodeHeaderOptions& options,
|
||||
const HeaderSet& headers, grpc_slice_buffer* output) {
|
||||
SliceBuffer raw;
|
||||
hpack_encoder_detail::Encoder encoder(
|
||||
this, options.use_true_binary_metadata, raw);
|
||||
headers.Encode(&encoder);
|
||||
Frame(options, raw, output);
|
||||
return !encoder.saw_encoding_errors();
|
||||
}
|
||||
|
||||
template <typename HeaderSet>
|
||||
void EncodeRawHeaders(const HeaderSet& headers, SliceBuffer& output) {
|
||||
bool EncodeRawHeaders(const HeaderSet& headers, SliceBuffer& output) {
|
||||
hpack_encoder_detail::Encoder encoder(this, true, output);
|
||||
headers.Encode(&encoder);
|
||||
return !encoder.saw_encoding_errors();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
#include "src/core/lib/experiments/experiments.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#ifndef GRPC_EXPERIMENTS_ARE_FINAL
|
||||
|
|
@ -114,8 +112,6 @@ const char* const description_work_serializer_dispatch =
|
|||
"callback, instead of running things inline in the first thread that "
|
||||
"successfully enqueues work.";
|
||||
const char* const additional_constraints_work_serializer_dispatch = "{}";
|
||||
const uint8_t required_experiments_work_serializer_dispatch[] = {
|
||||
static_cast<uint8_t>(grpc_core::kExperimentIdEventEngineClient)};
|
||||
} // namespace
|
||||
|
||||
namespace grpc_core {
|
||||
|
|
@ -181,8 +177,7 @@ const ExperimentMetadata g_experiment_metadata[] = {
|
|||
additional_constraints_work_serializer_clears_time_cache, nullptr, 0, true,
|
||||
true},
|
||||
{"work_serializer_dispatch", description_work_serializer_dispatch,
|
||||
additional_constraints_work_serializer_dispatch,
|
||||
required_experiments_work_serializer_dispatch, 1, false, true},
|
||||
additional_constraints_work_serializer_dispatch, nullptr, 0, false, true},
|
||||
};
|
||||
|
||||
} // namespace grpc_core
|
||||
|
|
@ -279,8 +274,6 @@ const char* const description_work_serializer_dispatch =
|
|||
"callback, instead of running things inline in the first thread that "
|
||||
"successfully enqueues work.";
|
||||
const char* const additional_constraints_work_serializer_dispatch = "{}";
|
||||
const uint8_t required_experiments_work_serializer_dispatch[] = {
|
||||
static_cast<uint8_t>(grpc_core::kExperimentIdEventEngineClient)};
|
||||
} // namespace
|
||||
|
||||
namespace grpc_core {
|
||||
|
|
@ -295,7 +288,7 @@ const ExperimentMetadata g_experiment_metadata[] = {
|
|||
{"client_privacy", description_client_privacy,
|
||||
additional_constraints_client_privacy, nullptr, 0, false, false},
|
||||
{"event_engine_client", description_event_engine_client,
|
||||
additional_constraints_event_engine_client, nullptr, 0, false, true},
|
||||
additional_constraints_event_engine_client, nullptr, 0, true, true},
|
||||
{"event_engine_dns", description_event_engine_dns,
|
||||
additional_constraints_event_engine_dns, nullptr, 0, true, false},
|
||||
{"event_engine_listener", description_event_engine_listener,
|
||||
|
|
@ -346,8 +339,7 @@ const ExperimentMetadata g_experiment_metadata[] = {
|
|||
additional_constraints_work_serializer_clears_time_cache, nullptr, 0, true,
|
||||
true},
|
||||
{"work_serializer_dispatch", description_work_serializer_dispatch,
|
||||
additional_constraints_work_serializer_dispatch,
|
||||
required_experiments_work_serializer_dispatch, 1, false, true},
|
||||
additional_constraints_work_serializer_dispatch, nullptr, 0, false, true},
|
||||
};
|
||||
|
||||
} // namespace grpc_core
|
||||
|
|
@ -444,8 +436,6 @@ const char* const description_work_serializer_dispatch =
|
|||
"callback, instead of running things inline in the first thread that "
|
||||
"successfully enqueues work.";
|
||||
const char* const additional_constraints_work_serializer_dispatch = "{}";
|
||||
const uint8_t required_experiments_work_serializer_dispatch[] = {
|
||||
static_cast<uint8_t>(grpc_core::kExperimentIdEventEngineClient)};
|
||||
} // namespace
|
||||
|
||||
namespace grpc_core {
|
||||
|
|
@ -511,8 +501,7 @@ const ExperimentMetadata g_experiment_metadata[] = {
|
|||
additional_constraints_work_serializer_clears_time_cache, nullptr, 0, true,
|
||||
true},
|
||||
{"work_serializer_dispatch", description_work_serializer_dispatch,
|
||||
additional_constraints_work_serializer_dispatch,
|
||||
required_experiments_work_serializer_dispatch, 1, true, true},
|
||||
additional_constraints_work_serializer_dispatch, nullptr, 0, true, true},
|
||||
};
|
||||
|
||||
} // namespace grpc_core
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@ inline bool IsWorkSerializerDispatchEnabled() { return false; }
|
|||
inline bool IsCallStatusOverrideOnCancellationEnabled() { return true; }
|
||||
inline bool IsCanaryClientPrivacyEnabled() { return false; }
|
||||
inline bool IsClientPrivacyEnabled() { return false; }
|
||||
inline bool IsEventEngineClientEnabled() { return false; }
|
||||
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_CLIENT
|
||||
inline bool IsEventEngineClientEnabled() { return true; }
|
||||
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_DNS
|
||||
inline bool IsEventEngineDnsEnabled() { return true; }
|
||||
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_LISTENER
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
# not tested on iOS at all
|
||||
ios: broken
|
||||
posix: false
|
||||
windows: false
|
||||
windows: true
|
||||
- name: event_engine_dns
|
||||
default:
|
||||
# not tested on iOS at all
|
||||
|
|
@ -111,7 +111,6 @@
|
|||
- name: work_serializer_clears_time_cache
|
||||
default: true
|
||||
- name: work_serializer_dispatch
|
||||
requires: ["event_engine_client"]
|
||||
default:
|
||||
# TODO(ysseung): Not fully tested.
|
||||
ios: broken
|
||||
|
|
|
|||
|
|
@ -22,6 +22,6 @@
|
|||
#include <grpc/grpc.h>
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
const char* grpc_version_string(void) { return "41.0.0"; }
|
||||
const char* grpc_version_string(void) { return "42.0.0"; }
|
||||
|
||||
const char* grpc_g_stands_for(void) { return "gnarly"; }
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@
|
|||
#include "absl/container/inlined_vector.h"
|
||||
#include "absl/functional/function_ref.h"
|
||||
#include "absl/log/check.h"
|
||||
#include "absl/log/globals.h"
|
||||
#include "absl/log/log.h"
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/status/statusor.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
|
|
@ -1162,13 +1164,12 @@ void GrpcLb::BalancerCallState::OnBalancerMessageReceivedLocked() {
|
|||
upb::Arena arena;
|
||||
if (!GrpcLbResponseParse(response_slice, arena.ptr(), &response) ||
|
||||
(response.type == response.INITIAL && seen_initial_response_)) {
|
||||
if (gpr_should_log(GPR_LOG_SEVERITY_ERROR)) {
|
||||
if (absl::MinLogLevel() <= absl::LogSeverityAtLeast::kError) {
|
||||
char* response_slice_str =
|
||||
grpc_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX);
|
||||
gpr_log(GPR_ERROR,
|
||||
"[grpclb %p] lb_calld=%p: Invalid LB response received: '%s'. "
|
||||
"Ignoring.",
|
||||
grpclb_policy(), this, response_slice_str);
|
||||
LOG(ERROR) << "[grpclb " << grpclb_policy() << "] lb_calld=" << this
|
||||
<< ": Invalid LB response received: '" << response_slice_str
|
||||
<< "'. Ignoring.";
|
||||
gpr_free(response_slice_str);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@
|
|||
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
#include "absl/log/check.h"
|
||||
#include "absl/log/log.h"
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/status/statusor.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
#include <grpc/support/alloc.h>
|
||||
#include <grpc/support/log.h>
|
||||
#include <grpc/support/port_platform.h>
|
||||
#include <grpc/support/sync.h>
|
||||
#include <grpcpp/impl/grpc_library.h>
|
||||
|
|
@ -64,8 +64,8 @@ std::string GetNamespaceName() {
|
|||
auto namespace_name = grpc_core::LoadFile(filename, false);
|
||||
if (!namespace_name.ok()) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(environment_autodetect)) {
|
||||
gpr_log(GPR_DEBUG, "Reading file %s failed: %s", filename,
|
||||
grpc_core::StatusToString(namespace_name.status()).c_str());
|
||||
VLOG(2) << "Reading file " << filename << " failed: "
|
||||
<< grpc_core::StatusToString(namespace_name.status());
|
||||
}
|
||||
// Fallback on an environment variable
|
||||
return grpc_core::GetEnv("NAMESPACE_NAME").value_or("");
|
||||
|
|
@ -249,13 +249,12 @@ class EnvironmentAutoDetectHelper
|
|||
element.first, &pollent_,
|
||||
[this](std::string attribute, absl::StatusOr<std::string> result) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(environment_autodetect)) {
|
||||
gpr_log(
|
||||
GPR_INFO,
|
||||
"Environment AutoDetect: Attribute: \"%s\" Result: \"%s\"",
|
||||
attribute.c_str(),
|
||||
result.ok()
|
||||
? result.value().c_str()
|
||||
: grpc_core::StatusToString(result.status()).c_str());
|
||||
LOG(INFO) << "Environment AutoDetect: Attribute: \"" << attribute
|
||||
<< "\" Result: \""
|
||||
<< (result.ok()
|
||||
? result.value()
|
||||
: grpc_core::StatusToString(result.status()))
|
||||
<< "\"";
|
||||
}
|
||||
absl::optional<EnvironmentAutoDetect::ResourceType> resource;
|
||||
{
|
||||
|
|
@ -270,9 +269,8 @@ class EnvironmentAutoDetectHelper
|
|||
// assuming a GCE environment, fallback to "global".
|
||||
else if (assuming_gce_) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(environment_autodetect)) {
|
||||
gpr_log(GPR_INFO,
|
||||
"Environment Autodetect: Falling back to global "
|
||||
"resource type");
|
||||
LOG(INFO) << "Environment Autodetect: Falling back to "
|
||||
"global resource type";
|
||||
}
|
||||
assuming_gce_ = false;
|
||||
resource_.resource_type = "global";
|
||||
|
|
@ -280,10 +278,9 @@ class EnvironmentAutoDetectHelper
|
|||
attributes_to_fetch_.erase(it);
|
||||
} else {
|
||||
// This should not happen
|
||||
gpr_log(GPR_ERROR,
|
||||
"An unexpected attribute was seen from the "
|
||||
"MetadataServer: %s",
|
||||
attribute.c_str());
|
||||
LOG(ERROR) << "An unexpected attribute was seen from the "
|
||||
"MetadataServer: "
|
||||
<< attribute;
|
||||
}
|
||||
if (attributes_to_fetch_.empty()) {
|
||||
resource = std::move(resource_);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/log/log.h"
|
||||
|
||||
#include <grpc/support/log.h>
|
||||
#include <grpcpp/ext/call_metric_recorder.h>
|
||||
#include <grpcpp/ext/server_metric_recorder.h>
|
||||
|
|
@ -69,36 +71,36 @@ void ServerMetricRecorder::UpdateBackendMetricDataState(
|
|||
void ServerMetricRecorder::SetCpuUtilization(double value) {
|
||||
if (!IsUtilizationWithSoftLimitsValid(value)) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] CPU utilization rejected: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] CPU utilization rejected: " << value;
|
||||
}
|
||||
return;
|
||||
}
|
||||
UpdateBackendMetricDataState(
|
||||
[value](BackendMetricData* data) { data->cpu_utilization = value; });
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] CPU utilization set: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] CPU utilization set: " << value;
|
||||
}
|
||||
}
|
||||
|
||||
void ServerMetricRecorder::SetMemoryUtilization(double value) {
|
||||
if (!IsUtilizationValid(value)) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Mem utilization rejected: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] Mem utilization rejected: " << value;
|
||||
}
|
||||
return;
|
||||
}
|
||||
UpdateBackendMetricDataState(
|
||||
[value](BackendMetricData* data) { data->mem_utilization = value; });
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Mem utilization set: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] Mem utilization set: " << value;
|
||||
}
|
||||
}
|
||||
|
||||
void ServerMetricRecorder::SetApplicationUtilization(double value) {
|
||||
if (!IsUtilizationWithSoftLimitsValid(value)) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Application utilization rejected: %f", this,
|
||||
value);
|
||||
LOG(INFO) << "[" << this
|
||||
<< "] Application utilization rejected: " << value;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -106,49 +108,49 @@ void ServerMetricRecorder::SetApplicationUtilization(double value) {
|
|||
data->application_utilization = value;
|
||||
});
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Application utilization set: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] Application utilization set: " << value;
|
||||
}
|
||||
}
|
||||
|
||||
void ServerMetricRecorder::SetQps(double value) {
|
||||
if (!IsRateValid(value)) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] QPS rejected: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] QPS rejected: " << value;
|
||||
}
|
||||
return;
|
||||
}
|
||||
UpdateBackendMetricDataState(
|
||||
[value](BackendMetricData* data) { data->qps = value; });
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] QPS set: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] QPS set: " << value;
|
||||
}
|
||||
}
|
||||
|
||||
void ServerMetricRecorder::SetEps(double value) {
|
||||
if (!IsRateValid(value)) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] EPS rejected: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] EPS rejected: " << value;
|
||||
}
|
||||
return;
|
||||
}
|
||||
UpdateBackendMetricDataState(
|
||||
[value](BackendMetricData* data) { data->eps = value; });
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] EPS set: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] EPS set: " << value;
|
||||
}
|
||||
}
|
||||
|
||||
void ServerMetricRecorder::SetNamedUtilization(string_ref name, double value) {
|
||||
if (!IsUtilizationValid(value)) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Named utilization rejected: %f name: %s", this,
|
||||
value, std::string(name.data(), name.size()).c_str());
|
||||
LOG(INFO) << "[" << this << "] Named utilization rejected: " << value
|
||||
<< " name: " << std::string(name.data(), name.size());
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Named utilization set: %f name: %s", this, value,
|
||||
std::string(name.data(), name.size()).c_str());
|
||||
LOG(INFO) << "[" << this << "] Named utilization set: " << value
|
||||
<< " name: " << std::string(name.data(), name.size());
|
||||
}
|
||||
UpdateBackendMetricDataState([name, value](BackendMetricData* data) {
|
||||
data->utilization[absl::string_view(name.data(), name.size())] = value;
|
||||
|
|
@ -158,8 +160,8 @@ void ServerMetricRecorder::SetNamedUtilization(string_ref name, double value) {
|
|||
void ServerMetricRecorder::SetAllNamedUtilization(
|
||||
std::map<string_ref, double> named_utilization) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] All named utilization updated. size: %" PRIuPTR,
|
||||
this, named_utilization.size());
|
||||
LOG(INFO) << "[" << this << "] All named utilization updated. size: "
|
||||
<< named_utilization.size();
|
||||
}
|
||||
UpdateBackendMetricDataState(
|
||||
[utilization = std::move(named_utilization)](BackendMetricData* data) {
|
||||
|
|
@ -175,7 +177,7 @@ void ServerMetricRecorder::ClearCpuUtilization() {
|
|||
UpdateBackendMetricDataState(
|
||||
[](BackendMetricData* data) { data->cpu_utilization = -1; });
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] CPU utilization cleared.", this);
|
||||
LOG(INFO) << "[" << this << "] CPU utilization cleared.";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -183,7 +185,7 @@ void ServerMetricRecorder::ClearMemoryUtilization() {
|
|||
UpdateBackendMetricDataState(
|
||||
[](BackendMetricData* data) { data->mem_utilization = -1; });
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Mem utilization cleared.", this);
|
||||
LOG(INFO) << "[" << this << "] Mem utilization cleared.";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -191,28 +193,28 @@ void ServerMetricRecorder::ClearApplicationUtilization() {
|
|||
UpdateBackendMetricDataState(
|
||||
[](BackendMetricData* data) { data->application_utilization = -1; });
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Application utilization cleared.", this);
|
||||
LOG(INFO) << "[" << this << "] Application utilization cleared.";
|
||||
}
|
||||
}
|
||||
|
||||
void ServerMetricRecorder::ClearQps() {
|
||||
UpdateBackendMetricDataState([](BackendMetricData* data) { data->qps = -1; });
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] QPS utilization cleared.", this);
|
||||
LOG(INFO) << "[" << this << "] QPS utilization cleared.";
|
||||
}
|
||||
}
|
||||
|
||||
void ServerMetricRecorder::ClearEps() {
|
||||
UpdateBackendMetricDataState([](BackendMetricData* data) { data->eps = -1; });
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] EPS utilization cleared.", this);
|
||||
LOG(INFO) << "[" << this << "] EPS utilization cleared.";
|
||||
}
|
||||
}
|
||||
|
||||
void ServerMetricRecorder::ClearNamedUtilization(string_ref name) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Named utilization cleared. name: %s", this,
|
||||
std::string(name.data(), name.size()).c_str());
|
||||
LOG(INFO) << "[" << this << "] Named utilization cleared. name: "
|
||||
<< std::string(name.data(), name.size());
|
||||
}
|
||||
UpdateBackendMetricDataState([name](BackendMetricData* data) {
|
||||
data->utilization.erase(absl::string_view(name.data(), name.size()));
|
||||
|
|
@ -233,12 +235,13 @@ ServerMetricRecorder::GetMetricsIfChanged() const {
|
|||
}
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
const auto& data = result->data;
|
||||
gpr_log(GPR_INFO,
|
||||
"[%p] GetMetrics() returned: seq:%" PRIu64
|
||||
" cpu:%f mem:%f app:%f qps:%f eps:%f utilization size: %" PRIuPTR,
|
||||
this, result->sequence_number, data.cpu_utilization,
|
||||
data.mem_utilization, data.application_utilization, data.qps,
|
||||
data.eps, data.utilization.size());
|
||||
LOG(INFO) << "[" << this
|
||||
<< "] GetMetrics() returned: seq:" << result->sequence_number
|
||||
<< " cpu:" << data.cpu_utilization
|
||||
<< " mem:" << data.mem_utilization
|
||||
<< " app:" << data.application_utilization << " qps:" << data.qps
|
||||
<< " eps:" << data.eps
|
||||
<< " utilization size: " << data.utilization.size();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -249,13 +252,13 @@ experimental::CallMetricRecorder&
|
|||
BackendMetricState::RecordCpuUtilizationMetric(double value) {
|
||||
if (!IsUtilizationWithSoftLimitsValid(value)) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] CPU utilization value rejected: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] CPU utilization value rejected: " << value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
cpu_utilization_.store(value, std::memory_order_relaxed);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] CPU utilization recorded: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] CPU utilization recorded: " << value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -264,13 +267,13 @@ experimental::CallMetricRecorder&
|
|||
BackendMetricState::RecordMemoryUtilizationMetric(double value) {
|
||||
if (!IsUtilizationValid(value)) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Mem utilization value rejected: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] Mem utilization value rejected: " << value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
mem_utilization_.store(value, std::memory_order_relaxed);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Mem utilization recorded: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] Mem utilization recorded: " << value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -279,14 +282,14 @@ experimental::CallMetricRecorder&
|
|||
BackendMetricState::RecordApplicationUtilizationMetric(double value) {
|
||||
if (!IsUtilizationWithSoftLimitsValid(value)) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Application utilization value rejected: %f", this,
|
||||
value);
|
||||
LOG(INFO) << "[" << this
|
||||
<< "] Application utilization value rejected: " << value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
application_utilization_.store(value, std::memory_order_relaxed);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Application utilization recorded: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] Application utilization recorded: " << value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -295,13 +298,13 @@ experimental::CallMetricRecorder& BackendMetricState::RecordQpsMetric(
|
|||
double value) {
|
||||
if (!IsRateValid(value)) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] QPS value rejected: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] QPS value rejected: " << value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
qps_.store(value, std::memory_order_relaxed);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] QPS recorded: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] QPS recorded: " << value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -310,13 +313,13 @@ experimental::CallMetricRecorder& BackendMetricState::RecordEpsMetric(
|
|||
double value) {
|
||||
if (!IsRateValid(value)) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] EPS value rejected: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] EPS value rejected: " << value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
eps_.store(value, std::memory_order_relaxed);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] EPS recorded: %f", this, value);
|
||||
LOG(INFO) << "[" << this << "] EPS recorded: " << value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -325,8 +328,8 @@ experimental::CallMetricRecorder& BackendMetricState::RecordUtilizationMetric(
|
|||
string_ref name, double value) {
|
||||
if (!IsUtilizationValid(value)) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Utilization value rejected: %s %f", this,
|
||||
std::string(name.data(), name.length()).c_str(), value);
|
||||
LOG(INFO) << "[" << this << "] Utilization value rejected: "
|
||||
<< std::string(name.data(), name.length()) << " " << value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -334,8 +337,8 @@ experimental::CallMetricRecorder& BackendMetricState::RecordUtilizationMetric(
|
|||
absl::string_view name_sv(name.data(), name.length());
|
||||
utilization_[name_sv] = value;
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Utilization recorded: %s %f", this,
|
||||
std::string(name_sv).c_str(), value);
|
||||
LOG(INFO) << "[" << this << "] Utilization recorded: " << name_sv << " "
|
||||
<< value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -346,8 +349,8 @@ experimental::CallMetricRecorder& BackendMetricState::RecordRequestCostMetric(
|
|||
absl::string_view name_sv(name.data(), name.length());
|
||||
request_cost_[name_sv] = value;
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Request cost recorded: %s %f", this,
|
||||
std::string(name_sv).c_str(), value);
|
||||
LOG(INFO) << "[" << this << "] Request cost recorded: " << name_sv << " "
|
||||
<< value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -358,8 +361,8 @@ experimental::CallMetricRecorder& BackendMetricState::RecordNamedMetric(
|
|||
absl::string_view name_sv(name.data(), name.length());
|
||||
named_metrics_[name_sv] = value;
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO, "[%p] Named metric recorded: %s %f", this,
|
||||
std::string(name_sv).c_str(), value);
|
||||
LOG(INFO) << "[" << this << "] Named metric recorded: " << name_sv << " "
|
||||
<< value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -406,13 +409,13 @@ BackendMetricData BackendMetricState::GetBackendMetricData() {
|
|||
}
|
||||
}
|
||||
if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) {
|
||||
gpr_log(GPR_INFO,
|
||||
"[%p] Backend metric data returned: cpu:%f mem:%f qps:%f eps:%f "
|
||||
"utilization size:%" PRIuPTR " request_cost size:%" PRIuPTR
|
||||
"named_metrics size:%" PRIuPTR,
|
||||
this, data.cpu_utilization, data.mem_utilization, data.qps,
|
||||
data.eps, data.utilization.size(), data.request_cost.size(),
|
||||
data.named_metrics.size());
|
||||
LOG(INFO) << "[" << this
|
||||
<< "] Backend metric data returned: cpu:" << data.cpu_utilization
|
||||
<< " mem:" << data.mem_utilization << " qps:" << data.qps
|
||||
<< " eps:" << data.eps
|
||||
<< " utilization size:" << data.utilization.size()
|
||||
<< " request_cost size:" << data.request_cost.size()
|
||||
<< "named_metrics size:" << data.named_metrics.size();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,4 @@
|
|||
// `tools/buildgen/generate_projects.sh`.
|
||||
|
||||
#define GRPC_OBJC_VERSION_STRING @"1.65.0-dev"
|
||||
#define GRPC_C_VERSION_STRING @"41.0.0"
|
||||
#define GRPC_C_VERSION_STRING @"42.0.0"
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class Verifier {
|
|||
static_cast<gpr_log_severity>(GPR_LOG_SEVERITY_ERROR + 1);
|
||||
}
|
||||
grpc_tracer_set_enabled("all", 0);
|
||||
gpr_set_log_verbosity(GPR_LOG_SEVERITY_DEBUG);
|
||||
grpc_set_absl_verbosity_debug();
|
||||
gpr_set_log_function(DispatchLog);
|
||||
}
|
||||
~Verifier() {
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ int main(int argc, char** argv) {
|
|||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_set_default_iomgr_platform();
|
||||
grpc_iomgr_platform_init();
|
||||
gpr_set_log_verbosity(GPR_LOG_SEVERITY_DEBUG);
|
||||
grpc_set_absl_verbosity_debug();
|
||||
add_test();
|
||||
destruction_test();
|
||||
grpc_iomgr_platform_shutdown();
|
||||
|
|
@ -256,7 +256,7 @@ int main(int argc, char** argv) {
|
|||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_set_default_iomgr_platform();
|
||||
grpc_iomgr_platform_init();
|
||||
gpr_set_log_verbosity(GPR_LOG_SEVERITY_DEBUG);
|
||||
grpc_set_absl_verbosity_debug();
|
||||
long_running_service_cleanup_test();
|
||||
add_test();
|
||||
destruction_test();
|
||||
|
|
|
|||
|
|
@ -138,6 +138,11 @@ void grpc_test_init(int* argc, char** argv) {
|
|||
srand(seed());
|
||||
}
|
||||
|
||||
void grpc_set_absl_verbosity_debug() {
|
||||
absl::SetMinLogLevel(absl::LogSeverityAtLeast::kInfo);
|
||||
absl::SetVLogLevel("*grpc*/*", 2);
|
||||
}
|
||||
|
||||
bool grpc_wait_until_shutdown(int64_t time_s) {
|
||||
gpr_timespec deadline = grpc_timeout_seconds_to_deadline(time_s);
|
||||
while (grpc_is_initialized()) {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ void grpc_disable_all_absl_logs(void);
|
|||
// Returns if grpc is shutdown
|
||||
bool grpc_wait_until_shutdown(int64_t time_s);
|
||||
|
||||
// Sets absl verbosity via SetMinLogLevel and SetVLogLevel
|
||||
void grpc_set_absl_verbosity_debug(void);
|
||||
|
||||
namespace grpc {
|
||||
namespace testing {
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ FrameLimits FuzzerFrameLimits() { return FrameLimits{1024 * 1024 * 1024, 63}; }
|
|||
template <typename T>
|
||||
void AssertRoundTrips(const T& input, FrameType expected_frame_type) {
|
||||
HPackCompressor hpack_compressor;
|
||||
auto serialized = input.Serialize(&hpack_compressor);
|
||||
bool saw_encoding_errors = false;
|
||||
auto serialized = input.Serialize(&hpack_compressor, saw_encoding_errors);
|
||||
CHECK(serialized.control.Length() >=
|
||||
24); // Initial output buffer size is 64 byte.
|
||||
uint8_t header_bytes[24];
|
||||
|
|
@ -67,7 +68,7 @@ void AssertRoundTrips(const T& input, FrameType expected_frame_type) {
|
|||
}
|
||||
Crash("Failed to parse header");
|
||||
}
|
||||
CHECK(header->type == expected_frame_type);
|
||||
CHECK_EQ(header->type, expected_frame_type);
|
||||
T output;
|
||||
HPackParser hpack_parser;
|
||||
DeterministicBitGen bitgen;
|
||||
|
|
@ -75,7 +76,7 @@ void AssertRoundTrips(const T& input, FrameType expected_frame_type) {
|
|||
absl::BitGenRef(bitgen), GetContext<Arena>(),
|
||||
std::move(serialized), FuzzerFrameLimits());
|
||||
CHECK_OK(deser);
|
||||
CHECK(output == input);
|
||||
if (!saw_encoding_errors) CHECK_EQ(input, output);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
control: "\200\001\000\000\022z`:0\000\000\000\000\000\000\000\000\000:status\234@\000\000\000\000\000\000\010\2342393\\3\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\23777\\3\377\377\377\0037X1user-agentrol: b0\\0\000"
|
||||
|
|
@ -34,7 +34,8 @@ FrameLimits TestFrameLimits() { return FrameLimits{1024 * 1024 * 1024, 63}; }
|
|||
template <typename T>
|
||||
void AssertRoundTrips(const T& input, FrameType expected_frame_type) {
|
||||
HPackCompressor hpack_compressor;
|
||||
auto serialized = input.Serialize(&hpack_compressor);
|
||||
bool saw_encoding_errors = false;
|
||||
auto serialized = input.Serialize(&hpack_compressor, saw_encoding_errors);
|
||||
CHECK_GE(serialized.control.Length(),
|
||||
24); // Initial output buffer size is 64 byte.
|
||||
uint8_t header_bytes[24];
|
||||
|
|
@ -43,7 +44,7 @@ void AssertRoundTrips(const T& input, FrameType expected_frame_type) {
|
|||
if (!header.ok()) {
|
||||
Crash("Failed to parse header");
|
||||
}
|
||||
CHECK(header->type == expected_frame_type);
|
||||
CHECK_EQ(header->type, expected_frame_type);
|
||||
T output;
|
||||
HPackParser hpack_parser;
|
||||
absl::BitGen bitgen;
|
||||
|
|
@ -55,7 +56,7 @@ void AssertRoundTrips(const T& input, FrameType expected_frame_type) {
|
|||
output.Deserialize(&hpack_parser, header.value(), absl::BitGenRef(bitgen),
|
||||
arena.get(), std::move(serialized), TestFrameLimits());
|
||||
CHECK_OK(deser);
|
||||
CHECK(output == input);
|
||||
if (!saw_encoding_errors) CHECK_EQ(output, input);
|
||||
}
|
||||
|
||||
TEST(FrameTest, SettingsFrameRoundTrips) {
|
||||
|
|
|
|||
|
|
@ -363,8 +363,6 @@ std::unique_ptr<ScenarioResult> RunScenario(
|
|||
if (run_inproc) {
|
||||
g_inproc_servers = new std::vector<grpc::testing::Server*>;
|
||||
}
|
||||
// Log everything from the driver
|
||||
gpr_set_log_verbosity(GPR_LOG_SEVERITY_DEBUG);
|
||||
|
||||
// ClientContext allocations (all are destroyed at scope exit)
|
||||
list<ClientContext> contexts;
|
||||
|
|
|
|||
|
|
@ -13,3 +13,204 @@ exports_files([
|
|||
"protobuf.patch",
|
||||
"protoc-gen-validate.patch",
|
||||
])
|
||||
|
||||
package(default_visibility = ["//:__subpackages__"])
|
||||
|
||||
alias(
|
||||
name = "libssl",
|
||||
actual = "@boringssl//:ssl",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "libcrypto",
|
||||
actual = "@boringssl//:crypto",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "madler_zlib",
|
||||
actual = "@zlib//:zlib",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "protobuf",
|
||||
actual = "@com_google_protobuf//:protobuf",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "protobuf_clib",
|
||||
actual = "@com_google_protobuf//:protoc_lib",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "protobuf_headers",
|
||||
actual = "@com_google_protobuf//:protobuf_headers",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "protocol_compiler",
|
||||
actual = "@com_google_protobuf//:protoc",
|
||||
tags = ["manual"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "cares",
|
||||
actual = "@com_github_cares_cares//:ares",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "gtest",
|
||||
actual = "@com_google_googletest//:gtest",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "fuzztest",
|
||||
actual = "@com_google_fuzztest//fuzztest",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "fuzztest_main",
|
||||
actual = "@com_google_fuzztest//fuzztest:fuzztest_gtest_main",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "benchmark",
|
||||
actual = "@com_github_google_benchmark//:benchmark",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "re2",
|
||||
actual = "@com_googlesource_code_re2//:re2",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "grpc_cpp_plugin",
|
||||
actual = "@com_github_grpc_grpc//src/compiler:grpc_cpp_plugin",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "grpc++_codegen_proto",
|
||||
actual = "@com_github_grpc_grpc//:grpc++_codegen_proto",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "opencensus-context",
|
||||
actual = "@io_opencensus_cpp//opencensus/context:context",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "opencensus-trace",
|
||||
actual = "@io_opencensus_cpp//opencensus/trace:trace",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "opencensus-trace-context_util",
|
||||
actual = "@io_opencensus_cpp//opencensus/trace:context_util",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "opencensus-trace-propagation",
|
||||
actual = "@io_opencensus_cpp//opencensus/trace:grpc_trace_bin",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "opencensus-trace-span_context",
|
||||
actual = "@io_opencensus_cpp//opencensus/trace:span_context",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "opencensus-stats",
|
||||
actual = "@io_opencensus_cpp//opencensus/stats:stats",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "opencensus-stats-test",
|
||||
actual = "@io_opencensus_cpp//opencensus/stats:test_utils",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "opencensus-with-tag-map",
|
||||
actual = "@io_opencensus_cpp//opencensus/tags:with_tag_map",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "opencensus-tags",
|
||||
actual = "@io_opencensus_cpp//opencensus/tags:tags",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "opencensus-tags-context_util",
|
||||
actual = "@io_opencensus_cpp//opencensus/tags:context_util",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "opencensus-trace-stackdriver_exporter",
|
||||
actual = "@io_opencensus_cpp//opencensus/exporters/trace/stackdriver:stackdriver_exporter",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "opencensus-stats-stackdriver_exporter",
|
||||
actual = "@io_opencensus_cpp//opencensus/exporters/stats/stackdriver:stackdriver_exporter",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "googleapis_trace_grpc_service",
|
||||
actual = "@com_google_googleapis//google/devtools/cloudtrace/v2:cloudtrace_cc_grpc",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "googleapis_monitoring_grpc_service",
|
||||
actual = "@com_google_googleapis//google/monitoring/v3:monitoring_cc_grpc",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "googleapis_logging_grpc_service",
|
||||
actual = "@com_google_googleapis//google/logging/v2:logging_cc_grpc",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "googleapis_logging_cc_proto",
|
||||
actual = "@com_google_googleapis//google/logging/v2:logging_cc_proto",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "twisted",
|
||||
actual = "@com_github_twisted_twisted//:twisted",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "yaml",
|
||||
actual = "@com_github_yaml_pyyaml//:yaml",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,6 @@ objc_library(
|
|||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//external:gtest",
|
||||
"//third_party:gtest",
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -544,11 +544,11 @@ def update_test_metadata_with_transitive_metadata(
|
|||
|
||||
bazel_rule = bazel_rules[_get_bazel_label(lib_name)]
|
||||
|
||||
if "//external:benchmark" in bazel_rule["_TRANSITIVE_DEPS"]:
|
||||
if "//third_party:benchmark" in bazel_rule["_TRANSITIVE_DEPS"]:
|
||||
lib_dict["benchmark"] = True
|
||||
lib_dict["defaults"] = "benchmark"
|
||||
|
||||
if "//external:gtest" in bazel_rule["_TRANSITIVE_DEPS"]:
|
||||
if "//third_party:gtest" in bazel_rule["_TRANSITIVE_DEPS"]:
|
||||
# run_tests.py checks the "gtest" property to see if test should be run via gtest.
|
||||
lib_dict["gtest"] = True
|
||||
# TODO: this might be incorrect categorization of the test...
|
||||
|
|
@ -672,7 +672,7 @@ def _patch_grpc_proto_library_rules(bazel_rules):
|
|||
and generator_func == "grpc_proto_library"
|
||||
):
|
||||
# Add explicit protobuf dependency for internal c++ proto targets.
|
||||
bazel_rule["deps"].append("//external:protobuf")
|
||||
bazel_rule["deps"].append("//third_party:protobuf")
|
||||
|
||||
|
||||
def _patch_descriptor_upb_proto_library(bazel_rules):
|
||||
|
|
@ -1333,8 +1333,8 @@ _BAZEL_DEPS_QUERIES = [
|
|||
'deps("//test/...")',
|
||||
'deps("//:all")',
|
||||
'deps("//src/compiler/...")',
|
||||
# allow resolving bind() workspace rules to the actual targets they point to
|
||||
'kind(bind, "//external:*")',
|
||||
# allow resolving alias() targets to the actual targets they point to
|
||||
'kind(alias, "//third_party:*")',
|
||||
# The ^ is needed to differentiate proto_library from go_proto_library
|
||||
'deps(kind("^proto_library", @envoy_api//envoy/...))',
|
||||
# Make sure we have source info for all the targets that _expand_upb_proto_library_rules artificially adds
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core"
|
|||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 41.0.0
|
||||
PROJECT_NUMBER = 42.0.0
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core"
|
|||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 41.0.0
|
||||
PROJECT_NUMBER = 42.0.0
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ pip_install_dir "$ROOT/src/python/grpcio_testing"
|
|||
# shellcheck disable=SC2261
|
||||
pip_install coverage==7.2.0 oauth2client==4.1.0 \
|
||||
google-auth>=1.35.0 requests==2.31.0 \
|
||||
googleapis-common-protos>=1.5.5 rsa==4.0 absl-py==1.4.0 \
|
||||
rsa==4.0 absl-py==1.4.0 \
|
||||
opentelemetry-sdk==1.21.0
|
||||
$VENV_PYTHON "$ROOT/src/python/grpcio_tests/setup.py" preprocess
|
||||
$VENV_PYTHON "$ROOT/src/python/grpcio_tests/setup.py" build_package_protos
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ set -ex
|
|||
# Make sure that there is no path from known unsecure libraries and targets
|
||||
# to an SSL library. Any failure among these will make the script fail.
|
||||
|
||||
test "$(bazel query 'somepath("//:grpc_unsecure", "//external:libssl")' 2>/dev/null | wc -l)" -eq 0 || exit 1
|
||||
test "$(bazel query 'somepath("//:grpc++_unsecure", "//external:libssl")' 2>/dev/null | wc -l)" -eq 0 || exit 1
|
||||
test "$(bazel query 'somepath("//:grpc++_codegen_proto", "//external:libssl")' 2>/dev/null | wc -l)" -eq 0 || exit 1
|
||||
test "$(bazel query 'somepath("//test/cpp/microbenchmarks:helpers", "//external:libssl")' 2>/dev/null | wc -l)" -eq 0 || exit 1
|
||||
test "$(bazel query 'somepath("//:grpc_unsecure", "//third_party:libssl")' 2>/dev/null | wc -l)" -eq 0 || exit 1
|
||||
test "$(bazel query 'somepath("//:grpc++_unsecure", "//third_party:libssl")' 2>/dev/null | wc -l)" -eq 0 || exit 1
|
||||
test "$(bazel query 'somepath("//:grpc++_codegen_proto", "//third_party:libssl")' 2>/dev/null | wc -l)" -eq 0 || exit 1
|
||||
test "$(bazel query 'somepath("//test/cpp/microbenchmarks:helpers", "//third_party:libssl")' 2>/dev/null | wc -l)" -eq 0 || exit 1
|
||||
|
||||
# Make sure that core doesn't depend on anything in C++ library
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue