From 00f2c93460a333c5951bef5de4d097b27407e5e7 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 4 Apr 2017 20:38:14 +0200 Subject: Avoid pollution from ares.h into the global space. --- src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver.h | 2 -- src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver.h b/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver.h index 334feaa2ab..fa22e11be4 100644 --- a/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver.h +++ b/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver.h @@ -34,8 +34,6 @@ #ifndef GRPC_CORE_EXT_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H #define GRPC_CORE_EXT_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H -#include - #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/pollset_set.h" diff --git a/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c b/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c index fab4f0c977..dd102e5dd6 100644 --- a/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +++ b/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c @@ -34,6 +34,8 @@ #include "src/core/lib/iomgr/port.h" #if GRPC_ARES == 1 && defined(GRPC_POSIX_SOCKET) +#include + #include "src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver.h" #include -- cgit v1.2.3 From 91455a9915df5f0663abe4aaed05a529ab2d1d35 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 3 May 2017 09:14:10 -0700 Subject: Apply a few recent changes from the wire guide on grpc.io. --- doc/PROTOCOL-HTTP2.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/PROTOCOL-HTTP2.md b/doc/PROTOCOL-HTTP2.md index 68af1f2ca1..29d3cc2e76 100644 --- a/doc/PROTOCOL-HTTP2.md +++ b/doc/PROTOCOL-HTTP2.md @@ -24,7 +24,8 @@ Request-Headers are delivered as HTTP2 headers in HEADERS + CONTINUATION frames. * **Call-Definition** → Method Scheme Path TE [Authority] [Timeout] Content-Type [Message-Type] [Message-Encoding] [Message-Accept-Encoding] [User-Agent] * **Method** → ":method POST" * **Scheme** → ":scheme " ("http" / "https") -* **Path** → ":path" {_path identifying method within exposed API_} +* **Path** → ":path" "/" Service-Name "/" {_method name_} +* **Service-Name** → {_IDL-specific service name_} * **Authority** → ":authority" {_virtual host name of authority_} * **TE** → "te" "trailers" # Used to detect incompatible proxies * **Timeout** → "grpc-timeout" TimeoutValue TimeoutUnit @@ -51,6 +52,13 @@ Request-Headers are delivered as HTTP2 headers in HEADERS + CONTINUATION frames. HTTP2 requires that reserved headers, ones starting with ":" appear before all other headers. Additionally implementations should send **Timeout** immediately after the reserved headers and they should send the **Call-Definition** headers before sending **Custom-Metadata**. +Some gRPC implementations may allow the **Path** format shown above +to be overridden, but this functionality is strongly discouraged. +gRPC does not go out of its way to break users that are using this kind +of override, but we do not actively support it, and some functionality +(e.g., service config support) will not work when the path is not of +the form shown above. + If **Timeout** is omitted a server should assume an infinite timeout. Client implementations are free to send a default minimum timeout based on their deployment requirements. **Custom-Metadata** is an arbitrary set of key-value pairs defined by the application layer. Header names starting with "grpc-" but not listed here are reserved for future GRPC use and should not be used by applications as **Custom-Metadata**. @@ -238,10 +246,10 @@ If a detectable connection failure occurs on the client all calls will be closed ### Appendix A - GRPC for Protobuf -The service interfaces declared by protobuf are easily mapped onto GRPC by code generation extensions to protoc. The following defines the mapping to be used - +The service interfaces declared by protobuf are easily mapped onto GRPC by +code generation extensions to protoc. The following defines the mapping +to be used. -* **Path** → / Service-Name / {_method name_} * **Service-Name** → ?( {_proto package name_} "." ) {_service name_} * **Message-Type** → {_fully qualified proto message name_} * **Content-Type** → "application/grpc+proto" -- cgit v1.2.3 From 8d1cfdcb5d86e6ebbbb8de9e0de51ff23768445c Mon Sep 17 00:00:00 2001 From: Yaron Shani Date: Mon, 22 May 2017 14:43:05 +0300 Subject: ALPN fix --- binding.gyp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/binding.gyp b/binding.gyp index 8aafdaa62b..8a120adf82 100644 --- a/binding.gyp +++ b/binding.gyp @@ -130,6 +130,15 @@ ] }, { 'conditions': [ + ["target_arch=='ia32'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] + }], + ["target_arch=='x64'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] + }], + ["target_arch=='arm'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] + }], ['grpc_alpn=="true"', { 'defines': [ 'TSI_OPENSSL_ALPN_SUPPORT=1' @@ -142,17 +151,6 @@ ], 'include_dirs': [ '<(node_root_dir)/deps/openssl/openssl/include', - ], - 'conditions': [ - ["target_arch=='ia32'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] - }], - ["target_arch=='x64'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] - }], - ["target_arch=='arm'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] - }] ] }], ['OS == "win"', { -- cgit v1.2.3 From 19489ae0cac02c972df29c80cd4432c3282e82bc Mon Sep 17 00:00:00 2001 From: Yaron Shani Date: Tue, 23 May 2017 08:22:35 +0300 Subject: update template --- templates/binding.gyp.template | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index 933174ab6e..204c5b63d4 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -120,6 +120,15 @@ ] }, { 'conditions': [ + ["target_arch=='ia32'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] + }], + ["target_arch=='x64'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] + }], + ["target_arch=='arm'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] + }], ['grpc_alpn=="true"', { 'defines': [ 'TSI_OPENSSL_ALPN_SUPPORT=1' @@ -132,17 +141,6 @@ ], 'include_dirs': [ '<(node_root_dir)/deps/openssl/openssl/include', - ], - 'conditions': [ - ["target_arch=='ia32'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] - }], - ["target_arch=='x64'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] - }], - ["target_arch=='arm'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] - }] ] }], ['OS == "win"', { -- cgit v1.2.3 From 1d9a11be82ee1dbeb1294f34e373d5f15625ed9b Mon Sep 17 00:00:00 2001 From: Yaron Shani Date: Mon, 22 May 2017 23:00:46 -0700 Subject: after running gen project --- binding.gyp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/binding.gyp b/binding.gyp index 8a120adf82..e7ddc2b34b 100644 --- a/binding.gyp +++ b/binding.gyp @@ -131,13 +131,13 @@ }, { 'conditions': [ ["target_arch=='ia32'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] }], ["target_arch=='x64'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] }], ["target_arch=='arm'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] }], ['grpc_alpn=="true"', { 'defines': [ -- cgit v1.2.3 From ce13cb78a2335e95729b9a18ea157661aa77a4d4 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 30 May 2017 14:11:38 -0700 Subject: 1.4.x branch cut, version bump PR --- BUILD | 4 ++-- CMakeLists.txt | 2 +- Makefile | 6 +++--- build.yaml | 4 ++-- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.json | 2 +- package.xml | 4 ++-- src/core/lib/surface/version.c | 2 +- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 2 +- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/node/health_check/package.json | 4 ++-- src/node/tools/package.json | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- tools/doxygen/Doxyfile.core | 2 +- tools/doxygen/Doxyfile.core.internal | 2 +- 32 files changed, 39 insertions(+), 39 deletions(-) diff --git a/BUILD b/BUILD index bdea522ad1..2070ce3311 100644 --- a/BUILD +++ b/BUILD @@ -51,9 +51,9 @@ load( # This should be updated along with build.yaml g_stands_for = "gregarious" -core_version = "3.0.0-dev" +core_version = "4.0.0-pre1" -version = "1.4.0-dev" +version = "1.4.0-pre1" grpc_cc_library( name = "gpr", diff --git a/CMakeLists.txt b/CMakeLists.txt index fd53f621a6..acae19ef39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.4.0-dev") +set(PACKAGE_VERSION "1.4.0-pre1") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 82b2104b4a..c87fd19144 100644 --- a/Makefile +++ b/Makefile @@ -422,9 +422,9 @@ E = @echo Q = @ endif -CORE_VERSION = 4.0.0-dev -CPP_VERSION = 1.4.0-dev -CSHARP_VERSION = 1.4.0-dev +CORE_VERSION = 4.0.0-pre1 +CPP_VERSION = 1.4.0-pre1 +CSHARP_VERSION = 1.4.0-pre1 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index 26144e33de..fd43d64b1a 100644 --- a/build.yaml +++ b/build.yaml @@ -12,9 +12,9 @@ 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: 4.0.0-dev + core_version: 4.0.0-pre1 g_stands_for: gregarious - version: 1.4.0-dev + version: 1.4.0-pre1 filegroups: - name: census public_headers: diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index d9de2d78a0..44e8931fbc 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -37,7 +37,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.4.0-dev' + version = '1.4.0-pre1' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 62cb0d11a1..88a64b8d11 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.4.0-dev' + version = '1.4.0-pre1' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 77ceb22123..cc6ab6c5cf 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.4.0-dev' + version = '1.4.0-pre1' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'http://www.grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 10520bd388..cf63bfeac7 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -35,7 +35,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.4.0-dev' + version = '1.4.0-pre1' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'http://www.grpc.io' diff --git a/package.json b/package.json index 1ed182ced9..6cde38694b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.4.0-dev", + "version": "1.4.0-pre1", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "http://www.grpc.io/", diff --git a/package.xml b/package.xml index 9179ef238c..5d6c089f04 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2017-05-22 - 1.4.0dev - 1.4.0dev + 1.4.0RC1 + 1.4.0RC1 beta diff --git a/src/core/lib/surface/version.c b/src/core/lib/surface/version.c index cddc595e4c..39dfebb948 100644 --- a/src/core/lib/surface/version.c +++ b/src/core/lib/surface/version.c @@ -36,6 +36,6 @@ #include -const char *grpc_version_string(void) { return "4.0.0-dev"; } +const char *grpc_version_string(void) { return "4.0.0-pre1"; } const char *grpc_g_stands_for(void) { return "gregarious"; } diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 72a4c4cf94..8359016c02 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -37,5 +37,5 @@ #include namespace grpc { -grpc::string Version() { return "1.4.0-dev"; } +grpc::string Version() { return "1.4.0-pre1"; } } diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 8388bfd9cc..8a15980f0a 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.4.0-dev + 1.4.0-pre1 3.3.0 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 2e55d9d80e..feac0736c3 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -53,6 +53,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.4.0-dev"; + public const string CurrentVersion = "1.4.0-pre1"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index aa8a8d3b17..cb4ff60d55 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -28,7 +28,7 @@ @rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @rem Current package versions -set VERSION=1.4.0-dev +set VERSION=1.4.0-pre1 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index d33923845c..f3dc843567 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -54,7 +54,7 @@ dotnet pack --configuration Release Grpc.Auth --output ../../../artifacts dotnet pack --configuration Release Grpc.HealthCheck --output ../../../artifacts dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts -nuget pack Grpc.nuspec -Version "1.4.0-dev" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.4.0-dev" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.4.0-pre1" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.4.0-pre1" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json index 37c9b7a54f..238547c177 100644 --- a/src/node/health_check/package.json +++ b/src/node/health_check/package.json @@ -1,6 +1,6 @@ { "name": "grpc-health-check", - "version": "1.4.0-dev", + "version": "1.4.0-pre1", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { @@ -15,7 +15,7 @@ } ], "dependencies": { - "grpc": "^1.4.0-dev", + "grpc": "^1.4.0-pre1", "lodash": "^3.9.3", "google-protobuf": "^3.0.0" }, diff --git a/src/node/tools/package.json b/src/node/tools/package.json index a81aa87f4b..f4f72a4de5 100644 --- a/src/node/tools/package.json +++ b/src/node/tools/package.json @@ -1,6 +1,6 @@ { "name": "grpc-tools", - "version": "1.4.0-dev", + "version": "1.4.0-pre1", "author": "Google Inc.", "description": "Tools for developing with gRPC on Node.js", "homepage": "http://www.grpc.io/", diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 2f29058b59..09f3303654 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.4.0-dev' + v = '1.4.0-pre1' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index c846f4214c..25a232a722 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -38,4 +38,4 @@ // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.4.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.4.0-pre1" diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index a0cb0dd067..fcfd197632 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.4.0.dev0""" +__version__ = """1.4.0rc1""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index ea4bc7ba20..31b85e5aee 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='1.4.0.dev0' +VERSION='1.4.0rc1' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 26aa555e14..53d798f603 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION='1.4.0.dev0' +VERSION='1.4.0rc1' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 978d6b4011..25ee2808c6 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION='1.4.0.dev0' +VERSION='1.4.0rc1' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index 5f0b084884..ea9d30704a 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION='1.4.0.dev0' +VERSION='1.4.0rc1' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index f30dff335f..103e5cbbcd 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.4.0.dev' + VERSION = '1.4.0.pre1' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index 1f8d4afb95..9ce13f3f82 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -29,6 +29,6 @@ module GRPC module Tools - VERSION = '1.4.0.dev' + VERSION = '1.4.0.pre1' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index 1f2aa81c85..09738ea9f3 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION='1.4.0.dev0' +VERSION='1.4.0rc1' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 3861bdb85a..d3eb740e29 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.4.0-dev +PROJECT_NUMBER = 1.4.0-pre1 # 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 diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 5bab66c7d6..c87e52df82 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.4.0-dev +PROJECT_NUMBER = 1.4.0-pre1 # 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 diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index c5ae421d40..1a8902a4ae 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -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 = 4.0.0-dev +PROJECT_NUMBER = 4.0.0-pre1 # 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 diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 15410dec01..49ebc2a9b7 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -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 = 4.0.0-dev +PROJECT_NUMBER = 4.0.0-pre1 # 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 -- cgit v1.2.3 From 1ef9f4ed4da81222d7ddc26bc5fa5c5ca9ad86c0 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 30 May 2017 15:27:46 -0700 Subject: Add artifact builds for Node 8 --- package.json | 2 +- templates/package.json.template | 2 +- tools/run_tests/artifacts/build_artifact_node.bat | 2 +- tools/run_tests/artifacts/build_artifact_node.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 1ed182ced9..1874f24125 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "arguejs": "^0.2.3", "lodash": "^4.15.0", "nan": "^2.0.0", - "node-pre-gyp": "^0.6.0", + "node-pre-gyp": "^0.6.35", "protobufjs": "^5.0.0" }, "devDependencies": { diff --git a/templates/package.json.template b/templates/package.json.template index 551c25f042..1027e7bb9b 100644 --- a/templates/package.json.template +++ b/templates/package.json.template @@ -35,7 +35,7 @@ "arguejs": "^0.2.3", "lodash": "^4.15.0", "nan": "^2.0.0", - "node-pre-gyp": "^0.6.0", + "node-pre-gyp": "^0.6.35", "protobufjs": "^5.0.0" }, "devDependencies": { diff --git a/tools/run_tests/artifacts/build_artifact_node.bat b/tools/run_tests/artifacts/build_artifact_node.bat index da4d479a8c..c2738619b3 100644 --- a/tools/run_tests/artifacts/build_artifact_node.bat +++ b/tools/run_tests/artifacts/build_artifact_node.bat @@ -27,7 +27,7 @@ @rem (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE @rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -set node_versions=4.0.0 5.0.0 6.0.0 7.0.0 +set node_versions=4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 diff --git a/tools/run_tests/artifacts/build_artifact_node.sh b/tools/run_tests/artifacts/build_artifact_node.sh index 3947bded6f..4d2f87838e 100755 --- a/tools/run_tests/artifacts/build_artifact_node.sh +++ b/tools/run_tests/artifacts/build_artifact_node.sh @@ -42,7 +42,7 @@ mkdir -p "${ARTIFACTS_OUT}" npm update -node_versions=( 4.0.0 5.0.0 6.0.0 7.0.0 ) +node_versions=( 4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 ) electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 ) -- cgit v1.2.3 From d2f91e8f024bcfb55675d426e654a9d02ac066e7 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 30 May 2017 16:35:34 -0700 Subject: Fix npm cache handling when updating dependencies --- tools/run_tests/helper_scripts/pre_build_node.bat | 6 ++++-- tools/run_tests/helper_scripts/pre_build_node.sh | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/run_tests/helper_scripts/pre_build_node.bat b/tools/run_tests/helper_scripts/pre_build_node.bat index addb01a2a4..62b883de46 100644 --- a/tools/run_tests/helper_scripts/pre_build_node.bat +++ b/tools/run_tests/helper_scripts/pre_build_node.bat @@ -29,5 +29,7 @@ set PATH=%PATH%;C:\Program Files\nodejs\;%APPDATA%\npm -@rem Expire cache after 1 day -call npm update --cache-min 86400 +@rem Update npm to at least version 5 +call npm update -g npm + +call npm update --prefer-online diff --git a/tools/run_tests/helper_scripts/pre_build_node.sh b/tools/run_tests/helper_scripts/pre_build_node.sh index 083cb2bc77..b7c6e14e74 100755 --- a/tools/run_tests/helper_scripts/pre_build_node.sh +++ b/tools/run_tests/helper_scripts/pre_build_node.sh @@ -35,10 +35,12 @@ source ~/.nvm/nvm.sh nvm install $NODE_VERSION set -ex +# Update npm to at least version 5 +npm update -g npm + export GRPC_CONFIG=${CONFIG:-opt} -# Expire cache after 1 day -npm update --cache-min 86400 +npm update --prefer-online npm install node-gyp-install ./node_modules/.bin/node-gyp-install -- cgit v1.2.3 From 4bea5b9866412c181c16cac119c314910a701c20 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 30 May 2017 17:37:02 -0700 Subject: Run tests on Node 8 by default, add Node 7 to portability suite --- tools/run_tests/run_tests.py | 7 ++++--- tools/run_tests/run_tests_matrix.py | 9 +++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 568774cece..266d31bf89 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -431,10 +431,11 @@ class NodeLanguage(object): # we should specify in the compiler argument _check_compiler(self.args.compiler, ['default', 'node0.12', 'node4', 'node5', 'node6', - 'node7', 'electron1.3', 'electron1.6']) + 'node7', 'node8', + 'electron1.3', 'electron1.6']) if self.args.compiler == 'default': self.runtime = 'node' - self.node_version = '7' + self.node_version = '8' else: if self.args.compiler.startswith('electron'): self.runtime = 'electron' @@ -1173,7 +1174,7 @@ argp.add_argument('--compiler', 'clang3.4', 'clang3.5', 'clang3.6', 'clang3.7', 'vs2013', 'vs2015', 'python2.7', 'python3.4', 'python3.5', 'python3.6', 'pypy', 'pypy3', 'python_alpine', - 'node0.12', 'node4', 'node5', 'node6', 'node7', + 'node0.12', 'node4', 'node5', 'node6', 'node7', 'node8', 'electron1.3', 'electron1.6', 'coreclr', 'cmake'], diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index 84551d9394..32b9d5676d 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -309,6 +309,15 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) extra_args=extra_args, inner_jobs=inner_jobs) + test_jobs += _generate_jobs(languages=['node'], + configs=['dbg'], + platforms=['linux'], + arch='default', + compiler='node7', + labels=['portability'], + extra_args=extra_args, + inner_jobs=inner_jobs) + return test_jobs -- cgit v1.2.3 From 9d56717be4fa5d0c05e42bb1137b30ef121960d8 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 26 May 2017 14:19:23 -0700 Subject: throw if server started with unbound ports --- src/csharp/Grpc.Core/Server.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Core/Server.cs b/src/csharp/Grpc.Core/Server.cs index 63c1d9cd00..7ba204a0b6 100644 --- a/src/csharp/Grpc.Core/Server.cs +++ b/src/csharp/Grpc.Core/Server.cs @@ -34,6 +34,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading.Tasks; using Grpc.Core.Internal; @@ -155,6 +156,7 @@ namespace Grpc.Core /// /// Starts the server. + /// Throws IOException if not successful. /// public void Start() { @@ -163,7 +165,8 @@ namespace Grpc.Core GrpcPreconditions.CheckState(!startRequested); GrpcPreconditions.CheckState(!shutdownRequested); startRequested = true; - + + CheckPortsBoundSuccessfully(); handle.Start(); for (int i = 0; i < requestCallTokensPerCq; i++) @@ -316,6 +319,20 @@ namespace Grpc.Core } } + /// + /// Checks that all ports have been bound successfully. + /// + private void CheckPortsBoundSuccessfully() + { + lock (myLock) + { + if (!ports.All((port) => port.BoundPort != 0)) + { + throw new IOException("Failed to bind some of ports exposed by the server."); + } + } + } + private void DisposeHandle() { var activeCallCount = activeCallCounter.Count; -- cgit v1.2.3 From 67206428a41124abcde3798fa39728064ef59ff8 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 26 May 2017 14:28:39 -0700 Subject: add StartThrowsWithUnboundPortTest --- src/csharp/Grpc.Core.Tests/ServerTest.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/csharp/Grpc.Core.Tests/ServerTest.cs b/src/csharp/Grpc.Core.Tests/ServerTest.cs index 3b51aa6330..5e95ed9ea6 100644 --- a/src/csharp/Grpc.Core.Tests/ServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ServerTest.cs @@ -32,6 +32,7 @@ #endregion using System; +using System.IO; using System.Linq; using Grpc.Core; using Grpc.Core.Internal; @@ -80,6 +81,21 @@ namespace Grpc.Core.Tests server.ShutdownAsync().Wait(); } + [Test] + public void StartThrowsWithUnboundPorts() + { + int twiceBoundPort = 9999; + Server server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) }) + { + Ports = { + new ServerPort("localhost", twiceBoundPort, ServerCredentials.Insecure), + new ServerPort("localhost", twiceBoundPort, ServerCredentials.Insecure) + } + }; + Assert.Throws(typeof(IOException), () => server.Start()); + server.ShutdownAsync().Wait(); + } + [Test] public void CannotModifyAfterStarted() { -- cgit v1.2.3 From feb99b215ed821ce756b674a61b069b2e7342d10 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 31 May 2017 15:52:29 -0700 Subject: Node artifacts: don't do testpackage --- tools/run_tests/artifacts/build_artifact_node.bat | 4 ++-- tools/run_tests/artifacts/build_artifact_node.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/run_tests/artifacts/build_artifact_node.bat b/tools/run_tests/artifacts/build_artifact_node.bat index c2738619b3..f540ef5abe 100644 --- a/tools/run_tests/artifacts/build_artifact_node.bat +++ b/tools/run_tests/artifacts/build_artifact_node.bat @@ -45,13 +45,13 @@ for %%v in (%node_versions%) do ( @rem Try again after removing openssl headers rmdir "%HOMEDRIVE%%HOMEPATH%\.node-gyp\%%v\include\node\openssl" /S /Q rmdir "%HOMEDRIVE%%HOMEPATH%\.node-gyp\iojs-%%v\include\node\openssl" /S /Q - call .\node_modules\.bin\node-pre-gyp.cmd build package testpackage --target=%%v --target_arch=%1 || goto :error + call .\node_modules\.bin\node-pre-gyp.cmd build package --target=%%v --target_arch=%1 || goto :error xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error ) for %%v in (%electron_versions%) do ( - cmd /V /C "set "HOME=%HOMEDRIVE%%HOMEPATH%\electron-gyp" && call .\node_modules\.bin\node-pre-gyp.cmd configure rebuild package testpackage --runtime=electron --target=%%v --target_arch=%1 --disturl=https://atom.io/download/electron" || goto :error + cmd /V /C "set "HOME=%HOMEDRIVE%%HOMEPATH%\electron-gyp" && call .\node_modules\.bin\node-pre-gyp.cmd configure rebuild package --runtime=electron --target=%%v --target_arch=%1 --disturl=https://atom.io/download/electron" || goto :error xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error ) diff --git a/tools/run_tests/artifacts/build_artifact_node.sh b/tools/run_tests/artifacts/build_artifact_node.sh index 4d2f87838e..e5e36903eb 100755 --- a/tools/run_tests/artifacts/build_artifact_node.sh +++ b/tools/run_tests/artifacts/build_artifact_node.sh @@ -48,12 +48,12 @@ electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 ) for version in ${node_versions[@]} do - ./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --target=$version --target_arch=$NODE_TARGET_ARCH --grpc_alpine=true + ./node_modules/.bin/node-pre-gyp configure rebuild package --target=$version --target_arch=$NODE_TARGET_ARCH --grpc_alpine=true cp -r build/stage/* "${ARTIFACTS_OUT}"/ done for version in ${electron_versions[@]} do - HOME=~/.electron-gyp ./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --runtime=electron --target=$version --target_arch=$NODE_TARGET_ARCH --disturl=https://atom.io/download/electron + HOME=~/.electron-gyp ./node_modules/.bin/node-pre-gyp configure rebuild package --runtime=electron --target=$version --target_arch=$NODE_TARGET_ARCH --disturl=https://atom.io/download/electron cp -r build/stage/* "${ARTIFACTS_OUT}"/ done -- cgit v1.2.3 From bc54144b2e7526defe28db98cfcf079387c44da7 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Thu, 1 Jun 2017 03:22:15 -0700 Subject: PHP: windows config.w32 fix --- config.w32 | 129 ++++++++++++++++++++++++++ src/php/ext/grpc/version.h | 2 +- templates/config.w32.template | 36 +++++++ templates/src/php/ext/grpc/version.h.template | 2 +- 4 files changed, 167 insertions(+), 2 deletions(-) diff --git a/config.w32 b/config.w32 index 7c407e848a..c9f30d655a 100644 --- a/config.w32 +++ b/config.w32 @@ -640,4 +640,133 @@ if (PHP_GRPC != "no") { "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+ "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ "/I"+configure_module_dirname+"\\third_party\\zlib"); + + base_dir = get_define('BUILD_DIR'); + FSO.CreateFolder(base_dir+"\\ext"); + FSO.CreateFolder(base_dir+"\\ext\\grpc"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\boringssl"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\census"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\census\\gen"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\pick_first"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\round_robin"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\dns"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\dns\\c_ares"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\dns\\native"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\sockaddr"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\deadline"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\http"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\http\\client"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\http\\message_compress"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\http\\server"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\load_reporting"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\max_age"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\message_size"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\workarounds"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\alpn"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\client"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\client\\insecure"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\client\\secure"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\server"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\server\\insecure"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\server\\secure"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\transport"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\channel"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\compression"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\debug"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\http"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\iomgr"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\json"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\profiling"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\context"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\composite"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\fake"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\google_default"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\iam"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\jwt"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\oauth2"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\plugin"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\ssl"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\transport"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\util"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\slice"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\support"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\surface"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\transport"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\plugin_registry"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\tsi"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\php"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\php\\ext"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\php\\ext\\grpc"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\aes"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\asn1"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\base64"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\bio"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\bn"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\bn\\asm"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\buf"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\bytestring"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\chacha"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\cipher"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\cmac"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\conf"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\curve25519"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\des"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\dh"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\digest"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\dsa"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\ec"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\ecdh"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\ecdsa"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\engine"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\err"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\evp"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\hkdf"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\hmac"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\lhash"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\md4"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\md5"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\modes"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\newhope"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\obj"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\pem"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\pkcs8"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\poly1305"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\rand"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\rc4"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\rsa"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\sha"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\stack"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\x509"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\x509v3"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\ssl"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\nanopb"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\zlib"); + _build_dirs = new Array(); + for (i = 0; i < build_dirs.length; i++) { + if (build_dirs[i].indexOf('grpc') == -1) { + _build_dirs[_build_dirs.length] = build_dirs[i]; + } + } + build_dirs = _build_dirs; + } diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 993ef2de27..0d5d36d9cf 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -35,6 +35,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.4.0" +#define PHP_GRPC_VERSION "1.4.0RC1" #endif /* VERSION_H */ diff --git a/templates/config.w32.template b/templates/config.w32.template index c822eae097..4edef963f2 100644 --- a/templates/config.w32.template +++ b/templates/config.w32.template @@ -28,4 +28,40 @@ "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+ "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ "/I"+configure_module_dirname+"\\third_party\\zlib"); + <% + dirs = {} + for lib in libs: + if lib.name in php_config_m4.get('deps', []) and lib.name != 'ares': + for source in lib.src: + tmp = source + prev = '' + while (True): + idx = tmp.find('/'); + if (idx == -1): + break + dirs[prev + '\\\\' + tmp[:idx]] = 1 + prev += ('\\\\' + tmp[:idx]); + tmp = tmp[idx+1:] + + dirs['\\\\src'] = 1; + dirs['\\\\src\\\\php'] = 1; + dirs['\\\\src\\\\php\\\\ext'] = 1; + dirs['\\\\src\\\\php\\\\ext\\\\grpc'] = 1; + dirs = dirs.keys() + dirs.sort() + %> + base_dir = get_define('BUILD_DIR'); + FSO.CreateFolder(base_dir+"\\ext"); + FSO.CreateFolder(base_dir+"\\ext\\grpc"); + % for dir in dirs: + FSO.CreateFolder(base_dir+"\\ext\\grpc${dir}"); + % endfor + _build_dirs = new Array(); + for (i = 0; i < build_dirs.length; i++) { + if (build_dirs[i].indexOf('grpc') == -1) { + _build_dirs[_build_dirs.length] = build_dirs[i]; + } + } + build_dirs = _build_dirs; + } diff --git a/templates/src/php/ext/grpc/version.h.template b/templates/src/php/ext/grpc/version.h.template index 828ea69296..10977a83c2 100644 --- a/templates/src/php/ext/grpc/version.h.template +++ b/templates/src/php/ext/grpc/version.h.template @@ -37,6 +37,6 @@ #ifndef VERSION_H #define VERSION_H - #define PHP_GRPC_VERSION "${settings.php_version.php_composer()}" + #define PHP_GRPC_VERSION "${settings.php_version.php()}" #endif /* VERSION_H */ -- cgit v1.2.3 From c4096469299bb9d417b7a3ebacea1dbfd31ed34f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 1 Jun 2017 21:56:24 +0200 Subject: improve exception message --- src/csharp/Grpc.Core/Server.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/csharp/Grpc.Core/Server.cs b/src/csharp/Grpc.Core/Server.cs index 7ba204a0b6..1fb5c62c8f 100644 --- a/src/csharp/Grpc.Core/Server.cs +++ b/src/csharp/Grpc.Core/Server.cs @@ -326,9 +326,11 @@ namespace Grpc.Core { lock (myLock) { - if (!ports.All((port) => port.BoundPort != 0)) + var unboundPort = ports.FirstOrDefault(port => port.BoundPort == 0); + if (unboundPort != null) { - throw new IOException("Failed to bind some of ports exposed by the server."); + throw new IOException( + string.Format("Failed to bind port \"{0}:{1}\"", unboundPort.Host, unboundPort.Port)); } } } -- cgit v1.2.3 From f5083fe3e3f49631fbb5e3cfb06d9273b270c263 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 1 Jun 2017 14:11:09 -0700 Subject: Update npm when building Node artifacts --- tools/run_tests/artifacts/build_artifact_node.bat | 2 ++ tools/run_tests/artifacts/build_artifact_node.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tools/run_tests/artifacts/build_artifact_node.bat b/tools/run_tests/artifacts/build_artifact_node.bat index f540ef5abe..72c59a96d3 100644 --- a/tools/run_tests/artifacts/build_artifact_node.bat +++ b/tools/run_tests/artifacts/build_artifact_node.bat @@ -35,6 +35,8 @@ set PATH=%PATH%;C:\Program Files\nodejs\;%APPDATA%\npm del /f /q BUILD || rmdir build /s /q +call npm update -g npm + call npm update || goto :error mkdir -p %ARTIFACTS_OUT% diff --git a/tools/run_tests/artifacts/build_artifact_node.sh b/tools/run_tests/artifacts/build_artifact_node.sh index e5e36903eb..8061c62a59 100755 --- a/tools/run_tests/artifacts/build_artifact_node.sh +++ b/tools/run_tests/artifacts/build_artifact_node.sh @@ -34,6 +34,8 @@ source ~/.nvm/nvm.sh nvm use 4 set -ex +npm update -g npm + cd $(dirname $0)/../../.. rm -rf build || true -- cgit v1.2.3 From da83f0d439cbba013121bf1d5fbcd36364462c37 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 5 Jun 2017 13:46:22 -0700 Subject: Fix minor error in Node generated documentation --- src/node/src/grpc_extension.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/node/src/grpc_extension.js b/src/node/src/grpc_extension.js index 864da97314..8c374e50b3 100644 --- a/src/node/src/grpc_extension.js +++ b/src/node/src/grpc_extension.js @@ -31,6 +31,13 @@ * */ +/** + * @module + * @private + */ + +'use strict'; + var binary = require('node-pre-gyp/lib/pre-binding'); var path = require('path'); var binding_path = -- cgit v1.2.3 From 44c16d31d3d13eff96b8e35010f398d4a634a9dc Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 6 Jun 2017 10:40:10 -0700 Subject: Undo updating npm in node artifact builds --- tools/run_tests/artifacts/build_artifact_node.bat | 2 -- tools/run_tests/artifacts/build_artifact_node.sh | 2 -- 2 files changed, 4 deletions(-) diff --git a/tools/run_tests/artifacts/build_artifact_node.bat b/tools/run_tests/artifacts/build_artifact_node.bat index 72c59a96d3..f540ef5abe 100644 --- a/tools/run_tests/artifacts/build_artifact_node.bat +++ b/tools/run_tests/artifacts/build_artifact_node.bat @@ -35,8 +35,6 @@ set PATH=%PATH%;C:\Program Files\nodejs\;%APPDATA%\npm del /f /q BUILD || rmdir build /s /q -call npm update -g npm - call npm update || goto :error mkdir -p %ARTIFACTS_OUT% diff --git a/tools/run_tests/artifacts/build_artifact_node.sh b/tools/run_tests/artifacts/build_artifact_node.sh index 8061c62a59..e5e36903eb 100755 --- a/tools/run_tests/artifacts/build_artifact_node.sh +++ b/tools/run_tests/artifacts/build_artifact_node.sh @@ -34,8 +34,6 @@ source ~/.nvm/nvm.sh nvm use 4 set -ex -npm update -g npm - cd $(dirname $0)/../../.. rm -rf build || true -- cgit v1.2.3 From 06eb057eb76d62ca6ee0987b9b2fae1befbff78a Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 8 Jun 2017 18:21:09 +0200 Subject: add grpc_slice_unref to fix leaks --- src/csharp/ext/grpc_csharp_ext.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index a56113eca3..8cde8ff0c0 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -413,8 +413,14 @@ GPR_EXPORT grpc_call *GPR_CALLTYPE grpcsharp_channel_create_call( host_slice = grpc_slice_from_copied_string(host); host_slice_ptr = &host_slice; } - return grpc_channel_create_call(channel, parent_call, propagation_mask, cq, - method_slice, host_slice_ptr, deadline, NULL); + grpc_call *ret = + grpc_channel_create_call(channel, parent_call, propagation_mask, cq, + method_slice, host_slice_ptr, deadline, NULL); + grpc_slice_unref(method_slice); + if (host != NULL) { + grpc_slice_unref(host_slice); + } + return ret; } GPR_EXPORT grpc_connectivity_state GPR_CALLTYPE @@ -805,7 +811,9 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server( ops[nops].reserved = NULL; nops++; } - return grpcsharp_call_start_batch(call, ops, nops, ctx, NULL); + grpc_call_error ret = grpcsharp_call_start_batch(call, ops, nops, ctx, NULL); + grpc_slice_unref(status_details_slice); + return ret; } GPR_EXPORT grpc_call_error GPR_CALLTYPE -- cgit v1.2.3 From 969b46ef73780baffc4aebff4f0fb9901d0aa191 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 8 Jun 2017 14:57:11 -0700 Subject: Add rich closure debug mode --- doc/core/grpc-error.md | 6 +- src/core/ext/census/grpc_filter.c | 2 +- .../filters/client_channel/channel_connectivity.c | 6 +- .../ext/filters/client_channel/client_channel.c | 62 +++++++------- .../client_channel/http_connect_handshaker.c | 10 +-- src/core/ext/filters/client_channel/lb_policy.c | 2 +- .../grpclb/client_load_reporting_filter.c | 8 +- .../client_channel/lb_policy/grpclb/grpclb.c | 38 ++++----- .../lb_policy/pick_first/pick_first.c | 14 ++-- .../lb_policy/round_robin/round_robin.c | 14 ++-- .../resolver/dns/c_ares/dns_resolver_ares.c | 8 +- .../dns/c_ares/grpc_ares_ev_driver_posix.c | 4 +- .../resolver/dns/c_ares/grpc_ares_wrapper.c | 10 +-- .../resolver/dns/native/dns_resolver.c | 8 +- .../client_channel/resolver/fake/fake_resolver.c | 8 +- .../resolver/sockaddr/sockaddr_resolver.c | 4 +- src/core/ext/filters/client_channel/subchannel.c | 12 +-- src/core/ext/filters/deadline/deadline_filter.c | 14 ++-- .../ext/filters/http/client/http_client_filter.c | 14 ++-- .../message_compress/message_compress_filter.c | 4 +- .../ext/filters/http/server/http_server_filter.c | 14 ++-- .../filters/load_reporting/load_reporting_filter.c | 2 +- src/core/ext/filters/max_age/max_age_filter.c | 18 ++-- .../ext/filters/message_size/message_size_filter.c | 4 +- .../workaround_cronet_compression_filter.c | 4 +- .../ext/transport/chttp2/client/chttp2_connector.c | 6 +- .../ext/transport/chttp2/server/chttp2_server.c | 2 +- .../transport/chttp2/transport/chttp2_transport.c | 98 +++++++++++----------- .../ext/transport/chttp2/transport/frame_data.c | 2 +- .../ext/transport/chttp2/transport/hpack_parser.c | 4 +- src/core/ext/transport/chttp2/transport/writing.c | 2 +- .../transport/cronet/transport/cronet_transport.c | 34 ++++---- src/core/lib/channel/channel_stack.h | 2 +- src/core/lib/channel/handshaker.c | 8 +- src/core/lib/http/httpcli.c | 10 +-- src/core/lib/http/httpcli_security_connector.c | 2 +- src/core/lib/iomgr/closure.c | 54 +++++++++++- src/core/lib/iomgr/closure.h | 60 ++++++++++++- src/core/lib/iomgr/combiner.c | 12 +-- src/core/lib/iomgr/error.h | 2 +- src/core/lib/iomgr/ev_epoll1_linux.c | 4 +- .../lib/iomgr/ev_epoll_limited_pollers_linux.c | 4 +- src/core/lib/iomgr/ev_epoll_thread_pool_linux.c | 4 +- src/core/lib/iomgr/ev_epollex_linux.c | 10 +-- src/core/lib/iomgr/ev_epollsig_linux.c | 4 +- src/core/lib/iomgr/ev_poll_posix.c | 16 ++-- src/core/lib/iomgr/exec_ctx.c | 4 +- src/core/lib/iomgr/executor.c | 2 +- src/core/lib/iomgr/lockfree_event.c | 8 +- src/core/lib/iomgr/pollset_uv.c | 2 +- src/core/lib/iomgr/pollset_windows.c | 4 +- src/core/lib/iomgr/resolve_address_posix.c | 6 +- src/core/lib/iomgr/resolve_address_uv.c | 6 +- src/core/lib/iomgr/resolve_address_windows.c | 6 +- src/core/lib/iomgr/resource_quota.c | 56 ++++++------- src/core/lib/iomgr/socket_windows.c | 4 +- src/core/lib/iomgr/tcp_client_posix.c | 14 ++-- src/core/lib/iomgr/tcp_client_uv.c | 4 +- src/core/lib/iomgr/tcp_client_windows.c | 8 +- src/core/lib/iomgr/tcp_posix.c | 14 ++-- src/core/lib/iomgr/tcp_server_posix.c | 10 +-- src/core/lib/iomgr/tcp_server_uv.c | 4 +- src/core/lib/iomgr/tcp_server_windows.c | 8 +- src/core/lib/iomgr/tcp_uv.c | 10 +-- src/core/lib/iomgr/tcp_windows.c | 20 ++--- src/core/lib/iomgr/timer_generic.c | 8 +- src/core/lib/iomgr/timer_uv.c | 6 +- src/core/lib/iomgr/udp_server.c | 12 +-- .../security/credentials/fake/fake_credentials.c | 4 +- .../google_default/google_default_credentials.c | 4 +- .../lib/security/credentials/jwt/jwt_verifier.c | 6 +- .../credentials/oauth2/oauth2_credentials.c | 4 +- src/core/lib/security/transport/secure_endpoint.c | 6 +- .../lib/security/transport/security_connector.c | 8 +- .../lib/security/transport/security_handshaker.c | 12 +-- .../lib/security/transport/server_auth_filter.c | 8 +- src/core/lib/surface/alarm.c | 2 +- src/core/lib/surface/call.c | 20 ++--- src/core/lib/surface/channel_ping.c | 2 +- src/core/lib/surface/completion_queue.c | 6 +- src/core/lib/surface/lame_client.cc | 8 +- src/core/lib/surface/server.c | 38 ++++----- src/core/lib/transport/connectivity_state.c | 10 +-- src/core/lib/transport/transport.c | 18 ++-- test/core/bad_client/bad_client.c | 4 +- .../resolvers/dns_resolver_connectivity_test.c | 10 +-- .../client_channel/resolvers/fake_resolver_test.c | 4 +- .../resolvers/sockaddr_resolver_test.c | 2 +- test/core/end2end/bad_server_response_test.c | 4 +- test/core/end2end/fixtures/http_proxy_fixture.c | 16 ++-- test/core/end2end/fuzzers/api_fuzzer.c | 16 ++-- test/core/end2end/goaway_server_test.c | 4 +- test/core/end2end/tests/filter_causes_close.c | 4 +- test/core/http/httpcli_test.c | 6 +- test/core/http/httpscli_test.c | 6 +- test/core/iomgr/combiner_test.c | 20 ++--- test/core/iomgr/endpoint_pair_test.c | 2 +- test/core/iomgr/endpoint_tests.c | 10 +-- test/core/iomgr/ev_epollsig_linux_test.c | 6 +- test/core/iomgr/fd_posix_test.c | 12 +-- test/core/iomgr/pollset_set_test.c | 4 +- test/core/iomgr/resolve_address_posix_test.c | 6 +- test/core/iomgr/resolve_address_test.c | 18 ++-- test/core/iomgr/resource_quota_test.c | 10 +-- test/core/iomgr/tcp_client_posix_test.c | 6 +- test/core/iomgr/tcp_client_uv_test.c | 6 +- test/core/iomgr/tcp_posix_test.c | 12 +-- test/core/iomgr/tcp_server_posix_test.c | 4 +- test/core/iomgr/tcp_server_uv_test.c | 4 +- test/core/iomgr/timer_list_test.c | 14 ++-- test/core/iomgr/udp_server_test.c | 2 +- test/core/security/credentials_test.c | 12 +-- test/core/security/jwt_verifier_test.c | 10 +-- test/core/security/oauth2_utils.c | 2 +- test/core/security/secure_endpoint_test.c | 4 +- test/core/surface/concurrent_connectivity_test.c | 2 +- test/core/surface/lame_client_test.c | 4 +- test/core/transport/connectivity_state_test.c | 6 +- test/core/util/mock_endpoint.c | 8 +- test/core/util/passthru_endpoint.c | 12 +-- test/core/util/port_server_client.c | 10 +-- test/core/util/test_tcp_server.c | 6 +- test/core/util/trickle_endpoint.c | 4 +- test/cpp/microbenchmarks/bm_call_create.cc | 14 ++-- test/cpp/microbenchmarks/bm_chttp2_transport.cc | 24 +++--- test/cpp/microbenchmarks/bm_closure.cc | 92 ++++++++++---------- test/cpp/microbenchmarks/bm_cq_multiple_threads.cc | 2 +- test/cpp/microbenchmarks/bm_pollset.cc | 10 +-- 128 files changed, 771 insertions(+), 665 deletions(-) diff --git a/doc/core/grpc-error.md b/doc/core/grpc-error.md index c05d1dd909..49a95b353c 100644 --- a/doc/core/grpc-error.md +++ b/doc/core/grpc-error.md @@ -83,12 +83,12 @@ c->cb(exec_ctx, c->cb_arg, err); The caller is still responsible for unref-ing the error. However, the above line is currently being phased out! It is safer to invoke -callbacks with `grpc_closure_run` and `grpc_closure_sched`. These functions are +callbacks with `GRPC_CLOSURE_RUN` and `GRPC_CLOSURE_SCHED`. These functions are not callbacks, so they will take ownership of the error passed to them. ```C grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Some error occured"); -grpc_closure_run(exec_ctx, cb, error); +GRPC_CLOSURE_RUN(exec_ctx, cb, error); // current function no longer has ownership of the error ``` @@ -97,7 +97,7 @@ you must explicitly take a reference. ```C grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Some error occured"); -grpc_closure_run(exec_ctx, cb, GRPC_ERROR_REF(error)); +GRPC_CLOSURE_RUN(exec_ctx, cb, GRPC_ERROR_REF(error)); // do some other things with the error GRPC_ERROR_UNREF(error); ``` diff --git a/src/core/ext/census/grpc_filter.c b/src/core/ext/census/grpc_filter.c index 1e805e33e0..13fe2e6b1c 100644 --- a/src/core/ext/census/grpc_filter.c +++ b/src/core/ext/census/grpc_filter.c @@ -141,7 +141,7 @@ static grpc_error *server_init_call_elem(grpc_exec_ctx *exec_ctx, memset(d, 0, sizeof(*d)); d->start_ts = args->start_time; /* TODO(hongyu): call census_tracing_start_op here. */ - grpc_closure_init(&d->finish_recv, server_on_done_recv, elem, + GRPC_CLOSURE_INIT(&d->finish_recv, server_on_done_recv, elem, grpc_schedule_on_exec_ctx); return GRPC_ERROR_NONE; } diff --git a/src/core/ext/filters/client_channel/channel_connectivity.c b/src/core/ext/filters/client_channel/channel_connectivity.c index 2e99257cd9..c3dca14305 100644 --- a/src/core/ext/filters/client_channel/channel_connectivity.c +++ b/src/core/ext/filters/client_channel/channel_connectivity.c @@ -211,9 +211,9 @@ void grpc_channel_watch_connectivity_state( grpc_cq_begin_op(cq, tag); gpr_mu_init(&w->mu); - grpc_closure_init(&w->on_complete, watch_complete, w, + GRPC_CLOSURE_INIT(&w->on_complete, watch_complete, w, grpc_schedule_on_exec_ctx); - grpc_closure_init(&w->on_timeout, timeout_complete, w, + GRPC_CLOSURE_INIT(&w->on_timeout, timeout_complete, w, grpc_schedule_on_exec_ctx); w->phase = WAITING; w->state = last_observed_state; @@ -225,7 +225,7 @@ void grpc_channel_watch_connectivity_state( watcher_timer_init_arg *wa = gpr_malloc(sizeof(watcher_timer_init_arg)); wa->w = w; wa->deadline = deadline; - grpc_closure_init(&w->watcher_timer_init, watcher_timer_init, wa, + GRPC_CLOSURE_INIT(&w->watcher_timer_init, watcher_timer_init, wa, grpc_schedule_on_exec_ctx); if (client_channel_elem->filter == &grpc_client_channel_filter) { diff --git a/src/core/ext/filters/client_channel/client_channel.c b/src/core/ext/filters/client_channel/client_channel.c index 3ec539884b..f29c5d55ed 100644 --- a/src/core/ext/filters/client_channel/client_channel.c +++ b/src/core/ext/filters/client_channel/client_channel.c @@ -275,7 +275,7 @@ static void watch_lb_policy_locked(grpc_exec_ctx *exec_ctx, channel_data *chand, GRPC_CHANNEL_STACK_REF(chand->owning_stack, "watch_lb_policy"); w->chand = chand; - grpc_closure_init(&w->on_changed, on_lb_policy_state_changed_locked, w, + GRPC_CLOSURE_INIT(&w->on_changed, on_lb_policy_state_changed_locked, w, grpc_combiner_scheduler(chand->combiner)); w->state = current_state; w->lb_policy = lb_policy; @@ -364,7 +364,7 @@ static void wrapped_on_pick_closure_cb(grpc_exec_ctx *exec_ctx, void *arg, GPR_ASSERT(wc_arg != NULL); GPR_ASSERT(wc_arg->wrapped_closure != NULL); GPR_ASSERT(wc_arg->lb_policy != NULL); - grpc_closure_run(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_RUN(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error)); GRPC_LB_POLICY_UNREF(exec_ctx, wc_arg->lb_policy, "pick_subchannel_wrapping"); gpr_free(wc_arg); } @@ -506,12 +506,12 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, } chand->method_params_table = method_params_table; if (lb_policy != NULL) { - grpc_closure_list_sched(exec_ctx, &chand->waiting_for_config_closures); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, &chand->waiting_for_config_closures); } else if (chand->resolver == NULL /* disconnected */) { grpc_closure_list_fail_all(&chand->waiting_for_config_closures, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Channel disconnected", &error, 1)); - grpc_closure_list_sched(exec_ctx, &chand->waiting_for_config_closures); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, &chand->waiting_for_config_closures); } if (!lb_policy_updated && lb_policy != NULL && chand->exit_idle_when_lb_policy_arrives) { @@ -583,7 +583,7 @@ static void start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg, if (op->send_ping != NULL) { if (chand->lb_policy == NULL) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, op->send_ping, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Ping with no load balancing")); } else { @@ -604,7 +604,7 @@ static void start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg, if (!chand->started_resolving) { grpc_closure_list_fail_all(&chand->waiting_for_config_closures, GRPC_ERROR_REF(op->disconnect_with_error)); - grpc_closure_list_sched(exec_ctx, &chand->waiting_for_config_closures); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, &chand->waiting_for_config_closures); } if (chand->lb_policy != NULL) { grpc_pollset_set_del_pollset_set(exec_ctx, @@ -618,7 +618,7 @@ static void start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg, } GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "start_transport_op"); - grpc_closure_sched(exec_ctx, op->on_consumed, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, op->on_consumed, GRPC_ERROR_NONE); } static void cc_start_transport_op(grpc_exec_ctx *exec_ctx, @@ -634,9 +634,9 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx, op->handler_private.extra_arg = elem; GRPC_CHANNEL_STACK_REF(chand->owning_stack, "start_transport_op"); - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, - grpc_closure_init(&op->handler_private.closure, start_transport_op_locked, + GRPC_CLOSURE_INIT(&op->handler_private.closure, start_transport_op_locked, op, grpc_combiner_scheduler(chand->combiner)), GRPC_ERROR_NONE); } @@ -677,7 +677,7 @@ static grpc_error *cc_init_channel_elem(grpc_exec_ctx *exec_ctx, gpr_mu_unlock(&chand->external_connectivity_watcher_list_mu); chand->owning_stack = args->channel_stack; - grpc_closure_init(&chand->on_resolver_result_changed, + GRPC_CLOSURE_INIT(&chand->on_resolver_result_changed, on_resolver_result_changed_locked, chand, grpc_combiner_scheduler(chand->combiner)); chand->interested_parties = grpc_pollset_set_create(); @@ -737,8 +737,8 @@ static void cc_destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) { channel_data *chand = elem->channel_data; if (chand->resolver != NULL) { - grpc_closure_sched( - exec_ctx, grpc_closure_create(shutdown_resolver_locked, chand->resolver, + GRPC_CLOSURE_SCHED( + exec_ctx, GRPC_CLOSURE_CREATE(shutdown_resolver_locked, chand->resolver, grpc_combiner_scheduler(chand->combiner)), GRPC_ERROR_NONE); } @@ -1038,13 +1038,13 @@ static void continue_picking_locked(grpc_exec_ctx *exec_ctx, void *arg, if (cpa->connected_subchannel == NULL) { /* cancelled, do nothing */ } else if (error != GRPC_ERROR_NONE) { - grpc_closure_sched(exec_ctx, cpa->on_ready, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, cpa->on_ready, GRPC_ERROR_REF(error)); } else { if (pick_subchannel_locked(exec_ctx, cpa->elem, cpa->initial_metadata, cpa->initial_metadata_flags, cpa->connected_subchannel, cpa->subchannel_call_context, cpa->on_ready)) { - grpc_closure_sched(exec_ctx, cpa->on_ready, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, cpa->on_ready, GRPC_ERROR_NONE); } } gpr_free(cpa); @@ -1064,7 +1064,7 @@ static void cancel_pick_locked(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, continue_picking_args *cpa = closure->cb_arg; if (cpa->connected_subchannel == &calld->connected_subchannel) { cpa->connected_subchannel = NULL; - grpc_closure_sched(exec_ctx, cpa->on_ready, + GRPC_CLOSURE_SCHED(exec_ctx, cpa->on_ready, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Pick cancelled", &error, 1)); } @@ -1113,7 +1113,7 @@ static bool pick_subchannel_locked( // the LB policy for the duration of the pick. wrapped_on_pick_closure_arg *w_on_pick_arg = gpr_zalloc(sizeof(*w_on_pick_arg)); - grpc_closure_init(&w_on_pick_arg->wrapper_closure, + GRPC_CLOSURE_INIT(&w_on_pick_arg->wrapper_closure, wrapped_on_pick_closure_cb, w_on_pick_arg, grpc_schedule_on_exec_ctx); w_on_pick_arg->wrapped_closure = on_ready; @@ -1147,12 +1147,12 @@ static bool pick_subchannel_locked( cpa->subchannel_call_context = subchannel_call_context; cpa->on_ready = on_ready; cpa->elem = elem; - grpc_closure_init(&cpa->closure, continue_picking_locked, cpa, + GRPC_CLOSURE_INIT(&cpa->closure, continue_picking_locked, cpa, grpc_combiner_scheduler(chand->combiner)); grpc_closure_list_append(&chand->waiting_for_config_closures, &cpa->closure, GRPC_ERROR_NONE); } else { - grpc_closure_sched(exec_ctx, on_ready, + GRPC_CLOSURE_SCHED(exec_ctx, on_ready, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected")); } @@ -1202,7 +1202,7 @@ static void start_transport_stream_op_batch_locked_inner( if (!calld->pick_pending && calld->connected_subchannel == NULL && op->send_initial_metadata) { calld->pick_pending = true; - grpc_closure_init(&calld->next_step, subchannel_ready_locked, elem, + GRPC_CLOSURE_INIT(&calld->next_step, subchannel_ready_locked, elem, grpc_combiner_scheduler(chand->combiner)); GRPC_CALL_STACK_REF(calld->owning_call, "pick_subchannel"); /* If a subchannel is not available immediately, the polling entity from @@ -1275,7 +1275,7 @@ static void on_complete(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { calld->retry_throttle_data); } } - grpc_closure_run(exec_ctx, calld->original_on_complete, + GRPC_CLOSURE_RUN(exec_ctx, calld->original_on_complete, GRPC_ERROR_REF(error)); } @@ -1291,7 +1291,7 @@ static void start_transport_stream_op_batch_locked(grpc_exec_ctx *exec_ctx, if (op->recv_trailing_metadata) { GPR_ASSERT(op->on_complete != NULL); calld->original_on_complete = op->on_complete; - grpc_closure_init(&calld->on_complete, on_complete, elem, + GRPC_CLOSURE_INIT(&calld->on_complete, on_complete, elem, grpc_schedule_on_exec_ctx); op->on_complete = &calld->on_complete; } @@ -1340,8 +1340,8 @@ static void cc_start_transport_stream_op_batch( /* we failed; lock and figure out what to do */ GRPC_CALL_STACK_REF(calld->owning_call, "start_transport_stream_op_batch"); op->handler_private.extra_arg = elem; - grpc_closure_sched( - exec_ctx, grpc_closure_init(&op->handler_private.closure, + GRPC_CLOSURE_SCHED( + exec_ctx, GRPC_CLOSURE_INIT(&op->handler_private.closure, start_transport_stream_op_batch_locked, op, grpc_combiner_scheduler(chand->combiner)), GRPC_ERROR_NONE); @@ -1402,7 +1402,7 @@ static void cc_destroy_call_elem(grpc_exec_ctx *exec_ctx, } } gpr_free(calld->waiting_ops); - grpc_closure_sched(exec_ctx, then_schedule_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, then_schedule_closure, GRPC_ERROR_NONE); } static void cc_set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx, @@ -1456,8 +1456,8 @@ grpc_connectivity_state grpc_client_channel_check_connectivity_state( grpc_connectivity_state_check(&chand->state_tracker); if (out == GRPC_CHANNEL_IDLE && try_to_connect) { GRPC_CHANNEL_STACK_REF(chand->owning_stack, "try_to_connect"); - grpc_closure_sched( - exec_ctx, grpc_closure_create(try_to_connect_locked, chand, + GRPC_CLOSURE_SCHED( + exec_ctx, GRPC_CLOSURE_CREATE(try_to_connect_locked, chand, grpc_combiner_scheduler(chand->combiner)), GRPC_ERROR_NONE); } @@ -1547,7 +1547,7 @@ static void on_external_watch_complete(grpc_exec_ctx *exec_ctx, void *arg, "external_connectivity_watcher"); external_connectivity_watcher_list_remove(w->chand, w); gpr_free(w); - grpc_closure_run(exec_ctx, follow_up, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_RUN(exec_ctx, follow_up, GRPC_ERROR_REF(error)); } static void watch_connectivity_state_locked(grpc_exec_ctx *exec_ctx, void *arg, @@ -1556,8 +1556,8 @@ static void watch_connectivity_state_locked(grpc_exec_ctx *exec_ctx, void *arg, external_connectivity_watcher *found = NULL; if (w->state != NULL) { external_connectivity_watcher_list_append(w->chand, w); - grpc_closure_run(exec_ctx, w->watcher_timer_init, GRPC_ERROR_NONE); - grpc_closure_init(&w->my_closure, on_external_watch_complete, w, + GRPC_CLOSURE_RUN(exec_ctx, w->watcher_timer_init, GRPC_ERROR_NONE); + GRPC_CLOSURE_INIT(&w->my_closure, on_external_watch_complete, w, grpc_schedule_on_exec_ctx); grpc_connectivity_state_notify_on_state_change( exec_ctx, &w->chand->state_tracker, w->state, &w->my_closure); @@ -1592,9 +1592,9 @@ void grpc_client_channel_watch_connectivity_state( chand->interested_parties); GRPC_CHANNEL_STACK_REF(w->chand->owning_stack, "external_connectivity_watcher"); - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, - grpc_closure_init(&w->my_closure, watch_connectivity_state_locked, w, + GRPC_CLOSURE_INIT(&w->my_closure, watch_connectivity_state_locked, w, grpc_combiner_scheduler(chand->combiner)), GRPC_ERROR_NONE); } diff --git a/src/core/ext/filters/client_channel/http_connect_handshaker.c b/src/core/ext/filters/client_channel/http_connect_handshaker.c index 5e4bfe74d8..0952dc6d4e 100644 --- a/src/core/ext/filters/client_channel/http_connect_handshaker.c +++ b/src/core/ext/filters/client_channel/http_connect_handshaker.c @@ -118,7 +118,7 @@ static void handshake_failed_locked(grpc_exec_ctx* exec_ctx, handshaker->shutdown = true; } // Invoke callback. - grpc_closure_sched(exec_ctx, handshaker->on_handshake_done, error); + GRPC_CLOSURE_SCHED(exec_ctx, handshaker->on_handshake_done, error); } // Callback invoked when finished writing HTTP CONNECT request. @@ -217,7 +217,7 @@ static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg, goto done; } // Success. Invoke handshake-done callback. - grpc_closure_sched(exec_ctx, handshaker->on_handshake_done, error); + GRPC_CLOSURE_SCHED(exec_ctx, handshaker->on_handshake_done, error); done: // Set shutdown to true so that subsequent calls to // http_connect_handshaker_shutdown() do nothing. @@ -266,7 +266,7 @@ static void http_connect_handshaker_do_handshake( gpr_mu_lock(&handshaker->mu); handshaker->shutdown = true; gpr_mu_unlock(&handshaker->mu); - grpc_closure_sched(exec_ctx, on_handshake_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, on_handshake_done, GRPC_ERROR_NONE); return; } GPR_ASSERT(arg->type == GRPC_ARG_STRING); @@ -339,9 +339,9 @@ static grpc_handshaker* grpc_http_connect_handshaker_create() { gpr_mu_init(&handshaker->mu); gpr_ref_init(&handshaker->refcount, 1); grpc_slice_buffer_init(&handshaker->write_buffer); - grpc_closure_init(&handshaker->request_done_closure, on_write_done, + GRPC_CLOSURE_INIT(&handshaker->request_done_closure, on_write_done, handshaker, grpc_schedule_on_exec_ctx); - grpc_closure_init(&handshaker->response_read_closure, on_read_done, + GRPC_CLOSURE_INIT(&handshaker->response_read_closure, on_read_done, handshaker, grpc_schedule_on_exec_ctx); grpc_http_parser_init(&handshaker->http_parser, GRPC_HTTP_RESPONSE, &handshaker->http_response); diff --git a/src/core/ext/filters/client_channel/lb_policy.c b/src/core/ext/filters/client_channel/lb_policy.c index 0c8e179925..50f8faef8e 100644 --- a/src/core/ext/filters/client_channel/lb_policy.c +++ b/src/core/ext/filters/client_channel/lb_policy.c @@ -74,7 +74,7 @@ void grpc_lb_policy_unref(grpc_exec_ctx *exec_ctx, gpr_atm mask = ~(gpr_atm)((1 << WEAK_REF_BITS) - 1); gpr_atm check = 1 << WEAK_REF_BITS; if ((old_val & mask) == check) { - grpc_closure_sched(exec_ctx, grpc_closure_create( + GRPC_CLOSURE_SCHED(exec_ctx, GRPC_CLOSURE_CREATE( shutdown_locked, policy, grpc_combiner_scheduler(policy->combiner)), GRPC_ERROR_NONE); diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c index 10e59a99de..52c6e38c87 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c @@ -53,7 +53,7 @@ static void on_complete_for_send(grpc_exec_ctx *exec_ctx, void *arg, if (error == GRPC_ERROR_NONE) { calld->send_initial_metadata_succeeded = true; } - grpc_closure_run(exec_ctx, calld->original_on_complete_for_send, + GRPC_CLOSURE_RUN(exec_ctx, calld->original_on_complete_for_send, GRPC_ERROR_REF(error)); } @@ -63,7 +63,7 @@ static void recv_initial_metadata_ready(grpc_exec_ctx *exec_ctx, void *arg, if (error == GRPC_ERROR_NONE) { calld->recv_initial_metadata_succeeded = true; } - grpc_closure_run(exec_ctx, calld->original_recv_initial_metadata_ready, + GRPC_CLOSURE_RUN(exec_ctx, calld->original_recv_initial_metadata_ready, GRPC_ERROR_REF(error)); } @@ -104,7 +104,7 @@ static void start_transport_stream_op_batch( // Intercept send_initial_metadata. if (batch->send_initial_metadata) { calld->original_on_complete_for_send = batch->on_complete; - grpc_closure_init(&calld->on_complete_for_send, on_complete_for_send, calld, + GRPC_CLOSURE_INIT(&calld->on_complete_for_send, on_complete_for_send, calld, grpc_schedule_on_exec_ctx); batch->on_complete = &calld->on_complete_for_send; } @@ -112,7 +112,7 @@ static void start_transport_stream_op_batch( if (batch->recv_initial_metadata) { calld->original_recv_initial_metadata_ready = batch->payload->recv_initial_metadata.recv_initial_metadata_ready; - grpc_closure_init(&calld->recv_initial_metadata_ready, + GRPC_CLOSURE_INIT(&calld->recv_initial_metadata_ready, recv_initial_metadata_ready, calld, grpc_schedule_on_exec_ctx); batch->payload->recv_initial_metadata.recv_initial_metadata_ready = diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c index d3182f35fe..8d3c1c8e72 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c @@ -184,7 +184,7 @@ static void wrapped_rr_closure(grpc_exec_ctx *exec_ctx, void *arg, wrapped_rr_closure_arg *wc_arg = arg; GPR_ASSERT(wc_arg->wrapped_closure != NULL); - grpc_closure_sched(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error)); if (wc_arg->rr_policy != NULL) { /* if *target is NULL, no pick has been made by the RR policy (eg, all @@ -256,7 +256,7 @@ static void add_pending_pick(pending_pick **root, pp->wrapped_on_complete_arg.lb_token_mdelem_storage = pick_args->lb_token_mdelem_storage; pp->wrapped_on_complete_arg.free_when_done = pp; - grpc_closure_init(&pp->wrapped_on_complete_arg.wrapper_closure, + GRPC_CLOSURE_INIT(&pp->wrapped_on_complete_arg.wrapper_closure, wrapped_rr_closure, &pp->wrapped_on_complete_arg, grpc_schedule_on_exec_ctx); *root = pp; @@ -275,7 +275,7 @@ static void add_pending_ping(pending_ping **root, grpc_closure *notify) { pping->wrapped_notify_arg.wrapped_closure = notify; pping->wrapped_notify_arg.free_when_done = pping; pping->next = *root; - grpc_closure_init(&pping->wrapped_notify_arg.wrapper_closure, + GRPC_CLOSURE_INIT(&pping->wrapped_notify_arg.wrapper_closure, wrapped_rr_closure, &pping->wrapped_notify_arg, grpc_schedule_on_exec_ctx); *root = pping; @@ -635,7 +635,7 @@ static bool pick_from_internal_rr_locked( grpc_grpclb_client_stats_unref(wc_arg->client_stats); if (force_async) { GPR_ASSERT(wc_arg->wrapped_closure != NULL); - grpc_closure_sched(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_NONE); gpr_free(wc_arg->free_when_done); return false; } @@ -663,7 +663,7 @@ static bool pick_from_internal_rr_locked( wc_arg->context[GRPC_GRPCLB_CLIENT_STATS].destroy = destroy_client_stats; if (force_async) { GPR_ASSERT(wc_arg->wrapped_closure != NULL); - grpc_closure_sched(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_NONE); gpr_free(wc_arg->free_when_done); return false; } @@ -739,7 +739,7 @@ static void create_rr_locked(grpc_exec_ctx *exec_ctx, glb_lb_policy *glb_policy, * It'll be deallocated in glb_rr_connectivity_changed() */ rr_connectivity_data *rr_connectivity = gpr_zalloc(sizeof(rr_connectivity_data)); - grpc_closure_init(&rr_connectivity->on_change, + GRPC_CLOSURE_INIT(&rr_connectivity->on_change, glb_rr_connectivity_changed_locked, rr_connectivity, grpc_combiner_scheduler(glb_policy->base.combiner)); rr_connectivity->glb_policy = glb_policy; @@ -1004,7 +1004,7 @@ static grpc_lb_policy *glb_create(grpc_exec_ctx *exec_ctx, return NULL; } - grpc_closure_init(&glb_policy->lb_channel_on_connectivity_changed, + GRPC_CLOSURE_INIT(&glb_policy->lb_channel_on_connectivity_changed, glb_lb_channel_on_connectivity_changed_cb, glb_policy, grpc_combiner_scheduler(args->combiner)); grpc_lb_policy_init(&glb_policy->base, &glb_lb_policy_vtable, args->combiner); @@ -1078,14 +1078,14 @@ static void glb_shutdown_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { while (pp != NULL) { pending_pick *next = pp->next; *pp->target = NULL; - grpc_closure_sched(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure, + GRPC_CLOSURE_SCHED(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure, GRPC_ERROR_NONE); pp = next; } while (pping != NULL) { pending_ping *next = pping->next; - grpc_closure_sched(exec_ctx, &pping->wrapped_notify_arg.wrapper_closure, + GRPC_CLOSURE_SCHED(exec_ctx, &pping->wrapped_notify_arg.wrapper_closure, GRPC_ERROR_NONE); pping = next; } @@ -1101,7 +1101,7 @@ static void glb_cancel_pick_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, pending_pick *next = pp->next; if (pp->target == target) { *target = NULL; - grpc_closure_sched(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure, + GRPC_CLOSURE_SCHED(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Pick Cancelled", &error, 1)); } else { @@ -1125,7 +1125,7 @@ static void glb_cancel_picks_locked(grpc_exec_ctx *exec_ctx, pending_pick *next = pp->next; if ((pp->pick_args.initial_metadata_flags & initial_metadata_flags_mask) == initial_metadata_flags_eq) { - grpc_closure_sched(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure, + GRPC_CLOSURE_SCHED(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Pick Cancelled", &error, 1)); } else { @@ -1160,7 +1160,7 @@ static int glb_pick_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, grpc_closure *on_complete) { if (pick_args->lb_token_mdelem_storage == NULL) { *target = NULL; - grpc_closure_sched(exec_ctx, on_complete, + GRPC_CLOSURE_SCHED(exec_ctx, on_complete, GRPC_ERROR_CREATE_FROM_STATIC_STRING( "No mdelem storage for the LB token. Load reporting " "won't work without it. Failing")); @@ -1179,7 +1179,7 @@ static int glb_pick_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, wrapped_rr_closure_arg *wc_arg = gpr_zalloc(sizeof(wrapped_rr_closure_arg)); - grpc_closure_init(&wc_arg->wrapper_closure, wrapped_rr_closure, wc_arg, + GRPC_CLOSURE_INIT(&wc_arg->wrapper_closure, wrapped_rr_closure, wc_arg, grpc_schedule_on_exec_ctx); wc_arg->rr_policy = glb_policy->rr_policy; wc_arg->target = target; @@ -1250,7 +1250,7 @@ static void schedule_next_client_load_report(grpc_exec_ctx *exec_ctx, const gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC); const gpr_timespec next_client_load_report_time = gpr_time_add(now, glb_policy->client_stats_report_interval); - grpc_closure_init(&glb_policy->client_load_report_closure, + GRPC_CLOSURE_INIT(&glb_policy->client_load_report_closure, send_client_load_report_locked, glb_policy, grpc_combiner_scheduler(glb_policy->base.combiner)); grpc_timer_init(exec_ctx, &glb_policy->client_load_report_timer, @@ -1278,7 +1278,7 @@ static void do_send_client_load_report_locked(grpc_exec_ctx *exec_ctx, memset(&op, 0, sizeof(op)); op.op = GRPC_OP_SEND_MESSAGE; op.data.send_message.send_message = glb_policy->client_load_report_payload; - grpc_closure_init(&glb_policy->client_load_report_closure, + GRPC_CLOSURE_INIT(&glb_policy->client_load_report_closure, client_load_report_done_locked, glb_policy, grpc_combiner_scheduler(glb_policy->base.combiner)); grpc_call_error call_error = grpc_call_start_batch_and_execute( @@ -1384,13 +1384,13 @@ static void lb_call_init_locked(grpc_exec_ctx *exec_ctx, grpc_slice_unref_internal(exec_ctx, request_payload_slice); grpc_grpclb_request_destroy(request); - grpc_closure_init(&glb_policy->lb_on_sent_initial_request, + GRPC_CLOSURE_INIT(&glb_policy->lb_on_sent_initial_request, lb_on_sent_initial_request_locked, glb_policy, grpc_combiner_scheduler(glb_policy->base.combiner)); - grpc_closure_init(&glb_policy->lb_on_server_status_received, + GRPC_CLOSURE_INIT(&glb_policy->lb_on_server_status_received, lb_on_server_status_received_locked, glb_policy, grpc_combiner_scheduler(glb_policy->base.combiner)); - grpc_closure_init(&glb_policy->lb_on_response_received, + GRPC_CLOSURE_INIT(&glb_policy->lb_on_response_received, lb_on_response_received_locked, glb_policy, grpc_combiner_scheduler(glb_policy->base.combiner)); @@ -1693,7 +1693,7 @@ static void lb_on_server_status_received_locked(grpc_exec_ctx *exec_ctx, } } GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "grpclb_retry_timer"); - grpc_closure_init(&glb_policy->lb_on_call_retry, + GRPC_CLOSURE_INIT(&glb_policy->lb_on_call_retry, lb_call_on_retry_timer_locked, glb_policy, grpc_combiner_scheduler(glb_policy->base.combiner)); glb_policy->retry_timer_active = true; diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c index 0e2b4131f1..307e3bad67 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c @@ -118,7 +118,7 @@ static void pf_shutdown_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { while (pp != NULL) { pending_pick *next = pp->next; *pp->target = NULL; - grpc_closure_sched(exec_ctx, pp->on_complete, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_NONE); gpr_free(pp); pp = next; } @@ -135,7 +135,7 @@ static void pf_cancel_pick_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, pending_pick *next = pp->next; if (pp->target == target) { *target = NULL; - grpc_closure_sched(exec_ctx, pp->on_complete, + GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Pick Cancelled", &error, 1)); gpr_free(pp); @@ -160,7 +160,7 @@ static void pf_cancel_picks_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, pending_pick *next = pp->next; if ((pp->initial_metadata_flags & initial_metadata_flags_mask) == initial_metadata_flags_eq) { - grpc_closure_sched(exec_ctx, pp->on_complete, + GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Pick Cancelled", &error, 1)); gpr_free(pp); @@ -258,7 +258,7 @@ static void pf_ping_one_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, if (p->selected) { grpc_connected_subchannel_ping(exec_ctx, p->selected, closure); } else { - grpc_closure_sched(exec_ctx, closure, + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Not connected")); } } @@ -557,7 +557,7 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, "Servicing pending pick with selected subchannel %p", (void *)p->selected); } - grpc_closure_sched(exec_ctx, pp->on_complete, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_NONE); gpr_free(pp); } grpc_connected_subchannel_notify_on_state_change( @@ -610,7 +610,7 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, while ((pp = p->pending_picks)) { p->pending_picks = pp->next; *pp->target = NULL; - grpc_closure_sched(exec_ctx, pp->on_complete, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_NONE); gpr_free(pp); } GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &p->base, @@ -654,7 +654,7 @@ static grpc_lb_policy *create_pick_first(grpc_exec_ctx *exec_ctx, pick_first_lb_policy *p = gpr_zalloc(sizeof(*p)); pf_update_locked(exec_ctx, &p->base, args); grpc_lb_policy_init(&p->base, &pick_first_lb_policy_vtable, args->combiner); - grpc_closure_init(&p->connectivity_changed, pf_connectivity_changed_locked, p, + GRPC_CLOSURE_INIT(&p->connectivity_changed, pf_connectivity_changed_locked, p, grpc_combiner_scheduler(args->combiner)); return &p->base; } diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c index 9ecb0a39da..3c8520cc1c 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c @@ -288,7 +288,7 @@ static void rr_shutdown_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { while ((pp = p->pending_picks)) { p->pending_picks = pp->next; *pp->target = NULL; - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, pp->on_complete, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel Shutdown")); gpr_free(pp); @@ -311,7 +311,7 @@ static void rr_cancel_pick_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, pending_pick *next = pp->next; if (pp->target == target) { *target = NULL; - grpc_closure_sched(exec_ctx, pp->on_complete, + GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Pick cancelled", &error, 1)); gpr_free(pp); @@ -336,7 +336,7 @@ static void rr_cancel_picks_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, if ((pp->initial_metadata_flags & initial_metadata_flags_mask) == initial_metadata_flags_eq) { *pp->target = NULL; - grpc_closure_sched(exec_ctx, pp->on_complete, + GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Pick cancelled", &error, 1)); gpr_free(pp); @@ -553,7 +553,7 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, while ((pp = p->pending_picks)) { p->pending_picks = pp->next; *pp->target = NULL; - grpc_closure_sched(exec_ctx, pp->on_complete, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_NONE); gpr_free(pp); } } @@ -614,7 +614,7 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, (void *)selected->subchannel, (unsigned long)next_ready_index); } - grpc_closure_sched(exec_ctx, pp->on_complete, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_NONE); gpr_free(pp); } } @@ -655,7 +655,7 @@ static void rr_ping_one_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, grpc_connected_subchannel_ping(exec_ctx, target, closure); GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, target, "rr_picked"); } else { - grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_CREATE_FROM_STATIC_STRING( + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Round Robin not connected")); } } @@ -747,7 +747,7 @@ static void rr_update_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy, subchannel_data *sd = &subchannel_list->subchannels[subchannel_index++]; sd->subchannel_list = subchannel_list; sd->subchannel = subchannel; - grpc_closure_init(&sd->connectivity_changed_closure, + GRPC_CLOSURE_INIT(&sd->connectivity_changed_closure, rr_connectivity_changed_locked, sd, grpc_combiner_scheduler(args->combiner)); /* use some sentinel value outside of the range of diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c index 92f060b422..04a7852323 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c @@ -116,7 +116,7 @@ static void dns_ares_shutdown_locked(grpc_exec_ctx *exec_ctx, } if (r->next_completion != NULL) { *r->target_result = NULL; - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown")); r->next_completion = NULL; @@ -221,7 +221,7 @@ static void dns_ares_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx, ? NULL : grpc_channel_args_copy(r->resolved_result); gpr_log(GPR_DEBUG, "dns_ares_maybe_finish_next_locked"); - grpc_closure_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE); r->next_completion = NULL; r->published_version = r->resolved_version; } @@ -266,10 +266,10 @@ static grpc_resolver *dns_ares_create(grpc_exec_ctx *exec_ctx, GRPC_DNS_RECONNECT_JITTER, GRPC_DNS_MIN_CONNECT_TIMEOUT_SECONDS * 1000, GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000); - grpc_closure_init(&r->dns_ares_on_retry_timer_locked, + GRPC_CLOSURE_INIT(&r->dns_ares_on_retry_timer_locked, dns_ares_on_retry_timer_locked, r, grpc_combiner_scheduler(r->base.combiner)); - grpc_closure_init(&r->dns_ares_on_resolved_locked, + GRPC_CLOSURE_INIT(&r->dns_ares_on_resolved_locked, dns_ares_on_resolved_locked, r, grpc_combiner_scheduler(r->base.combiner)); return &r->base; diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c index 293e6b0252..4e79c44ba3 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c @@ -257,9 +257,9 @@ static void grpc_ares_notify_on_event_locked(grpc_exec_ctx *exec_ctx, fdn->readable_registered = false; fdn->writable_registered = false; gpr_mu_init(&fdn->mu); - grpc_closure_init(&fdn->read_closure, on_readable_cb, fdn, + GRPC_CLOSURE_INIT(&fdn->read_closure, on_readable_cb, fdn, grpc_schedule_on_exec_ctx); - grpc_closure_init(&fdn->write_closure, on_writable_cb, fdn, + GRPC_CLOSURE_INIT(&fdn->write_closure, on_writable_cb, fdn, grpc_schedule_on_exec_ctx); grpc_pollset_set_add_fd(exec_ctx, ev_driver->pollset_set, fdn->grpc_fd); diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c index 153287c30e..244b260dfa 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c @@ -107,10 +107,10 @@ static void grpc_ares_request_unref(grpc_exec_ctx *exec_ctx, acquire locks in on_done. ares_dns_resolver is using combiner to protect resources needed by on_done. */ grpc_exec_ctx new_exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_closure_sched(&new_exec_ctx, r->on_done, r->error); + GRPC_CLOSURE_SCHED(&new_exec_ctx, r->on_done, r->error); grpc_exec_ctx_finish(&new_exec_ctx); } else { - grpc_closure_sched(exec_ctx, r->on_done, r->error); + GRPC_CLOSURE_SCHED(exec_ctx, r->on_done, r->error); } gpr_mu_destroy(&r->mu); grpc_ares_ev_driver_destroy(r->ev_driver); @@ -370,7 +370,7 @@ static grpc_ares_request *grpc_dns_lookup_ares_impl( return r; error_cleanup: - grpc_closure_sched(exec_ctx, on_done, error); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, error); gpr_free(host); gpr_free(port); return NULL; @@ -445,7 +445,7 @@ static void on_dns_lookup_done_cb(grpc_exec_ctx *exec_ctx, void *arg, &r->lb_addrs->addresses[i].address, sizeof(grpc_resolved_address)); } } - grpc_closure_sched(exec_ctx, r->on_resolve_address_done, + GRPC_CLOSURE_SCHED(exec_ctx, r->on_resolve_address_done, GRPC_ERROR_REF(error)); grpc_lb_addresses_destroy(exec_ctx, r->lb_addrs); gpr_free(r); @@ -461,7 +461,7 @@ static void grpc_resolve_address_ares_impl(grpc_exec_ctx *exec_ctx, gpr_zalloc(sizeof(grpc_resolve_address_ares_request)); r->addrs_out = addrs; r->on_resolve_address_done = on_done; - grpc_closure_init(&r->on_dns_lookup_done, on_dns_lookup_done_cb, r, + GRPC_CLOSURE_INIT(&r->on_dns_lookup_done, on_dns_lookup_done_cb, r, grpc_schedule_on_exec_ctx); grpc_dns_lookup_ares(exec_ctx, NULL /* dns_server */, name, default_port, interested_parties, &r->on_dns_lookup_done, &r->lb_addrs, diff --git a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.c b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.c index 6c263c32f9..af3391a731 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.c +++ b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.c @@ -99,7 +99,7 @@ static void dns_shutdown_locked(grpc_exec_ctx *exec_ctx, } if (r->next_completion != NULL) { *r->target_result = NULL; - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown")); r->next_completion = NULL; @@ -178,7 +178,7 @@ static void dns_on_resolved_locked(grpc_exec_ctx *exec_ctx, void *arg, } else { gpr_log(GPR_DEBUG, "retrying immediately"); } - grpc_closure_init(&r->on_retry, dns_on_retry_timer_locked, r, + GRPC_CLOSURE_INIT(&r->on_retry, dns_on_retry_timer_locked, r, grpc_combiner_scheduler(r->base.combiner)); grpc_timer_init(exec_ctx, &r->retry_timer, next_try, &r->on_retry, now); } @@ -200,7 +200,7 @@ static void dns_start_resolving_locked(grpc_exec_ctx *exec_ctx, r->addresses = NULL; grpc_resolve_address( exec_ctx, r->name_to_resolve, r->default_port, r->interested_parties, - grpc_closure_create(dns_on_resolved_locked, r, + GRPC_CLOSURE_CREATE(dns_on_resolved_locked, r, grpc_combiner_scheduler(r->base.combiner)), &r->addresses); } @@ -212,7 +212,7 @@ static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx, *r->target_result = r->resolved_result == NULL ? NULL : grpc_channel_args_copy(r->resolved_result); - grpc_closure_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE); r->next_completion = NULL; r->published_version = r->resolved_version; } diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c index cbb0e628ed..8e73d606aa 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c @@ -74,7 +74,7 @@ static void fake_resolver_shutdown_locked(grpc_exec_ctx* exec_ctx, fake_resolver* r = (fake_resolver*)resolver; if (r->next_completion != NULL) { *r->target_result = NULL; - grpc_closure_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE); r->next_completion = NULL; } } @@ -85,7 +85,7 @@ static void fake_resolver_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx, *r->target_result = grpc_channel_args_union(r->next_results, r->channel_args); grpc_channel_args_destroy(exec_ctx, r->next_results); - grpc_closure_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE); r->next_completion = NULL; r->next_results = NULL; } @@ -157,8 +157,8 @@ void grpc_fake_resolver_response_generator_set_response( grpc_channel_args* next_response) { GPR_ASSERT(generator->resolver != NULL); generator->next_response = grpc_channel_args_copy(next_response); - grpc_closure_sched( - exec_ctx, grpc_closure_create(set_response_cb, generator, + GRPC_CLOSURE_SCHED( + exec_ctx, GRPC_CLOSURE_CREATE(set_response_cb, generator, grpc_combiner_scheduler( generator->resolver->base.combiner)), GRPC_ERROR_NONE); diff --git a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c index 641c8d3afe..b5d2e5c92b 100644 --- a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +++ b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c @@ -73,7 +73,7 @@ static void sockaddr_shutdown_locked(grpc_exec_ctx *exec_ctx, sockaddr_resolver *r = (sockaddr_resolver *)resolver; if (r->next_completion != NULL) { *r->target_result = NULL; - grpc_closure_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE); r->next_completion = NULL; } } @@ -103,7 +103,7 @@ static void sockaddr_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx, grpc_arg arg = grpc_lb_addresses_create_channel_arg(r->addresses); *r->target_result = grpc_channel_args_copy_and_add(r->channel_args, &arg, 1); - grpc_closure_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE); r->next_completion = NULL; } } diff --git a/src/core/ext/filters/client_channel/subchannel.c b/src/core/ext/filters/client_channel/subchannel.c index 68a8bb8303..37dd96726e 100644 --- a/src/core/ext/filters/client_channel/subchannel.c +++ b/src/core/ext/filters/client_channel/subchannel.c @@ -283,7 +283,7 @@ void grpc_subchannel_weak_unref(grpc_exec_ctx *exec_ctx, gpr_atm old_refs; old_refs = ref_mutate(c, -(gpr_atm)1, 1 REF_MUTATE_PURPOSE("WEAK_UNREF")); if (old_refs == 1) { - grpc_closure_sched(exec_ctx, grpc_closure_create(subchannel_destroy, c, + GRPC_CLOSURE_SCHED(exec_ctx, GRPC_CLOSURE_CREATE(subchannel_destroy, c, grpc_schedule_on_exec_ctx), GRPC_ERROR_NONE); } @@ -333,7 +333,7 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx, if (new_args != NULL) grpc_channel_args_destroy(exec_ctx, new_args); c->root_external_state_watcher.next = c->root_external_state_watcher.prev = &c->root_external_state_watcher; - grpc_closure_init(&c->connected, subchannel_connected, c, + GRPC_CLOSURE_INIT(&c->connected, subchannel_connected, c, grpc_schedule_on_exec_ctx); grpc_connectivity_state_init(&c->state_tracker, GRPC_CHANNEL_IDLE, "subchannel"); @@ -421,7 +421,7 @@ static void on_external_state_watcher_done(grpc_exec_ctx *exec_ctx, void *arg, gpr_mu_unlock(&w->subchannel->mu); GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, w->subchannel, "external_state_watcher"); gpr_free(w); - grpc_closure_run(exec_ctx, follow_up, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_RUN(exec_ctx, follow_up, GRPC_ERROR_REF(error)); } static void on_alarm(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { @@ -488,7 +488,7 @@ static void maybe_start_connecting_locked(grpc_exec_ctx *exec_ctx, gpr_log(GPR_INFO, "Retry in %" PRId64 ".%09d seconds", time_til_next.tv_sec, time_til_next.tv_nsec); } - grpc_closure_init(&c->on_alarm, on_alarm, c, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c->on_alarm, on_alarm, c, grpc_schedule_on_exec_ctx); grpc_timer_init(exec_ctx, &c->alarm, c->next_attempt, &c->on_alarm, now); } } @@ -514,7 +514,7 @@ void grpc_subchannel_notify_on_state_change( w->subchannel = c; w->pollset_set = interested_parties; w->notify = notify; - grpc_closure_init(&w->closure, on_external_state_watcher_done, w, + GRPC_CLOSURE_INIT(&w->closure, on_external_state_watcher_done, w, grpc_schedule_on_exec_ctx); if (interested_parties != NULL) { grpc_pollset_set_add_pollset_set(exec_ctx, c->pollset_set, @@ -635,7 +635,7 @@ static bool publish_transport_locked(grpc_exec_ctx *exec_ctx, sw_subchannel = gpr_malloc(sizeof(*sw_subchannel)); sw_subchannel->subchannel = c; sw_subchannel->connectivity_state = GRPC_CHANNEL_READY; - grpc_closure_init(&sw_subchannel->closure, subchannel_on_child_state_changed, + GRPC_CLOSURE_INIT(&sw_subchannel->closure, subchannel_on_child_state_changed, sw_subchannel, grpc_schedule_on_exec_ctx); if (c->disconnected) { diff --git a/src/core/ext/filters/deadline/deadline_filter.c b/src/core/ext/filters/deadline/deadline_filter.c index c02756a726..ced025e2e2 100644 --- a/src/core/ext/filters/deadline/deadline_filter.c +++ b/src/core/ext/filters/deadline/deadline_filter.c @@ -74,7 +74,7 @@ retry: // If we've already created and destroyed a timer, we always create a // new closure: we have no other guarantee that the inlined closure is // not in use (it may hold a pending call to timer_callback) - closure = grpc_closure_create(timer_callback, elem, + closure = GRPC_CLOSURE_CREATE(timer_callback, elem, grpc_schedule_on_exec_ctx); } else { goto retry; @@ -85,7 +85,7 @@ retry: GRPC_DEADLINE_STATE_INITIAL, GRPC_DEADLINE_STATE_PENDING)) { closure = - grpc_closure_init(&deadline_state->timer_callback, timer_callback, + GRPC_CLOSURE_INIT(&deadline_state->timer_callback, timer_callback, elem, grpc_schedule_on_exec_ctx); } else { goto retry; @@ -115,7 +115,7 @@ static void on_complete(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { grpc_deadline_state* deadline_state = arg; cancel_timer_if_needed(exec_ctx, deadline_state); // Invoke the next callback. - grpc_closure_run(exec_ctx, deadline_state->next_on_complete, + GRPC_CLOSURE_RUN(exec_ctx, deadline_state->next_on_complete, GRPC_ERROR_REF(error)); } @@ -123,7 +123,7 @@ static void on_complete(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { static void inject_on_complete_cb(grpc_deadline_state* deadline_state, grpc_transport_stream_op_batch* op) { deadline_state->next_on_complete = op->on_complete; - grpc_closure_init(&deadline_state->on_complete, on_complete, deadline_state, + GRPC_CLOSURE_INIT(&deadline_state->on_complete, on_complete, deadline_state, grpc_schedule_on_exec_ctx); op->on_complete = &deadline_state->on_complete; } @@ -161,9 +161,9 @@ void grpc_deadline_state_init(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, struct start_timer_after_init_state* state = gpr_malloc(sizeof(*state)); state->elem = elem; state->deadline = deadline; - grpc_closure_init(&state->closure, start_timer_after_init, state, + GRPC_CLOSURE_INIT(&state->closure, start_timer_after_init, state, grpc_schedule_on_exec_ctx); - grpc_closure_sched(exec_ctx, &state->closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &state->closure, GRPC_ERROR_NONE); } } @@ -281,7 +281,7 @@ static void server_start_transport_stream_op_batch( op->payload->recv_initial_metadata.recv_initial_metadata_ready; calld->recv_initial_metadata = op->payload->recv_initial_metadata.recv_initial_metadata; - grpc_closure_init(&calld->recv_initial_metadata_ready, + GRPC_CLOSURE_INIT(&calld->recv_initial_metadata_ready, recv_initial_metadata_ready, elem, grpc_schedule_on_exec_ctx); op->payload->recv_initial_metadata.recv_initial_metadata_ready = diff --git a/src/core/ext/filters/http/client/http_client_filter.c b/src/core/ext/filters/http/client/http_client_filter.c index fb2a5d10fe..90f0aed7a0 100644 --- a/src/core/ext/filters/http/client/http_client_filter.c +++ b/src/core/ext/filters/http/client/http_client_filter.c @@ -158,7 +158,7 @@ static void hc_on_recv_initial_metadata(grpc_exec_ctx *exec_ctx, } else { GRPC_ERROR_REF(error); } - grpc_closure_run(exec_ctx, calld->on_done_recv_initial_metadata, error); + GRPC_CLOSURE_RUN(exec_ctx, calld->on_done_recv_initial_metadata, error); } static void hc_on_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, @@ -171,7 +171,7 @@ static void hc_on_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, } else { GRPC_ERROR_REF(error); } - grpc_closure_run(exec_ctx, calld->on_done_recv_trailing_metadata, error); + GRPC_CLOSURE_RUN(exec_ctx, calld->on_done_recv_trailing_metadata, error); } static void hc_on_complete(grpc_exec_ctx *exec_ctx, void *user_data, @@ -445,17 +445,17 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, calld->payload_bytes = NULL; calld->send_message_blocked = false; grpc_slice_buffer_init(&calld->slices); - grpc_closure_init(&calld->hc_on_recv_initial_metadata, + GRPC_CLOSURE_INIT(&calld->hc_on_recv_initial_metadata, hc_on_recv_initial_metadata, elem, grpc_schedule_on_exec_ctx); - grpc_closure_init(&calld->hc_on_recv_trailing_metadata, + GRPC_CLOSURE_INIT(&calld->hc_on_recv_trailing_metadata, hc_on_recv_trailing_metadata, elem, grpc_schedule_on_exec_ctx); - grpc_closure_init(&calld->hc_on_complete, hc_on_complete, elem, + GRPC_CLOSURE_INIT(&calld->hc_on_complete, hc_on_complete, elem, grpc_schedule_on_exec_ctx); - grpc_closure_init(&calld->got_slice, got_slice, elem, + GRPC_CLOSURE_INIT(&calld->got_slice, got_slice, elem, grpc_schedule_on_exec_ctx); - grpc_closure_init(&calld->send_done, send_done, elem, + GRPC_CLOSURE_INIT(&calld->send_done, send_done, elem, grpc_schedule_on_exec_ctx); return GRPC_ERROR_NONE; } diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.c b/src/core/ext/filters/http/message_compress/message_compress_filter.c index 4f753cef1c..04cb1d94f8 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.c +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.c @@ -364,9 +364,9 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, /* initialize members */ grpc_slice_buffer_init(&calld->slices); - grpc_closure_init(&calld->got_slice, got_slice, elem, + GRPC_CLOSURE_INIT(&calld->got_slice, got_slice, elem, grpc_schedule_on_exec_ctx); - grpc_closure_init(&calld->send_done, send_done, elem, + GRPC_CLOSURE_INIT(&calld->send_done, send_done, elem, grpc_schedule_on_exec_ctx); return GRPC_ERROR_NONE; diff --git a/src/core/ext/filters/http/server/http_server_filter.c b/src/core/ext/filters/http/server/http_server_filter.c index 113e07d249..b145f12aff 100644 --- a/src/core/ext/filters/http/server/http_server_filter.c +++ b/src/core/ext/filters/http/server/http_server_filter.c @@ -269,7 +269,7 @@ static void hs_on_recv(grpc_exec_ctx *exec_ctx, void *user_data, } else { GRPC_ERROR_REF(err); } - grpc_closure_run(exec_ctx, calld->on_done_recv, err); + GRPC_CLOSURE_RUN(exec_ctx, calld->on_done_recv, err); } static void hs_on_complete(grpc_exec_ctx *exec_ctx, void *user_data, @@ -281,11 +281,11 @@ static void hs_on_complete(grpc_exec_ctx *exec_ctx, void *user_data, *calld->pp_recv_message = calld->payload_bin_delivered ? NULL : (grpc_byte_stream *)&calld->read_stream; - grpc_closure_run(exec_ctx, calld->recv_message_ready, GRPC_ERROR_REF(err)); + GRPC_CLOSURE_RUN(exec_ctx, calld->recv_message_ready, GRPC_ERROR_REF(err)); calld->recv_message_ready = NULL; calld->payload_bin_delivered = true; } - grpc_closure_run(exec_ctx, calld->on_complete, GRPC_ERROR_REF(err)); + GRPC_CLOSURE_RUN(exec_ctx, calld->on_complete, GRPC_ERROR_REF(err)); } static void hs_recv_message_ready(grpc_exec_ctx *exec_ctx, void *user_data, @@ -296,7 +296,7 @@ static void hs_recv_message_ready(grpc_exec_ctx *exec_ctx, void *user_data, /* do nothing. This is probably a GET request, and payload will be returned in hs_on_complete callback. */ } else { - grpc_closure_run(exec_ctx, calld->recv_message_ready, GRPC_ERROR_REF(err)); + GRPC_CLOSURE_RUN(exec_ctx, calld->recv_message_ready, GRPC_ERROR_REF(err)); } } @@ -383,11 +383,11 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, /* grab pointers to our data from the call element */ call_data *calld = elem->call_data; /* initialize members */ - grpc_closure_init(&calld->hs_on_recv, hs_on_recv, elem, + GRPC_CLOSURE_INIT(&calld->hs_on_recv, hs_on_recv, elem, grpc_schedule_on_exec_ctx); - grpc_closure_init(&calld->hs_on_complete, hs_on_complete, elem, + GRPC_CLOSURE_INIT(&calld->hs_on_complete, hs_on_complete, elem, grpc_schedule_on_exec_ctx); - grpc_closure_init(&calld->hs_recv_message_ready, hs_recv_message_ready, elem, + GRPC_CLOSURE_INIT(&calld->hs_recv_message_ready, hs_recv_message_ready, elem, grpc_schedule_on_exec_ctx); grpc_slice_buffer_init(&calld->read_slice_buffer); return GRPC_ERROR_NONE; diff --git a/src/core/ext/filters/load_reporting/load_reporting_filter.c b/src/core/ext/filters/load_reporting/load_reporting_filter.c index 80446ca914..08474efb2e 100644 --- a/src/core/ext/filters/load_reporting/load_reporting_filter.c +++ b/src/core/ext/filters/load_reporting/load_reporting_filter.c @@ -90,7 +90,7 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, const grpc_call_element_args *args) { call_data *calld = elem->call_data; calld->id = (intptr_t)args->call_stack; - grpc_closure_init(&calld->on_initial_md_ready, on_initial_md_ready, elem, + GRPC_CLOSURE_INIT(&calld->on_initial_md_ready, on_initial_md_ready, elem, grpc_schedule_on_exec_ctx); /* TODO(dgq): do something with the data diff --git a/src/core/ext/filters/max_age/max_age_filter.c b/src/core/ext/filters/max_age/max_age_filter.c index 604f74e751..35304f8150 100644 --- a/src/core/ext/filters/max_age/max_age_filter.c +++ b/src/core/ext/filters/max_age/max_age_filter.c @@ -329,23 +329,23 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, : gpr_time_from_millis(value, GPR_TIMESPAN); } } - grpc_closure_init(&chand->close_max_idle_channel, close_max_idle_channel, + GRPC_CLOSURE_INIT(&chand->close_max_idle_channel, close_max_idle_channel, chand, grpc_schedule_on_exec_ctx); - grpc_closure_init(&chand->close_max_age_channel, close_max_age_channel, chand, + GRPC_CLOSURE_INIT(&chand->close_max_age_channel, close_max_age_channel, chand, grpc_schedule_on_exec_ctx); - grpc_closure_init(&chand->force_close_max_age_channel, + GRPC_CLOSURE_INIT(&chand->force_close_max_age_channel, force_close_max_age_channel, chand, grpc_schedule_on_exec_ctx); - grpc_closure_init(&chand->start_max_idle_timer_after_init, + GRPC_CLOSURE_INIT(&chand->start_max_idle_timer_after_init, start_max_idle_timer_after_init, chand, grpc_schedule_on_exec_ctx); - grpc_closure_init(&chand->start_max_age_timer_after_init, + GRPC_CLOSURE_INIT(&chand->start_max_age_timer_after_init, start_max_age_timer_after_init, chand, grpc_schedule_on_exec_ctx); - grpc_closure_init(&chand->start_max_age_grace_timer_after_goaway_op, + GRPC_CLOSURE_INIT(&chand->start_max_age_grace_timer_after_goaway_op, start_max_age_grace_timer_after_goaway_op, chand, grpc_schedule_on_exec_ctx); - grpc_closure_init(&chand->channel_connectivity_changed, + GRPC_CLOSURE_INIT(&chand->channel_connectivity_changed, channel_connectivity_changed, chand, grpc_schedule_on_exec_ctx); @@ -360,7 +360,7 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, initialization is done. */ GRPC_CHANNEL_STACK_REF(chand->channel_stack, "max_age start_max_age_timer_after_init"); - grpc_closure_sched(exec_ctx, &chand->start_max_age_timer_after_init, + GRPC_CLOSURE_SCHED(exec_ctx, &chand->start_max_age_timer_after_init, GRPC_ERROR_NONE); } @@ -371,7 +371,7 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, 0) { GRPC_CHANNEL_STACK_REF(chand->channel_stack, "max_age start_max_idle_timer_after_init"); - grpc_closure_sched(exec_ctx, &chand->start_max_idle_timer_after_init, + GRPC_CLOSURE_SCHED(exec_ctx, &chand->start_max_idle_timer_after_init, GRPC_ERROR_NONE); } return GRPC_ERROR_NONE; diff --git a/src/core/ext/filters/message_size/message_size_filter.c b/src/core/ext/filters/message_size/message_size_filter.c index e68ba149f2..9bb565ed6d 100644 --- a/src/core/ext/filters/message_size/message_size_filter.c +++ b/src/core/ext/filters/message_size/message_size_filter.c @@ -110,7 +110,7 @@ static void recv_message_ready(grpc_exec_ctx* exec_ctx, void* user_data, GRPC_ERROR_REF(error); } // Invoke the next callback. - grpc_closure_run(exec_ctx, calld->next_recv_message_ready, error); + GRPC_CLOSURE_RUN(exec_ctx, calld->next_recv_message_ready, error); } // Start transport stream op. @@ -152,7 +152,7 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx, channel_data* chand = elem->channel_data; call_data* calld = elem->call_data; calld->next_recv_message_ready = NULL; - grpc_closure_init(&calld->recv_message_ready, recv_message_ready, elem, + GRPC_CLOSURE_INIT(&calld->recv_message_ready, recv_message_ready, elem, grpc_schedule_on_exec_ctx); // Get max sizes from channel data, then merge in per-method config values. // Note: Per-method config is only available on the client, so we diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c index 9095d6167c..8b3fff5fa3 100644 --- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +++ b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c @@ -67,7 +67,7 @@ static void recv_initial_metadata_ready(grpc_exec_ctx* exec_ctx, } // Invoke the next callback. - grpc_closure_run(exec_ctx, calld->next_recv_initial_metadata_ready, + GRPC_CLOSURE_RUN(exec_ctx, calld->next_recv_initial_metadata_ready, GRPC_ERROR_REF(error)); } @@ -106,7 +106,7 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx, call_data* calld = elem->call_data; calld->next_recv_initial_metadata_ready = NULL; calld->workaround_active = false; - grpc_closure_init(&calld->recv_initial_metadata_ready, + GRPC_CLOSURE_INIT(&calld->recv_initial_metadata_ready, recv_initial_metadata_ready, elem, grpc_schedule_on_exec_ctx); return GRPC_ERROR_NONE; diff --git a/src/core/ext/transport/chttp2/client/chttp2_connector.c b/src/core/ext/transport/chttp2/client/chttp2_connector.c index c636170319..983691bbad 100644 --- a/src/core/ext/transport/chttp2/client/chttp2_connector.c +++ b/src/core/ext/transport/chttp2/client/chttp2_connector.c @@ -124,7 +124,7 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, } grpc_closure *notify = c->notify; c->notify = NULL; - grpc_closure_sched(exec_ctx, notify, error); + GRPC_CLOSURE_SCHED(exec_ctx, notify, error); grpc_handshake_manager_destroy(exec_ctx, c->handshake_mgr); c->handshake_mgr = NULL; gpr_mu_unlock(&c->mu); @@ -156,7 +156,7 @@ static void connected(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { memset(c->result, 0, sizeof(*c->result)); grpc_closure *notify = c->notify; c->notify = NULL; - grpc_closure_sched(exec_ctx, notify, error); + GRPC_CLOSURE_SCHED(exec_ctx, notify, error); if (c->endpoint != NULL) { grpc_endpoint_shutdown(exec_ctx, c->endpoint, GRPC_ERROR_REF(error)); } @@ -184,7 +184,7 @@ static void chttp2_connector_connect(grpc_exec_ctx *exec_ctx, c->result = result; GPR_ASSERT(c->endpoint == NULL); chttp2_connector_ref(con); // Ref taken for callback. - grpc_closure_init(&c->connected, connected, c, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c->connected, connected, c, grpc_schedule_on_exec_ctx); GPR_ASSERT(!c->connecting); c->connecting = true; grpc_tcp_client_connect(exec_ctx, &c->connected, &c->endpoint, diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.c b/src/core/ext/transport/chttp2/server/chttp2_server.c index 28393775d3..f207155900 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.c +++ b/src/core/ext/transport/chttp2/server/chttp2_server.c @@ -209,7 +209,7 @@ grpc_error *grpc_chttp2_server_add_port(grpc_exec_ctx *exec_ctx, goto error; } state = gpr_zalloc(sizeof(*state)); - grpc_closure_init(&state->tcp_server_shutdown_complete, + GRPC_CLOSURE_INIT(&state->tcp_server_shutdown_complete, tcp_server_shutdown_complete, state, grpc_schedule_on_exec_ctx); err = grpc_tcp_server_create(exec_ctx, &state->tcp_server_shutdown_complete, diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index bdebc8eeec..0ad63d1af2 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -269,30 +269,30 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_slice_buffer_init(&t->outbuf); grpc_chttp2_hpack_compressor_init(&t->hpack_compressor); - grpc_closure_init(&t->write_action, write_action, t, + GRPC_CLOSURE_INIT(&t->write_action, write_action, t, grpc_schedule_on_exec_ctx); - grpc_closure_init(&t->read_action_locked, read_action_locked, t, + GRPC_CLOSURE_INIT(&t->read_action_locked, read_action_locked, t, grpc_combiner_scheduler(t->combiner)); - grpc_closure_init(&t->benign_reclaimer_locked, benign_reclaimer_locked, t, + GRPC_CLOSURE_INIT(&t->benign_reclaimer_locked, benign_reclaimer_locked, t, grpc_combiner_scheduler(t->combiner)); - grpc_closure_init(&t->destructive_reclaimer_locked, + GRPC_CLOSURE_INIT(&t->destructive_reclaimer_locked, destructive_reclaimer_locked, t, grpc_combiner_scheduler(t->combiner)); - grpc_closure_init(&t->retry_initiate_ping_locked, retry_initiate_ping_locked, + GRPC_CLOSURE_INIT(&t->retry_initiate_ping_locked, retry_initiate_ping_locked, t, grpc_combiner_scheduler(t->combiner)); - grpc_closure_init(&t->start_bdp_ping_locked, start_bdp_ping_locked, t, + GRPC_CLOSURE_INIT(&t->start_bdp_ping_locked, start_bdp_ping_locked, t, grpc_combiner_scheduler(t->combiner)); - grpc_closure_init(&t->finish_bdp_ping_locked, finish_bdp_ping_locked, t, + GRPC_CLOSURE_INIT(&t->finish_bdp_ping_locked, finish_bdp_ping_locked, t, grpc_combiner_scheduler(t->combiner)); - grpc_closure_init(&t->init_keepalive_ping_locked, init_keepalive_ping_locked, + GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked, init_keepalive_ping_locked, t, grpc_combiner_scheduler(t->combiner)); - grpc_closure_init(&t->start_keepalive_ping_locked, + GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked, start_keepalive_ping_locked, t, grpc_combiner_scheduler(t->combiner)); - grpc_closure_init(&t->finish_keepalive_ping_locked, + GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked, finish_keepalive_ping_locked, t, grpc_combiner_scheduler(t->combiner)); - grpc_closure_init(&t->keepalive_watchdog_fired_locked, + GRPC_CLOSURE_INIT(&t->keepalive_watchdog_fired_locked, keepalive_watchdog_fired_locked, t, grpc_combiner_scheduler(t->combiner)); @@ -567,8 +567,8 @@ static void destroy_transport_locked(grpc_exec_ctx *exec_ctx, void *tp, static void destroy_transport(grpc_exec_ctx *exec_ctx, grpc_transport *gt) { grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt; - grpc_closure_sched(exec_ctx, - grpc_closure_create(destroy_transport_locked, t, + GRPC_CLOSURE_SCHED(exec_ctx, + GRPC_CLOSURE_CREATE(destroy_transport_locked, t, grpc_combiner_scheduler(t->combiner)), GRPC_ERROR_NONE); } @@ -656,12 +656,12 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, grpc_chttp2_data_parser_init(&s->data_parser); grpc_slice_buffer_init(&s->flow_controlled_buffer); s->deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); - grpc_closure_init(&s->complete_fetch_locked, complete_fetch_locked, s, + GRPC_CLOSURE_INIT(&s->complete_fetch_locked, complete_fetch_locked, s, grpc_schedule_on_exec_ctx); grpc_slice_buffer_init(&s->unprocessed_incoming_frames_buffer); grpc_slice_buffer_init(&s->frame_storage); s->pending_byte_stream = false; - grpc_closure_init(&s->reset_byte_stream, reset_byte_stream, s, + GRPC_CLOSURE_INIT(&s->reset_byte_stream, reset_byte_stream, s, grpc_combiner_scheduler(t->combiner)); GRPC_CHTTP2_REF_TRANSPORT(t, "stream"); @@ -733,7 +733,7 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, GPR_TIMER_END("destroy_stream", 0); - grpc_closure_sched(exec_ctx, s->destroy_stream_arg, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, s->destroy_stream_arg, GRPC_ERROR_NONE); } static void destroy_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, @@ -744,8 +744,8 @@ static void destroy_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, grpc_chttp2_stream *s = (grpc_chttp2_stream *)gs; s->destroy_stream_arg = then_schedule_closure; - grpc_closure_sched( - exec_ctx, grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s, + GRPC_CLOSURE_SCHED( + exec_ctx, GRPC_CLOSURE_INIT(&s->destroy_stream, destroy_stream_locked, s, grpc_combiner_scheduler(t->combiner)), GRPC_ERROR_NONE); GPR_TIMER_END("destroy_stream", 0); @@ -796,7 +796,7 @@ static void set_write_state(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, write_state_name(st), reason)); t->write_state = st; if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) { - grpc_closure_list_sched(exec_ctx, &t->run_after_write); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, &t->run_after_write); if (t->close_transport_on_writes_finished != NULL) { grpc_error *err = t->close_transport_on_writes_finished; t->close_transport_on_writes_finished = NULL; @@ -813,9 +813,9 @@ void grpc_chttp2_initiate_write(grpc_exec_ctx *exec_ctx, case GRPC_CHTTP2_WRITE_STATE_IDLE: set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_WRITING, reason); GRPC_CHTTP2_REF_TRANSPORT(t, "writing"); - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, - grpc_closure_init(&t->write_action_begin_locked, + GRPC_CLOSURE_INIT(&t->write_action_begin_locked, write_action_begin_locked, t, grpc_combiner_finally_scheduler(t->combiner)), GRPC_ERROR_NONE); @@ -863,12 +863,12 @@ static void write_action_begin_locked(grpc_exec_ctx *exec_ctx, void *gt, case GRPC_CHTTP2_PARTIAL_WRITE: set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE, "begin writing partial"); - grpc_closure_sched(exec_ctx, &t->write_action, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &t->write_action, GRPC_ERROR_NONE); break; case GRPC_CHTTP2_FULL_WRITE: set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_WRITING, "begin writing"); - grpc_closure_sched(exec_ctx, &t->write_action, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &t->write_action, GRPC_ERROR_NONE); break; } GPR_TIMER_END("write_action_begin_locked", 0); @@ -879,7 +879,7 @@ static void write_action(grpc_exec_ctx *exec_ctx, void *gt, grpc_error *error) { GPR_TIMER_BEGIN("write_action", 0); grpc_endpoint_write( exec_ctx, t->ep, &t->outbuf, - grpc_closure_init(&t->write_action_end_locked, write_action_end_locked, t, + GRPC_CLOSURE_INIT(&t->write_action_end_locked, write_action_end_locked, t, grpc_combiner_scheduler(t->combiner))); GPR_TIMER_END("write_action", 0); } @@ -914,9 +914,9 @@ static void write_action_end_locked(grpc_exec_ctx *exec_ctx, void *tp, set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_WRITING, "continue writing [!covered]"); GRPC_CHTTP2_REF_TRANSPORT(t, "writing"); - grpc_closure_run( + GRPC_CLOSURE_RUN( exec_ctx, - grpc_closure_init(&t->write_action_begin_locked, + GRPC_CLOSURE_INIT(&t->write_action_begin_locked, write_action_begin_locked, t, grpc_combiner_finally_scheduler(t->combiner)), GRPC_ERROR_NONE); @@ -1046,7 +1046,7 @@ static void null_then_run_closure(grpc_exec_ctx *exec_ctx, grpc_closure **closure, grpc_error *error) { grpc_closure *c = *closure; *closure = NULL; - grpc_closure_run(exec_ctx, c, error); + GRPC_CLOSURE_RUN(exec_ctx, c, error); } void grpc_chttp2_complete_closure_step(grpc_exec_ctx *exec_ctx, @@ -1088,7 +1088,7 @@ void grpc_chttp2_complete_closure_step(grpc_exec_ctx *exec_ctx, } if ((t->write_state == GRPC_CHTTP2_WRITE_STATE_IDLE) || !(closure->next_data.scratch & CLOSURE_BARRIER_MAY_COVER_WRITE)) { - grpc_closure_run(exec_ctx, closure, closure->error_data.error); + GRPC_CLOSURE_RUN(exec_ctx, closure, closure->error_data.error); } else { grpc_closure_list_append(&t->run_after_write, closure, closure->error_data.error); @@ -1224,7 +1224,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, grpc_closure *on_complete = op->on_complete; if (on_complete == NULL) { on_complete = - grpc_closure_create(do_nothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_CREATE(do_nothing, NULL, grpc_schedule_on_exec_ctx); } /* use final_data as a barrier until enqueue time; the inital counter is @@ -1456,9 +1456,9 @@ static void perform_stream_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, op->handler_private.extra_arg = gs; GRPC_CHTTP2_STREAM_REF(s, "perform_stream_op"); - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, - grpc_closure_init(&op->handler_private.closure, perform_stream_op_locked, + GRPC_CLOSURE_INIT(&op->handler_private.closure, perform_stream_op_locked, op, grpc_combiner_scheduler(t->combiner)), GRPC_ERROR_NONE); GPR_TIMER_END("perform_stream_op", 0); @@ -1472,7 +1472,7 @@ static void cancel_pings(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_ping_queue *pq = &t->ping_queues[i]; for (size_t j = 0; j < GRPC_CHTTP2_PCL_COUNT; j++) { grpc_closure_list_fail_all(&pq->lists[j], GRPC_ERROR_REF(error)); - grpc_closure_list_sched(exec_ctx, &pq->lists[j]); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, &pq->lists[j]); } } GRPC_ERROR_UNREF(error); @@ -1507,7 +1507,7 @@ void grpc_chttp2_ack_ping(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, gpr_free(from); return; } - grpc_closure_list_sched(exec_ctx, &pq->lists[GRPC_CHTTP2_PCL_INFLIGHT]); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, &pq->lists[GRPC_CHTTP2_PCL_INFLIGHT]); if (!grpc_closure_list_empty(pq->lists[GRPC_CHTTP2_PCL_NEXT])) { grpc_chttp2_initiate_write(exec_ctx, t, "continue_pings"); } @@ -1581,7 +1581,7 @@ static void perform_transport_op_locked(grpc_exec_ctx *exec_ctx, close_transport_locked(exec_ctx, t, close_transport); } - grpc_closure_run(exec_ctx, op->on_consumed, GRPC_ERROR_NONE); + GRPC_CLOSURE_RUN(exec_ctx, op->on_consumed, GRPC_ERROR_NONE); GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "transport_op"); } @@ -1593,8 +1593,8 @@ static void perform_transport_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, gpr_free(msg); op->handler_private.extra_arg = gt; GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op"); - grpc_closure_sched(exec_ctx, - grpc_closure_init(&op->handler_private.closure, + GRPC_CLOSURE_SCHED(exec_ctx, + GRPC_CLOSURE_INIT(&op->handler_private.closure, perform_transport_op_locked, op, grpc_combiner_scheduler(t->combiner)), GRPC_ERROR_NONE); @@ -2472,7 +2472,7 @@ static void reset_byte_stream(grpc_exec_ctx *exec_ctx, void *arg, grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, s->t, s); } else { GPR_ASSERT(error != GRPC_ERROR_NONE); - grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); s->on_next = NULL; GRPC_ERROR_UNREF(s->byte_stream_error); s->byte_stream_error = GRPC_ERROR_NONE; @@ -2551,9 +2551,9 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, if (s->frame_storage.length > 0) { grpc_slice_buffer_swap(&s->frame_storage, &s->unprocessed_incoming_frames_buffer); - grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); } else if (s->byte_stream_error != GRPC_ERROR_NONE) { - grpc_closure_sched(exec_ctx, bs->next_action.on_complete, + GRPC_CLOSURE_SCHED(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_REF(s->byte_stream_error)); if (s->data_parser.parsing_frame != NULL) { incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame); @@ -2563,7 +2563,7 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, if (bs->remaining_bytes != 0) { s->byte_stream_error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); - grpc_closure_sched(exec_ctx, bs->next_action.on_complete, + GRPC_CLOSURE_SCHED(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_REF(s->byte_stream_error)); if (s->data_parser.parsing_frame != NULL) { incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame); @@ -2594,9 +2594,9 @@ static bool incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, gpr_ref(&bs->refs); bs->next_action.max_size_hint = max_size_hint; bs->next_action.on_complete = on_complete; - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, - grpc_closure_init(&bs->next_action.closure, + GRPC_CLOSURE_INIT(&bs->next_action.closure, incoming_byte_stream_next_locked, bs, grpc_combiner_scheduler(bs->transport->combiner)), GRPC_ERROR_NONE); @@ -2623,7 +2623,7 @@ static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, } else { grpc_error *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); - grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); return error; } GPR_TIMER_END("incoming_byte_stream_pull", 0); @@ -2652,8 +2652,8 @@ static void incoming_byte_stream_destroy(grpc_exec_ctx *exec_ctx, GPR_TIMER_BEGIN("incoming_byte_stream_destroy", 0); grpc_chttp2_incoming_byte_stream *bs = (grpc_chttp2_incoming_byte_stream *)byte_stream; - grpc_closure_sched( - exec_ctx, grpc_closure_init( + GRPC_CLOSURE_SCHED( + exec_ctx, GRPC_CLOSURE_INIT( &bs->destroy_action, incoming_byte_stream_destroy_locked, bs, grpc_combiner_scheduler(bs->transport->combiner)), GRPC_ERROR_NONE); @@ -2666,7 +2666,7 @@ static void incoming_byte_stream_publish_error( grpc_chttp2_stream *s = bs->stream; GPR_ASSERT(error != GRPC_ERROR_NONE); - grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); s->on_next = NULL; GRPC_ERROR_UNREF(s->byte_stream_error); s->byte_stream_error = GRPC_ERROR_REF(error); @@ -2683,7 +2683,7 @@ grpc_error *grpc_chttp2_incoming_byte_stream_push( grpc_error *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream"); - grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); grpc_slice_unref_internal(exec_ctx, slice); return error; } else { @@ -2706,7 +2706,7 @@ grpc_error *grpc_chttp2_incoming_byte_stream_finished( } } if (error != GRPC_ERROR_NONE && reset_on_error) { - grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); } incoming_byte_stream_unref(exec_ctx, bs); return error; @@ -2940,5 +2940,5 @@ void grpc_chttp2_transport_start_reading(grpc_exec_ctx *exec_ctx, grpc_slice_buffer_move_into(read_buffer, &t->read_buffer); gpr_free(read_buffer); } - grpc_closure_sched(exec_ctx, &t->read_action_locked, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &t->read_action_locked, GRPC_ERROR_NONE); } diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index dac0cb63a3..fa0dfa0333 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -295,7 +295,7 @@ grpc_error *grpc_chttp2_data_parser_parse(grpc_exec_ctx *exec_ctx, void *parser, GPR_ASSERT(s->frame_storage.length == 0); grpc_slice_ref_internal(slice); grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, slice); - grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, s->on_next, GRPC_ERROR_NONE); s->on_next = NULL; } else { grpc_slice_ref_internal(slice); diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.c b/src/core/ext/transport/chttp2/transport/hpack_parser.c index ab5f3288ac..7f37365558 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.c +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.c @@ -1696,9 +1696,9 @@ grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx, however -- it might be that we receive a RST_STREAM following this and can avoid the extra write */ GRPC_CHTTP2_STREAM_REF(s, "final_rst"); - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, - grpc_closure_create(force_client_rst_stream, s, + GRPC_CLOSURE_CREATE(force_client_rst_stream, s, grpc_combiner_finally_scheduler(t->combiner)), GRPC_ERROR_NONE); } diff --git a/src/core/ext/transport/chttp2/transport/writing.c b/src/core/ext/transport/chttp2/transport/writing.c index 02cf42283a..4db0fbb098 100644 --- a/src/core/ext/transport/chttp2/transport/writing.c +++ b/src/core/ext/transport/chttp2/transport/writing.c @@ -111,7 +111,7 @@ static void maybe_initiate_ping(grpc_exec_ctx *exec_ctx, } pq->inflight_id = t->ping_ctr * GRPC_CHTTP2_PING_TYPE_COUNT + ping_type; t->ping_ctr++; - grpc_closure_list_sched(exec_ctx, &pq->lists[GRPC_CHTTP2_PCL_INITIATE]); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, &pq->lists[GRPC_CHTTP2_PCL_INITIATE]); grpc_closure_list_move(&pq->lists[GRPC_CHTTP2_PCL_NEXT], &pq->lists[GRPC_CHTTP2_PCL_INFLIGHT]); grpc_slice_buffer_add(&t->outbuf, diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 8d0eb74d9d..ce72fc3d08 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -1033,17 +1033,17 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, OP_RECV_INITIAL_METADATA)) { CRONET_LOG(GPR_DEBUG, "running: %p OP_RECV_INITIAL_METADATA", oas); if (stream_state->state_op_done[OP_CANCEL_ERROR]) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, stream_op->payload->recv_initial_metadata.recv_initial_metadata_ready, GRPC_ERROR_NONE); } else if (stream_state->state_callback_received[OP_FAILED]) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, stream_op->payload->recv_initial_metadata.recv_initial_metadata_ready, GRPC_ERROR_NONE); } else if (stream_state->state_op_done[OP_RECV_TRAILING_METADATA]) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, stream_op->payload->recv_initial_metadata.recv_initial_metadata_ready, GRPC_ERROR_NONE); @@ -1051,7 +1051,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_metadata_buffer_publish( exec_ctx, &oas->s->state.rs.initial_metadata, stream_op->payload->recv_initial_metadata.recv_initial_metadata); - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, stream_op->payload->recv_initial_metadata.recv_initial_metadata_ready, GRPC_ERROR_NONE); @@ -1063,14 +1063,14 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, CRONET_LOG(GPR_DEBUG, "running: %p OP_RECV_MESSAGE", oas); if (stream_state->state_op_done[OP_CANCEL_ERROR]) { CRONET_LOG(GPR_DEBUG, "Stream is cancelled."); - grpc_closure_sched(exec_ctx, + GRPC_CLOSURE_SCHED(exec_ctx, stream_op->payload->recv_message.recv_message_ready, GRPC_ERROR_NONE); stream_state->state_op_done[OP_RECV_MESSAGE] = true; result = ACTION_TAKEN_NO_CALLBACK; } else if (stream_state->state_callback_received[OP_FAILED]) { CRONET_LOG(GPR_DEBUG, "Stream failed."); - grpc_closure_sched(exec_ctx, + GRPC_CLOSURE_SCHED(exec_ctx, stream_op->payload->recv_message.recv_message_ready, GRPC_ERROR_NONE); stream_state->state_op_done[OP_RECV_MESSAGE] = true; @@ -1078,7 +1078,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, } else if (stream_state->rs.read_stream_closed == true) { /* No more data will be received */ CRONET_LOG(GPR_DEBUG, "read stream closed"); - grpc_closure_sched(exec_ctx, + GRPC_CLOSURE_SCHED(exec_ctx, stream_op->payload->recv_message.recv_message_ready, GRPC_ERROR_NONE); stream_state->state_op_done[OP_RECV_MESSAGE] = true; @@ -1086,7 +1086,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, result = ACTION_TAKEN_NO_CALLBACK; } else if (stream_state->flush_read) { CRONET_LOG(GPR_DEBUG, "flush read"); - grpc_closure_sched(exec_ctx, + GRPC_CLOSURE_SCHED(exec_ctx, stream_op->payload->recv_message.recv_message_ready, GRPC_ERROR_NONE); stream_state->state_op_done[OP_RECV_MESSAGE] = true; @@ -1127,7 +1127,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, *((grpc_byte_buffer **) stream_op->payload->recv_message.recv_message) = (grpc_byte_buffer *)&stream_state->rs.sbs; - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, stream_op->payload->recv_message.recv_message_ready, GRPC_ERROR_NONE); stream_state->state_op_done[OP_RECV_MESSAGE] = true; @@ -1181,7 +1181,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, } *((grpc_byte_buffer **)stream_op->payload->recv_message.recv_message) = (grpc_byte_buffer *)&stream_state->rs.sbs; - grpc_closure_sched(exec_ctx, + GRPC_CLOSURE_SCHED(exec_ctx, stream_op->payload->recv_message.recv_message_ready, GRPC_ERROR_NONE); stream_state->state_op_done[OP_RECV_MESSAGE] = true; @@ -1230,17 +1230,17 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, op_can_be_run(stream_op, s, &oas->state, OP_ON_COMPLETE)) { CRONET_LOG(GPR_DEBUG, "running: %p OP_ON_COMPLETE", oas); if (stream_state->state_op_done[OP_CANCEL_ERROR]) { - grpc_closure_sched(exec_ctx, stream_op->on_complete, + GRPC_CLOSURE_SCHED(exec_ctx, stream_op->on_complete, GRPC_ERROR_REF(stream_state->cancel_error)); } else if (stream_state->state_callback_received[OP_FAILED]) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, stream_op->on_complete, make_error_with_desc(GRPC_STATUS_UNAVAILABLE, "Unavailable.")); } else { /* All actions in this stream_op are complete. Call the on_complete * callback */ - grpc_closure_sched(exec_ctx, stream_op->on_complete, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, stream_op->on_complete, GRPC_ERROR_NONE); } oas->state.state_op_done[OP_ON_COMPLETE] = true; oas->done = true; @@ -1312,16 +1312,16 @@ static void perform_stream_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, /* Cronet does not support :authority header field. We cancel the call when this field is present in metadata */ if (op->recv_initial_metadata) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, op->payload->recv_initial_metadata.recv_initial_metadata_ready, GRPC_ERROR_CANCELLED); } if (op->recv_message) { - grpc_closure_sched(exec_ctx, op->payload->recv_message.recv_message_ready, + GRPC_CLOSURE_SCHED(exec_ctx, op->payload->recv_message.recv_message_ready, GRPC_ERROR_CANCELLED); } - grpc_closure_sched(exec_ctx, op->on_complete, GRPC_ERROR_CANCELLED); + GRPC_CLOSURE_SCHED(exec_ctx, op->on_complete, GRPC_ERROR_CANCELLED); return; } stream_obj *s = (stream_obj *)gs; @@ -1335,7 +1335,7 @@ static void destroy_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, stream_obj *s = (stream_obj *)gs; null_and_maybe_free_read_buffer(s); GRPC_ERROR_UNREF(s->state.cancel_error); - grpc_closure_sched(exec_ctx, then_schedule_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, then_schedule_closure, GRPC_ERROR_NONE); } static void destroy_transport(grpc_exec_ctx *exec_ctx, grpc_transport *gt) {} diff --git a/src/core/lib/channel/channel_stack.h b/src/core/lib/channel/channel_stack.h index d6877f6a91..b0559ad745 100644 --- a/src/core/lib/channel/channel_stack.h +++ b/src/core/lib/channel/channel_stack.h @@ -126,7 +126,7 @@ typedef struct { /* Destroy per call data. The filter does not need to do any chaining. The bottom filter of a stack will be passed a non-NULL pointer to - \a then_schedule_closure that should be passed to grpc_closure_sched when + \a then_schedule_closure that should be passed to GRPC_CLOSURE_SCHED when destruction is complete. \a final_info contains data about the completed call, mainly for reporting purposes. */ void (*destroy_call_elem)(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, diff --git a/src/core/lib/channel/handshaker.c b/src/core/lib/channel/handshaker.c index a351e98203..2cb83f4114 100644 --- a/src/core/lib/channel/handshaker.c +++ b/src/core/lib/channel/handshaker.c @@ -190,7 +190,7 @@ static bool call_next_handshaker_locked(grpc_exec_ctx* exec_ctx, // Cancel deadline timer, since we're invoking the on_handshake_done // callback now. grpc_timer_cancel(exec_ctx, &mgr->deadline_timer); - grpc_closure_sched(exec_ctx, &mgr->on_handshake_done, error); + GRPC_CLOSURE_SCHED(exec_ctx, &mgr->on_handshake_done, error); mgr->shutdown = true; } else { grpc_handshaker_do_handshake(exec_ctx, mgr->handshakers[mgr->index], @@ -245,13 +245,13 @@ void grpc_handshake_manager_do_handshake( grpc_slice_buffer_init(mgr->args.read_buffer); // Initialize state needed for calling handshakers. mgr->acceptor = acceptor; - grpc_closure_init(&mgr->call_next_handshaker, call_next_handshaker, mgr, + GRPC_CLOSURE_INIT(&mgr->call_next_handshaker, call_next_handshaker, mgr, grpc_schedule_on_exec_ctx); - grpc_closure_init(&mgr->on_handshake_done, on_handshake_done, &mgr->args, + GRPC_CLOSURE_INIT(&mgr->on_handshake_done, on_handshake_done, &mgr->args, grpc_schedule_on_exec_ctx); // Start deadline timer, which owns a ref. gpr_ref(&mgr->refs); - grpc_closure_init(&mgr->on_timeout, on_timeout, mgr, + GRPC_CLOSURE_INIT(&mgr->on_timeout, on_timeout, mgr, grpc_schedule_on_exec_ctx); grpc_timer_init(exec_ctx, &mgr->deadline_timer, gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC), diff --git a/src/core/lib/http/httpcli.c b/src/core/lib/http/httpcli.c index 492eb5ad7b..1b7e2cfe68 100644 --- a/src/core/lib/http/httpcli.c +++ b/src/core/lib/http/httpcli.c @@ -90,7 +90,7 @@ static void finish(grpc_exec_ctx *exec_ctx, internal_request *req, grpc_error *error) { grpc_polling_entity_del_from_pollset_set(exec_ctx, req->pollent, req->context->pollset_set); - grpc_closure_sched(exec_ctx, req->on_done, error); + GRPC_CLOSURE_SCHED(exec_ctx, req->on_done, error); grpc_http_parser_destroy(&req->parser); if (req->addresses != NULL) { grpc_resolved_addresses_destroy(req->addresses); @@ -213,7 +213,7 @@ static void next_address(grpc_exec_ctx *exec_ctx, internal_request *req, return; } addr = &req->addresses->addrs[req->next_address++]; - grpc_closure_init(&req->connected, on_connected, req, + GRPC_CLOSURE_INIT(&req->connected, on_connected, req, grpc_schedule_on_exec_ctx); grpc_arg arg; arg.key = GRPC_ARG_RESOURCE_QUOTA; @@ -256,8 +256,8 @@ static void internal_request_begin(grpc_exec_ctx *exec_ctx, req->pollent = pollent; req->overall_error = GRPC_ERROR_NONE; req->resource_quota = grpc_resource_quota_ref_internal(resource_quota); - grpc_closure_init(&req->on_read, on_read, req, grpc_schedule_on_exec_ctx); - grpc_closure_init(&req->done_write, done_write, req, + GRPC_CLOSURE_INIT(&req->on_read, on_read, req, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&req->done_write, done_write, req, grpc_schedule_on_exec_ctx); grpc_slice_buffer_init(&req->incoming); grpc_slice_buffer_init(&req->outgoing); @@ -271,7 +271,7 @@ static void internal_request_begin(grpc_exec_ctx *exec_ctx, grpc_resolve_address( exec_ctx, request->host, req->handshaker->default_port, req->context->pollset_set, - grpc_closure_create(on_resolved, req, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(on_resolved, req, grpc_schedule_on_exec_ctx), &req->addresses); } diff --git a/src/core/lib/http/httpcli_security_connector.c b/src/core/lib/http/httpcli_security_connector.c index 6500192277..34a77c3bf4 100644 --- a/src/core/lib/http/httpcli_security_connector.c +++ b/src/core/lib/http/httpcli_security_connector.c @@ -85,7 +85,7 @@ static void httpcli_ssl_check_peer(grpc_exec_ctx *exec_ctx, error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg); gpr_free(msg); } - grpc_closure_sched(exec_ctx, on_peer_checked, error); + GRPC_CLOSURE_SCHED(exec_ctx, on_peer_checked, error); tsi_peer_destruct(&peer); } diff --git a/src/core/lib/iomgr/closure.c b/src/core/lib/iomgr/closure.c index 72a1b20443..719e2e8cee 100644 --- a/src/core/lib/iomgr/closure.c +++ b/src/core/lib/iomgr/closure.c @@ -24,14 +24,26 @@ #include "src/core/lib/profiling/timers.h" +#ifdef GRPC_CLOSURE_RICH_DEBUG +grpc_closure *grpc_closure_init(const char *file, int line, + grpc_closure *closure, grpc_iomgr_cb_func cb, + void *cb_arg, + grpc_closure_scheduler *scheduler) { +#else grpc_closure *grpc_closure_init(grpc_closure *closure, grpc_iomgr_cb_func cb, void *cb_arg, grpc_closure_scheduler *scheduler) { +#endif closure->cb = cb; closure->cb_arg = cb_arg; closure->scheduler = scheduler; -#ifndef NDEBUG +#ifdef GRPC_CLOSURE_RICH_DEBUG closure->scheduled = false; + closure->file_initiated = NULL; + closure->line_initiated = 0; + closure->run = false; + closure->file_created = file; + closure->line_created = line; #endif return closure; } @@ -100,19 +112,39 @@ static void closure_wrapper(grpc_exec_ctx *exec_ctx, void *arg, cb(exec_ctx, cb_arg, error); } +#ifdef GRPC_CLOSURE_RICH_DEBUG +grpc_closure *grpc_closure_create(const char *file, int line, + grpc_iomgr_cb_func cb, void *cb_arg, + grpc_closure_scheduler *scheduler) { +#else grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg, grpc_closure_scheduler *scheduler) { +#endif wrapped_closure *wc = gpr_malloc(sizeof(*wc)); wc->cb = cb; wc->cb_arg = cb_arg; +#ifdef GRPC_CLOSURE_RICH_DEBUG + grpc_closure_init(file, line, &wc->wrapper, closure_wrapper, wc, scheduler); +#else grpc_closure_init(&wc->wrapper, closure_wrapper, wc, scheduler); +#endif return &wc->wrapper; } +#ifdef GRPC_CLOSURE_RICH_DEBUG +void grpc_closure_run(const char *file, int line, grpc_exec_ctx *exec_ctx, + grpc_closure *c, grpc_error *error) { +#else void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *c, grpc_error *error) { +#endif GPR_TIMER_BEGIN("grpc_closure_run", 0); if (c != NULL) { +#ifdef GRPC_CLOSURE_RICH_DEBUG + c->file_initiated = file; + c->line_initiated = line; + c->run = true; +#endif assert(c->cb); c->scheduler->vtable->run(exec_ctx, c, error); } else { @@ -121,13 +153,21 @@ void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *c, GPR_TIMER_END("grpc_closure_run", 0); } +#ifdef GRPC_CLOSURE_RICH_DEBUG +void grpc_closure_sched(const char *file, int line, grpc_exec_ctx *exec_ctx, + grpc_closure *c, grpc_error *error) { +#else void grpc_closure_sched(grpc_exec_ctx *exec_ctx, grpc_closure *c, grpc_error *error) { +#endif GPR_TIMER_BEGIN("grpc_closure_sched", 0); if (c != NULL) { -#ifndef NDEBUG +#ifdef GRPC_CLOSURE_RICH_DEBUG GPR_ASSERT(!c->scheduled); c->scheduled = true; + c->file_initiated = file; + c->line_initiated = line; + c->run = false; #endif assert(c->cb); c->scheduler->vtable->sched(exec_ctx, c, error); @@ -137,13 +177,21 @@ void grpc_closure_sched(grpc_exec_ctx *exec_ctx, grpc_closure *c, GPR_TIMER_END("grpc_closure_sched", 0); } +#ifdef GRPC_CLOSURE_RICH_DEBUG +void grpc_closure_list_sched(const char *file, int line, + grpc_exec_ctx *exec_ctx, grpc_closure_list *list) { +#else void grpc_closure_list_sched(grpc_exec_ctx *exec_ctx, grpc_closure_list *list) { +#endif grpc_closure *c = list->head; while (c != NULL) { grpc_closure *next = c->next_data.next; -#ifndef NDEBUG +#ifdef GRPC_CLOSURE_RICH_DEBUG GPR_ASSERT(!c->scheduled); c->scheduled = true; + c->file_initiated = file; + c->line_initiated = line; + c->run = false; #endif assert(c->cb); c->scheduler->vtable->sched(exec_ctx, c, c->error_data.error); diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index 25086fa483..3ecf9e947b 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -59,6 +59,8 @@ struct grpc_closure_scheduler { const grpc_closure_scheduler_vtable *vtable; }; +// #define GRPC_CLOSURE_RICH_DEBUG + /** A closure over a grpc_iomgr_cb_func. */ struct grpc_closure { /** Once queued, next indicates the next queued closure; before then, scratch @@ -85,19 +87,47 @@ struct grpc_closure { uintptr_t scratch; } error_data; -#ifndef NDEBUG +// extra tracing and debugging for grpc_closure. This incurs a decent amount of +// overhead per closure, so it must be enabled at compile time. +#ifdef GRPC_CLOSURE_RICH_DEBUG bool scheduled; + bool run; // true = run, false = scheduled + const char *file_created; + int line_created; + const char *file_initiated; + int line_initiated; #endif }; /** Initializes \a closure with \a cb and \a cb_arg. Returns \a closure. */ +#ifdef GRPC_CLOSURE_RICH_DEBUG +grpc_closure *grpc_closure_init(const char *file, int line, + grpc_closure *closure, grpc_iomgr_cb_func cb, + void *cb_arg, + grpc_closure_scheduler *scheduler); +#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler) \ + grpc_closure_init(__FILE__, __LINE__, closure, cb, cb_arg, scheduler) +#else grpc_closure *grpc_closure_init(grpc_closure *closure, grpc_iomgr_cb_func cb, void *cb_arg, grpc_closure_scheduler *scheduler); +#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler) \ + grpc_closure_init(closure, cb, cb_arg, scheduler) +#endif /* Create a heap allocated closure: try to avoid except for very rare events */ +#ifdef GRPC_CLOSURE_RICH_DEBUG +grpc_closure *grpc_closure_create(const char *file, int line, + grpc_iomgr_cb_func cb, void *cb_arg, + grpc_closure_scheduler *scheduler); +#define GRPC_CLOSURE_CREATE(cb, cb_arg, scheduler) \ + grpc_closure_create(__FILE__, __LINE__, cb, cb_arg, scheduler) +#else grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg, grpc_closure_scheduler *scheduler); +#define GRPC_CLOSURE_CREATE(cb, cb_arg, scheduler) \ + grpc_closure_create(cb, cb_arg, scheduler) +#endif #define GRPC_CLOSURE_LIST_INIT \ { NULL, NULL } @@ -123,16 +153,44 @@ bool grpc_closure_list_empty(grpc_closure_list list); /** Run a closure directly. Caller ensures that no locks are being held above. * Note that calling this at the end of a closure callback function itself is * by definition safe. */ +#ifdef GRPC_CLOSURE_RICH_DEBUG +void grpc_closure_run(const char *file, int line, grpc_exec_ctx *exec_ctx, + grpc_closure *closure, grpc_error *error); +#define GRPC_CLOSURE_RUN(exec_ctx, closure, error) \ + grpc_closure_run(__FILE__, __LINE__, exec_ctx, closure, error) +#else void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error); +#define GRPC_CLOSURE_RUN(exec_ctx, closure, error) \ + grpc_closure_run(exec_ctx, closure, error) +#endif /** Schedule a closure to be run. Does not need to be run from a safe point. */ +#ifdef GRPC_CLOSURE_RICH_DEBUG +void grpc_closure_sched(const char *file, int line, grpc_exec_ctx *exec_ctx, + grpc_closure *closure, grpc_error *error); +#define GRPC_CLOSURE_SCHED(exec_ctx, closure, error) \ + grpc_closure_sched(__FILE__, __LINE__, exec_ctx, closure, error) +#else void grpc_closure_sched(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error); +#define GRPC_CLOSURE_SCHED(exec_ctx, closure, error) \ + grpc_closure_sched(exec_ctx, closure, error) +#endif /** Schedule all closures in a list to be run. Does not need to be run from a * safe point. */ +#ifdef GRPC_CLOSURE_RICH_DEBUG +void grpc_closure_list_sched(const char *file, int line, + grpc_exec_ctx *exec_ctx, + grpc_closure_list *closure_list); +#define GRPC_CLOSURE_LIST_SCHED(exec_ctx, closure_list) \ + grpc_closure_list_sched(__FILE__, __LINE__, exec_ctx, closure_list) +#else void grpc_closure_list_sched(grpc_exec_ctx *exec_ctx, grpc_closure_list *closure_list); +#define GRPC_CLOSURE_LIST_SCHED(exec_ctx, closure_list) \ + grpc_closure_list_sched(exec_ctx, closure_list) +#endif #endif /* GRPC_CORE_LIB_IOMGR_CLOSURE_H */ diff --git a/src/core/lib/iomgr/combiner.c b/src/core/lib/iomgr/combiner.c index f6976c5650..750ff102ff 100644 --- a/src/core/lib/iomgr/combiner.c +++ b/src/core/lib/iomgr/combiner.c @@ -81,7 +81,7 @@ grpc_combiner *grpc_combiner_create(void) { gpr_atm_no_barrier_store(&lock->state, STATE_UNORPHANED); gpr_mpscq_init(&lock->queue); grpc_closure_list_init(&lock->final_list); - grpc_closure_init(&lock->offload, offload, lock, grpc_executor_scheduler); + GRPC_CLOSURE_INIT(&lock->offload, offload, lock, grpc_executor_scheduler); GRPC_COMBINER_TRACE(gpr_log(GPR_DEBUG, "C:%p create", lock)); return lock; } @@ -196,7 +196,7 @@ static void offload(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { static void queue_offload(grpc_exec_ctx *exec_ctx, grpc_combiner *lock) { move_next(exec_ctx); GRPC_COMBINER_TRACE(gpr_log(GPR_DEBUG, "C:%p queue_offload", lock)); - grpc_closure_sched(exec_ctx, &lock->offload, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &lock->offload, GRPC_ERROR_NONE); } bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx) { @@ -247,7 +247,7 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx) { GPR_TIMER_BEGIN("combiner.exec1", 0); grpc_closure *cl = (grpc_closure *)n; grpc_error *cl_err = cl->error_data.error; -#ifndef NDEBUG +#ifdef GRPC_CLOSURE_RICH_DEBUG cl->scheduled = false; #endif cl->cb(exec_ctx, cl->cb_arg, cl_err); @@ -264,7 +264,7 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx) { gpr_log(GPR_DEBUG, "C:%p execute_final[%d] c=%p", lock, loops, c)); grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; -#ifndef NDEBUG +#ifdef GRPC_CLOSURE_RICH_DEBUG c->scheduled = false; #endif c->cb(exec_ctx, c->cb_arg, error); @@ -332,8 +332,8 @@ static void combiner_finally_exec(grpc_exec_ctx *exec_ctx, GPR_TIMER_BEGIN("combiner.execute_finally", 0); if (exec_ctx->active_combiner != lock) { GPR_TIMER_MARK("slowpath", 0); - grpc_closure_sched(exec_ctx, - grpc_closure_create(enqueue_finally, closure, + GRPC_CLOSURE_SCHED(exec_ctx, + GRPC_CLOSURE_CREATE(enqueue_finally, closure, grpc_combiner_scheduler(lock)), error); GPR_TIMER_END("combiner.execute_finally", 0); diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index e626845fa4..1ce916f2ec 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -149,7 +149,7 @@ grpc_error *grpc_error_create(const char *file, int line, grpc_slice desc, grpc_error_create(__FILE__, __LINE__, grpc_slice_from_copied_string(desc), \ errs, count) -//#define GRPC_ERROR_REFCOUNT_DEBUG +// #define GRPC_ERROR_REFCOUNT_DEBUG #ifdef GRPC_ERROR_REFCOUNT_DEBUG grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line, const char *func); diff --git a/src/core/lib/iomgr/ev_epoll1_linux.c b/src/core/lib/iomgr/ev_epoll1_linux.c index 63f6962ede..e0c05457e3 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.c +++ b/src/core/lib/iomgr/ev_epoll1_linux.c @@ -237,7 +237,7 @@ static void fd_orphan(grpc_exec_ctx *exec_ctx, grpc_fd *fd, close(fd->fd); } - grpc_closure_sched(exec_ctx, on_done, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_REF(error)); grpc_iomgr_unregister_object(&fd->iomgr_object); grpc_lfev_destroy(&fd->read_closure); @@ -427,7 +427,7 @@ static void pollset_maybe_finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset) { if (pollset->shutdown_closure != NULL && pollset->root_worker == NULL && pollset->begin_refs == 0) { - grpc_closure_sched(exec_ctx, pollset->shutdown_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, pollset->shutdown_closure, GRPC_ERROR_NONE); pollset->shutdown_closure = NULL; } } diff --git a/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c b/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c index d7ae0d371e..761e2ed5fe 100644 --- a/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +++ b/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c @@ -965,7 +965,7 @@ static void fd_orphan(grpc_exec_ctx *exec_ctx, grpc_fd *fd, fd->po.pi = NULL; } - grpc_closure_sched(exec_ctx, fd->on_done_closure, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, fd->on_done_closure, GRPC_ERROR_REF(error)); gpr_mu_unlock(&fd->po.mu); UNREF_BY(fd, 2, reason); /* Drop the reference */ @@ -1250,7 +1250,7 @@ static void finish_shutdown_locked(grpc_exec_ctx *exec_ctx, /* Release the ref and set pollset->po.pi to NULL */ pollset_release_polling_island(exec_ctx, pollset, "ps_shutdown"); - grpc_closure_sched(exec_ctx, pollset->shutdown_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, pollset->shutdown_done, GRPC_ERROR_NONE); } /* pollset->po.mu lock must be held by the caller before calling this */ diff --git a/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c b/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c index 8692b5b3c3..0ab3594818 100644 --- a/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +++ b/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c @@ -515,7 +515,7 @@ static void fd_orphan(grpc_exec_ctx *exec_ctx, grpc_fd *fd, fd->eps = NULL; } - grpc_closure_sched(exec_ctx, fd->on_done_closure, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, fd->on_done_closure, GRPC_ERROR_REF(error)); gpr_mu_unlock(&fd->mu); @@ -716,7 +716,7 @@ static void finish_shutdown_locked(grpc_exec_ctx *exec_ctx, /* Release the ref and set pollset->eps to NULL */ pollset_release_epoll_set(exec_ctx, pollset, "ps_shutdown"); - grpc_closure_sched(exec_ctx, pollset->shutdown_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, pollset->shutdown_done, GRPC_ERROR_NONE); } /* pollset->mu lock must be held by the caller before calling this */ diff --git a/src/core/lib/iomgr/ev_epollex_linux.c b/src/core/lib/iomgr/ev_epollex_linux.c index c3627dc914..abcf7b429f 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.c +++ b/src/core/lib/iomgr/ev_epollex_linux.c @@ -269,7 +269,7 @@ static void unref_by(grpc_exec_ctx *exec_ctx, grpc_fd *fd, int n) { #endif old = gpr_atm_full_fetch_add(&fd->refst, -n); if (old == n) { - grpc_closure_sched(exec_ctx, grpc_closure_create(fd_destroy, fd, + GRPC_CLOSURE_SCHED(exec_ctx, GRPC_CLOSURE_CREATE(fd_destroy, fd, grpc_schedule_on_exec_ctx), GRPC_ERROR_NONE); } else { @@ -367,7 +367,7 @@ static void fd_orphan(grpc_exec_ctx *exec_ctx, grpc_fd *fd, to be alive (and not added to freelist) until the end of this function */ REF_BY(fd, 1, reason); - grpc_closure_sched(exec_ctx, fd->on_done_closure, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, fd->on_done_closure, GRPC_ERROR_REF(error)); gpr_mu_unlock(&fd->orphaned_mu); gpr_mu_unlock(&fd->pollable.po.mu); @@ -667,7 +667,7 @@ static grpc_error *fd_become_pollable_locked(grpc_fd *fd) { static void pollset_maybe_finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset) { if (pollset->shutdown_closure != NULL && pollset->root_worker == NULL) { - grpc_closure_sched(exec_ctx, pollset->shutdown_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, pollset->shutdown_closure, GRPC_ERROR_NONE); pollset->shutdown_closure = NULL; } } @@ -966,8 +966,8 @@ static grpc_error *pollset_add_fd_locked(grpc_exec_ctx *exec_ctx, pollable_add_fd(&pollset->pollable, had_fd); pollable_add_fd(&pollset->pollable, fd); } - grpc_closure_sched(exec_ctx, - grpc_closure_create(unref_fd_no_longer_poller, had_fd, + GRPC_CLOSURE_SCHED(exec_ctx, + GRPC_CLOSURE_CREATE(unref_fd_no_longer_poller, had_fd, grpc_schedule_on_exec_ctx), GRPC_ERROR_NONE); } diff --git a/src/core/lib/iomgr/ev_epollsig_linux.c b/src/core/lib/iomgr/ev_epollsig_linux.c index 29a86f73ff..fa4b4e8d0a 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.c +++ b/src/core/lib/iomgr/ev_epollsig_linux.c @@ -893,7 +893,7 @@ static void fd_orphan(grpc_exec_ctx *exec_ctx, grpc_fd *fd, fd->po.pi = NULL; } - grpc_closure_sched(exec_ctx, fd->on_done_closure, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, fd->on_done_closure, GRPC_ERROR_REF(error)); gpr_mu_unlock(&fd->po.mu); UNREF_BY(fd, 2, reason); /* Drop the reference */ @@ -1147,7 +1147,7 @@ static void finish_shutdown_locked(grpc_exec_ctx *exec_ctx, /* Release the ref and set pollset->po.pi to NULL */ pollset_release_polling_island(exec_ctx, pollset, "ps_shutdown"); - grpc_closure_sched(exec_ctx, pollset->shutdown_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, pollset->shutdown_done, GRPC_ERROR_NONE); } /* pollset->po.mu lock must be held by the caller before calling this */ diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index 6145c9ec3f..d1a27b8228 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -386,7 +386,7 @@ static void close_fd_locked(grpc_exec_ctx *exec_ctx, grpc_fd *fd) { if (!fd->released) { close(fd->fd); } - grpc_closure_sched(exec_ctx, fd->on_done_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, fd->on_done_closure, GRPC_ERROR_NONE); } static int fd_wrapped_fd(grpc_fd *fd) { @@ -445,7 +445,7 @@ static grpc_error *fd_shutdown_error(grpc_fd *fd) { static void notify_on_locked(grpc_exec_ctx *exec_ctx, grpc_fd *fd, grpc_closure **st, grpc_closure *closure) { if (fd->shutdown) { - grpc_closure_sched(exec_ctx, closure, + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_CREATE_FROM_STATIC_STRING("FD shutdown")); } else if (*st == CLOSURE_NOT_READY) { /* not ready ==> switch to a waiting state by setting the closure */ @@ -453,7 +453,7 @@ static void notify_on_locked(grpc_exec_ctx *exec_ctx, grpc_fd *fd, } else if (*st == CLOSURE_READY) { /* already ready ==> queue the closure to run immediately */ *st = CLOSURE_NOT_READY; - grpc_closure_sched(exec_ctx, closure, fd_shutdown_error(fd)); + GRPC_CLOSURE_SCHED(exec_ctx, closure, fd_shutdown_error(fd)); maybe_wake_one_watcher_locked(fd); } else { /* upcallptr was set to a different closure. This is an error! */ @@ -476,7 +476,7 @@ static int set_ready_locked(grpc_exec_ctx *exec_ctx, grpc_fd *fd, return 0; } else { /* waiting ==> queue closure */ - grpc_closure_sched(exec_ctx, *st, fd_shutdown_error(fd)); + GRPC_CLOSURE_SCHED(exec_ctx, *st, fd_shutdown_error(fd)); *st = CLOSURE_NOT_READY; return 1; } @@ -834,7 +834,7 @@ static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset) { GRPC_FD_UNREF(pollset->fds[i], "multipoller"); } pollset->fd_count = 0; - grpc_closure_sched(exec_ctx, pollset->shutdown_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, pollset->shutdown_done, GRPC_ERROR_NONE); } static void work_combine_error(grpc_error **composite, grpc_error *error) { @@ -883,7 +883,7 @@ static grpc_error *pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, if (!pollset_has_workers(pollset) && !grpc_closure_list_empty(pollset->idle_jobs)) { GPR_TIMER_MARK("pollset_work.idle_jobs", 0); - grpc_closure_list_sched(exec_ctx, &pollset->idle_jobs); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, &pollset->idle_jobs); goto done; } /* If we're shutting down then we don't execute any extended work */ @@ -1056,7 +1056,7 @@ static grpc_error *pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, * TODO(dklempner): Can we refactor the shutdown logic to avoid this? */ gpr_mu_lock(&pollset->mu); } else if (!grpc_closure_list_empty(pollset->idle_jobs)) { - grpc_closure_list_sched(exec_ctx, &pollset->idle_jobs); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, &pollset->idle_jobs); gpr_mu_unlock(&pollset->mu); grpc_exec_ctx_flush(exec_ctx); gpr_mu_lock(&pollset->mu); @@ -1075,7 +1075,7 @@ static void pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, pollset->shutdown_done = closure; pollset_kick(pollset, GRPC_POLLSET_KICK_BROADCAST); if (!pollset_has_workers(pollset)) { - grpc_closure_list_sched(exec_ctx, &pollset->idle_jobs); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, &pollset->idle_jobs); } if (!pollset->called_shutdown && !pollset_has_observers(pollset)) { pollset->called_shutdown = 1; diff --git a/src/core/lib/iomgr/exec_ctx.c b/src/core/lib/iomgr/exec_ctx.c index 6699be3646..51c36216c5 100644 --- a/src/core/lib/iomgr/exec_ctx.c +++ b/src/core/lib/iomgr/exec_ctx.c @@ -62,7 +62,7 @@ bool grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx) { grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; did_something = true; -#ifndef NDEBUG +#ifdef GRPC_CLOSURE_RICH_DEBUG c->scheduled = false; #endif c->cb(exec_ctx, c->cb_arg, error); @@ -85,7 +85,7 @@ void grpc_exec_ctx_finish(grpc_exec_ctx *exec_ctx) { static void exec_ctx_run(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error) { -#ifndef NDEBUG +#ifdef GRPC_CLOSURE_RICH_DEBUG closure->scheduled = false; #endif closure->cb(exec_ctx, closure->cb_arg, error); diff --git a/src/core/lib/iomgr/executor.c b/src/core/lib/iomgr/executor.c index 7621a7fe75..fda274e797 100644 --- a/src/core/lib/iomgr/executor.c +++ b/src/core/lib/iomgr/executor.c @@ -58,7 +58,7 @@ static size_t run_closures(grpc_exec_ctx *exec_ctx, grpc_closure_list list) { while (c != NULL) { grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; -#ifndef NDEBUG +#ifdef GRPC_CLOSURE_RICH_DEBUG c->scheduled = false; #endif c->cb(exec_ctx, c->cb_arg, error); diff --git a/src/core/lib/iomgr/lockfree_event.c b/src/core/lib/iomgr/lockfree_event.c index 6fa285b5f3..c2ceecb3c5 100644 --- a/src/core/lib/iomgr/lockfree_event.c +++ b/src/core/lib/iomgr/lockfree_event.c @@ -112,7 +112,7 @@ void grpc_lfev_notify_on(grpc_exec_ctx *exec_ctx, gpr_atm *state, closure when transitioning out of CLOSURE_NO_READY state (i.e there is no other code that needs to 'happen-after' this) */ if (gpr_atm_no_barrier_cas(state, CLOSURE_READY, CLOSURE_NOT_READY)) { - grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_NONE); return; /* Successful. Return */ } @@ -125,7 +125,7 @@ void grpc_lfev_notify_on(grpc_exec_ctx *exec_ctx, gpr_atm *state, schedule the closure with the shutdown error */ if ((curr & FD_SHUTDOWN_BIT) > 0) { grpc_error *shutdown_err = (grpc_error *)(curr & ~FD_SHUTDOWN_BIT); - grpc_closure_sched(exec_ctx, closure, + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "FD Shutdown", &shutdown_err, 1)); return; @@ -177,7 +177,7 @@ bool grpc_lfev_set_shutdown(grpc_exec_ctx *exec_ctx, gpr_atm *state, happens-after on that edge), and a release to pair with anything loading the shutdown state. */ if (gpr_atm_full_cas(state, curr, new_state)) { - grpc_closure_sched(exec_ctx, (grpc_closure *)curr, + GRPC_CLOSURE_SCHED(exec_ctx, (grpc_closure *)curr, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "FD Shutdown", &shutdown_err, 1)); return true; @@ -226,7 +226,7 @@ void grpc_lfev_set_ready(grpc_exec_ctx *exec_ctx, gpr_atm *state) { spurious set_ready; release pairs with this or the acquire in notify_on (or set_shutdown) */ else if (gpr_atm_full_cas(state, curr, CLOSURE_NOT_READY)) { - grpc_closure_sched(exec_ctx, (grpc_closure *)curr, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, (grpc_closure *)curr, GRPC_ERROR_NONE); return; } /* else the state changed again (only possible by either a racing diff --git a/src/core/lib/iomgr/pollset_uv.c b/src/core/lib/iomgr/pollset_uv.c index 8ff647f03c..07c7c04559 100644 --- a/src/core/lib/iomgr/pollset_uv.c +++ b/src/core/lib/iomgr/pollset_uv.c @@ -88,7 +88,7 @@ void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, // kick the loop once uv_timer_start(dummy_uv_handle, dummy_timer_cb, 0, 0); } - grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_NONE); } void grpc_pollset_destroy(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset) { diff --git a/src/core/lib/iomgr/pollset_windows.c b/src/core/lib/iomgr/pollset_windows.c index ab1a327b46..d5a03732cb 100644 --- a/src/core/lib/iomgr/pollset_windows.c +++ b/src/core/lib/iomgr/pollset_windows.c @@ -95,7 +95,7 @@ void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, pollset->shutting_down = 1; grpc_pollset_kick(pollset, GRPC_POLLSET_KICK_BROADCAST); if (!pollset->is_iocp_worker) { - grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_NONE); } else { pollset->on_shutdown = closure; } @@ -143,7 +143,7 @@ grpc_error *grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, } if (pollset->shutting_down && pollset->on_shutdown != NULL) { - grpc_closure_sched(exec_ctx, pollset->on_shutdown, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, pollset->on_shutdown, GRPC_ERROR_NONE); pollset->on_shutdown = NULL; } goto done; diff --git a/src/core/lib/iomgr/resolve_address_posix.c b/src/core/lib/iomgr/resolve_address_posix.c index a78de66941..35dedc23de 100644 --- a/src/core/lib/iomgr/resolve_address_posix.c +++ b/src/core/lib/iomgr/resolve_address_posix.c @@ -154,7 +154,7 @@ typedef struct { static void do_request_thread(grpc_exec_ctx *exec_ctx, void *rp, grpc_error *error) { request *r = rp; - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, r->on_done, grpc_blocking_resolve_address(r->name, r->default_port, r->addrs_out)); gpr_free(r->name); @@ -175,13 +175,13 @@ static void resolve_address_impl(grpc_exec_ctx *exec_ctx, const char *name, grpc_closure *on_done, grpc_resolved_addresses **addrs) { request *r = gpr_malloc(sizeof(request)); - grpc_closure_init(&r->request_closure, do_request_thread, r, + GRPC_CLOSURE_INIT(&r->request_closure, do_request_thread, r, grpc_executor_scheduler); r->name = gpr_strdup(name); r->default_port = gpr_strdup(default_port); r->on_done = on_done; r->addrs_out = addrs; - grpc_closure_sched(exec_ctx, &r->request_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &r->request_closure, GRPC_ERROR_NONE); } void (*grpc_resolve_address)( diff --git a/src/core/lib/iomgr/resolve_address_uv.c b/src/core/lib/iomgr/resolve_address_uv.c index f1ea516175..45de289e45 100644 --- a/src/core/lib/iomgr/resolve_address_uv.c +++ b/src/core/lib/iomgr/resolve_address_uv.c @@ -124,7 +124,7 @@ static void getaddrinfo_callback(uv_getaddrinfo_t *req, int status, /* Either no retry was attempted, or the retry failed. Either way, the original error probably has more interesting information */ error = handle_addrinfo_result(status, res, r->addresses); - grpc_closure_sched(&exec_ctx, r->on_done, error); + GRPC_CLOSURE_SCHED(&exec_ctx, r->on_done, error); grpc_exec_ctx_finish(&exec_ctx); gpr_free(r->hints); gpr_free(r); @@ -225,7 +225,7 @@ static void resolve_address_impl(grpc_exec_ctx *exec_ctx, const char *name, int s; err = try_split_host_port(name, default_port, &host, &port); if (err != GRPC_ERROR_NONE) { - grpc_closure_sched(exec_ctx, on_done, err); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, err); return; } r = gpr_malloc(sizeof(request)); @@ -252,7 +252,7 @@ static void resolve_address_impl(grpc_exec_ctx *exec_ctx, const char *name, err = GRPC_ERROR_CREATE_FROM_STATIC_STRING("getaddrinfo failed"); err = grpc_error_set_str(err, GRPC_ERROR_STR_OS_ERROR, grpc_slice_from_static_string(uv_strerror(s))); - grpc_closure_sched(exec_ctx, on_done, err); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, err); gpr_free(r); gpr_free(req); gpr_free(hints); diff --git a/src/core/lib/iomgr/resolve_address_windows.c b/src/core/lib/iomgr/resolve_address_windows.c index 83adfd338a..45cfd7248d 100644 --- a/src/core/lib/iomgr/resolve_address_windows.c +++ b/src/core/lib/iomgr/resolve_address_windows.c @@ -139,7 +139,7 @@ static void do_request_thread(grpc_exec_ctx *exec_ctx, void *rp, } else { GRPC_ERROR_REF(error); } - grpc_closure_sched(exec_ctx, r->on_done, error); + GRPC_CLOSURE_SCHED(exec_ctx, r->on_done, error); gpr_free(r->name); gpr_free(r->default_port); gpr_free(r); @@ -158,13 +158,13 @@ static void resolve_address_impl(grpc_exec_ctx *exec_ctx, const char *name, grpc_closure *on_done, grpc_resolved_addresses **addresses) { request *r = gpr_malloc(sizeof(request)); - grpc_closure_init(&r->request_closure, do_request_thread, r, + GRPC_CLOSURE_INIT(&r->request_closure, do_request_thread, r, grpc_executor_scheduler); r->name = gpr_strdup(name); r->default_port = gpr_strdup(default_port); r->on_done = on_done; r->addresses = addresses; - grpc_closure_sched(exec_ctx, &r->request_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &r->request_closure, GRPC_ERROR_NONE); } void (*grpc_resolve_address)( diff --git a/src/core/lib/iomgr/resource_quota.c b/src/core/lib/iomgr/resource_quota.c index 7c3fb93279..f2cc1be74e 100644 --- a/src/core/lib/iomgr/resource_quota.c +++ b/src/core/lib/iomgr/resource_quota.c @@ -259,7 +259,7 @@ static void rq_step_sched(grpc_exec_ctx *exec_ctx, if (resource_quota->step_scheduled) return; resource_quota->step_scheduled = true; grpc_resource_quota_ref_internal(resource_quota); - grpc_closure_sched(exec_ctx, &resource_quota->rq_step_closure, + GRPC_CLOSURE_SCHED(exec_ctx, &resource_quota->rq_step_closure, GRPC_ERROR_NONE); } @@ -305,7 +305,7 @@ static bool rq_alloc(grpc_exec_ctx *exec_ctx, } if (resource_user->free_pool >= 0) { resource_user->allocating = false; - grpc_closure_list_sched(exec_ctx, &resource_user->on_allocated); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, &resource_user->on_allocated); gpr_mu_unlock(&resource_user->mu); } else { rulist_add_head(resource_user, GRPC_RULIST_AWAITING_ALLOCATION); @@ -363,7 +363,7 @@ static bool rq_reclaim(grpc_exec_ctx *exec_ctx, resource_quota->debug_only_last_reclaimer_resource_user = resource_user; resource_quota->debug_only_last_initiated_reclaimer = c; resource_user->reclaimers[destructive] = NULL; - grpc_closure_run(exec_ctx, c, GRPC_ERROR_NONE); + GRPC_CLOSURE_RUN(exec_ctx, c, GRPC_ERROR_NONE); return true; } @@ -444,7 +444,7 @@ static bool ru_post_reclaimer(grpc_exec_ctx *exec_ctx, resource_user->new_reclaimers[destructive] = NULL; GPR_ASSERT(resource_user->reclaimers[destructive] == NULL); if (gpr_atm_acq_load(&resource_user->shutdown) > 0) { - grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_CANCELLED); + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_CANCELLED); return false; } resource_user->reclaimers[destructive] = closure; @@ -485,9 +485,9 @@ static void ru_post_destructive_reclaimer(grpc_exec_ctx *exec_ctx, void *ru, static void ru_shutdown(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) { grpc_resource_user *resource_user = ru; - grpc_closure_sched(exec_ctx, resource_user->reclaimers[0], + GRPC_CLOSURE_SCHED(exec_ctx, resource_user->reclaimers[0], GRPC_ERROR_CANCELLED); - grpc_closure_sched(exec_ctx, resource_user->reclaimers[1], + GRPC_CLOSURE_SCHED(exec_ctx, resource_user->reclaimers[1], GRPC_ERROR_CANCELLED); resource_user->reclaimers[0] = NULL; resource_user->reclaimers[1] = NULL; @@ -501,9 +501,9 @@ static void ru_destroy(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) { for (int i = 0; i < GRPC_RULIST_COUNT; i++) { rulist_remove(resource_user, (grpc_rulist)i); } - grpc_closure_sched(exec_ctx, resource_user->reclaimers[0], + GRPC_CLOSURE_SCHED(exec_ctx, resource_user->reclaimers[0], GRPC_ERROR_CANCELLED); - grpc_closure_sched(exec_ctx, resource_user->reclaimers[1], + GRPC_CLOSURE_SCHED(exec_ctx, resource_user->reclaimers[1], GRPC_ERROR_CANCELLED); if (resource_user->free_pool != 0) { resource_user->resource_quota->free_pool += resource_user->free_pool; @@ -525,7 +525,7 @@ static void ru_allocated_slices(grpc_exec_ctx *exec_ctx, void *arg, slice_allocator->length)); } } - grpc_closure_run(exec_ctx, &slice_allocator->on_done, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_RUN(exec_ctx, &slice_allocator->on_done, GRPC_ERROR_REF(error)); } /******************************************************************************* @@ -579,9 +579,9 @@ grpc_resource_quota *grpc_resource_quota_create(const char *name) { gpr_asprintf(&resource_quota->name, "anonymous_pool_%" PRIxPTR, (intptr_t)resource_quota); } - grpc_closure_init(&resource_quota->rq_step_closure, rq_step, resource_quota, + GRPC_CLOSURE_INIT(&resource_quota->rq_step_closure, rq_step, resource_quota, grpc_combiner_finally_scheduler(resource_quota->combiner)); - grpc_closure_init(&resource_quota->rq_reclamation_done_closure, + GRPC_CLOSURE_INIT(&resource_quota->rq_reclamation_done_closure, rq_reclamation_done, resource_quota, grpc_combiner_scheduler(resource_quota->combiner)); for (int i = 0; i < GRPC_RULIST_COUNT; i++) { @@ -633,8 +633,8 @@ void grpc_resource_quota_resize(grpc_resource_quota *resource_quota, a->size = (int64_t)size; gpr_atm_no_barrier_store(&resource_quota->last_size, (gpr_atm)GPR_MIN((size_t)GPR_ATM_MAX, size)); - grpc_closure_init(&a->closure, rq_resize, a, grpc_schedule_on_exec_ctx); - grpc_closure_sched(&exec_ctx, &a->closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_INIT(&a->closure, rq_resize, a, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_SCHED(&exec_ctx, &a->closure, GRPC_ERROR_NONE); grpc_exec_ctx_finish(&exec_ctx); } @@ -686,19 +686,19 @@ grpc_resource_user *grpc_resource_user_create( grpc_resource_user *resource_user = gpr_malloc(sizeof(*resource_user)); resource_user->resource_quota = grpc_resource_quota_ref_internal(resource_quota); - grpc_closure_init(&resource_user->allocate_closure, &ru_allocate, + GRPC_CLOSURE_INIT(&resource_user->allocate_closure, &ru_allocate, resource_user, grpc_combiner_scheduler(resource_quota->combiner)); - grpc_closure_init(&resource_user->add_to_free_pool_closure, + GRPC_CLOSURE_INIT(&resource_user->add_to_free_pool_closure, &ru_add_to_free_pool, resource_user, grpc_combiner_scheduler(resource_quota->combiner)); - grpc_closure_init(&resource_user->post_reclaimer_closure[0], + GRPC_CLOSURE_INIT(&resource_user->post_reclaimer_closure[0], &ru_post_benign_reclaimer, resource_user, grpc_combiner_scheduler(resource_quota->combiner)); - grpc_closure_init(&resource_user->post_reclaimer_closure[1], + GRPC_CLOSURE_INIT(&resource_user->post_reclaimer_closure[1], &ru_post_destructive_reclaimer, resource_user, grpc_combiner_scheduler(resource_quota->combiner)); - grpc_closure_init(&resource_user->destroy_closure, &ru_destroy, resource_user, + GRPC_CLOSURE_INIT(&resource_user->destroy_closure, &ru_destroy, resource_user, grpc_combiner_scheduler(resource_quota->combiner)); gpr_mu_init(&resource_user->mu); gpr_atm_rel_store(&resource_user->refs, 1); @@ -739,7 +739,7 @@ static void ru_unref_by(grpc_exec_ctx *exec_ctx, gpr_atm old = gpr_atm_full_fetch_add(&resource_user->refs, -amount); GPR_ASSERT(old >= amount); if (old == amount) { - grpc_closure_sched(exec_ctx, &resource_user->destroy_closure, + GRPC_CLOSURE_SCHED(exec_ctx, &resource_user->destroy_closure, GRPC_ERROR_NONE); } } @@ -756,9 +756,9 @@ void grpc_resource_user_unref(grpc_exec_ctx *exec_ctx, void grpc_resource_user_shutdown(grpc_exec_ctx *exec_ctx, grpc_resource_user *resource_user) { if (gpr_atm_full_fetch_add(&resource_user->shutdown, 1) == 0) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, - grpc_closure_create( + GRPC_CLOSURE_CREATE( ru_shutdown, resource_user, grpc_combiner_scheduler(resource_user->resource_quota->combiner)), GRPC_ERROR_NONE); @@ -781,11 +781,11 @@ void grpc_resource_user_alloc(grpc_exec_ctx *exec_ctx, GRPC_ERROR_NONE); if (!resource_user->allocating) { resource_user->allocating = true; - grpc_closure_sched(exec_ctx, &resource_user->allocate_closure, + GRPC_CLOSURE_SCHED(exec_ctx, &resource_user->allocate_closure, GRPC_ERROR_NONE); } } else { - grpc_closure_sched(exec_ctx, optional_on_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, optional_on_done, GRPC_ERROR_NONE); } gpr_mu_unlock(&resource_user->mu); } @@ -804,7 +804,7 @@ void grpc_resource_user_free(grpc_exec_ctx *exec_ctx, if (is_bigger_than_zero && was_zero_or_negative && !resource_user->added_to_free_pool) { resource_user->added_to_free_pool = true; - grpc_closure_sched(exec_ctx, &resource_user->add_to_free_pool_closure, + GRPC_CLOSURE_SCHED(exec_ctx, &resource_user->add_to_free_pool_closure, GRPC_ERROR_NONE); } gpr_mu_unlock(&resource_user->mu); @@ -817,7 +817,7 @@ void grpc_resource_user_post_reclaimer(grpc_exec_ctx *exec_ctx, grpc_closure *closure) { GPR_ASSERT(resource_user->new_reclaimers[destructive] == NULL); resource_user->new_reclaimers[destructive] = closure; - grpc_closure_sched(exec_ctx, + GRPC_CLOSURE_SCHED(exec_ctx, &resource_user->post_reclaimer_closure[destructive], GRPC_ERROR_NONE); } @@ -828,7 +828,7 @@ void grpc_resource_user_finish_reclamation(grpc_exec_ctx *exec_ctx, gpr_log(GPR_DEBUG, "RQ %s %s: reclamation complete", resource_user->resource_quota->name, resource_user->name); } - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, &resource_user->resource_quota->rq_reclamation_done_closure, GRPC_ERROR_NONE); } @@ -836,9 +836,9 @@ void grpc_resource_user_finish_reclamation(grpc_exec_ctx *exec_ctx, void grpc_resource_user_slice_allocator_init( grpc_resource_user_slice_allocator *slice_allocator, grpc_resource_user *resource_user, grpc_iomgr_cb_func cb, void *p) { - grpc_closure_init(&slice_allocator->on_allocated, ru_allocated_slices, + GRPC_CLOSURE_INIT(&slice_allocator->on_allocated, ru_allocated_slices, slice_allocator, grpc_schedule_on_exec_ctx); - grpc_closure_init(&slice_allocator->on_done, cb, p, + GRPC_CLOSURE_INIT(&slice_allocator->on_done, cb, p, grpc_schedule_on_exec_ctx); slice_allocator->resource_user = resource_user; } diff --git a/src/core/lib/iomgr/socket_windows.c b/src/core/lib/iomgr/socket_windows.c index f73e33db86..a0d731b942 100644 --- a/src/core/lib/iomgr/socket_windows.c +++ b/src/core/lib/iomgr/socket_windows.c @@ -116,7 +116,7 @@ static void socket_notify_on_iocp(grpc_exec_ctx *exec_ctx, gpr_mu_lock(&socket->state_mu); if (info->has_pending_iocp) { info->has_pending_iocp = 0; - grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_NONE); } else { info->closure = closure; } @@ -139,7 +139,7 @@ void grpc_socket_become_ready(grpc_exec_ctx *exec_ctx, grpc_winsocket *socket, GPR_ASSERT(!info->has_pending_iocp); gpr_mu_lock(&socket->state_mu); if (info->closure) { - grpc_closure_sched(exec_ctx, info->closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, info->closure, GRPC_ERROR_NONE); info->closure = NULL; } else { info->has_pending_iocp = 1; diff --git a/src/core/lib/iomgr/tcp_client_posix.c b/src/core/lib/iomgr/tcp_client_posix.c index abad3c2f22..21e320a6e7 100644 --- a/src/core/lib/iomgr/tcp_client_posix.c +++ b/src/core/lib/iomgr/tcp_client_posix.c @@ -234,7 +234,7 @@ finish: grpc_channel_args_destroy(exec_ctx, ac->channel_args); gpr_free(ac); } - grpc_closure_sched(exec_ctx, closure, error); + GRPC_CLOSURE_SCHED(exec_ctx, closure, error); } static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx, @@ -263,7 +263,7 @@ static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx, error = grpc_create_dualstack_socket(addr, SOCK_STREAM, 0, &dsmode, &fd); if (error != GRPC_ERROR_NONE) { - grpc_closure_sched(exec_ctx, closure, error); + GRPC_CLOSURE_SCHED(exec_ctx, closure, error); return; } if (dsmode == GRPC_DSMODE_IPV4) { @@ -272,7 +272,7 @@ static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx, addr = &addr4_copy; } if ((error = prepare_socket(addr, fd, channel_args)) != GRPC_ERROR_NONE) { - grpc_closure_sched(exec_ctx, closure, error); + GRPC_CLOSURE_SCHED(exec_ctx, closure, error); return; } @@ -290,13 +290,13 @@ static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx, if (err >= 0) { *ep = grpc_tcp_client_create_from_fd(exec_ctx, fdobj, channel_args, addr_str); - grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_NONE); goto done; } if (errno != EWOULDBLOCK && errno != EINPROGRESS) { grpc_fd_orphan(exec_ctx, fdobj, NULL, NULL, "tcp_client_connect_error"); - grpc_closure_sched(exec_ctx, closure, GRPC_OS_ERROR(errno, "connect")); + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_OS_ERROR(errno, "connect")); goto done; } @@ -311,7 +311,7 @@ static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx, addr_str = NULL; gpr_mu_init(&ac->mu); ac->refs = 2; - grpc_closure_init(&ac->write_closure, on_writable, ac, + GRPC_CLOSURE_INIT(&ac->write_closure, on_writable, ac, grpc_schedule_on_exec_ctx); ac->channel_args = grpc_channel_args_copy(channel_args); @@ -321,7 +321,7 @@ static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx, } gpr_mu_lock(&ac->mu); - grpc_closure_init(&ac->on_alarm, tc_on_alarm, ac, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&ac->on_alarm, tc_on_alarm, ac, grpc_schedule_on_exec_ctx); grpc_timer_init(exec_ctx, &ac->alarm, gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC), &ac->on_alarm, gpr_now(GPR_CLOCK_MONOTONIC)); diff --git a/src/core/lib/iomgr/tcp_client_uv.c b/src/core/lib/iomgr/tcp_client_uv.c index f4084339d6..ab6832932f 100644 --- a/src/core/lib/iomgr/tcp_client_uv.c +++ b/src/core/lib/iomgr/tcp_client_uv.c @@ -107,7 +107,7 @@ static void uv_tc_on_connect(uv_connect_t *req, int status) { if (done) { uv_tcp_connect_cleanup(&exec_ctx, connect); } - grpc_closure_sched(&exec_ctx, closure, error); + GRPC_CLOSURE_SCHED(&exec_ctx, closure, error); grpc_exec_ctx_finish(&exec_ctx); } @@ -150,7 +150,7 @@ static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx, uv_tcp_connect(&connect->connect_req, connect->tcp_handle, (const struct sockaddr *)resolved_addr->addr, uv_tc_on_connect); - grpc_closure_init(&connect->on_alarm, uv_tc_on_alarm, connect, + GRPC_CLOSURE_INIT(&connect->on_alarm, uv_tc_on_alarm, connect, grpc_schedule_on_exec_ctx); grpc_timer_init(exec_ctx, &connect->alarm, gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC), diff --git a/src/core/lib/iomgr/tcp_client_windows.c b/src/core/lib/iomgr/tcp_client_windows.c index e0913cfaed..fc62105cc9 100644 --- a/src/core/lib/iomgr/tcp_client_windows.c +++ b/src/core/lib/iomgr/tcp_client_windows.c @@ -116,7 +116,7 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *acp, grpc_error *error) { async_connect_unlock_and_cleanup(exec_ctx, ac, socket); /* If the connection was aborted, the callback was already called when the deadline was met. */ - grpc_closure_sched(exec_ctx, on_done, error); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, error); } /* Tries to issue one async connection, then schedules both an IOCP @@ -201,9 +201,9 @@ static void tcp_client_connect_impl( ac->addr_name = grpc_sockaddr_to_uri(addr); ac->endpoint = endpoint; ac->channel_args = grpc_channel_args_copy(channel_args); - grpc_closure_init(&ac->on_connect, on_connect, ac, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&ac->on_connect, on_connect, ac, grpc_schedule_on_exec_ctx); - grpc_closure_init(&ac->on_alarm, on_alarm, ac, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&ac->on_alarm, on_alarm, ac, grpc_schedule_on_exec_ctx); grpc_timer_init(exec_ctx, &ac->alarm, deadline, &ac->on_alarm, gpr_now(GPR_CLOCK_MONOTONIC)); grpc_socket_notify_on_write(exec_ctx, socket, &ac->on_connect); @@ -222,7 +222,7 @@ failure: } else if (sock != INVALID_SOCKET) { closesocket(sock); } - grpc_closure_sched(exec_ctx, on_done, final_error); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, final_error); } // overridden by api_fuzzer.c diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c index a2404f97c1..66e81bf81f 100644 --- a/src/core/lib/iomgr/tcp_posix.c +++ b/src/core/lib/iomgr/tcp_posix.c @@ -221,7 +221,7 @@ static void call_read_cb(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, tcp->read_cb = NULL; tcp->incoming_buffer = NULL; - grpc_closure_run(exec_ctx, cb, error); + GRPC_CLOSURE_RUN(exec_ctx, cb, error); } #define MAX_READ_IOVEC 4 @@ -348,7 +348,7 @@ static void tcp_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, tcp->finished_edge = false; grpc_fd_notify_on_read(exec_ctx, tcp->em_fd, &tcp->read_closure); } else { - grpc_closure_sched(exec_ctx, &tcp->read_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &tcp->read_closure, GRPC_ERROR_NONE); } } @@ -465,7 +465,7 @@ static void tcp_handle_write(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */, gpr_log(GPR_DEBUG, "write: %s", str); } - grpc_closure_run(exec_ctx, cb, error); + GRPC_CLOSURE_RUN(exec_ctx, cb, error); TCP_UNREF(exec_ctx, tcp, "write"); } } @@ -491,7 +491,7 @@ static void tcp_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, if (buf->length == 0) { GPR_TIMER_END("tcp_write", 0); - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, cb, grpc_fd_is_shutdown(tcp->em_fd) ? tcp_annotate_error(GRPC_ERROR_CREATE_FROM_STATIC_STRING("EOF"), @@ -515,7 +515,7 @@ static void tcp_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, const char *str = grpc_error_string(error); gpr_log(GPR_DEBUG, "write: %s", str); } - grpc_closure_sched(exec_ctx, cb, error); + GRPC_CLOSURE_SCHED(exec_ctx, cb, error); } GPR_TIMER_END("tcp_write", 0); @@ -616,9 +616,9 @@ grpc_endpoint *grpc_tcp_create(grpc_exec_ctx *exec_ctx, grpc_fd *em_fd, gpr_ref_init(&tcp->refcount, 1); gpr_atm_no_barrier_store(&tcp->shutdown_count, 0); tcp->em_fd = em_fd; - grpc_closure_init(&tcp->read_closure, tcp_handle_read, tcp, + GRPC_CLOSURE_INIT(&tcp->read_closure, tcp_handle_read, tcp, grpc_schedule_on_exec_ctx); - grpc_closure_init(&tcp->write_closure, tcp_handle_write, tcp, + GRPC_CLOSURE_INIT(&tcp->write_closure, tcp_handle_write, tcp, grpc_schedule_on_exec_ctx); grpc_slice_buffer_init(&tcp->last_read_buffer); tcp->resource_user = grpc_resource_user_create(resource_quota, peer_string); diff --git a/src/core/lib/iomgr/tcp_server_posix.c b/src/core/lib/iomgr/tcp_server_posix.c index 7bb8392d4b..f304642951 100644 --- a/src/core/lib/iomgr/tcp_server_posix.c +++ b/src/core/lib/iomgr/tcp_server_posix.c @@ -121,7 +121,7 @@ static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { GPR_ASSERT(s->shutdown); gpr_mu_unlock(&s->mu); if (s->shutdown_complete != NULL) { - grpc_closure_sched(exec_ctx, s->shutdown_complete, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, s->shutdown_complete, GRPC_ERROR_NONE); } gpr_mu_destroy(&s->mu); @@ -163,7 +163,7 @@ static void deactivated_all_ports(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { grpc_tcp_listener *sp; for (sp = s->head; sp; sp = sp->next) { grpc_unlink_if_unix_domain_socket(&sp->addr); - grpc_closure_init(&sp->destroyed_closure, destroyed_port, s, + GRPC_CLOSURE_INIT(&sp->destroyed_closure, destroyed_port, s, grpc_schedule_on_exec_ctx); grpc_fd_orphan(exec_ctx, sp->emfd, &sp->destroyed_closure, NULL, "tcp_listener_shutdown"); @@ -503,7 +503,7 @@ void grpc_tcp_server_start(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s, "clone_port", clone_port(sp, (unsigned)(pollset_count - 1)))); for (i = 0; i < pollset_count; i++) { grpc_pollset_add_fd(exec_ctx, pollsets[i], sp->emfd); - grpc_closure_init(&sp->read_closure, on_read, sp, + GRPC_CLOSURE_INIT(&sp->read_closure, on_read, sp, grpc_schedule_on_exec_ctx); grpc_fd_notify_on_read(exec_ctx, sp->emfd, &sp->read_closure); s->active_ports++; @@ -513,7 +513,7 @@ void grpc_tcp_server_start(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s, for (i = 0; i < pollset_count; i++) { grpc_pollset_add_fd(exec_ctx, pollsets[i], sp->emfd); } - grpc_closure_init(&sp->read_closure, on_read, sp, + GRPC_CLOSURE_INIT(&sp->read_closure, on_read, sp, grpc_schedule_on_exec_ctx); grpc_fd_notify_on_read(exec_ctx, sp->emfd, &sp->read_closure); s->active_ports++; @@ -540,7 +540,7 @@ void grpc_tcp_server_unref(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { if (gpr_unref(&s->refs)) { grpc_tcp_server_shutdown_listeners(exec_ctx, s); gpr_mu_lock(&s->mu); - grpc_closure_list_sched(exec_ctx, &s->shutdown_starting); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, &s->shutdown_starting); gpr_mu_unlock(&s->mu); tcp_server_destroy(exec_ctx, s); } diff --git a/src/core/lib/iomgr/tcp_server_uv.c b/src/core/lib/iomgr/tcp_server_uv.c index 632a232861..2de0ea90e7 100644 --- a/src/core/lib/iomgr/tcp_server_uv.c +++ b/src/core/lib/iomgr/tcp_server_uv.c @@ -117,7 +117,7 @@ void grpc_tcp_server_shutdown_starting_add(grpc_tcp_server *s, static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { GPR_ASSERT(s->shutdown); if (s->shutdown_complete != NULL) { - grpc_closure_sched(exec_ctx, s->shutdown_complete, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, s->shutdown_complete, GRPC_ERROR_NONE); } while (s->head) { @@ -171,7 +171,7 @@ void grpc_tcp_server_unref(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { if (gpr_unref(&s->refs)) { /* Complete shutdown_starting work before destroying. */ grpc_exec_ctx local_exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_closure_list_sched(&local_exec_ctx, &s->shutdown_starting); + GRPC_CLOSURE_LIST_SCHED(&local_exec_ctx, &s->shutdown_starting); if (exec_ctx == NULL) { grpc_exec_ctx_flush(&local_exec_ctx); tcp_server_destroy(&local_exec_ctx, s); diff --git a/src/core/lib/iomgr/tcp_server_windows.c b/src/core/lib/iomgr/tcp_server_windows.c index e8343a94a0..0162afc1ad 100644 --- a/src/core/lib/iomgr/tcp_server_windows.c +++ b/src/core/lib/iomgr/tcp_server_windows.c @@ -134,10 +134,10 @@ static void destroy_server(grpc_exec_ctx *exec_ctx, void *arg, static void finish_shutdown_locked(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { if (s->shutdown_complete != NULL) { - grpc_closure_sched(exec_ctx, s->shutdown_complete, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, s->shutdown_complete, GRPC_ERROR_NONE); } - grpc_closure_sched(exec_ctx, grpc_closure_create(destroy_server, s, + GRPC_CLOSURE_SCHED(exec_ctx, GRPC_CLOSURE_CREATE(destroy_server, s, grpc_schedule_on_exec_ctx), GRPC_ERROR_NONE); } @@ -176,7 +176,7 @@ void grpc_tcp_server_unref(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { if (gpr_unref(&s->refs)) { grpc_tcp_server_shutdown_listeners(exec_ctx, s); gpr_mu_lock(&s->mu); - grpc_closure_list_sched(exec_ctx, &s->shutdown_starting); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, &s->shutdown_starting); gpr_mu_unlock(&s->mu); tcp_server_destroy(exec_ctx, s); } @@ -437,7 +437,7 @@ static grpc_error *add_socket_to_server(grpc_tcp_server *s, SOCKET sock, sp->new_socket = INVALID_SOCKET; sp->port = port; sp->port_index = port_index; - grpc_closure_init(&sp->on_accept, on_accept, sp, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&sp->on_accept, on_accept, sp, grpc_schedule_on_exec_ctx); GPR_ASSERT(sp->socket); gpr_mu_unlock(&s->mu); *listener = sp; diff --git a/src/core/lib/iomgr/tcp_uv.c b/src/core/lib/iomgr/tcp_uv.c index a37a75c8fa..ab5bb9f7da 100644 --- a/src/core/lib/iomgr/tcp_uv.c +++ b/src/core/lib/iomgr/tcp_uv.c @@ -161,7 +161,7 @@ static void read_callback(uv_stream_t *stream, ssize_t nread, // nread < 0: Error error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("TCP Read failed"); } - grpc_closure_sched(&exec_ctx, cb, error); + GRPC_CLOSURE_SCHED(&exec_ctx, cb, error); grpc_exec_ctx_finish(&exec_ctx); } @@ -183,7 +183,7 @@ static void uv_endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, error = grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR, grpc_slice_from_static_string(uv_strerror(status))); - grpc_closure_sched(exec_ctx, cb, error); + GRPC_CLOSURE_SCHED(exec_ctx, cb, error); } if (GRPC_TRACER_ON(grpc_tcp_trace)) { const char *str = grpc_error_string(error); @@ -210,7 +210,7 @@ static void write_callback(uv_write_t *req, int status) { gpr_free(tcp->write_buffers); grpc_resource_user_free(&exec_ctx, tcp->resource_user, sizeof(uv_buf_t) * tcp->write_slices->count); - grpc_closure_sched(&exec_ctx, cb, error); + GRPC_CLOSURE_SCHED(&exec_ctx, cb, error); grpc_exec_ctx_finish(&exec_ctx); } @@ -236,7 +236,7 @@ static void uv_endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, } if (tcp->shutting_down) { - grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_CREATE_FROM_STATIC_STRING( + GRPC_CLOSURE_SCHED(exec_ctx, cb, GRPC_ERROR_CREATE_FROM_STATIC_STRING( "TCP socket is shutting down")); return; } @@ -247,7 +247,7 @@ static void uv_endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, if (tcp->write_slices->count == 0) { // No slices means we don't have to do anything, // and libuv doesn't like empty writes - grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, cb, GRPC_ERROR_NONE); return; } diff --git a/src/core/lib/iomgr/tcp_windows.c b/src/core/lib/iomgr/tcp_windows.c index dbae42e936..161b397534 100644 --- a/src/core/lib/iomgr/tcp_windows.c +++ b/src/core/lib/iomgr/tcp_windows.c @@ -179,7 +179,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *tcpp, grpc_error *error) { tcp->read_cb = NULL; TCP_UNREF(exec_ctx, tcp, "read"); - grpc_closure_sched(exec_ctx, cb, error); + GRPC_CLOSURE_SCHED(exec_ctx, cb, error); } static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, @@ -193,7 +193,7 @@ static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, WSABUF buffer; if (tcp->shutting_down) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, cb, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "TCP socket is shutting down", &tcp->shutdown_error, 1)); @@ -220,7 +220,7 @@ static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, /* Did we get data immediately ? Yay. */ if (info->wsa_error != WSAEWOULDBLOCK) { info->bytes_transfered = bytes_read; - grpc_closure_sched(exec_ctx, &tcp->on_read, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &tcp->on_read, GRPC_ERROR_NONE); return; } @@ -233,7 +233,7 @@ static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, int wsa_error = WSAGetLastError(); if (wsa_error != WSA_IO_PENDING) { info->wsa_error = wsa_error; - grpc_closure_sched(exec_ctx, &tcp->on_read, + GRPC_CLOSURE_SCHED(exec_ctx, &tcp->on_read, GRPC_WSA_ERROR(info->wsa_error, "WSARecv")); return; } @@ -265,7 +265,7 @@ static void on_write(grpc_exec_ctx *exec_ctx, void *tcpp, grpc_error *error) { } TCP_UNREF(exec_ctx, tcp, "write"); - grpc_closure_sched(exec_ctx, cb, error); + GRPC_CLOSURE_SCHED(exec_ctx, cb, error); } /* Initiates a write. */ @@ -283,7 +283,7 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, size_t len; if (tcp->shutting_down) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, cb, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "TCP socket is shutting down", &tcp->shutdown_error, 1)); @@ -317,7 +317,7 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, grpc_error *error = status == 0 ? GRPC_ERROR_NONE : GRPC_WSA_ERROR(info->wsa_error, "WSASend"); - grpc_closure_sched(exec_ctx, cb, error); + GRPC_CLOSURE_SCHED(exec_ctx, cb, error); if (allocated) gpr_free(allocated); return; } @@ -335,7 +335,7 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, int wsa_error = WSAGetLastError(); if (wsa_error != WSA_IO_PENDING) { TCP_UNREF(exec_ctx, tcp, "write"); - grpc_closure_sched(exec_ctx, cb, GRPC_WSA_ERROR(wsa_error, "WSASend")); + GRPC_CLOSURE_SCHED(exec_ctx, cb, GRPC_WSA_ERROR(wsa_error, "WSASend")); return; } } @@ -426,8 +426,8 @@ grpc_endpoint *grpc_tcp_create(grpc_exec_ctx *exec_ctx, grpc_winsocket *socket, tcp->socket = socket; gpr_mu_init(&tcp->mu); gpr_ref_init(&tcp->refcount, 1); - grpc_closure_init(&tcp->on_read, on_read, tcp, grpc_schedule_on_exec_ctx); - grpc_closure_init(&tcp->on_write, on_write, tcp, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&tcp->on_read, on_read, tcp, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&tcp->on_write, on_write, tcp, grpc_schedule_on_exec_ctx); tcp->peer_string = gpr_strdup(peer_string); tcp->resource_user = grpc_resource_user_create(resource_quota, peer_string); /* Tell network status tracking code about the new endpoint */ diff --git a/src/core/lib/iomgr/timer_generic.c b/src/core/lib/iomgr/timer_generic.c index 69b3cfd139..bf73d2c685 100644 --- a/src/core/lib/iomgr/timer_generic.c +++ b/src/core/lib/iomgr/timer_generic.c @@ -230,7 +230,7 @@ void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer, if (!g_shared_mutables.initialized) { timer->pending = false; - grpc_closure_sched(exec_ctx, timer->closure, + GRPC_CLOSURE_SCHED(exec_ctx, timer->closure, GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Attempt to create timer before initialization")); return; @@ -240,7 +240,7 @@ void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer, timer->pending = true; if (gpr_time_cmp(deadline, now) <= 0) { timer->pending = false; - grpc_closure_sched(exec_ctx, timer->closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, timer->closure, GRPC_ERROR_NONE); gpr_mu_unlock(&shard->mu); /* early out */ return; @@ -310,7 +310,7 @@ void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer) { timer->pending ? "true" : "false"); } if (timer->pending) { - grpc_closure_sched(exec_ctx, timer->closure, GRPC_ERROR_CANCELLED); + GRPC_CLOSURE_SCHED(exec_ctx, timer->closure, GRPC_ERROR_CANCELLED); timer->pending = false; if (timer->heap_index == INVALID_HEAP_INDEX) { list_remove(timer); @@ -400,7 +400,7 @@ static size_t pop_timers(grpc_exec_ctx *exec_ctx, shard_type *shard, grpc_timer *timer; gpr_mu_lock(&shard->mu); while ((timer = pop_one(shard, now))) { - grpc_closure_sched(exec_ctx, timer->closure, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, timer->closure, GRPC_ERROR_REF(error)); n++; } *new_min_deadline = compute_min_deadline(shard); diff --git a/src/core/lib/iomgr/timer_uv.c b/src/core/lib/iomgr/timer_uv.c index f814f0e474..4f204cfbf8 100644 --- a/src/core/lib/iomgr/timer_uv.c +++ b/src/core/lib/iomgr/timer_uv.c @@ -44,7 +44,7 @@ void run_expired_timer(uv_timer_t *handle) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; GPR_ASSERT(timer->pending); timer->pending = 0; - grpc_closure_sched(&exec_ctx, timer->closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, timer->closure, GRPC_ERROR_NONE); stop_uv_timer(handle); grpc_exec_ctx_finish(&exec_ctx); } @@ -57,7 +57,7 @@ void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer, timer->closure = closure; if (gpr_time_cmp(deadline, now) <= 0) { timer->pending = 0; - grpc_closure_sched(exec_ctx, timer->closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, timer->closure, GRPC_ERROR_NONE); return; } timer->pending = 1; @@ -76,7 +76,7 @@ void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer, void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer) { if (timer->pending) { timer->pending = 0; - grpc_closure_sched(exec_ctx, timer->closure, GRPC_ERROR_CANCELLED); + GRPC_CLOSURE_SCHED(exec_ctx, timer->closure, GRPC_ERROR_CANCELLED); stop_uv_timer((uv_timer_t *)timer->uv_timer); } } diff --git a/src/core/lib/iomgr/udp_server.c b/src/core/lib/iomgr/udp_server.c index 200a722c7e..54e7f417a7 100644 --- a/src/core/lib/iomgr/udp_server.c +++ b/src/core/lib/iomgr/udp_server.c @@ -156,7 +156,7 @@ static void dummy_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_udp_server *s) { if (s->shutdown_complete != NULL) { - grpc_closure_sched(exec_ctx, s->shutdown_complete, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, s->shutdown_complete, GRPC_ERROR_NONE); } gpr_mu_destroy(&s->mu); @@ -201,13 +201,13 @@ static void deactivated_all_ports(grpc_exec_ctx *exec_ctx, grpc_udp_server *s) { for (sp = s->head; sp; sp = sp->next) { grpc_unlink_if_unix_domain_socket(&sp->addr); - grpc_closure_init(&sp->destroyed_closure, destroyed_port, s, + GRPC_CLOSURE_INIT(&sp->destroyed_closure, destroyed_port, s, grpc_schedule_on_exec_ctx); if (!sp->orphan_notified) { /* Call the orphan_cb to signal that the FD is about to be closed and * should no longer be used. Because at this point, all listening ports * have been shutdown already, no need to shutdown again.*/ - grpc_closure_init(&sp->orphan_fd_closure, dummy_cb, sp->emfd, + GRPC_CLOSURE_INIT(&sp->orphan_fd_closure, dummy_cb, sp->emfd, grpc_schedule_on_exec_ctx); GPR_ASSERT(sp->orphan_cb); sp->orphan_cb(exec_ctx, sp->emfd, &sp->orphan_fd_closure, @@ -240,7 +240,7 @@ void grpc_udp_server_destroy(grpc_exec_ctx *exec_ctx, grpc_udp_server *s, struct shutdown_fd_args *args = gpr_malloc(sizeof(*args)); args->fd = sp->emfd; args->server_mu = &s->mu; - grpc_closure_init(&sp->orphan_fd_closure, shutdown_fd, args, + GRPC_CLOSURE_INIT(&sp->orphan_fd_closure, shutdown_fd, args, grpc_schedule_on_exec_ctx); sp->orphan_cb(exec_ctx, sp->emfd, &sp->orphan_fd_closure, sp->server->user_data); @@ -525,11 +525,11 @@ void grpc_udp_server_start(grpc_exec_ctx *exec_ctx, grpc_udp_server *s, for (i = 0; i < pollset_count; i++) { grpc_pollset_add_fd(exec_ctx, pollsets[i], sp->emfd); } - grpc_closure_init(&sp->read_closure, on_read, sp, + GRPC_CLOSURE_INIT(&sp->read_closure, on_read, sp, grpc_schedule_on_exec_ctx); grpc_fd_notify_on_read(exec_ctx, sp->emfd, &sp->read_closure); - grpc_closure_init(&sp->write_closure, on_write, sp, + GRPC_CLOSURE_INIT(&sp->write_closure, on_write, sp, grpc_schedule_on_exec_ctx); grpc_fd_notify_on_write(exec_ctx, sp->emfd, &sp->write_closure); diff --git a/src/core/lib/security/credentials/fake/fake_credentials.c b/src/core/lib/security/credentials/fake/fake_credentials.c index 15288e1dbe..3cbb399429 100644 --- a/src/core/lib/security/credentials/fake/fake_credentials.c +++ b/src/core/lib/security/credentials/fake/fake_credentials.c @@ -123,8 +123,8 @@ static void md_only_test_get_request_metadata( if (c->is_async) { grpc_credentials_metadata_request *cb_arg = grpc_credentials_metadata_request_create(creds, cb, user_data); - grpc_closure_sched(exec_ctx, - grpc_closure_create(on_simulated_token_fetch_done, + GRPC_CLOSURE_SCHED(exec_ctx, + GRPC_CLOSURE_CREATE(on_simulated_token_fetch_done, cb_arg, grpc_executor_scheduler), GRPC_ERROR_NONE); } else { diff --git a/src/core/lib/security/credentials/google_default/google_default_credentials.c b/src/core/lib/security/credentials/google_default/google_default_credentials.c index aaa7d97d3f..a2a8e289ee 100644 --- a/src/core/lib/security/credentials/google_default/google_default_credentials.c +++ b/src/core/lib/security/credentials/google_default/google_default_credentials.c @@ -115,7 +115,7 @@ static int is_stack_running_on_compute_engine(grpc_exec_ctx *exec_ctx) { grpc_httpcli_get( exec_ctx, &context, &detector.pollent, resource_quota, &request, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), max_detection_delay), - grpc_closure_create(on_compute_engine_detection_http_response, &detector, + GRPC_CLOSURE_CREATE(on_compute_engine_detection_http_response, &detector, grpc_schedule_on_exec_ctx), &detector.response); grpc_resource_quota_unref_internal(exec_ctx, resource_quota); @@ -140,7 +140,7 @@ static int is_stack_running_on_compute_engine(grpc_exec_ctx *exec_ctx) { gpr_mu_unlock(g_polling_mu); grpc_httpcli_context_destroy(exec_ctx, &context); - grpc_closure_init(&destroy_closure, destroy_pollset, + GRPC_CLOSURE_INIT(&destroy_closure, destroy_pollset, grpc_polling_entity_pollset(&detector.pollent), grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(exec_ctx, diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.c b/src/core/lib/security/credentials/jwt/jwt_verifier.c index f6db670a67..8c747085bb 100644 --- a/src/core/lib/security/credentials/jwt/jwt_verifier.c +++ b/src/core/lib/security/credentials/jwt/jwt_verifier.c @@ -668,7 +668,7 @@ static void on_openid_config_retrieved(grpc_exec_ctx *exec_ctx, void *user_data, grpc_httpcli_get( exec_ctx, &ctx->verifier->http_ctx, &ctx->pollent, resource_quota, &req, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay), - grpc_closure_create(on_keys_retrieved, ctx, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(on_keys_retrieved, ctx, grpc_schedule_on_exec_ctx), &ctx->responses[HTTP_RESPONSE_KEYS]); grpc_resource_quota_unref_internal(exec_ctx, resource_quota); grpc_json_destroy(json); @@ -771,7 +771,7 @@ static void retrieve_key_and_verify(grpc_exec_ctx *exec_ctx, gpr_asprintf(&req.http.path, "/%s/%s", path_prefix, iss); } http_cb = - grpc_closure_create(on_keys_retrieved, ctx, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_CREATE(on_keys_retrieved, ctx, grpc_schedule_on_exec_ctx); rsp_idx = HTTP_RESPONSE_KEYS; } else { req.host = gpr_strdup(strstr(iss, "https://") == iss ? iss + 8 : iss); @@ -783,7 +783,7 @@ static void retrieve_key_and_verify(grpc_exec_ctx *exec_ctx, gpr_asprintf(&req.http.path, "/%s%s", path_prefix, GRPC_OPENID_CONFIG_URL_SUFFIX); } - http_cb = grpc_closure_create(on_openid_config_retrieved, ctx, + http_cb = GRPC_CLOSURE_CREATE(on_openid_config_retrieved, ctx, grpc_schedule_on_exec_ctx); rsp_idx = HTTP_RESPONSE_OPENID; } diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.c b/src/core/lib/security/credentials/oauth2/oauth2_credentials.c index acf4c37da8..9de561b310 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.c @@ -300,7 +300,7 @@ static void compute_engine_fetch_oauth2( grpc_resource_quota_create("oauth2_credentials"); grpc_httpcli_get( exec_ctx, httpcli_context, pollent, resource_quota, &request, deadline, - grpc_closure_create(response_cb, metadata_req, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(response_cb, metadata_req, grpc_schedule_on_exec_ctx), &metadata_req->response); grpc_resource_quota_unref_internal(exec_ctx, resource_quota); @@ -360,7 +360,7 @@ static void refresh_token_fetch_oauth2( grpc_httpcli_post( exec_ctx, httpcli_context, pollent, resource_quota, &request, body, strlen(body), deadline, - grpc_closure_create(response_cb, metadata_req, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(response_cb, metadata_req, grpc_schedule_on_exec_ctx), &metadata_req->response); grpc_resource_quota_unref_internal(exec_ctx, resource_quota); gpr_free(body); diff --git a/src/core/lib/security/transport/secure_endpoint.c b/src/core/lib/security/transport/secure_endpoint.c index 643e057229..140cf294ae 100644 --- a/src/core/lib/security/transport/secure_endpoint.c +++ b/src/core/lib/security/transport/secure_endpoint.c @@ -132,7 +132,7 @@ static void call_read_cb(grpc_exec_ctx *exec_ctx, secure_endpoint *ep, } } ep->read_buffer = NULL; - grpc_closure_sched(exec_ctx, ep->read_cb, error); + GRPC_CLOSURE_SCHED(exec_ctx, ep->read_cb, error); SECURE_ENDPOINT_UNREF(exec_ctx, ep, "read"); } @@ -317,7 +317,7 @@ static void endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep, if (result != TSI_OK) { /* TODO(yangg) do different things according to the error type? */ grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &ep->output_buffer); - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, cb, grpc_set_tsi_error_result( GRPC_ERROR_CREATE_FROM_STATIC_STRING("Wrap failed"), result)); @@ -399,7 +399,7 @@ grpc_endpoint *grpc_secure_endpoint_create( grpc_slice_buffer_init(&ep->output_buffer); grpc_slice_buffer_init(&ep->source_buffer); ep->read_buffer = NULL; - grpc_closure_init(&ep->on_read, on_read, ep, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&ep->on_read, on_read, ep, grpc_schedule_on_exec_ctx); gpr_mu_init(&ep->protector_mu); gpr_ref_init(&ep->ref, 1); return &ep->base; diff --git a/src/core/lib/security/transport/security_connector.c b/src/core/lib/security/transport/security_connector.c index 519e2538a1..30a74302e1 100644 --- a/src/core/lib/security/transport/security_connector.c +++ b/src/core/lib/security/transport/security_connector.c @@ -122,7 +122,7 @@ void grpc_security_connector_check_peer(grpc_exec_ctx *exec_ctx, grpc_auth_context **auth_context, grpc_closure *on_peer_checked) { if (sc == NULL) { - grpc_closure_sched(exec_ctx, on_peer_checked, + GRPC_CLOSURE_SCHED(exec_ctx, on_peer_checked, GRPC_ERROR_CREATE_FROM_STATIC_STRING( "cannot check peer -- no security connector")); tsi_peer_destruct(&peer); @@ -340,7 +340,7 @@ static void fake_check_peer(grpc_exec_ctx *exec_ctx, *auth_context, GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME, GRPC_FAKE_TRANSPORT_SECURITY_TYPE); end: - grpc_closure_sched(exec_ctx, on_peer_checked, error); + GRPC_CLOSURE_SCHED(exec_ctx, on_peer_checked, error); tsi_peer_destruct(&peer); } @@ -602,7 +602,7 @@ static void ssl_channel_check_peer(grpc_exec_ctx *exec_ctx, ? c->overridden_target_name : c->target_name, &peer, auth_context); - grpc_closure_sched(exec_ctx, on_peer_checked, error); + GRPC_CLOSURE_SCHED(exec_ctx, on_peer_checked, error); tsi_peer_destruct(&peer); } @@ -612,7 +612,7 @@ static void ssl_server_check_peer(grpc_exec_ctx *exec_ctx, grpc_closure *on_peer_checked) { grpc_error *error = ssl_check_peer(sc, NULL, &peer, auth_context); tsi_peer_destruct(&peer); - grpc_closure_sched(exec_ctx, on_peer_checked, error); + GRPC_CLOSURE_SCHED(exec_ctx, on_peer_checked, error); } static void add_shallow_auth_property_to_peer(tsi_peer *peer, diff --git a/src/core/lib/security/transport/security_handshaker.c b/src/core/lib/security/transport/security_handshaker.c index f39d10cd81..239a211c0b 100644 --- a/src/core/lib/security/transport/security_handshaker.c +++ b/src/core/lib/security/transport/security_handshaker.c @@ -124,7 +124,7 @@ static void security_handshake_failed_locked(grpc_exec_ctx *exec_ctx, h->shutdown = true; } // Invoke callback. - grpc_closure_sched(exec_ctx, h->on_handshake_done, error); + GRPC_CLOSURE_SCHED(exec_ctx, h->on_handshake_done, error); } static void on_peer_checked(grpc_exec_ctx *exec_ctx, void *arg, @@ -173,7 +173,7 @@ static void on_peer_checked(grpc_exec_ctx *exec_ctx, void *arg, grpc_channel_args_copy_and_add(tmp_args, &auth_context_arg, 1); grpc_channel_args_destroy(exec_ctx, tmp_args); // Invoke callback. - grpc_closure_sched(exec_ctx, h->on_handshake_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, h->on_handshake_done, GRPC_ERROR_NONE); // Set shutdown to true so that subsequent calls to // security_handshaker_shutdown() do nothing. h->shutdown = true; @@ -408,13 +408,13 @@ static grpc_handshaker *security_handshaker_create( gpr_ref_init(&h->refs, 1); h->handshake_buffer_size = GRPC_INITIAL_HANDSHAKE_BUFFER_SIZE; h->handshake_buffer = gpr_malloc(h->handshake_buffer_size); - grpc_closure_init(&h->on_handshake_data_sent_to_peer, + GRPC_CLOSURE_INIT(&h->on_handshake_data_sent_to_peer, on_handshake_data_sent_to_peer, h, grpc_schedule_on_exec_ctx); - grpc_closure_init(&h->on_handshake_data_received_from_peer, + GRPC_CLOSURE_INIT(&h->on_handshake_data_received_from_peer, on_handshake_data_received_from_peer, h, grpc_schedule_on_exec_ctx); - grpc_closure_init(&h->on_peer_checked, on_peer_checked, h, + GRPC_CLOSURE_INIT(&h->on_peer_checked, on_peer_checked, h, grpc_schedule_on_exec_ctx); grpc_slice_buffer_init(&h->outgoing); return &h->base; @@ -440,7 +440,7 @@ static void fail_handshaker_do_handshake(grpc_exec_ctx *exec_ctx, grpc_tcp_server_acceptor *acceptor, grpc_closure *on_handshake_done, grpc_handshaker_args *args) { - grpc_closure_sched(exec_ctx, on_handshake_done, + GRPC_CLOSURE_SCHED(exec_ctx, on_handshake_done, GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Failed to create security handshaker")); } diff --git a/src/core/lib/security/transport/server_auth_filter.c b/src/core/lib/security/transport/server_auth_filter.c index eb7b635098..4e6914be7b 100644 --- a/src/core/lib/security/transport/server_auth_filter.c +++ b/src/core/lib/security/transport/server_auth_filter.c @@ -113,7 +113,7 @@ static void on_md_processing_done( grpc_slice_unref_internal(&exec_ctx, calld->md.metadata[i].value); } grpc_metadata_array_destroy(&calld->md); - grpc_closure_sched(&exec_ctx, calld->on_done_recv, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, calld->on_done_recv, GRPC_ERROR_NONE); } else { for (size_t i = 0; i < calld->md.count; i++) { grpc_slice_unref_internal(&exec_ctx, calld->md.metadata[i].key); @@ -128,7 +128,7 @@ static void on_md_processing_done( &exec_ctx, calld->transport_op->payload->send_message.send_message); calld->transport_op->payload->send_message.send_message = NULL; } - grpc_closure_sched( + GRPC_CLOSURE_SCHED( &exec_ctx, calld->on_done_recv, grpc_error_set_int(GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_details), GRPC_ERROR_INT_GRPC_STATUS, status)); @@ -151,7 +151,7 @@ static void auth_on_recv(grpc_exec_ctx *exec_ctx, void *user_data, return; } } - grpc_closure_sched(exec_ctx, calld->on_done_recv, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, calld->on_done_recv, GRPC_ERROR_REF(error)); } static void set_recv_ops_md_callbacks(grpc_call_element *elem, @@ -193,7 +193,7 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, /* initialize members */ memset(calld, 0, sizeof(*calld)); - grpc_closure_init(&calld->auth_on_recv, auth_on_recv, elem, + GRPC_CLOSURE_INIT(&calld->auth_on_recv, auth_on_recv, elem, grpc_schedule_on_exec_ctx); if (args->context[GRPC_CONTEXT_SECURITY].value != NULL) { diff --git a/src/core/lib/surface/alarm.c b/src/core/lib/surface/alarm.c index 4cd73a3f20..ef8405cca8 100644 --- a/src/core/lib/surface/alarm.c +++ b/src/core/lib/surface/alarm.c @@ -50,7 +50,7 @@ grpc_alarm *grpc_alarm_create(grpc_completion_queue *cq, gpr_timespec deadline, alarm->tag = tag; grpc_cq_begin_op(cq, tag); - grpc_closure_init(&alarm->on_alarm, alarm_cb, alarm, + GRPC_CLOSURE_INIT(&alarm->on_alarm, alarm_cb, alarm, grpc_schedule_on_exec_ctx); grpc_timer_init(&exec_ctx, &alarm->alarm, gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC), diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index fd4ed726b8..b499219e17 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -520,7 +520,7 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, void *call, } grpc_call_stack_destroy(exec_ctx, CALL_STACK_FROM_CALL(c), &c->final_info, - grpc_closure_init(&c->release_call, release_call, c, + GRPC_CLOSURE_INIT(&c->release_call, release_call, c, grpc_schedule_on_exec_ctx)); GPR_TIMER_END("destroy_call", 0); } @@ -634,7 +634,7 @@ static void cancel_with_error(grpc_exec_ctx *exec_ctx, grpc_call *c, GRPC_CALL_INTERNAL_REF(c, "termination"); set_status_from_error(exec_ctx, c, source, GRPC_ERROR_REF(error)); grpc_transport_stream_op_batch *op = grpc_make_transport_stream_op( - grpc_closure_create(done_termination, c, grpc_schedule_on_exec_ctx)); + GRPC_CLOSURE_CREATE(done_termination, c, grpc_schedule_on_exec_ctx)); op->cancel_stream = true; op->payload->cancel_stream.cancel_error = error; execute_op(exec_ctx, c, op); @@ -1170,7 +1170,7 @@ static void post_batch_completion(grpc_exec_ctx *exec_ctx, if (bctl->completion_data.notify_tag.is_closure) { /* unrefs bctl->error */ bctl->call = NULL; - grpc_closure_run(exec_ctx, bctl->completion_data.notify_tag.tag, error); + GRPC_CLOSURE_RUN(exec_ctx, bctl->completion_data.notify_tag.tag, error); GRPC_CALL_INTERNAL_UNREF(exec_ctx, call, "completion"); } else { /* unrefs bctl->error */ @@ -1275,7 +1275,7 @@ static void process_data_after_md(grpc_exec_ctx *exec_ctx, } else { *call->receiving_buffer = grpc_raw_byte_buffer_create(NULL, 0); } - grpc_closure_init(&call->receiving_slice_ready, receiving_slice_ready, bctl, + GRPC_CLOSURE_INIT(&call->receiving_slice_ready, receiving_slice_ready, bctl, grpc_schedule_on_exec_ctx); continue_receiving_slices(exec_ctx, bctl); } @@ -1390,11 +1390,11 @@ static void receiving_initial_metadata_ready(grpc_exec_ctx *exec_ctx, call->has_initial_md_been_received = true; if (call->saved_receiving_stream_ready_bctlp != NULL) { - grpc_closure *saved_rsr_closure = grpc_closure_create( + grpc_closure *saved_rsr_closure = GRPC_CLOSURE_CREATE( receiving_stream_ready, call->saved_receiving_stream_ready_bctlp, grpc_schedule_on_exec_ctx); call->saved_receiving_stream_ready_bctlp = NULL; - grpc_closure_run(exec_ctx, saved_rsr_closure, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_RUN(exec_ctx, saved_rsr_closure, GRPC_ERROR_REF(error)); } finish_batch_step(exec_ctx, bctl); @@ -1436,7 +1436,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, free_no_op_completion, NULL, gpr_malloc(sizeof(grpc_cq_completion))); } else { - grpc_closure_sched(exec_ctx, notify_tag, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, notify_tag, GRPC_ERROR_NONE); } error = GRPC_CALL_OK; goto done; @@ -1644,7 +1644,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, call->received_initial_metadata = true; call->buffered_metadata[0] = op->data.recv_initial_metadata.recv_initial_metadata; - grpc_closure_init(&call->receiving_initial_metadata_ready, + GRPC_CLOSURE_INIT(&call->receiving_initial_metadata_ready, receiving_initial_metadata_ready, bctl, grpc_schedule_on_exec_ctx); stream_op->recv_initial_metadata = true; @@ -1668,7 +1668,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, stream_op->recv_message = true; call->receiving_buffer = op->data.recv_message.recv_message; stream_op_payload->recv_message.recv_message = &call->receiving_stream; - grpc_closure_init(&call->receiving_stream_ready, receiving_stream_ready, + GRPC_CLOSURE_INIT(&call->receiving_stream_ready, receiving_stream_ready, bctl, grpc_schedule_on_exec_ctx); stream_op_payload->recv_message.recv_message_ready = &call->receiving_stream_ready; @@ -1734,7 +1734,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, } gpr_ref_init(&bctl->steps_to_complete, num_completion_callbacks_needed); - grpc_closure_init(&bctl->finish_batch, finish_batch, bctl, + GRPC_CLOSURE_INIT(&bctl->finish_batch, finish_batch, bctl, grpc_schedule_on_exec_ctx); stream_op->on_complete = &bctl->finish_batch; gpr_atm_rel_store(&call->any_ops_sent_atm, 1); diff --git a/src/core/lib/surface/channel_ping.c b/src/core/lib/surface/channel_ping.c index 4de3a8af64..80eb80af78 100644 --- a/src/core/lib/surface/channel_ping.c +++ b/src/core/lib/surface/channel_ping.c @@ -56,7 +56,7 @@ void grpc_channel_ping(grpc_channel *channel, grpc_completion_queue *cq, GPR_ASSERT(reserved == NULL); pr->tag = tag; pr->cq = cq; - grpc_closure_init(&pr->closure, ping_done, pr, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&pr->closure, ping_done, pr, grpc_schedule_on_exec_ctx); op->send_ping = &pr->closure; op->bind_pollset = grpc_cq_pollset(cq); grpc_cq_begin_op(cq, tag); diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index 07288053c8..1a5c721214 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -113,7 +113,7 @@ static grpc_error *non_polling_poller_work(grpc_exec_ctx *exec_ctx, npp->root = w.next; if (&w == npp->root) { if (npp->shutdown) { - grpc_closure_sched(exec_ctx, npp->shutdown, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, npp->shutdown, GRPC_ERROR_NONE); } npp->root = NULL; } @@ -146,7 +146,7 @@ static void non_polling_poller_shutdown(grpc_exec_ctx *exec_ctx, GPR_ASSERT(closure != NULL); p->shutdown = closure; if (p->root == NULL) { - grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_NONE); } else { non_polling_worker *w = p->root; do { @@ -417,7 +417,7 @@ grpc_completion_queue *grpc_completion_queue_create_internal( cqd->outstanding_tag_count = 0; #endif cq_event_queue_init(&cqd->queue); - grpc_closure_init(&cqd->pollset_shutdown_done, on_pollset_shutdown_done, cc, + GRPC_CLOSURE_INIT(&cqd->pollset_shutdown_done, on_pollset_shutdown_done, cc, grpc_schedule_on_exec_ctx); GPR_TIMER_END("grpc_completion_queue_create_internal", 0); diff --git a/src/core/lib/surface/lame_client.cc b/src/core/lib/surface/lame_client.cc index c9f498ce6a..a0791080a9 100644 --- a/src/core/lib/surface/lame_client.cc +++ b/src/core/lib/surface/lame_client.cc @@ -105,17 +105,17 @@ static void lame_start_transport_op(grpc_exec_ctx *exec_ctx, if (op->on_connectivity_state_change) { GPR_ASSERT(*op->connectivity_state != GRPC_CHANNEL_SHUTDOWN); *op->connectivity_state = GRPC_CHANNEL_SHUTDOWN; - grpc_closure_sched(exec_ctx, op->on_connectivity_state_change, + GRPC_CLOSURE_SCHED(exec_ctx, op->on_connectivity_state_change, GRPC_ERROR_NONE); } if (op->send_ping != NULL) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, op->send_ping, GRPC_ERROR_CREATE_FROM_STATIC_STRING("lame client channel")); } GRPC_ERROR_UNREF(op->disconnect_with_error); if (op->on_consumed != NULL) { - grpc_closure_sched(exec_ctx, op->on_consumed, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, op->on_consumed, GRPC_ERROR_NONE); } } @@ -128,7 +128,7 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_final_info *final_info, grpc_closure *then_schedule_closure) { - grpc_closure_sched(exec_ctx, then_schedule_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, then_schedule_closure, GRPC_ERROR_NONE); } static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx, diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 6cccd0d634..8a2616b027 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -269,7 +269,7 @@ static void shutdown_cleanup(grpc_exec_ctx *exec_ctx, void *arg, static void send_shutdown(grpc_exec_ctx *exec_ctx, grpc_channel *channel, bool send_goaway, grpc_error *send_disconnect) { struct shutdown_cleanup_args *sc = gpr_malloc(sizeof(*sc)); - grpc_closure_init(&sc->closure, shutdown_cleanup, sc, + GRPC_CLOSURE_INIT(&sc->closure, shutdown_cleanup, sc, grpc_schedule_on_exec_ctx); grpc_transport_op *op = grpc_make_transport_op(&sc->closure); grpc_channel_element *elem; @@ -337,11 +337,11 @@ static void request_matcher_zombify_all_pending_calls(grpc_exec_ctx *exec_ctx, gpr_mu_lock(&calld->mu_state); calld->state = ZOMBIED; gpr_mu_unlock(&calld->mu_state); - grpc_closure_init( + GRPC_CLOSURE_INIT( &calld->kill_zombie_closure, kill_zombie, grpc_call_stack_element(grpc_call_get_call_stack(calld->call), 0), grpc_schedule_on_exec_ctx); - grpc_closure_sched(exec_ctx, &calld->kill_zombie_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &calld->kill_zombie_closure, GRPC_ERROR_NONE); } } @@ -432,7 +432,7 @@ static void destroy_channel(grpc_exec_ctx *exec_ctx, channel_data *chand, orphan_channel(chand); server_ref(chand->server); maybe_finish_shutdown(exec_ctx, chand->server); - grpc_closure_init(&chand->finish_destroy_channel_closure, + GRPC_CLOSURE_INIT(&chand->finish_destroy_channel_closure, finish_destroy_channel, chand, grpc_schedule_on_exec_ctx); if (GRPC_TRACER_ON(grpc_server_channel_trace) && error != GRPC_ERROR_NONE) { @@ -497,11 +497,11 @@ static void publish_new_rpc(grpc_exec_ctx *exec_ctx, void *arg, gpr_mu_lock(&calld->mu_state); calld->state = ZOMBIED; gpr_mu_unlock(&calld->mu_state); - grpc_closure_init( + GRPC_CLOSURE_INIT( &calld->kill_zombie_closure, kill_zombie, grpc_call_stack_element(grpc_call_get_call_stack(calld->call), 0), grpc_schedule_on_exec_ctx); - grpc_closure_sched(exec_ctx, &calld->kill_zombie_closure, + GRPC_CLOSURE_SCHED(exec_ctx, &calld->kill_zombie_closure, GRPC_ERROR_REF(error)); return; } @@ -546,9 +546,9 @@ static void finish_start_new_rpc( gpr_mu_lock(&calld->mu_state); calld->state = ZOMBIED; gpr_mu_unlock(&calld->mu_state); - grpc_closure_init(&calld->kill_zombie_closure, kill_zombie, elem, + GRPC_CLOSURE_INIT(&calld->kill_zombie_closure, kill_zombie, elem, grpc_schedule_on_exec_ctx); - grpc_closure_sched(exec_ctx, &calld->kill_zombie_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &calld->kill_zombie_closure, GRPC_ERROR_NONE); return; } @@ -563,7 +563,7 @@ static void finish_start_new_rpc( memset(&op, 0, sizeof(op)); op.op = GRPC_OP_RECV_MESSAGE; op.data.recv_message.recv_message = &calld->payload; - grpc_closure_init(&calld->publish, publish_new_rpc, elem, + GRPC_CLOSURE_INIT(&calld->publish, publish_new_rpc, elem, grpc_schedule_on_exec_ctx); grpc_call_start_batch_and_execute(exec_ctx, calld->call, &op, 1, &calld->publish); @@ -740,7 +740,7 @@ static void server_on_recv_initial_metadata(grpc_exec_ctx *exec_ctx, void *ptr, GRPC_ERROR_UNREF(src_error); } - grpc_closure_run(exec_ctx, calld->on_done_recv_initial_metadata, error); + GRPC_CLOSURE_RUN(exec_ctx, calld->on_done_recv_initial_metadata, error); } static void server_mutate_op(grpc_call_element *elem, @@ -779,9 +779,9 @@ static void got_initial_metadata(grpc_exec_ctx *exec_ctx, void *ptr, if (calld->state == NOT_STARTED) { calld->state = ZOMBIED; gpr_mu_unlock(&calld->mu_state); - grpc_closure_init(&calld->kill_zombie_closure, kill_zombie, elem, + GRPC_CLOSURE_INIT(&calld->kill_zombie_closure, kill_zombie, elem, grpc_schedule_on_exec_ctx); - grpc_closure_sched(exec_ctx, &calld->kill_zombie_closure, + GRPC_CLOSURE_SCHED(exec_ctx, &calld->kill_zombie_closure, GRPC_ERROR_NONE); } else if (calld->state == PENDING) { calld->state = ZOMBIED; @@ -819,7 +819,7 @@ static void accept_stream(grpc_exec_ctx *exec_ctx, void *cd, op.op = GRPC_OP_RECV_INITIAL_METADATA; op.data.recv_initial_metadata.recv_initial_metadata = &calld->initial_metadata; - grpc_closure_init(&calld->got_initial_metadata, got_initial_metadata, elem, + GRPC_CLOSURE_INIT(&calld->got_initial_metadata, got_initial_metadata, elem, grpc_schedule_on_exec_ctx); grpc_call_start_batch_and_execute(exec_ctx, call, &op, 1, &calld->got_initial_metadata); @@ -855,7 +855,7 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, calld->call = grpc_call_from_top_element(elem); gpr_mu_init(&calld->mu_state); - grpc_closure_init(&calld->server_on_recv_initial_metadata, + GRPC_CLOSURE_INIT(&calld->server_on_recv_initial_metadata, server_on_recv_initial_metadata, elem, grpc_schedule_on_exec_ctx); @@ -895,7 +895,7 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx, chand->next = chand->prev = chand; chand->registered_methods = NULL; chand->connectivity_state = GRPC_CHANNEL_IDLE; - grpc_closure_init(&chand->channel_connectivity_changed, + GRPC_CLOSURE_INIT(&chand->channel_connectivity_changed, channel_connectivity_changed, chand, grpc_schedule_on_exec_ctx); return GRPC_ERROR_NONE; @@ -1075,7 +1075,7 @@ void grpc_server_start(grpc_server *server) { server_ref(server); server->starting = true; - grpc_closure_sched(&exec_ctx, grpc_closure_create(start_listeners, server, + GRPC_CLOSURE_SCHED(&exec_ctx, GRPC_CLOSURE_CREATE(start_listeners, server, grpc_executor_scheduler), GRPC_ERROR_NONE); @@ -1255,7 +1255,7 @@ void grpc_server_shutdown_and_notify(grpc_server *server, /* Shutdown listeners */ for (l = server->listeners; l; l = l->next) { - grpc_closure_init(&l->destroy_done, listener_destroy_done, server, + GRPC_CLOSURE_INIT(&l->destroy_done, listener_destroy_done, server, grpc_schedule_on_exec_ctx); l->destroy(&exec_ctx, server, l->arg, &l->destroy_done); } @@ -1349,11 +1349,11 @@ static grpc_call_error queue_call_request(grpc_exec_ctx *exec_ctx, gpr_mu_lock(&calld->mu_state); if (calld->state == ZOMBIED) { gpr_mu_unlock(&calld->mu_state); - grpc_closure_init( + GRPC_CLOSURE_INIT( &calld->kill_zombie_closure, kill_zombie, grpc_call_stack_element(grpc_call_get_call_stack(calld->call), 0), grpc_schedule_on_exec_ctx); - grpc_closure_sched(exec_ctx, &calld->kill_zombie_closure, + GRPC_CLOSURE_SCHED(exec_ctx, &calld->kill_zombie_closure, GRPC_ERROR_NONE); } else { GPR_ASSERT(calld->state == PENDING); diff --git a/src/core/lib/transport/connectivity_state.c b/src/core/lib/transport/connectivity_state.c index f1bbfc082a..6fe40af3b2 100644 --- a/src/core/lib/transport/connectivity_state.c +++ b/src/core/lib/transport/connectivity_state.c @@ -67,7 +67,7 @@ void grpc_connectivity_state_destroy(grpc_exec_ctx *exec_ctx, error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Shutdown connectivity owner"); } - grpc_closure_sched(exec_ctx, w->notify, error); + GRPC_CLOSURE_SCHED(exec_ctx, w->notify, error); gpr_free(w); } GRPC_ERROR_UNREF(tracker->current_error); @@ -125,7 +125,7 @@ bool grpc_connectivity_state_notify_on_state_change( if (current == NULL) { grpc_connectivity_state_watcher *w = tracker->watchers; if (w != NULL && w->notify == notify) { - grpc_closure_sched(exec_ctx, notify, GRPC_ERROR_CANCELLED); + GRPC_CLOSURE_SCHED(exec_ctx, notify, GRPC_ERROR_CANCELLED); tracker->watchers = w->next; gpr_free(w); return false; @@ -133,7 +133,7 @@ bool grpc_connectivity_state_notify_on_state_change( while (w != NULL) { grpc_connectivity_state_watcher *rm_candidate = w->next; if (rm_candidate != NULL && rm_candidate->notify == notify) { - grpc_closure_sched(exec_ctx, notify, GRPC_ERROR_CANCELLED); + GRPC_CLOSURE_SCHED(exec_ctx, notify, GRPC_ERROR_CANCELLED); w->next = w->next->next; gpr_free(rm_candidate); return false; @@ -144,7 +144,7 @@ bool grpc_connectivity_state_notify_on_state_change( } else { if (cur != *current) { *current = cur; - grpc_closure_sched(exec_ctx, notify, + GRPC_CLOSURE_SCHED(exec_ctx, notify, GRPC_ERROR_REF(tracker->current_error)); } else { grpc_connectivity_state_watcher *w = gpr_malloc(sizeof(*w)); @@ -197,7 +197,7 @@ void grpc_connectivity_state_set(grpc_exec_ctx *exec_ctx, gpr_log(GPR_DEBUG, "NOTIFY: %p %s: %p", tracker, tracker->name, w->notify); } - grpc_closure_sched(exec_ctx, w->notify, + GRPC_CLOSURE_SCHED(exec_ctx, w->notify, GRPC_ERROR_REF(tracker->current_error)); gpr_free(w); } diff --git a/src/core/lib/transport/transport.c b/src/core/lib/transport/transport.c index abc289ccd9..c2afedec58 100644 --- a/src/core/lib/transport/transport.c +++ b/src/core/lib/transport/transport.c @@ -65,7 +65,7 @@ void grpc_stream_unref(grpc_exec_ctx *exec_ctx, there. */ refcount->destroy.scheduler = grpc_executor_scheduler; } - grpc_closure_sched(exec_ctx, &refcount->destroy, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &refcount->destroy, GRPC_ERROR_NONE); } } @@ -112,7 +112,7 @@ void grpc_stream_ref_init(grpc_stream_refcount *refcount, int initial_refs, grpc_iomgr_cb_func cb, void *cb_arg) { #endif gpr_ref_init(&refcount->refs, initial_refs); - grpc_closure_init(&refcount->destroy, cb, cb_arg, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&refcount->destroy, cb, cb_arg, grpc_schedule_on_exec_ctx); refcount->slice_refcount.vtable = &stream_ref_slice_vtable; refcount->slice_refcount.sub_refcount = &refcount->slice_refcount; } @@ -202,16 +202,16 @@ void grpc_transport_stream_op_batch_finish_with_failure( grpc_exec_ctx *exec_ctx, grpc_transport_stream_op_batch *op, grpc_error *error) { if (op->recv_message) { - grpc_closure_sched(exec_ctx, op->payload->recv_message.recv_message_ready, + GRPC_CLOSURE_SCHED(exec_ctx, op->payload->recv_message.recv_message_ready, GRPC_ERROR_REF(error)); } if (op->recv_initial_metadata) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, op->payload->recv_initial_metadata.recv_initial_metadata_ready, GRPC_ERROR_REF(error)); } - grpc_closure_sched(exec_ctx, op->on_complete, error); + GRPC_CLOSURE_SCHED(exec_ctx, op->on_complete, error); if (op->cancel_stream) { GRPC_ERROR_UNREF(op->payload->cancel_stream.cancel_error); } @@ -226,13 +226,13 @@ typedef struct { static void destroy_made_transport_op(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { made_transport_op *op = arg; - grpc_closure_sched(exec_ctx, op->inner_on_complete, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, op->inner_on_complete, GRPC_ERROR_REF(error)); gpr_free(op); } grpc_transport_op *grpc_make_transport_op(grpc_closure *on_complete) { made_transport_op *op = gpr_malloc(sizeof(*op)); - grpc_closure_init(&op->outer_on_complete, destroy_made_transport_op, op, + GRPC_CLOSURE_INIT(&op->outer_on_complete, destroy_made_transport_op, op, grpc_schedule_on_exec_ctx); op->inner_on_complete = on_complete; memset(&op->op, 0, sizeof(op->op)); @@ -252,14 +252,14 @@ static void destroy_made_transport_stream_op(grpc_exec_ctx *exec_ctx, void *arg, made_transport_stream_op *op = arg; grpc_closure *c = op->inner_on_complete; gpr_free(op); - grpc_closure_run(exec_ctx, c, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_RUN(exec_ctx, c, GRPC_ERROR_REF(error)); } grpc_transport_stream_op_batch *grpc_make_transport_stream_op( grpc_closure *on_complete) { made_transport_stream_op *op = gpr_zalloc(sizeof(*op)); op->op.payload = &op->payload; - grpc_closure_init(&op->outer_on_complete, destroy_made_transport_stream_op, + GRPC_CLOSURE_INIT(&op->outer_on_complete, destroy_made_transport_stream_op, op, grpc_schedule_on_exec_ctx); op->inner_on_complete = on_complete; op->op.on_complete = &op->outer_on_complete; diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index 4f8e428278..9454aba136 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -134,7 +134,7 @@ void grpc_run_bad_client_test( grpc_slice_buffer_init(&outgoing); grpc_slice_buffer_add(&outgoing, slice); - grpc_closure_init(&done_write_closure, done_write, &a, + GRPC_CLOSURE_INIT(&done_write_closure, done_write, &a, grpc_schedule_on_exec_ctx); /* Write data */ @@ -164,7 +164,7 @@ void grpc_run_bad_client_test( grpc_slice_buffer_init(&args.incoming); gpr_event_init(&args.read_done); grpc_closure read_done_closure; - grpc_closure_init(&read_done_closure, read_done, &args, + GRPC_CLOSURE_INIT(&read_done_closure, read_done, &args, grpc_schedule_on_exec_ctx); grpc_endpoint_read(&exec_ctx, sfd.client, &args.incoming, &read_done_closure); diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c index 43dc7e9084..6e3d69c265 100644 --- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c +++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c @@ -54,7 +54,7 @@ static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, (*addrs)->addrs = gpr_malloc(sizeof(*(*addrs)->addrs)); (*addrs)->addrs[0].len = 123; } - grpc_closure_sched(exec_ctx, on_done, error); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, error); } static grpc_ares_request *my_dns_lookup_ares( @@ -73,7 +73,7 @@ static grpc_ares_request *my_dns_lookup_ares( *lb_addrs = grpc_lb_addresses_create(1, NULL); grpc_lb_addresses_set_address(*lb_addrs, 0, NULL, 0, false, NULL, NULL); } - grpc_closure_sched(exec_ctx, on_done, error); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, error); return NULL; } @@ -133,7 +133,7 @@ static void call_resolver_next_after_locking(grpc_exec_ctx *exec_ctx, a->resolver = resolver; a->result = result; a->on_complete = on_complete; - grpc_closure_sched(exec_ctx, grpc_closure_create( + GRPC_CLOSURE_SCHED(exec_ctx, GRPC_CLOSURE_CREATE( call_resolver_next_now_lock_taken, a, grpc_combiner_scheduler(resolver->combiner)), GRPC_ERROR_NONE); @@ -155,7 +155,7 @@ int main(int argc, char **argv) { gpr_event_init(&ev1); call_resolver_next_after_locking( &exec_ctx, resolver, &result, - grpc_closure_create(on_done, &ev1, grpc_schedule_on_exec_ctx)); + GRPC_CLOSURE_CREATE(on_done, &ev1, grpc_schedule_on_exec_ctx)); grpc_exec_ctx_flush(&exec_ctx); GPR_ASSERT(wait_loop(5, &ev1)); GPR_ASSERT(result == NULL); @@ -164,7 +164,7 @@ int main(int argc, char **argv) { gpr_event_init(&ev2); call_resolver_next_after_locking( &exec_ctx, resolver, &result, - grpc_closure_create(on_done, &ev2, grpc_schedule_on_exec_ctx)); + GRPC_CLOSURE_CREATE(on_done, &ev2, grpc_schedule_on_exec_ctx)); grpc_exec_ctx_flush(&exec_ctx); GPR_ASSERT(wait_loop(30, &ev2)); GPR_ASSERT(result != NULL); diff --git a/test/core/client_channel/resolvers/fake_resolver_test.c b/test/core/client_channel/resolvers/fake_resolver_test.c index 74aabffeca..9b0854d6d8 100644 --- a/test/core/client_channel/resolvers/fake_resolver_test.c +++ b/test/core/client_channel/resolvers/fake_resolver_test.c @@ -101,7 +101,7 @@ static void test_fake_resolver() { memset(&on_res_arg, 0, sizeof(on_res_arg)); on_res_arg.expected_resolver_result = results; gpr_event_init(&on_res_arg.ev); - grpc_closure *on_resolution = grpc_closure_create( + grpc_closure *on_resolution = GRPC_CLOSURE_CREATE( on_resolution_cb, &on_res_arg, grpc_combiner_scheduler(combiner)); // Set resolver results and trigger first resolution. on_resolution_cb @@ -138,7 +138,7 @@ static void test_fake_resolver() { memset(&on_res_arg_update, 0, sizeof(on_res_arg_update)); on_res_arg_update.expected_resolver_result = results_update; gpr_event_init(&on_res_arg_update.ev); - on_resolution = grpc_closure_create(on_resolution_cb, &on_res_arg_update, + on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg_update, grpc_combiner_scheduler(combiner)); // Set updated resolver results and trigger a second resolution. diff --git a/test/core/client_channel/resolvers/sockaddr_resolver_test.c b/test/core/client_channel/resolvers/sockaddr_resolver_test.c index 11d09acaa1..8b88619164 100644 --- a/test/core/client_channel/resolvers/sockaddr_resolver_test.c +++ b/test/core/client_channel/resolvers/sockaddr_resolver_test.c @@ -57,7 +57,7 @@ static void test_succeeds(grpc_resolver_factory *factory, const char *string) { on_resolution_arg on_res_arg; memset(&on_res_arg, 0, sizeof(on_res_arg)); on_res_arg.expected_server_name = uri->path; - grpc_closure *on_resolution = grpc_closure_create( + grpc_closure *on_resolution = GRPC_CLOSURE_CREATE( on_resolution_cb, &on_res_arg, grpc_schedule_on_exec_ctx); grpc_resolver_next_locked(&exec_ctx, resolver, &on_res_arg.resolver_result, diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c index f0c384db29..5f89058c45 100644 --- a/test/core/end2end/bad_server_response_test.c +++ b/test/core/end2end/bad_server_response_test.c @@ -137,8 +137,8 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp, grpc_tcp_server_acceptor *acceptor) { gpr_free(acceptor); test_tcp_server *server = arg; - grpc_closure_init(&on_read, handle_read, NULL, grpc_schedule_on_exec_ctx); - grpc_closure_init(&on_write, done_write, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&on_read, handle_read, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&on_write, done_write, NULL, grpc_schedule_on_exec_ctx); grpc_slice_buffer_init(&state.temp_incoming_buffer); grpc_slice_buffer_init(&state.outgoing_buffer); state.tcp = tcp; diff --git a/test/core/end2end/fixtures/http_proxy_fixture.c b/test/core/end2end/fixtures/http_proxy_fixture.c index c0641a8cff..248f721cbb 100644 --- a/test/core/end2end/fixtures/http_proxy_fixture.c +++ b/test/core/end2end/fixtures/http_proxy_fixture.c @@ -387,19 +387,19 @@ static void on_accept(grpc_exec_ctx* exec_ctx, void* arg, conn->pollset_set = grpc_pollset_set_create(); grpc_pollset_set_add_pollset(exec_ctx, conn->pollset_set, proxy->pollset); grpc_endpoint_add_to_pollset_set(exec_ctx, endpoint, conn->pollset_set); - grpc_closure_init(&conn->on_read_request_done, on_read_request_done, conn, + GRPC_CLOSURE_INIT(&conn->on_read_request_done, on_read_request_done, conn, grpc_combiner_scheduler(conn->proxy->combiner)); - grpc_closure_init(&conn->on_server_connect_done, on_server_connect_done, conn, + GRPC_CLOSURE_INIT(&conn->on_server_connect_done, on_server_connect_done, conn, grpc_combiner_scheduler(conn->proxy->combiner)); - grpc_closure_init(&conn->on_write_response_done, on_write_response_done, conn, + GRPC_CLOSURE_INIT(&conn->on_write_response_done, on_write_response_done, conn, grpc_combiner_scheduler(conn->proxy->combiner)); - grpc_closure_init(&conn->on_client_read_done, on_client_read_done, conn, + GRPC_CLOSURE_INIT(&conn->on_client_read_done, on_client_read_done, conn, grpc_combiner_scheduler(conn->proxy->combiner)); - grpc_closure_init(&conn->on_client_write_done, on_client_write_done, conn, + GRPC_CLOSURE_INIT(&conn->on_client_write_done, on_client_write_done, conn, grpc_combiner_scheduler(conn->proxy->combiner)); - grpc_closure_init(&conn->on_server_read_done, on_server_read_done, conn, + GRPC_CLOSURE_INIT(&conn->on_server_read_done, on_server_read_done, conn, grpc_combiner_scheduler(conn->proxy->combiner)); - grpc_closure_init(&conn->on_server_write_done, on_server_write_done, conn, + GRPC_CLOSURE_INIT(&conn->on_server_write_done, on_server_write_done, conn, grpc_combiner_scheduler(conn->proxy->combiner)); grpc_slice_buffer_init(&conn->client_read_buffer); grpc_slice_buffer_init(&conn->client_deferred_write_buffer); @@ -491,7 +491,7 @@ void grpc_end2end_http_proxy_destroy(grpc_end2end_http_proxy* proxy) { gpr_free(proxy->proxy_name); grpc_channel_args_destroy(&exec_ctx, proxy->channel_args); grpc_pollset_shutdown(&exec_ctx, proxy->pollset, - grpc_closure_create(destroy_pollset, proxy->pollset, + GRPC_CLOSURE_CREATE(destroy_pollset, proxy->pollset, grpc_schedule_on_exec_ctx)); grpc_combiner_unref(&exec_ctx, proxy->combiner); gpr_free(proxy); diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index 1e9e7e6194..281a1af20c 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -384,9 +384,9 @@ static void finish_resolve(grpc_exec_ctx *exec_ctx, void *arg, grpc_lb_addresses_set_address(lb_addrs, 0, NULL, 0, NULL, NULL, NULL); *r->lb_addrs = lb_addrs; } - grpc_closure_sched(exec_ctx, r->on_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, r->on_done, GRPC_ERROR_NONE); } else { - grpc_closure_sched(exec_ctx, r->on_done, + GRPC_CLOSURE_SCHED(exec_ctx, r->on_done, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Resolution failed", &error, 1)); } @@ -408,7 +408,7 @@ void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, grpc_timer_init( exec_ctx, &r->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), gpr_time_from_seconds(1, GPR_TIMESPAN)), - grpc_closure_create(finish_resolve, r, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx), gpr_now(GPR_CLOCK_MONOTONIC)); } @@ -424,7 +424,7 @@ grpc_ares_request *my_dns_lookup_ares( grpc_timer_init( exec_ctx, &r->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), gpr_time_from_seconds(1, GPR_TIMESPAN)), - grpc_closure_create(finish_resolve, r, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx), gpr_now(GPR_CLOCK_MONOTONIC)); return NULL; } @@ -452,7 +452,7 @@ static void do_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { future_connect *fc = arg; if (error != GRPC_ERROR_NONE) { *fc->ep = NULL; - grpc_closure_sched(exec_ctx, fc->closure, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(exec_ctx, fc->closure, GRPC_ERROR_REF(error)); } else if (g_server != NULL) { grpc_endpoint *client; grpc_endpoint *server; @@ -464,7 +464,7 @@ static void do_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { grpc_server_setup_transport(exec_ctx, g_server, transport, NULL, NULL); grpc_chttp2_transport_start_reading(exec_ctx, transport, NULL); - grpc_closure_sched(exec_ctx, fc->closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, fc->closure, GRPC_ERROR_NONE); } else { sched_connect(exec_ctx, fc->closure, fc->ep, fc->deadline); } @@ -475,7 +475,7 @@ static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_endpoint **ep, gpr_timespec deadline) { if (gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) < 0) { *ep = NULL; - grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_CREATE_FROM_STATIC_STRING( + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Connect deadline exceeded")); return; } @@ -487,7 +487,7 @@ static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_timer_init( exec_ctx, &fc->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), gpr_time_from_millis(1, GPR_TIMESPAN)), - grpc_closure_create(do_connect, fc, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(do_connect, fc, grpc_schedule_on_exec_ctx), gpr_now(GPR_CLOCK_MONOTONIC)); } diff --git a/test/core/end2end/goaway_server_test.c b/test/core/end2end/goaway_server_test.c index 91a377e6b9..bf90e2525d 100644 --- a/test/core/end2end/goaway_server_test.c +++ b/test/core/end2end/goaway_server_test.c @@ -84,7 +84,7 @@ static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, (*addrs)->addrs[0].len = sizeof(*sa); gpr_mu_unlock(&g_mu); } - grpc_closure_sched(exec_ctx, on_done, error); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, error); } static grpc_ares_request *my_dns_lookup_ares( @@ -113,7 +113,7 @@ static grpc_ares_request *my_dns_lookup_ares( gpr_free(sa); gpr_mu_unlock(&g_mu); } - grpc_closure_sched(exec_ctx, on_done, error); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, error); return NULL; } diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c index 949de09ded..aff39dd89d 100644 --- a/test/core/end2end/tests/filter_causes_close.c +++ b/test/core/end2end/tests/filter_causes_close.c @@ -197,7 +197,7 @@ static void recv_im_ready(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { grpc_call_element *elem = arg; call_data *calld = elem->call_data; - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, calld->recv_im_ready, grpc_error_set_int(GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Failure that's not preventable.", &error, 1), @@ -213,7 +213,7 @@ static void start_transport_stream_op_batch( calld->recv_im_ready = op->payload->recv_initial_metadata.recv_initial_metadata_ready; op->payload->recv_initial_metadata.recv_initial_metadata_ready = - grpc_closure_create(recv_im_ready, elem, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_CREATE(recv_im_ready, elem, grpc_schedule_on_exec_ctx); } grpc_call_next_op(exec_ctx, elem, op); } diff --git a/test/core/http/httpcli_test.c b/test/core/http/httpcli_test.c index 14bdc6da1c..b8b96d673c 100644 --- a/test/core/http/httpcli_test.c +++ b/test/core/http/httpcli_test.c @@ -77,7 +77,7 @@ static void test_get(int port) { grpc_resource_quota *resource_quota = grpc_resource_quota_create("test_get"); grpc_httpcli_get( &exec_ctx, &g_context, &g_pops, resource_quota, &req, n_seconds_time(15), - grpc_closure_create(on_finish, &response, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(on_finish, &response, grpc_schedule_on_exec_ctx), &response); grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); gpr_mu_lock(g_mu); @@ -119,7 +119,7 @@ static void test_post(int port) { grpc_httpcli_post( &exec_ctx, &g_context, &g_pops, resource_quota, &req, "hello", 5, n_seconds_time(15), - grpc_closure_create(on_finish, &response, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(on_finish, &response, grpc_schedule_on_exec_ctx), &response); grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); gpr_mu_lock(g_mu); @@ -195,7 +195,7 @@ int main(int argc, char **argv) { test_post(port); grpc_httpcli_context_destroy(&exec_ctx, &g_context); - grpc_closure_init(&destroyed, destroy_pops, &g_pops, + GRPC_CLOSURE_INIT(&destroyed, destroy_pops, &g_pops, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&g_pops), &destroyed); diff --git a/test/core/http/httpscli_test.c b/test/core/http/httpscli_test.c index 2e4e654e2c..a9d7abdcff 100644 --- a/test/core/http/httpscli_test.c +++ b/test/core/http/httpscli_test.c @@ -78,7 +78,7 @@ static void test_get(int port) { grpc_resource_quota *resource_quota = grpc_resource_quota_create("test_get"); grpc_httpcli_get( &exec_ctx, &g_context, &g_pops, resource_quota, &req, n_seconds_time(15), - grpc_closure_create(on_finish, &response, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(on_finish, &response, grpc_schedule_on_exec_ctx), &response); grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); gpr_mu_lock(g_mu); @@ -121,7 +121,7 @@ static void test_post(int port) { grpc_httpcli_post( &exec_ctx, &g_context, &g_pops, resource_quota, &req, "hello", 5, n_seconds_time(15), - grpc_closure_create(on_finish, &response, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(on_finish, &response, grpc_schedule_on_exec_ctx), &response); grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); gpr_mu_lock(g_mu); @@ -198,7 +198,7 @@ int main(int argc, char **argv) { test_post(port); grpc_httpcli_context_destroy(&exec_ctx, &g_context); - grpc_closure_init(&destroyed, destroy_pops, &g_pops, + GRPC_CLOSURE_INIT(&destroyed, destroy_pops, &g_pops, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&g_pops), &destroyed); diff --git a/test/core/iomgr/combiner_test.c b/test/core/iomgr/combiner_test.c index 82e692902e..38f512de0e 100644 --- a/test/core/iomgr/combiner_test.c +++ b/test/core/iomgr/combiner_test.c @@ -45,8 +45,8 @@ static void test_execute_one(void) { gpr_event done; gpr_event_init(&done); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_closure_sched(&exec_ctx, - grpc_closure_create(set_event_to_true, &done, + GRPC_CLOSURE_SCHED(&exec_ctx, + GRPC_CLOSURE_CREATE(set_event_to_true, &done, grpc_combiner_scheduler(lock)), GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); @@ -83,8 +83,8 @@ static void execute_many_loop(void *a) { ex_args *c = gpr_malloc(sizeof(*c)); c->ctr = &args->ctr; c->value = n++; - grpc_closure_sched(&exec_ctx, - grpc_closure_create( + GRPC_CLOSURE_SCHED(&exec_ctx, + GRPC_CLOSURE_CREATE( check_one, c, grpc_combiner_scheduler(args->lock)), GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); @@ -93,8 +93,8 @@ static void execute_many_loop(void *a) { // picking it up gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); } - grpc_closure_sched(&exec_ctx, - grpc_closure_create(set_event_to_true, &args->done, + GRPC_CLOSURE_SCHED(&exec_ctx, + GRPC_CLOSURE_CREATE(set_event_to_true, &args->done, grpc_combiner_scheduler(args->lock)), GRPC_ERROR_NONE); grpc_exec_ctx_finish(&exec_ctx); @@ -131,8 +131,8 @@ static void in_finally(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { } static void add_finally(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - grpc_closure_sched(exec_ctx, - grpc_closure_create(in_finally, arg, + GRPC_CLOSURE_SCHED(exec_ctx, + GRPC_CLOSURE_CREATE(in_finally, arg, grpc_combiner_finally_scheduler(arg)), GRPC_ERROR_NONE); } @@ -143,9 +143,9 @@ static void test_execute_finally(void) { grpc_combiner *lock = grpc_combiner_create(); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; gpr_event_init(&got_in_finally); - grpc_closure_sched( + GRPC_CLOSURE_SCHED( &exec_ctx, - grpc_closure_create(add_finally, lock, grpc_combiner_scheduler(lock)), + GRPC_CLOSURE_CREATE(add_finally, lock, grpc_combiner_scheduler(lock)), GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); GPR_ASSERT(gpr_event_wait(&got_in_finally, diff --git a/test/core/iomgr/endpoint_pair_test.c b/test/core/iomgr/endpoint_pair_test.c index 1c514129e5..f2ce3d0d12 100644 --- a/test/core/iomgr/endpoint_pair_test.c +++ b/test/core/iomgr/endpoint_pair_test.c @@ -66,7 +66,7 @@ int main(int argc, char **argv) { g_pollset = gpr_zalloc(grpc_pollset_size()); grpc_pollset_init(g_pollset, &g_mu); grpc_endpoint_tests(configs[0], g_pollset, g_mu); - grpc_closure_init(&destroyed, destroy_pollset, g_pollset, + GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.c index d6477a6a87..11b45e8e08 100644 --- a/test/core/iomgr/endpoint_tests.c +++ b/test/core/iomgr/endpoint_tests.c @@ -198,9 +198,9 @@ static void read_and_write_test(grpc_endpoint_test_config config, state.write_done = 0; state.current_read_data = 0; state.current_write_data = 0; - grpc_closure_init(&state.done_read, read_and_write_test_read_handler, &state, + GRPC_CLOSURE_INIT(&state.done_read, read_and_write_test_read_handler, &state, grpc_schedule_on_exec_ctx); - grpc_closure_init(&state.done_write, read_and_write_test_write_handler, + GRPC_CLOSURE_INIT(&state.done_write, read_and_write_test_write_handler, &state, grpc_schedule_on_exec_ctx); grpc_slice_buffer_init(&state.outgoing); grpc_slice_buffer_init(&state.incoming); @@ -287,19 +287,19 @@ static void multiple_shutdown_test(grpc_endpoint_test_config config) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_endpoint_add_to_pollset(&exec_ctx, f.client_ep, g_pollset); grpc_endpoint_read(&exec_ctx, f.client_ep, &slice_buffer, - grpc_closure_create(inc_on_failure, &fail_count, + GRPC_CLOSURE_CREATE(inc_on_failure, &fail_count, grpc_schedule_on_exec_ctx)); wait_for_fail_count(&exec_ctx, &fail_count, 0); grpc_endpoint_shutdown(&exec_ctx, f.client_ep, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown")); wait_for_fail_count(&exec_ctx, &fail_count, 1); grpc_endpoint_read(&exec_ctx, f.client_ep, &slice_buffer, - grpc_closure_create(inc_on_failure, &fail_count, + GRPC_CLOSURE_CREATE(inc_on_failure, &fail_count, grpc_schedule_on_exec_ctx)); wait_for_fail_count(&exec_ctx, &fail_count, 2); grpc_slice_buffer_add(&slice_buffer, grpc_slice_from_copied_string("a")); grpc_endpoint_write(&exec_ctx, f.client_ep, &slice_buffer, - grpc_closure_create(inc_on_failure, &fail_count, + GRPC_CLOSURE_CREATE(inc_on_failure, &fail_count, grpc_schedule_on_exec_ctx)); wait_for_fail_count(&exec_ctx, &fail_count, 3); grpc_endpoint_shutdown(&exec_ctx, f.client_ep, diff --git a/test/core/iomgr/ev_epollsig_linux_test.c b/test/core/iomgr/ev_epollsig_linux_test.c index 85f933651d..1d272fa406 100644 --- a/test/core/iomgr/ev_epollsig_linux_test.c +++ b/test/core/iomgr/ev_epollsig_linux_test.c @@ -106,7 +106,7 @@ static void test_pollset_cleanup(grpc_exec_ctx *exec_ctx, int i; for (i = 0; i < num_pollsets; i++) { - grpc_closure_init(&destroyed, destroy_pollset, pollsets[i].pollset, + GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, pollsets[i].pollset, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(exec_ctx, pollsets[i].pollset, &destroyed); @@ -280,7 +280,7 @@ static void test_threading(void) { grpc_pollset_add_fd(&exec_ctx, shared.pollset, shared.wakeup_desc); grpc_fd_notify_on_read( &exec_ctx, shared.wakeup_desc, - grpc_closure_init(&shared.on_wakeup, test_threading_wakeup, &shared, + GRPC_CLOSURE_INIT(&shared.on_wakeup, test_threading_wakeup, &shared, grpc_schedule_on_exec_ctx)); grpc_exec_ctx_finish(&exec_ctx); } @@ -296,7 +296,7 @@ static void test_threading(void) { grpc_fd_shutdown(&exec_ctx, shared.wakeup_desc, GRPC_ERROR_CANCELLED); grpc_fd_orphan(&exec_ctx, shared.wakeup_desc, NULL, NULL, "done"); grpc_pollset_shutdown(&exec_ctx, shared.pollset, - grpc_closure_create(destroy_pollset, shared.pollset, + GRPC_CLOSURE_CREATE(destroy_pollset, shared.pollset, grpc_schedule_on_exec_ctx)); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c index 54c71b8a1f..02596450d2 100644 --- a/test/core/iomgr/fd_posix_test.c +++ b/test/core/iomgr/fd_posix_test.c @@ -205,7 +205,7 @@ static void listen_cb(grpc_exec_ctx *exec_ctx, void *arg, /*=sv_arg*/ se->sv = sv; se->em_fd = grpc_fd_create(fd, "listener"); grpc_pollset_add_fd(exec_ctx, g_pollset, se->em_fd); - grpc_closure_init(&se->session_read_closure, session_read_cb, se, + GRPC_CLOSURE_INIT(&se->session_read_closure, session_read_cb, se, grpc_schedule_on_exec_ctx); grpc_fd_notify_on_read(exec_ctx, se->em_fd, &se->session_read_closure); @@ -235,7 +235,7 @@ static int server_start(grpc_exec_ctx *exec_ctx, server *sv) { sv->em_fd = grpc_fd_create(fd, "server"); grpc_pollset_add_fd(exec_ctx, g_pollset, sv->em_fd); /* Register to be interested in reading from listen_fd. */ - grpc_closure_init(&sv->listen_closure, listen_cb, sv, + GRPC_CLOSURE_INIT(&sv->listen_closure, listen_cb, sv, grpc_schedule_on_exec_ctx); grpc_fd_notify_on_read(exec_ctx, sv->em_fd, &sv->listen_closure); @@ -319,7 +319,7 @@ static void client_session_write(grpc_exec_ctx *exec_ctx, void *arg, /*client */ if (errno == EAGAIN) { gpr_mu_lock(g_mu); if (cl->client_write_cnt < CLIENT_TOTAL_WRITE_CNT) { - grpc_closure_init(&cl->write_closure, client_session_write, cl, + GRPC_CLOSURE_INIT(&cl->write_closure, client_session_write, cl, grpc_schedule_on_exec_ctx); grpc_fd_notify_on_write(exec_ctx, cl->em_fd, &cl->write_closure); cl->client_write_cnt++; @@ -445,9 +445,9 @@ static void test_grpc_fd_change(void) { grpc_closure second_closure; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_closure_init(&first_closure, first_read_callback, &a, + GRPC_CLOSURE_INIT(&first_closure, first_read_callback, &a, grpc_schedule_on_exec_ctx); - grpc_closure_init(&second_closure, second_read_callback, &b, + GRPC_CLOSURE_INIT(&second_closure, second_read_callback, &b, grpc_schedule_on_exec_ctx); init_change_data(&a); @@ -533,7 +533,7 @@ int main(int argc, char **argv) { grpc_pollset_init(g_pollset, &g_mu); test_grpc_fd(); test_grpc_fd_change(); - grpc_closure_init(&destroyed, destroy_pollset, g_pollset, + GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed); grpc_exec_ctx_flush(&exec_ctx); diff --git a/test/core/iomgr/pollset_set_test.c b/test/core/iomgr/pollset_set_test.c index 4486586992..6aedaf1081 100644 --- a/test/core/iomgr/pollset_set_test.c +++ b/test/core/iomgr/pollset_set_test.c @@ -79,7 +79,7 @@ static void cleanup_test_pollsets(grpc_exec_ctx *exec_ctx, const int num_pollsets) { grpc_closure destroyed; for (int i = 0; i < num_pollsets; i++) { - grpc_closure_init(&destroyed, destroy_pollset, pollsets[i].ps, + GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, pollsets[i].ps, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(exec_ctx, pollsets[i].ps, &destroyed); @@ -108,7 +108,7 @@ void on_readable(grpc_exec_ctx *exec_ctx, void *tfd, grpc_error *error) { static void reset_test_fd(grpc_exec_ctx *exec_ctx, test_fd *tfd) { tfd->is_on_readable_called = false; - grpc_closure_init(&tfd->on_readable, on_readable, tfd, + GRPC_CLOSURE_INIT(&tfd->on_readable, on_readable, tfd, grpc_schedule_on_exec_ctx); grpc_fd_notify_on_read(exec_ctx, tfd->fd, &tfd->on_readable); } diff --git a/test/core/iomgr/resolve_address_posix_test.c b/test/core/iomgr/resolve_address_posix_test.c index be193deca3..9cc09ed5d3 100644 --- a/test/core/iomgr/resolve_address_posix_test.c +++ b/test/core/iomgr/resolve_address_posix_test.c @@ -61,7 +61,7 @@ void args_finish(grpc_exec_ctx *exec_ctx, args_struct *args) { grpc_pollset_set_del_pollset(exec_ctx, args->pollset_set, args->pollset); grpc_pollset_set_destroy(exec_ctx, args->pollset_set); grpc_closure do_nothing_cb; - grpc_closure_init(&do_nothing_cb, do_nothing, NULL, + GRPC_CLOSURE_INIT(&do_nothing_cb, do_nothing, NULL, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(exec_ctx, args->pollset, &do_nothing_cb); // exec_ctx needs to be flushed before calling grpc_pollset_destroy() @@ -129,7 +129,7 @@ static void test_unix_socket(void) { poll_pollset_until_request_done(&args); grpc_resolve_address( &exec_ctx, "unix:/path/name", NULL, args.pollset_set, - grpc_closure_create(must_succeed, &args, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); args_finish(&exec_ctx, &args); grpc_exec_ctx_finish(&exec_ctx); @@ -150,7 +150,7 @@ static void test_unix_socket_path_name_too_long(void) { poll_pollset_until_request_done(&args); grpc_resolve_address( &exec_ctx, path_name, NULL, args.pollset_set, - grpc_closure_create(must_fail, &args, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx), &args.addrs); gpr_free(path_name); args_finish(&exec_ctx, &args); diff --git a/test/core/iomgr/resolve_address_test.c b/test/core/iomgr/resolve_address_test.c index dfcc5ad9de..cb156ee61e 100644 --- a/test/core/iomgr/resolve_address_test.c +++ b/test/core/iomgr/resolve_address_test.c @@ -56,7 +56,7 @@ void args_finish(grpc_exec_ctx *exec_ctx, args_struct *args) { grpc_pollset_set_del_pollset(exec_ctx, args->pollset_set, args->pollset); grpc_pollset_set_destroy(exec_ctx, args->pollset_set); grpc_closure do_nothing_cb; - grpc_closure_init(&do_nothing_cb, do_nothing, NULL, + GRPC_CLOSURE_INIT(&do_nothing_cb, do_nothing, NULL, grpc_schedule_on_exec_ctx); gpr_mu_lock(args->mu); grpc_pollset_shutdown(exec_ctx, args->pollset, &do_nothing_cb); @@ -124,7 +124,7 @@ static void test_localhost(void) { args_init(&exec_ctx, &args); grpc_resolve_address( &exec_ctx, "localhost:1", NULL, args.pollset_set, - grpc_closure_create(must_succeed, &args, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); grpc_exec_ctx_flush(&exec_ctx); poll_pollset_until_request_done(&args); @@ -138,7 +138,7 @@ static void test_default_port(void) { args_init(&exec_ctx, &args); grpc_resolve_address( &exec_ctx, "localhost", "1", args.pollset_set, - grpc_closure_create(must_succeed, &args, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); grpc_exec_ctx_flush(&exec_ctx); poll_pollset_until_request_done(&args); @@ -152,7 +152,7 @@ static void test_non_numeric_default_port(void) { args_init(&exec_ctx, &args); grpc_resolve_address( &exec_ctx, "localhost", "https", args.pollset_set, - grpc_closure_create(must_succeed, &args, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); grpc_exec_ctx_flush(&exec_ctx); poll_pollset_until_request_done(&args); @@ -166,7 +166,7 @@ static void test_missing_default_port(void) { args_init(&exec_ctx, &args); grpc_resolve_address( &exec_ctx, "localhost", NULL, args.pollset_set, - grpc_closure_create(must_fail, &args, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx), &args.addrs); grpc_exec_ctx_flush(&exec_ctx); poll_pollset_until_request_done(&args); @@ -180,7 +180,7 @@ static void test_ipv6_with_port(void) { args_init(&exec_ctx, &args); grpc_resolve_address( &exec_ctx, "[2001:db8::1]:1", NULL, args.pollset_set, - grpc_closure_create(must_succeed, &args, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); grpc_exec_ctx_flush(&exec_ctx); poll_pollset_until_request_done(&args); @@ -199,7 +199,7 @@ static void test_ipv6_without_port(void) { args_init(&exec_ctx, &args); grpc_resolve_address( &exec_ctx, kCases[i], "80", args.pollset_set, - grpc_closure_create(must_succeed, &args, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); grpc_exec_ctx_flush(&exec_ctx); poll_pollset_until_request_done(&args); @@ -219,7 +219,7 @@ static void test_invalid_ip_addresses(void) { args_init(&exec_ctx, &args); grpc_resolve_address( &exec_ctx, kCases[i], NULL, args.pollset_set, - grpc_closure_create(must_fail, &args, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx), &args.addrs); grpc_exec_ctx_flush(&exec_ctx); poll_pollset_until_request_done(&args); @@ -239,7 +239,7 @@ static void test_unparseable_hostports(void) { args_init(&exec_ctx, &args); grpc_resolve_address( &exec_ctx, kCases[i], "1", args.pollset_set, - grpc_closure_create(must_fail, &args, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx), &args.addrs); grpc_exec_ctx_flush(&exec_ctx); poll_pollset_until_request_done(&args); diff --git a/test/core/iomgr/resource_quota_test.c b/test/core/iomgr/resource_quota_test.c index a3a0db59f5..b588f3d120 100644 --- a/test/core/iomgr/resource_quota_test.c +++ b/test/core/iomgr/resource_quota_test.c @@ -47,7 +47,7 @@ static void set_event_cb(grpc_exec_ctx *exec_ctx, void *a, grpc_error *error) { gpr_event_set((gpr_event *)a, (void *)1); } grpc_closure *set_event(gpr_event *ev) { - return grpc_closure_create(set_event_cb, ev, grpc_schedule_on_exec_ctx); + return GRPC_CLOSURE_CREATE(set_event_cb, ev, grpc_schedule_on_exec_ctx); } typedef struct { @@ -61,7 +61,7 @@ static void reclaimer_cb(grpc_exec_ctx *exec_ctx, void *args, reclaimer_args *a = args; grpc_resource_user_free(exec_ctx, a->resource_user, a->size); grpc_resource_user_finish_reclamation(exec_ctx, a->resource_user); - grpc_closure_run(exec_ctx, a->then, GRPC_ERROR_NONE); + GRPC_CLOSURE_RUN(exec_ctx, a->then, GRPC_ERROR_NONE); gpr_free(a); } grpc_closure *make_reclaimer(grpc_resource_user *resource_user, size_t size, @@ -70,16 +70,16 @@ grpc_closure *make_reclaimer(grpc_resource_user *resource_user, size_t size, a->size = size; a->resource_user = resource_user; a->then = then; - return grpc_closure_create(reclaimer_cb, a, grpc_schedule_on_exec_ctx); + return GRPC_CLOSURE_CREATE(reclaimer_cb, a, grpc_schedule_on_exec_ctx); } static void unused_reclaimer_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { GPR_ASSERT(error == GRPC_ERROR_CANCELLED); - grpc_closure_run(exec_ctx, arg, GRPC_ERROR_NONE); + GRPC_CLOSURE_RUN(exec_ctx, arg, GRPC_ERROR_NONE); } grpc_closure *make_unused_reclaimer(grpc_closure *then) { - return grpc_closure_create(unused_reclaimer_cb, then, + return GRPC_CLOSURE_CREATE(unused_reclaimer_cb, then, grpc_schedule_on_exec_ctx); } diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.c index 75104617c5..00ea495bbe 100644 --- a/test/core/iomgr/tcp_client_posix_test.c +++ b/test/core/iomgr/tcp_client_posix_test.c @@ -105,7 +105,7 @@ void test_succeeds(void) { /* connect to it */ GPR_ASSERT(getsockname(svr_fd, (struct sockaddr *)addr, (socklen_t *)&resolved_addr.len) == 0); - grpc_closure_init(&done, must_succeed, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&done, must_succeed, NULL, grpc_schedule_on_exec_ctx); grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, g_pollset_set, NULL, &resolved_addr, gpr_inf_future(GPR_CLOCK_REALTIME)); @@ -155,7 +155,7 @@ void test_fails(void) { gpr_mu_unlock(g_mu); /* connect to a broken address */ - grpc_closure_init(&done, must_fail, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&done, must_fail, NULL, grpc_schedule_on_exec_ctx); grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, g_pollset_set, NULL, &resolved_addr, gpr_inf_future(GPR_CLOCK_REALTIME)); @@ -206,7 +206,7 @@ int main(int argc, char **argv) { gpr_log(GPR_ERROR, "End of first test"); test_fails(); grpc_pollset_set_destroy(&exec_ctx, g_pollset_set); - grpc_closure_init(&destroyed, destroy_pollset, g_pollset, + GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/iomgr/tcp_client_uv_test.c b/test/core/iomgr/tcp_client_uv_test.c index 9b741d3682..9927356613 100644 --- a/test/core/iomgr/tcp_client_uv_test.c +++ b/test/core/iomgr/tcp_client_uv_test.c @@ -108,7 +108,7 @@ void test_succeeds(void) { /* connect to it */ GPR_ASSERT(uv_tcp_getsockname(svr_handle, (struct sockaddr *)addr, (int *)&resolved_addr.len) == 0); - grpc_closure_init(&done, must_succeed, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&done, must_succeed, NULL, grpc_schedule_on_exec_ctx); grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, NULL, NULL, &resolved_addr, gpr_inf_future(GPR_CLOCK_REALTIME)); @@ -152,7 +152,7 @@ void test_fails(void) { gpr_mu_unlock(g_mu); /* connect to a broken address */ - grpc_closure_init(&done, must_fail, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&done, must_fail, NULL, grpc_schedule_on_exec_ctx); grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, NULL, NULL, &resolved_addr, gpr_inf_future(GPR_CLOCK_REALTIME)); @@ -200,7 +200,7 @@ int main(int argc, char **argv) { test_succeeds(); gpr_log(GPR_ERROR, "End of first test"); test_fails(); - grpc_closure_init(&destroyed, destroy_pollset, g_pollset, + GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c index 9ae03fc023..c45068e7ec 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.c @@ -184,7 +184,7 @@ static void read_test(size_t num_bytes, size_t slice_size) { state.read_bytes = 0; state.target_read_bytes = written_bytes; grpc_slice_buffer_init(&state.incoming); - grpc_closure_init(&state.read_cb, read_cb, &state, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&state.read_cb, read_cb, &state, grpc_schedule_on_exec_ctx); grpc_endpoint_read(&exec_ctx, ep, &state.incoming, &state.read_cb); @@ -236,7 +236,7 @@ static void large_read_test(size_t slice_size) { state.read_bytes = 0; state.target_read_bytes = (size_t)written_bytes; grpc_slice_buffer_init(&state.incoming); - grpc_closure_init(&state.read_cb, read_cb, &state, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&state.read_cb, read_cb, &state, grpc_schedule_on_exec_ctx); grpc_endpoint_read(&exec_ctx, ep, &state.incoming, &state.read_cb); @@ -376,7 +376,7 @@ static void write_test(size_t num_bytes, size_t slice_size) { grpc_slice_buffer_init(&outgoing); grpc_slice_buffer_addn(&outgoing, slices, num_blocks); - grpc_closure_init(&write_done_closure, write_done, &state, + GRPC_CLOSURE_INIT(&write_done_closure, write_done, &state, grpc_schedule_on_exec_ctx); grpc_endpoint_write(&exec_ctx, ep, &outgoing, &write_done_closure); @@ -422,7 +422,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_closure fd_released_cb; int fd_released_done = 0; - grpc_closure_init(&fd_released_cb, &on_fd_released, &fd_released_done, + GRPC_CLOSURE_INIT(&fd_released_cb, &on_fd_released, &fd_released_done, grpc_schedule_on_exec_ctx); gpr_log(GPR_INFO, @@ -447,7 +447,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { state.read_bytes = 0; state.target_read_bytes = written_bytes; grpc_slice_buffer_init(&state.incoming); - grpc_closure_init(&state.read_cb, read_cb, &state, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&state.read_cb, read_cb, &state, grpc_schedule_on_exec_ctx); grpc_endpoint_read(&exec_ctx, ep, &state.incoming, &state.read_cb); @@ -560,7 +560,7 @@ int main(int argc, char **argv) { grpc_pollset_init(g_pollset, &g_mu); grpc_endpoint_tests(configs[0], g_pollset, g_mu); run_tests(); - grpc_closure_init(&destroyed, destroy_pollset, g_pollset, + GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c index adfaa390dc..2371721a60 100644 --- a/test/core/iomgr/tcp_server_posix_test.c +++ b/test/core/iomgr/tcp_server_posix_test.c @@ -118,7 +118,7 @@ static void server_weak_ref_shutdown(grpc_exec_ctx *exec_ctx, void *arg, static void server_weak_ref_init(server_weak_ref *weak_ref) { weak_ref->server = NULL; - grpc_closure_init(&weak_ref->server_shutdown, server_weak_ref_shutdown, + GRPC_CLOSURE_INIT(&weak_ref->server_shutdown, server_weak_ref_shutdown, weak_ref, grpc_schedule_on_exec_ctx); } @@ -492,7 +492,7 @@ int main(int argc, char **argv) { /* Test connect(2) with dst_addrs. */ test_connect(10, &channel_args, dst_addrs, false); - grpc_closure_init(&destroyed, destroy_pollset, g_pollset, + GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/iomgr/tcp_server_uv_test.c b/test/core/iomgr/tcp_server_uv_test.c index 307e40a49e..8f4d553d1e 100644 --- a/test/core/iomgr/tcp_server_uv_test.c +++ b/test/core/iomgr/tcp_server_uv_test.c @@ -82,7 +82,7 @@ static void server_weak_ref_shutdown(grpc_exec_ctx *exec_ctx, void *arg, static void server_weak_ref_init(server_weak_ref *weak_ref) { weak_ref->server = NULL; - grpc_closure_init(&weak_ref->server_shutdown, server_weak_ref_shutdown, + GRPC_CLOSURE_INIT(&weak_ref->server_shutdown, server_weak_ref_shutdown, weak_ref, grpc_schedule_on_exec_ctx); } @@ -309,7 +309,7 @@ int main(int argc, char **argv) { test_connect(1); test_connect(10); - grpc_closure_init(&destroyed, destroy_pollset, g_pollset, + GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/iomgr/timer_list_test.c b/test/core/iomgr/timer_list_test.c index fbd2d0df77..5f8b01fdc4 100644 --- a/test/core/iomgr/timer_list_test.c +++ b/test/core/iomgr/timer_list_test.c @@ -58,7 +58,7 @@ static void add_test(void) { grpc_timer_init( &exec_ctx, &timers[i], gpr_time_add(start, gpr_time_from_millis(10, GPR_TIMESPAN)), - grpc_closure_create(cb, (void *)(intptr_t)i, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)i, grpc_schedule_on_exec_ctx), start); } @@ -67,7 +67,7 @@ static void add_test(void) { grpc_timer_init( &exec_ctx, &timers[i], gpr_time_add(start, gpr_time_from_millis(1010, GPR_TIMESPAN)), - grpc_closure_create(cb, (void *)(intptr_t)i, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)i, grpc_schedule_on_exec_ctx), start); } @@ -134,23 +134,23 @@ void destruction_test(void) { grpc_timer_init( &exec_ctx, &timers[0], tfm(100), - grpc_closure_create(cb, (void *)(intptr_t)0, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)0, grpc_schedule_on_exec_ctx), gpr_time_0(GPR_CLOCK_REALTIME)); grpc_timer_init( &exec_ctx, &timers[1], tfm(3), - grpc_closure_create(cb, (void *)(intptr_t)1, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)1, grpc_schedule_on_exec_ctx), gpr_time_0(GPR_CLOCK_REALTIME)); grpc_timer_init( &exec_ctx, &timers[2], tfm(100), - grpc_closure_create(cb, (void *)(intptr_t)2, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)2, grpc_schedule_on_exec_ctx), gpr_time_0(GPR_CLOCK_REALTIME)); grpc_timer_init( &exec_ctx, &timers[3], tfm(3), - grpc_closure_create(cb, (void *)(intptr_t)3, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)3, grpc_schedule_on_exec_ctx), gpr_time_0(GPR_CLOCK_REALTIME)); grpc_timer_init( &exec_ctx, &timers[4], tfm(1), - grpc_closure_create(cb, (void *)(intptr_t)4, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)4, grpc_schedule_on_exec_ctx), gpr_time_0(GPR_CLOCK_REALTIME)); GPR_ASSERT(grpc_timer_check(&exec_ctx, tfm(2), NULL) == GRPC_TIMERS_FIRED); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/iomgr/udp_server_test.c b/test/core/iomgr/udp_server_test.c index c95d0ce835..aa34857dbd 100644 --- a/test/core/iomgr/udp_server_test.c +++ b/test/core/iomgr/udp_server_test.c @@ -311,7 +311,7 @@ int main(int argc, char **argv) { test_receive(1); test_receive(10); - grpc_closure_init(&destroyed, destroy_pollset, g_pollset, + GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index e0c209f4f1..9d419c78ea 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -583,7 +583,7 @@ static int compute_engine_httpcli_get_success_override( grpc_httpcli_response *response) { validate_compute_engine_http_request(request); *response = http_response(200, valid_oauth2_json_response); - grpc_closure_sched(exec_ctx, on_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE); return 1; } @@ -593,7 +593,7 @@ static int compute_engine_httpcli_get_failure_override( grpc_httpcli_response *response) { validate_compute_engine_http_request(request); *response = http_response(403, "Not Authorized."); - grpc_closure_sched(exec_ctx, on_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE); return 1; } @@ -686,7 +686,7 @@ static int refresh_token_httpcli_post_success( grpc_closure *on_done, grpc_httpcli_response *response) { validate_refresh_token_http_request(request, body, body_size); *response = http_response(200, valid_oauth2_json_response); - grpc_closure_sched(exec_ctx, on_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE); return 1; } @@ -696,7 +696,7 @@ static int refresh_token_httpcli_post_failure( grpc_closure *on_done, grpc_httpcli_response *response) { validate_refresh_token_http_request(request, body, body_size); *response = http_response(403, "Not Authorized."); - grpc_closure_sched(exec_ctx, on_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE); return 1; } @@ -939,7 +939,7 @@ static int default_creds_gce_detection_httpcli_get_success_override( response->hdrs = headers; GPR_ASSERT(strcmp(request->http.path, "/") == 0); GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0); - grpc_closure_sched(exec_ctx, on_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE); return 1; } @@ -997,7 +997,7 @@ static int default_creds_gce_detection_httpcli_get_failure_override( GPR_ASSERT(strcmp(request->http.path, "/") == 0); GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0); *response = http_response(200, ""); - grpc_closure_sched(exec_ctx, on_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE); return 1; } diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c index 76b95df888..9b17fb516d 100644 --- a/test/core/security/jwt_verifier_test.c +++ b/test/core/security/jwt_verifier_test.c @@ -341,7 +341,7 @@ static int httpcli_get_google_keys_for_email( "/robot/v1/metadata/x509/" "777-abaslkan11hlb6nmim3bpspl31ud@developer." "gserviceaccount.com") == 0); - grpc_closure_sched(exec_ctx, on_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE); return 1; } @@ -385,7 +385,7 @@ static int httpcli_get_custom_keys_for_email( GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl); GPR_ASSERT(strcmp(request->host, "keys.bar.com") == 0); GPR_ASSERT(strcmp(request->http.path, "/jwk/foo@bar.com") == 0); - grpc_closure_sched(exec_ctx, on_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE); return 1; } @@ -419,7 +419,7 @@ static int httpcli_get_jwk_set(grpc_exec_ctx *exec_ctx, GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl); GPR_ASSERT(strcmp(request->host, "www.googleapis.com") == 0); GPR_ASSERT(strcmp(request->http.path, "/oauth2/v3/certs") == 0); - grpc_closure_sched(exec_ctx, on_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE); return 1; } @@ -434,7 +434,7 @@ static int httpcli_get_openid_config(grpc_exec_ctx *exec_ctx, GPR_ASSERT(strcmp(request->http.path, GRPC_OPENID_CONFIG_URL_SUFFIX) == 0); grpc_httpcli_set_override(httpcli_get_jwk_set, httpcli_post_should_not_be_called); - grpc_closure_sched(exec_ctx, on_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE); return 1; } @@ -475,7 +475,7 @@ static int httpcli_get_bad_json(grpc_exec_ctx *exec_ctx, grpc_httpcli_response *response) { *response = http_response(200, gpr_strdup("{\"bad\": \"stuff\"}")); GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl); - grpc_closure_sched(exec_ctx, on_done, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE); return 1; } diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.c index 95b18445dc..e2331fbd97 100644 --- a/test/core/security/oauth2_utils.c +++ b/test/core/security/oauth2_utils.c @@ -77,7 +77,7 @@ char *grpc_test_fetch_oauth2_token_with_credentials( request.pops = grpc_polling_entity_create_from_pollset(pollset); request.is_done = 0; - grpc_closure_init(&do_nothing_closure, do_nothing, NULL, + GRPC_CLOSURE_INIT(&do_nothing_closure, do_nothing, NULL, grpc_schedule_on_exec_ctx); grpc_call_credentials_get_request_metadata( diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c index e69466ccf1..fd8af2f152 100644 --- a/test/core/security/secure_endpoint_test.c +++ b/test/core/security/secure_endpoint_test.c @@ -146,7 +146,7 @@ static void test_leftover(grpc_endpoint_test_config config, size_t slice_size) { gpr_log(GPR_INFO, "Start test left over"); grpc_slice_buffer_init(&incoming); - grpc_closure_init(&done_closure, inc_call_ctr, &n, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&done_closure, inc_call_ctr, &n, grpc_schedule_on_exec_ctx); grpc_endpoint_read(&exec_ctx, f.client_ep, &incoming, &done_closure); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(n == 1); @@ -183,7 +183,7 @@ int main(int argc, char **argv) { grpc_pollset_init(g_pollset, &g_mu); grpc_endpoint_tests(configs[0], g_pollset, g_mu); test_leftover(configs[1], 1); - grpc_closure_init(&destroyed, destroy_pollset, g_pollset, + GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/surface/concurrent_connectivity_test.c b/test/core/surface/concurrent_connectivity_test.c index 234730d83d..08079b6091 100644 --- a/test/core/surface/concurrent_connectivity_test.c +++ b/test/core/surface/concurrent_connectivity_test.c @@ -229,7 +229,7 @@ int run_concurrent_connectivity_test() { gpr_thd_join(server); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_pollset_shutdown(&exec_ctx, args.pollset, - grpc_closure_create(done_pollset_shutdown, args.pollset, + GRPC_CLOSURE_CREATE(done_pollset_shutdown, args.pollset, grpc_schedule_on_exec_ctx)); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c index af8725b8de..f623e1a743 100644 --- a/test/core/surface/lame_client_test.c +++ b/test/core/surface/lame_client_test.c @@ -47,7 +47,7 @@ void test_transport_op(grpc_channel *channel) { grpc_connectivity_state state = GRPC_CHANNEL_IDLE; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_closure_init(&transport_op_cb, verify_connectivity, &state, + GRPC_CLOSURE_INIT(&transport_op_cb, verify_connectivity, &state, grpc_schedule_on_exec_ctx); op = grpc_make_transport_op(NULL); @@ -57,7 +57,7 @@ void test_transport_op(grpc_channel *channel) { elem->filter->start_transport_op(&exec_ctx, elem, op); grpc_exec_ctx_finish(&exec_ctx); - grpc_closure_init(&transport_op_cb, do_nothing, NULL, + GRPC_CLOSURE_INIT(&transport_op_cb, do_nothing, NULL, grpc_schedule_on_exec_ctx); op = grpc_make_transport_op(&transport_op_cb); elem->filter->start_transport_op(&exec_ctx, elem, op); diff --git a/test/core/transport/connectivity_state_test.c b/test/core/transport/connectivity_state_test.c index 73e48838d4..4ef8683107 100644 --- a/test/core/transport/connectivity_state_test.c +++ b/test/core/transport/connectivity_state_test.c @@ -73,7 +73,7 @@ static void test_check(void) { static void test_subscribe_then_unsubscribe(void) { grpc_connectivity_state_tracker tracker; grpc_closure *closure = - grpc_closure_create(must_fail, THE_ARG, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_CREATE(must_fail, THE_ARG, grpc_schedule_on_exec_ctx); grpc_connectivity_state state = GRPC_CHANNEL_IDLE; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; gpr_log(GPR_DEBUG, "test_subscribe_then_unsubscribe"); @@ -97,7 +97,7 @@ static void test_subscribe_then_unsubscribe(void) { static void test_subscribe_then_destroy(void) { grpc_connectivity_state_tracker tracker; grpc_closure *closure = - grpc_closure_create(must_succeed, THE_ARG, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_CREATE(must_succeed, THE_ARG, grpc_schedule_on_exec_ctx); grpc_connectivity_state state = GRPC_CHANNEL_IDLE; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; gpr_log(GPR_DEBUG, "test_subscribe_then_destroy"); @@ -117,7 +117,7 @@ static void test_subscribe_then_destroy(void) { static void test_subscribe_with_failure_then_destroy(void) { grpc_connectivity_state_tracker tracker; grpc_closure *closure = - grpc_closure_create(must_fail, THE_ARG, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_CREATE(must_fail, THE_ARG, grpc_schedule_on_exec_ctx); grpc_connectivity_state state = GRPC_CHANNEL_SHUTDOWN; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; gpr_log(GPR_DEBUG, "test_subscribe_with_failure_then_destroy"); diff --git a/test/core/util/mock_endpoint.c b/test/core/util/mock_endpoint.c index 8cec085be5..40cf0a2652 100644 --- a/test/core/util/mock_endpoint.c +++ b/test/core/util/mock_endpoint.c @@ -46,7 +46,7 @@ static void me_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, gpr_mu_lock(&m->mu); if (m->read_buffer.count > 0) { grpc_slice_buffer_swap(&m->read_buffer, slices); - grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, cb, GRPC_ERROR_NONE); } else { m->on_read = cb; m->on_read_out = slices; @@ -60,7 +60,7 @@ static void me_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, for (size_t i = 0; i < slices->count; i++) { m->on_write(slices->slices[i]); } - grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, cb, GRPC_ERROR_NONE); } static void me_add_to_pollset(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, @@ -74,7 +74,7 @@ static void me_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep; gpr_mu_lock(&m->mu); if (m->on_read) { - grpc_closure_sched(exec_ctx, m->on_read, + GRPC_CLOSURE_SCHED(exec_ctx, m->on_read, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Endpoint Shutdown", &why, 1)); m->on_read = NULL; @@ -129,7 +129,7 @@ void grpc_mock_endpoint_put_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, gpr_mu_lock(&m->mu); if (m->on_read != NULL) { grpc_slice_buffer_add(m->on_read_out, slice); - grpc_closure_sched(exec_ctx, m->on_read, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, m->on_read, GRPC_ERROR_NONE); m->on_read = NULL; } else { grpc_slice_buffer_add(&m->read_buffer, slice); diff --git a/test/core/util/passthru_endpoint.c b/test/core/util/passthru_endpoint.c index 187bc74ab1..eef1f163f0 100644 --- a/test/core/util/passthru_endpoint.c +++ b/test/core/util/passthru_endpoint.c @@ -60,11 +60,11 @@ static void me_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, half *m = (half *)ep; gpr_mu_lock(&m->parent->mu); if (m->parent->shutdown) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, cb, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Already shutdown")); } else if (m->read_buffer.count > 0) { grpc_slice_buffer_swap(&m->read_buffer, slices); - grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, cb, GRPC_ERROR_NONE); } else { m->on_read = cb; m->on_read_out = slices; @@ -89,7 +89,7 @@ static void me_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, for (size_t i = 0; i < slices->count; i++) { grpc_slice_buffer_add(m->on_read_out, grpc_slice_copy(slices->slices[i])); } - grpc_closure_sched(exec_ctx, m->on_read, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, m->on_read, GRPC_ERROR_NONE); m->on_read = NULL; } else { for (size_t i = 0; i < slices->count; i++) { @@ -98,7 +98,7 @@ static void me_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, } } gpr_mu_unlock(&m->parent->mu); - grpc_closure_sched(exec_ctx, cb, error); + GRPC_CLOSURE_SCHED(exec_ctx, cb, error); } static void me_add_to_pollset(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, @@ -113,14 +113,14 @@ static void me_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, gpr_mu_lock(&m->parent->mu); m->parent->shutdown = true; if (m->on_read) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, m->on_read, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING("Shutdown", &why, 1)); m->on_read = NULL; } m = other_half(m); if (m->on_read) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, m->on_read, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING("Shutdown", &why, 1)); m->on_read = NULL; diff --git a/test/core/util/port_server_client.c b/test/core/util/port_server_client.c index e5a2ecd517..d5739effb3 100644 --- a/test/core/util/port_server_client.c +++ b/test/core/util/port_server_client.c @@ -76,7 +76,7 @@ void grpc_free_port_using_server(int port) { grpc_pollset *pollset = gpr_zalloc(grpc_pollset_size()); grpc_pollset_init(pollset, &pr.mu); pr.pops = grpc_polling_entity_create_from_pollset(pollset); - shutdown_closure = grpc_closure_create(destroy_pops_and_shutdown, &pr.pops, + shutdown_closure = GRPC_CLOSURE_CREATE(destroy_pops_and_shutdown, &pr.pops, grpc_schedule_on_exec_ctx); req.host = GRPC_PORT_SERVER_ADDRESS; @@ -88,7 +88,7 @@ void grpc_free_port_using_server(int port) { grpc_resource_quota_create("port_server_client/free"); grpc_httpcli_get(&exec_ctx, &context, &pr.pops, resource_quota, &req, grpc_timeout_seconds_to_deadline(30), - grpc_closure_create(freed_port_from_server, &pr, + GRPC_CLOSURE_CREATE(freed_port_from_server, &pr, grpc_schedule_on_exec_ctx), &rsp); grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); @@ -172,7 +172,7 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg, grpc_resource_quota_create("port_server_client/pick_retry"); grpc_httpcli_get(exec_ctx, pr->ctx, &pr->pops, resource_quota, &req, grpc_timeout_seconds_to_deadline(10), - grpc_closure_create(got_port_from_server, pr, + GRPC_CLOSURE_CREATE(got_port_from_server, pr, grpc_schedule_on_exec_ctx), &pr->response); grpc_resource_quota_unref_internal(exec_ctx, resource_quota); @@ -207,7 +207,7 @@ int grpc_pick_port_using_server(void) { grpc_pollset *pollset = gpr_zalloc(grpc_pollset_size()); grpc_pollset_init(pollset, &pr.mu); pr.pops = grpc_polling_entity_create_from_pollset(pollset); - shutdown_closure = grpc_closure_create(destroy_pops_and_shutdown, &pr.pops, + shutdown_closure = GRPC_CLOSURE_CREATE(destroy_pops_and_shutdown, &pr.pops, grpc_schedule_on_exec_ctx); pr.port = -1; pr.server = GRPC_PORT_SERVER_ADDRESS; @@ -222,7 +222,7 @@ int grpc_pick_port_using_server(void) { grpc_httpcli_get( &exec_ctx, &context, &pr.pops, resource_quota, &req, grpc_timeout_seconds_to_deadline(30), - grpc_closure_create(got_port_from_server, &pr, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(got_port_from_server, &pr, grpc_schedule_on_exec_ctx), &pr.response); grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); grpc_exec_ctx_flush(&exec_ctx); diff --git a/test/core/util/test_tcp_server.c b/test/core/util/test_tcp_server.c index 7058cdf321..d3a1de8a3b 100644 --- a/test/core/util/test_tcp_server.c +++ b/test/core/util/test_tcp_server.c @@ -42,7 +42,7 @@ void test_tcp_server_init(test_tcp_server *server, grpc_tcp_server_cb on_connect, void *user_data) { grpc_init(); server->tcp_server = NULL; - grpc_closure_init(&server->shutdown_complete, on_server_destroyed, server, + GRPC_CLOSURE_INIT(&server->shutdown_complete, on_server_destroyed, server, grpc_schedule_on_exec_ctx); server->shutdown = 0; server->pollset = gpr_zalloc(grpc_pollset_size()); @@ -101,7 +101,7 @@ void test_tcp_server_destroy(test_tcp_server *server) { gpr_timespec shutdown_deadline; grpc_closure do_nothing_cb; grpc_tcp_server_unref(&exec_ctx, server->tcp_server); - grpc_closure_init(&do_nothing_cb, do_nothing, NULL, + GRPC_CLOSURE_INIT(&do_nothing_cb, do_nothing, NULL, grpc_schedule_on_exec_ctx); shutdown_deadline = gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), gpr_time_from_seconds(5, GPR_TIMESPAN)); @@ -110,7 +110,7 @@ void test_tcp_server_destroy(test_tcp_server *server) { test_tcp_server_poll(server, 1); } grpc_pollset_shutdown(&exec_ctx, server->pollset, - grpc_closure_create(finish_pollset, server->pollset, + GRPC_CLOSURE_CREATE(finish_pollset, server->pollset, grpc_schedule_on_exec_ctx)); grpc_exec_ctx_finish(&exec_ctx); gpr_free(server->pollset); diff --git a/test/core/util/trickle_endpoint.c b/test/core/util/trickle_endpoint.c index af4c003f80..4f3c30dcf6 100644 --- a/test/core/util/trickle_endpoint.c +++ b/test/core/util/trickle_endpoint.c @@ -55,7 +55,7 @@ static void maybe_call_write_cb_locked(grpc_exec_ctx *exec_ctx, trickle_endpoint *te) { if (te->write_cb != NULL && (te->error != GRPC_ERROR_NONE || te->write_buffer.length <= WRITE_BUFFER_SIZE)) { - grpc_closure_sched(exec_ctx, te->write_cb, GRPC_ERROR_REF(te->error)); + GRPC_CLOSURE_SCHED(exec_ctx, te->write_cb, GRPC_ERROR_REF(te->error)); te->write_cb = NULL; } } @@ -176,7 +176,7 @@ size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx *exec_ctx, te->last_write = now; grpc_endpoint_write( exec_ctx, te->wrapped, &te->writing_buffer, - grpc_closure_create(te_finish_write, te, grpc_schedule_on_exec_ctx)); + GRPC_CLOSURE_CREATE(te_finish_write, te, grpc_schedule_on_exec_ctx)); maybe_call_write_cb_locked(exec_ctx, te); } } diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 0838680f27..508f7f94d6 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -445,7 +445,7 @@ void SetPollsetSet(grpc_exec_ctx *exec_ctx, grpc_transport *self, /* implementation of grpc_transport_perform_stream_op */ void PerformStreamOp(grpc_exec_ctx *exec_ctx, grpc_transport *self, grpc_stream *stream, grpc_transport_stream_op_batch *op) { - grpc_closure_sched(exec_ctx, op->on_complete, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, op->on_complete, GRPC_ERROR_NONE); } /* implementation of grpc_transport_perform_op */ @@ -492,7 +492,7 @@ class SendEmptyMetadata { public: SendEmptyMetadata() { memset(&op_, 0, sizeof(op_)); - op_.on_complete = grpc_closure_init(&closure_, DoNothing, nullptr, + op_.on_complete = GRPC_CLOSURE_INIT(&closure_, DoNothing, nullptr, grpc_schedule_on_exec_ctx); op_.send_initial_metadata = true; op_.payload = &op_payload_; @@ -643,16 +643,16 @@ static void StartTransportStreamOp(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op_batch *op) { if (op->recv_initial_metadata) { - grpc_closure_sched( + GRPC_CLOSURE_SCHED( exec_ctx, op->payload->recv_initial_metadata.recv_initial_metadata_ready, GRPC_ERROR_NONE); } if (op->recv_message) { - grpc_closure_sched(exec_ctx, op->payload->recv_message.recv_message_ready, + GRPC_CLOSURE_SCHED(exec_ctx, op->payload->recv_message.recv_message_ready, GRPC_ERROR_NONE); } - grpc_closure_sched(exec_ctx, op->on_complete, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, op->on_complete, GRPC_ERROR_NONE); } static void StartTransportOp(grpc_exec_ctx *exec_ctx, @@ -661,7 +661,7 @@ static void StartTransportOp(grpc_exec_ctx *exec_ctx, if (op->disconnect_with_error != GRPC_ERROR_NONE) { GRPC_ERROR_UNREF(op->disconnect_with_error); } - grpc_closure_sched(exec_ctx, op->on_consumed, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, op->on_consumed, GRPC_ERROR_NONE); } static grpc_error *InitCallElem(grpc_exec_ctx *exec_ctx, @@ -677,7 +677,7 @@ static void SetPollsetOrPollsetSet(grpc_exec_ctx *exec_ctx, static void DestroyCallElem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_final_info *final_info, grpc_closure *then_sched_closure) { - grpc_closure_sched(exec_ctx, then_sched_closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, then_sched_closure, GRPC_ERROR_NONE); } grpc_error *InitChannelElem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index 42843632c5..567ef1cf24 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -61,7 +61,7 @@ class DummyEndpoint : public grpc_endpoint { return; } grpc_slice_buffer_add(slices_, slice); - grpc_closure_sched(exec_ctx, read_cb_, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, read_cb_, GRPC_ERROR_NONE); read_cb_ = nullptr; } @@ -78,7 +78,7 @@ class DummyEndpoint : public grpc_endpoint { if (have_slice_) { have_slice_ = false; grpc_slice_buffer_add(slices, buffered_slice_); - grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, cb, GRPC_ERROR_NONE); return; } read_cb_ = cb; @@ -92,7 +92,7 @@ class DummyEndpoint : public grpc_endpoint { static void write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb) { - grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, cb, GRPC_ERROR_NONE); } static grpc_workqueue *get_workqueue(grpc_endpoint *ep) { return NULL; } @@ -107,7 +107,7 @@ class DummyEndpoint : public grpc_endpoint { grpc_error *why) { grpc_resource_user_shutdown(exec_ctx, static_cast(ep)->ru_); - grpc_closure_sched(exec_ctx, static_cast(ep)->read_cb_, + GRPC_CLOSURE_SCHED(exec_ctx, static_cast(ep)->read_cb_, why); } @@ -213,7 +213,7 @@ std::unique_ptr MakeClosure( F f, grpc_closure_scheduler *sched = grpc_schedule_on_exec_ctx) { struct C : public Closure { C(const F &f, grpc_closure_scheduler *sched) : f_(f) { - grpc_closure_init(this, Execute, this, sched); + GRPC_CLOSURE_INIT(this, Execute, this, sched); } F f_; static void Execute(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { @@ -235,7 +235,7 @@ grpc_closure *MakeOnceClosure( } }; auto *c = new C{f}; - return grpc_closure_init(c, C::Execute, c, sched); + return GRPC_CLOSURE_INIT(c, C::Execute, c, sched); } //////////////////////////////////////////////////////////////////////////////// @@ -252,7 +252,7 @@ static void BM_StreamCreateDestroy(benchmark::State &state) { s.Init(state); s.DestroyThen(next.get()); }); - grpc_closure_run(f.exec_ctx(), next.get(), GRPC_ERROR_NONE); + GRPC_CLOSURE_RUN(f.exec_ctx(), next.get(), GRPC_ERROR_NONE); f.FlushExecCtx(); track_counters.Finish(state); } @@ -322,7 +322,7 @@ static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State &state) { s.Op(&op); s.DestroyThen(start.get()); }); - grpc_closure_sched(f.exec_ctx(), start.get(), GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(f.exec_ctx(), start.get(), GRPC_ERROR_NONE); f.FlushExecCtx(); grpc_metadata_batch_destroy(f.exec_ctx(), &b); track_counters.Finish(state); @@ -348,7 +348,7 @@ static void BM_TransportEmptyOp(benchmark::State &state) { op.on_complete = c.get(); s.Op(&op); }); - grpc_closure_sched(f.exec_ctx(), c.get(), GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(f.exec_ctx(), c.get(), GRPC_ERROR_NONE); f.FlushExecCtx(); s.DestroyThen( MakeOnceClosure([](grpc_exec_ctx *exec_ctx, grpc_error *error) {})); @@ -538,14 +538,14 @@ static void BM_TransportStreamRecv(benchmark::State &state) { GPR_ASSERT(!state.KeepRunning()); return; } - grpc_closure_run(exec_ctx, drain.get(), GRPC_ERROR_NONE); + GRPC_CLOSURE_RUN(exec_ctx, drain.get(), GRPC_ERROR_NONE); }); drain = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { do { if (received == recv_stream->length) { grpc_byte_stream_destroy(exec_ctx, recv_stream); - grpc_closure_sched(exec_ctx, c.get(), GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, c.get(), GRPC_ERROR_NONE); return; } } while (grpc_byte_stream_next(exec_ctx, recv_stream, @@ -561,7 +561,7 @@ static void BM_TransportStreamRecv(benchmark::State &state) { grpc_byte_stream_pull(exec_ctx, recv_stream, &recv_slice); received += GRPC_SLICE_LENGTH(recv_slice); grpc_slice_unref_internal(exec_ctx, recv_slice); - grpc_closure_run(exec_ctx, drain.get(), GRPC_ERROR_NONE); + GRPC_CLOSURE_RUN(exec_ctx, drain.get(), GRPC_ERROR_NONE); }); reset_op(); diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc index e6cc21ecaf..41649b8a73 100644 --- a/test/cpp/microbenchmarks/bm_closure.cc +++ b/test/cpp/microbenchmarks/bm_closure.cc @@ -61,7 +61,7 @@ static void BM_ClosureInitAgainstExecCtx(benchmark::State& state) { grpc_closure c; while (state.KeepRunning()) { benchmark::DoNotOptimize( - grpc_closure_init(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx)); + GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx)); } track_counters.Finish(state); } @@ -73,7 +73,7 @@ static void BM_ClosureInitAgainstCombiner(benchmark::State& state) { grpc_closure c; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - benchmark::DoNotOptimize(grpc_closure_init( + benchmark::DoNotOptimize(GRPC_CLOSURE_INIT( &c, DoNothing, NULL, grpc_combiner_scheduler(combiner))); } GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); @@ -85,10 +85,10 @@ BENCHMARK(BM_ClosureInitAgainstCombiner); static void BM_ClosureRunOnExecCtx(benchmark::State& state) { TrackCounters track_counters; grpc_closure c; - grpc_closure_init(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - grpc_closure_run(&exec_ctx, &c, GRPC_ERROR_NONE); + GRPC_CLOSURE_RUN(&exec_ctx, &c, GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); } grpc_exec_ctx_finish(&exec_ctx); @@ -100,7 +100,7 @@ static void BM_ClosureCreateAndRun(benchmark::State& state) { TrackCounters track_counters; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - grpc_closure_run(&exec_ctx, grpc_closure_create(DoNothing, NULL, + GRPC_CLOSURE_RUN(&exec_ctx, GRPC_CLOSURE_CREATE(DoNothing, NULL, grpc_schedule_on_exec_ctx), GRPC_ERROR_NONE); } @@ -114,7 +114,7 @@ static void BM_ClosureInitAndRun(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_closure c; while (state.KeepRunning()) { - grpc_closure_run(&exec_ctx, grpc_closure_init(&c, DoNothing, NULL, + GRPC_CLOSURE_RUN(&exec_ctx, GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx), GRPC_ERROR_NONE); } @@ -126,10 +126,10 @@ BENCHMARK(BM_ClosureInitAndRun); static void BM_ClosureSchedOnExecCtx(benchmark::State& state) { TrackCounters track_counters; grpc_closure c; - grpc_closure_init(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - grpc_closure_sched(&exec_ctx, &c, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c, GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); } grpc_exec_ctx_finish(&exec_ctx); @@ -141,12 +141,12 @@ static void BM_ClosureSched2OnExecCtx(benchmark::State& state) { TrackCounters track_counters; grpc_closure c1; grpc_closure c2; - grpc_closure_init(&c1, DoNothing, NULL, grpc_schedule_on_exec_ctx); - grpc_closure_init(&c2, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_schedule_on_exec_ctx); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - grpc_closure_sched(&exec_ctx, &c1, GRPC_ERROR_NONE); - grpc_closure_sched(&exec_ctx, &c2, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c2, GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); } grpc_exec_ctx_finish(&exec_ctx); @@ -159,14 +159,14 @@ static void BM_ClosureSched3OnExecCtx(benchmark::State& state) { grpc_closure c1; grpc_closure c2; grpc_closure c3; - grpc_closure_init(&c1, DoNothing, NULL, grpc_schedule_on_exec_ctx); - grpc_closure_init(&c2, DoNothing, NULL, grpc_schedule_on_exec_ctx); - grpc_closure_init(&c3, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c3, DoNothing, NULL, grpc_schedule_on_exec_ctx); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - grpc_closure_sched(&exec_ctx, &c1, GRPC_ERROR_NONE); - grpc_closure_sched(&exec_ctx, &c2, GRPC_ERROR_NONE); - grpc_closure_sched(&exec_ctx, &c3, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c2, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c3, GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); } grpc_exec_ctx_finish(&exec_ctx); @@ -246,10 +246,10 @@ static void BM_ClosureSchedOnCombiner(benchmark::State& state) { TrackCounters track_counters; grpc_combiner* combiner = grpc_combiner_create(); grpc_closure c; - grpc_closure_init(&c, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_combiner_scheduler(combiner)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - grpc_closure_sched(&exec_ctx, &c, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c, GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); } GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); @@ -263,12 +263,12 @@ static void BM_ClosureSched2OnCombiner(benchmark::State& state) { grpc_combiner* combiner = grpc_combiner_create(); grpc_closure c1; grpc_closure c2; - grpc_closure_init(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner)); - grpc_closure_init(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - grpc_closure_sched(&exec_ctx, &c1, GRPC_ERROR_NONE); - grpc_closure_sched(&exec_ctx, &c2, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c2, GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); } GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); @@ -283,14 +283,14 @@ static void BM_ClosureSched3OnCombiner(benchmark::State& state) { grpc_closure c1; grpc_closure c2; grpc_closure c3; - grpc_closure_init(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner)); - grpc_closure_init(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner)); - grpc_closure_init(&c3, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c3, DoNothing, NULL, grpc_combiner_scheduler(combiner)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - grpc_closure_sched(&exec_ctx, &c1, GRPC_ERROR_NONE); - grpc_closure_sched(&exec_ctx, &c2, GRPC_ERROR_NONE); - grpc_closure_sched(&exec_ctx, &c3, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c2, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c3, GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); } GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); @@ -305,12 +305,12 @@ static void BM_ClosureSched2OnTwoCombiners(benchmark::State& state) { grpc_combiner* combiner2 = grpc_combiner_create(); grpc_closure c1; grpc_closure c2; - grpc_closure_init(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); - grpc_closure_init(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); + GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); + GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - grpc_closure_sched(&exec_ctx, &c1, GRPC_ERROR_NONE); - grpc_closure_sched(&exec_ctx, &c2, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c2, GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); } GRPC_COMBINER_UNREF(&exec_ctx, combiner1, "finished"); @@ -328,16 +328,16 @@ static void BM_ClosureSched4OnTwoCombiners(benchmark::State& state) { grpc_closure c2; grpc_closure c3; grpc_closure c4; - grpc_closure_init(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); - grpc_closure_init(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); - grpc_closure_init(&c3, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); - grpc_closure_init(&c4, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); + GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); + GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); + GRPC_CLOSURE_INIT(&c3, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); + GRPC_CLOSURE_INIT(&c4, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - grpc_closure_sched(&exec_ctx, &c1, GRPC_ERROR_NONE); - grpc_closure_sched(&exec_ctx, &c2, GRPC_ERROR_NONE); - grpc_closure_sched(&exec_ctx, &c3, GRPC_ERROR_NONE); - grpc_closure_sched(&exec_ctx, &c4, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c2, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c3, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, &c4, GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); } GRPC_COMBINER_UNREF(&exec_ctx, combiner1, "finished"); @@ -353,16 +353,16 @@ class Rescheduler { public: Rescheduler(benchmark::State& state, grpc_closure_scheduler* scheduler) : state_(state) { - grpc_closure_init(&closure_, Step, this, scheduler); + GRPC_CLOSURE_INIT(&closure_, Step, this, scheduler); } void ScheduleFirst(grpc_exec_ctx* exec_ctx) { - grpc_closure_sched(exec_ctx, &closure_, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &closure_, GRPC_ERROR_NONE); } void ScheduleFirstAgainstDifferentScheduler( grpc_exec_ctx* exec_ctx, grpc_closure_scheduler* scheduler) { - grpc_closure_sched(exec_ctx, grpc_closure_create(Step, this, scheduler), + GRPC_CLOSURE_SCHED(exec_ctx, GRPC_CLOSURE_CREATE(Step, this, scheduler), GRPC_ERROR_NONE); } @@ -373,7 +373,7 @@ class Rescheduler { static void Step(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { Rescheduler* self = static_cast(arg); if (self->state_.KeepRunning()) { - grpc_closure_sched(exec_ctx, &self->closure_, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, &self->closure_, GRPC_ERROR_NONE); } } }; diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index 3c41f18266..1e3830a556 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -44,7 +44,7 @@ static grpc_event_engine_vtable g_vtable; static void pollset_shutdown(grpc_exec_ctx* exec_ctx, grpc_pollset* ps, grpc_closure* closure) { - grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_NONE); } static void pollset_init(grpc_pollset* ps, gpr_mu** mu) { diff --git a/test/cpp/microbenchmarks/bm_pollset.cc b/test/cpp/microbenchmarks/bm_pollset.cc index 543b24b77a..683f4703c2 100644 --- a/test/cpp/microbenchmarks/bm_pollset.cc +++ b/test/cpp/microbenchmarks/bm_pollset.cc @@ -54,7 +54,7 @@ static void BM_CreateDestroyPollset(benchmark::State& state) { gpr_mu* mu; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_closure shutdown_ps_closure; - grpc_closure_init(&shutdown_ps_closure, shutdown_ps, ps, + GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps, grpc_schedule_on_exec_ctx); while (state.KeepRunning()) { memset(ps, 0, ps_sz); @@ -124,7 +124,7 @@ static void BM_PollEmptyPollset(benchmark::State& state) { GRPC_ERROR_UNREF(grpc_pollset_work(&exec_ctx, ps, NULL, now, deadline)); } grpc_closure shutdown_ps_closure; - grpc_closure_init(&shutdown_ps_closure, shutdown_ps, ps, + GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, ps, &shutdown_ps_closure); gpr_mu_unlock(mu); @@ -151,7 +151,7 @@ static void BM_PollAddFd(benchmark::State& state) { } grpc_fd_orphan(&exec_ctx, fd, NULL, NULL, "xxx"); grpc_closure shutdown_ps_closure; - grpc_closure_init(&shutdown_ps_closure, shutdown_ps, ps, + GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps, grpc_schedule_on_exec_ctx); gpr_mu_lock(mu); grpc_pollset_shutdown(&exec_ctx, ps, &shutdown_ps_closure); @@ -171,7 +171,7 @@ template Closure* MakeClosure(F f, grpc_closure_scheduler* scheduler) { struct C : public Closure { C(F f, grpc_closure_scheduler* scheduler) : f_(f) { - grpc_closure_init(this, C::cbfn, this, scheduler); + GRPC_CLOSURE_INIT(this, C::cbfn, this, scheduler); } static void cbfn(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { C* p = static_cast(arg); @@ -250,7 +250,7 @@ static void BM_SingleThreadPollOneFd(benchmark::State& state) { grpc_fd_orphan(&exec_ctx, wakeup, NULL, NULL, "done"); wakeup_fd.read_fd = 0; grpc_closure shutdown_ps_closure; - grpc_closure_init(&shutdown_ps_closure, shutdown_ps, ps, + GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, ps, &shutdown_ps_closure); gpr_mu_unlock(mu); -- cgit v1.2.3 From a4bc791fd806896f8cae5cbe377acd56f9c01d31 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 8 Jun 2017 15:29:46 -0700 Subject: Ban the non macro versions --- tools/run_tests/sanity/core_banned_functions.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/run_tests/sanity/core_banned_functions.py b/tools/run_tests/sanity/core_banned_functions.py index a214eb59e5..b394bbbeaf 100755 --- a/tools/run_tests/sanity/core_banned_functions.py +++ b/tools/run_tests/sanity/core_banned_functions.py @@ -36,6 +36,11 @@ BANNED_EXCEPT = { 'grpc_wsa_error(': ['src/core/lib/iomgr/error.c'], 'grpc_log_if_error(': ['src/core/lib/iomgr/error.c'], 'grpc_slice_malloc(': ['src/core/lib/slice/slice.c'], + 'grpc_closure_create(' : ['src/core/lib/iomgr/closure.c'], + 'grpc_closure_init(' : ['src/core/lib/iomgr/closure.c'], + 'grpc_closure_sched(' : ['src/core/lib/iomgr/closure.c'], + 'grpc_closure_run(' : ['src/core/lib/iomgr/closure.c'], + 'grpc_closure_list_sched(' : ['src/core/lib/iomgr/closure.c'], } errors = 0 -- cgit v1.2.3 From f0c46e360b3e740aea254b5adc0c9dfeae31243a Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 8 Jun 2017 15:57:09 -0700 Subject: Rework error and closure tracing --- src/core/lib/iomgr/closure.c | 22 ++++++++++++---------- src/core/lib/iomgr/closure.h | 16 ++++++++-------- src/core/lib/iomgr/combiner.c | 4 ++-- src/core/lib/iomgr/error.c | 42 ++++++++++++++++++++++++++++-------------- src/core/lib/iomgr/error.h | 7 +++++-- src/core/lib/iomgr/exec_ctx.c | 15 +++++++++++++-- src/core/lib/iomgr/executor.c | 2 +- src/core/lib/surface/init.c | 2 ++ 8 files changed, 71 insertions(+), 39 deletions(-) diff --git a/src/core/lib/iomgr/closure.c b/src/core/lib/iomgr/closure.c index 719e2e8cee..c1535fbabe 100644 --- a/src/core/lib/iomgr/closure.c +++ b/src/core/lib/iomgr/closure.c @@ -24,7 +24,9 @@ #include "src/core/lib/profiling/timers.h" -#ifdef GRPC_CLOSURE_RICH_DEBUG +grpc_tracer_flag grpc_trace_closure = GRPC_TRACER_INITIALIZER(false); + +#ifndef NDEBUG grpc_closure *grpc_closure_init(const char *file, int line, grpc_closure *closure, grpc_iomgr_cb_func cb, void *cb_arg, @@ -37,7 +39,7 @@ grpc_closure *grpc_closure_init(grpc_closure *closure, grpc_iomgr_cb_func cb, closure->cb = cb; closure->cb_arg = cb_arg; closure->scheduler = scheduler; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG closure->scheduled = false; closure->file_initiated = NULL; closure->line_initiated = 0; @@ -112,7 +114,7 @@ static void closure_wrapper(grpc_exec_ctx *exec_ctx, void *arg, cb(exec_ctx, cb_arg, error); } -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG grpc_closure *grpc_closure_create(const char *file, int line, grpc_iomgr_cb_func cb, void *cb_arg, grpc_closure_scheduler *scheduler) { @@ -123,7 +125,7 @@ grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg, wrapped_closure *wc = gpr_malloc(sizeof(*wc)); wc->cb = cb; wc->cb_arg = cb_arg; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG grpc_closure_init(file, line, &wc->wrapper, closure_wrapper, wc, scheduler); #else grpc_closure_init(&wc->wrapper, closure_wrapper, wc, scheduler); @@ -131,7 +133,7 @@ grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg, return &wc->wrapper; } -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_run(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure *c, grpc_error *error) { #else @@ -140,7 +142,7 @@ void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *c, #endif GPR_TIMER_BEGIN("grpc_closure_run", 0); if (c != NULL) { -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG c->file_initiated = file; c->line_initiated = line; c->run = true; @@ -153,7 +155,7 @@ void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *c, GPR_TIMER_END("grpc_closure_run", 0); } -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_sched(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure *c, grpc_error *error) { #else @@ -162,7 +164,7 @@ void grpc_closure_sched(grpc_exec_ctx *exec_ctx, grpc_closure *c, #endif GPR_TIMER_BEGIN("grpc_closure_sched", 0); if (c != NULL) { -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG GPR_ASSERT(!c->scheduled); c->scheduled = true; c->file_initiated = file; @@ -177,7 +179,7 @@ void grpc_closure_sched(grpc_exec_ctx *exec_ctx, grpc_closure *c, GPR_TIMER_END("grpc_closure_sched", 0); } -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_list_sched(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure_list *list) { #else @@ -186,7 +188,7 @@ void grpc_closure_list_sched(grpc_exec_ctx *exec_ctx, grpc_closure_list *list) { grpc_closure *c = list->head; while (c != NULL) { grpc_closure *next = c->next_data.next; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG GPR_ASSERT(!c->scheduled); c->scheduled = true; c->file_initiated = file; diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index 3ecf9e947b..874d08d29e 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -29,6 +29,8 @@ struct grpc_closure; typedef struct grpc_closure grpc_closure; +extern grpc_tracer_flag grpc_trace_closure; + typedef struct grpc_closure_list { grpc_closure *head; grpc_closure *tail; @@ -59,8 +61,6 @@ struct grpc_closure_scheduler { const grpc_closure_scheduler_vtable *vtable; }; -// #define GRPC_CLOSURE_RICH_DEBUG - /** A closure over a grpc_iomgr_cb_func. */ struct grpc_closure { /** Once queued, next indicates the next queued closure; before then, scratch @@ -89,7 +89,7 @@ struct grpc_closure { // extra tracing and debugging for grpc_closure. This incurs a decent amount of // overhead per closure, so it must be enabled at compile time. -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG bool scheduled; bool run; // true = run, false = scheduled const char *file_created; @@ -100,7 +100,7 @@ struct grpc_closure { }; /** Initializes \a closure with \a cb and \a cb_arg. Returns \a closure. */ -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG grpc_closure *grpc_closure_init(const char *file, int line, grpc_closure *closure, grpc_iomgr_cb_func cb, void *cb_arg, @@ -116,7 +116,7 @@ grpc_closure *grpc_closure_init(grpc_closure *closure, grpc_iomgr_cb_func cb, #endif /* Create a heap allocated closure: try to avoid except for very rare events */ -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG grpc_closure *grpc_closure_create(const char *file, int line, grpc_iomgr_cb_func cb, void *cb_arg, grpc_closure_scheduler *scheduler); @@ -153,7 +153,7 @@ bool grpc_closure_list_empty(grpc_closure_list list); /** Run a closure directly. Caller ensures that no locks are being held above. * Note that calling this at the end of a closure callback function itself is * by definition safe. */ -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_run(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error); #define GRPC_CLOSURE_RUN(exec_ctx, closure, error) \ @@ -166,7 +166,7 @@ void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *closure, #endif /** Schedule a closure to be run. Does not need to be run from a safe point. */ -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_sched(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error); #define GRPC_CLOSURE_SCHED(exec_ctx, closure, error) \ @@ -180,7 +180,7 @@ void grpc_closure_sched(grpc_exec_ctx *exec_ctx, grpc_closure *closure, /** Schedule all closures in a list to be run. Does not need to be run from a * safe point. */ -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_list_sched(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure_list *closure_list); diff --git a/src/core/lib/iomgr/combiner.c b/src/core/lib/iomgr/combiner.c index 750ff102ff..d1377a942a 100644 --- a/src/core/lib/iomgr/combiner.c +++ b/src/core/lib/iomgr/combiner.c @@ -247,7 +247,7 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx) { GPR_TIMER_BEGIN("combiner.exec1", 0); grpc_closure *cl = (grpc_closure *)n; grpc_error *cl_err = cl->error_data.error; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG cl->scheduled = false; #endif cl->cb(exec_ctx, cl->cb_arg, cl_err); @@ -264,7 +264,7 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx) { gpr_log(GPR_DEBUG, "C:%p execute_final[%d] c=%p", lock, loops, c)); grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG c->scheduled = false; #endif c->cb(exec_ctx, c->cb_arg, error); diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index 68884226b5..30a6a0fd2c 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -34,6 +34,8 @@ #include "src/core/lib/profiling/timers.h" #include "src/core/lib/slice/slice_internal.h" +grpc_tracer_flag grpc_trace_error_refcount = GRPC_TRACER_INITIALIZER(false); + static const char *error_int_name(grpc_error_ints key) { switch (key) { case GRPC_ERROR_INT_ERRNO: @@ -119,14 +121,16 @@ bool grpc_error_is_special(grpc_error *err) { err == GRPC_ERROR_CANCELLED; } -#ifdef GRPC_ERROR_REFCOUNT_DEBUG +#ifndef NDEBUG grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line, const char *func) { if (grpc_error_is_special(err)) return err; - gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d %s]", err, + if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { + gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d %s]", err, gpr_atm_no_barrier_load(&err->atomics.refs.count), gpr_atm_no_barrier_load(&err->atomics.refs.count) + 1, file, line, func); + } gpr_ref(&err->atomics.refs); return err; } @@ -172,14 +176,16 @@ static void error_destroy(grpc_error *err) { gpr_free(err); } -#ifdef GRPC_ERROR_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_error_unref(grpc_error *err, const char *file, int line, const char *func) { if (grpc_error_is_special(err)) return; - gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d %s]", err, - gpr_atm_no_barrier_load(&err->atomics.refs.count), - gpr_atm_no_barrier_load(&err->atomics.refs.count) - 1, file, line, - func); + if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { + gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d %s]", err, + gpr_atm_no_barrier_load(&err->atomics.refs.count), + gpr_atm_no_barrier_load(&err->atomics.refs.count) - 1, file, line, + func); + } if (gpr_unref(&err->atomics.refs)) { error_destroy(err); } @@ -202,13 +208,17 @@ static uint8_t get_placement(grpc_error **err, size_t size) { if ((*err)->arena_size + slots > (*err)->arena_capacity) { return UINT8_MAX; } -#ifdef GRPC_ERROR_REFCOUNT_DEBUG +#ifndef NDEBUG grpc_error *orig = *err; #endif *err = gpr_realloc( *err, sizeof(grpc_error) + (*err)->arena_capacity * sizeof(intptr_t)); -#ifdef GRPC_ERROR_REFCOUNT_DEBUG - if (*err != orig) gpr_log(GPR_DEBUG, "realloc %p -> %p", orig, *err); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { + if (*err != orig) { + gpr_log(GPR_DEBUG, "realloc %p -> %p", orig, *err); + } + } #endif } uint8_t placement = (*err)->arena_size; @@ -316,8 +326,10 @@ grpc_error *grpc_error_create(const char *file, int line, grpc_slice desc, if (err == NULL) { // TODO(ctiller): make gpr_malloc return NULL return GRPC_ERROR_OOM; } -#ifdef GRPC_ERROR_REFCOUNT_DEBUG - gpr_log(GPR_DEBUG, "%p create [%s:%d]", err, file, line); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { + gpr_log(GPR_DEBUG, "%p create [%s:%d]", err, file, line); + } #endif err->arena_size = 0; @@ -395,8 +407,10 @@ static grpc_error *copy_error_and_unref(grpc_error *in) { new_arena_capacity = (uint8_t)(3 * new_arena_capacity / 2); } out = gpr_malloc(sizeof(*in) + new_arena_capacity * sizeof(intptr_t)); -#ifdef GRPC_ERROR_REFCOUNT_DEBUG - gpr_log(GPR_DEBUG, "%p create copying %p", out, in); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { + gpr_log(GPR_DEBUG, "%p create copying %p", out, in); + } #endif // bulk memcpy of the rest of the struct. size_t skip = sizeof(&out->atomics); diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index 1ce916f2ec..729f4eb70c 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -26,6 +26,8 @@ #include #include +#include "src/core/lib/debug/trace.h" + #ifdef __cplusplus extern "C" { #endif @@ -36,6 +38,8 @@ extern "C" { typedef struct grpc_error grpc_error; +extern grpc_tracer_flag grpc_trace_error_refcount; + typedef enum { /// 'errno' from the operating system GRPC_ERROR_INT_ERRNO, @@ -149,8 +153,7 @@ grpc_error *grpc_error_create(const char *file, int line, grpc_slice desc, grpc_error_create(__FILE__, __LINE__, grpc_slice_from_copied_string(desc), \ errs, count) -// #define GRPC_ERROR_REFCOUNT_DEBUG -#ifdef GRPC_ERROR_REFCOUNT_DEBUG +#ifndef NDEBUG grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line, const char *func); void grpc_error_unref(grpc_error *err, const char *file, int line, diff --git a/src/core/lib/iomgr/exec_ctx.c b/src/core/lib/iomgr/exec_ctx.c index 51c36216c5..322944eb98 100644 --- a/src/core/lib/iomgr/exec_ctx.c +++ b/src/core/lib/iomgr/exec_ctx.c @@ -62,7 +62,7 @@ bool grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx) { grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; did_something = true; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG c->scheduled = false; #endif c->cb(exec_ctx, c->cb_arg, error); @@ -85,10 +85,21 @@ void grpc_exec_ctx_finish(grpc_exec_ctx *exec_ctx) { static void exec_ctx_run(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error) { -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG closure->scheduled = false; + if (GRPC_TRACER_ON(grpc_trace_closure)) { + gpr_log(GPR_DEBUG, "running closure %p: created [%s:%d]: %s [%s:%d]", + closure, closure->file_created, closure->line_created, + closure->run ? "run" : "scheduled", closure->file_initiated, + closure->line_initiated); + } #endif closure->cb(exec_ctx, closure->cb_arg, error); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_closure)) { + gpr_log(GPR_DEBUG, "closure %p finished", closure); + } +#endif GRPC_ERROR_UNREF(error); } diff --git a/src/core/lib/iomgr/executor.c b/src/core/lib/iomgr/executor.c index fda274e797..7621a7fe75 100644 --- a/src/core/lib/iomgr/executor.c +++ b/src/core/lib/iomgr/executor.c @@ -58,7 +58,7 @@ static size_t run_closures(grpc_exec_ctx *exec_ctx, grpc_closure_list list) { while (c != NULL) { grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG c->scheduled = false; #endif c->cb(exec_ctx, c->cb_arg, error); diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index 01a1f33db2..9b8077bc6c 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -138,6 +138,8 @@ void grpc_init(void) { grpc_register_tracer("call_error", &grpc_call_error_trace); #ifndef NDEBUG grpc_register_tracer("pending_tags", &grpc_trace_pending_tags); + grpc_register_tracer("closure", &grpc_trace_closure); + grpc_register_tracer("error_refcount", &grpc_trace_error_refcount); #endif grpc_security_pre_init(); grpc_iomgr_init(&exec_ctx); -- cgit v1.2.3 From 9c43fc024224ec73fce2320e332c1210b831bcc4 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 8 Jun 2017 16:06:23 -0700 Subject: Add refcount tracers for resolver, lb_policy, stream --- src/core/ext/filters/client_channel/lb_policy.c | 16 +++++++---- src/core/ext/filters/client_channel/lb_policy.h | 5 ++-- src/core/ext/filters/client_channel/resolver.c | 29 ++++++++++++-------- src/core/ext/filters/client_channel/resolver.h | 12 ++++---- src/core/ext/filters/client_channel/subchannel.c | 24 +++++----------- src/core/ext/filters/client_channel/subchannel.h | 2 +- .../transport/chttp2/transport/chttp2_transport.c | 2 +- src/core/ext/transport/chttp2/transport/internal.h | 2 +- src/core/lib/channel/channel_stack.h | 2 +- src/core/lib/surface/call.c | 2 +- src/core/lib/surface/call.h | 2 +- src/core/lib/surface/channel.c | 2 +- src/core/lib/surface/channel.h | 2 +- src/core/lib/surface/init.c | 8 ++++++ src/core/lib/transport/transport.c | 32 +++++++++++++--------- src/core/lib/transport/transport.h | 6 ++-- 16 files changed, 83 insertions(+), 65 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy.c b/src/core/ext/filters/client_channel/lb_policy.c index 50f8faef8e..a2fd1b6c47 100644 --- a/src/core/ext/filters/client_channel/lb_policy.c +++ b/src/core/ext/filters/client_channel/lb_policy.c @@ -21,6 +21,8 @@ #define WEAK_REF_BITS 16 +grpc_tracer_flag grpc_trace_lb_policy_refcount = GRPC_TRACER_INITIALIZER(false); + void grpc_lb_policy_init(grpc_lb_policy *policy, const grpc_lb_policy_vtable *vtable, grpc_combiner *combiner) { @@ -30,7 +32,7 @@ void grpc_lb_policy_init(grpc_lb_policy *policy, policy->combiner = GRPC_COMBINER_REF(combiner, "lb_policy"); } -#ifdef GRPC_LB_POLICY_REFCOUNT_DEBUG +#ifndef NDEBUG #define REF_FUNC_EXTRA_ARGS , const char *file, int line, const char *reason #define REF_MUTATE_EXTRA_ARGS REF_FUNC_EXTRA_ARGS, const char *purpose #define REF_FUNC_PASS_ARGS(new_reason) , file, line, new_reason @@ -46,11 +48,13 @@ static gpr_atm ref_mutate(grpc_lb_policy *c, gpr_atm delta, int barrier REF_MUTATE_EXTRA_ARGS) { gpr_atm old_val = barrier ? gpr_atm_full_fetch_add(&c->ref_pair, delta) : gpr_atm_no_barrier_fetch_add(&c->ref_pair, delta); -#ifdef GRPC_LB_POLICY_REFCOUNT_DEBUG - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "LB_POLICY: 0x%" PRIxPTR " %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR - " [%s]", - (intptr_t)c, purpose, old_val, old_val + delta, reason); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_lb_policy_refcount)) { + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "LB_POLICY: 0x%" PRIxPTR " %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR + " [%s]", + (intptr_t)c, purpose, old_val, old_val + delta, reason); + } #endif return old_val; } diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h index 42503c37ca..5783c81bec 100644 --- a/src/core/ext/filters/client_channel/lb_policy.h +++ b/src/core/ext/filters/client_channel/lb_policy.h @@ -29,6 +29,8 @@ typedef struct grpc_lb_policy grpc_lb_policy; typedef struct grpc_lb_policy_vtable grpc_lb_policy_vtable; typedef struct grpc_lb_policy_args grpc_lb_policy_args; +extern grpc_tracer_flag grpc_trace_lb_policy_refcount; + struct grpc_lb_policy { const grpc_lb_policy_vtable *vtable; gpr_atm ref_pair; @@ -96,8 +98,7 @@ struct grpc_lb_policy_vtable { const grpc_lb_policy_args *args); }; -//#define GRPC_LB_POLICY_REFCOUNT_DEBUG -#ifdef GRPC_LB_POLICY_REFCOUNT_DEBUG +#ifndef NDEBUG /* Strong references: the policy will shutdown when they reach zero */ #define GRPC_LB_POLICY_REF(p, r) \ diff --git a/src/core/ext/filters/client_channel/resolver.c b/src/core/ext/filters/client_channel/resolver.c index 69b1c31e59..bf1ddcc666 100644 --- a/src/core/ext/filters/client_channel/resolver.c +++ b/src/core/ext/filters/client_channel/resolver.c @@ -19,6 +19,8 @@ #include "src/core/ext/filters/client_channel/resolver.h" #include "src/core/lib/iomgr/combiner.h" +grpc_tracer_flag grpc_trace_resolver_refcount = GRPC_TRACER_INITIALIZER(false); + void grpc_resolver_init(grpc_resolver *resolver, const grpc_resolver_vtable *vtable, grpc_combiner *combiner) { @@ -27,25 +29,30 @@ void grpc_resolver_init(grpc_resolver *resolver, gpr_ref_init(&resolver->refs, 1); } -#ifdef GRPC_RESOLVER_REFCOUNT_DEBUG -void grpc_resolver_ref(grpc_resolver *resolver, grpc_closure_list *closure_list, +#ifndef NDEBUG +void grpc_resolver_ref(grpc_resolver *resolver, const char *file, int line, const char *reason) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "RESOLVER:%p ref %d -> %d %s", - resolver, (int)resolver->refs.count, (int)resolver->refs.count + 1, - reason); + if (GRPC_TRACER_ON(grpc_trace_resolver_refcount)) { + long old_refs = gpr_atm_no_barrier_load(&resolver->refs.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "RESOLVER:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", + resolver, old_refs, old_refs + 1, + reason); + } #else void grpc_resolver_ref(grpc_resolver *resolver) { #endif gpr_ref(&resolver->refs); } -#ifdef GRPC_RESOLVER_REFCOUNT_DEBUG -void grpc_resolver_unref(grpc_resolver *resolver, - grpc_closure_list *closure_list, const char *file, +#ifndef NDEBUG +void grpc_resolver_unref(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver, const char *file, int line, const char *reason) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "RESOLVER:%p unref %d -> %d %s", - resolver, (int)resolver->refs.count, (int)resolver->refs.count - 1, - reason); + if (GRPC_TRACER_ON(grpc_trace_resolver_refcount)) { + long old_refs = gpr_atm_no_barrier_load(&resolver->refs.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "RESOLVER:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", + resolver, old_refs, old_refs - 1, + reason); + } #else void grpc_resolver_unref(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver) { #endif diff --git a/src/core/ext/filters/client_channel/resolver.h b/src/core/ext/filters/client_channel/resolver.h index c78bb316cb..8f9e8e83e9 100644 --- a/src/core/ext/filters/client_channel/resolver.h +++ b/src/core/ext/filters/client_channel/resolver.h @@ -25,6 +25,8 @@ typedef struct grpc_resolver grpc_resolver; typedef struct grpc_resolver_vtable grpc_resolver_vtable; +extern grpc_tracer_flag grpc_trace_resolver_refcount; + /** \a grpc_resolver provides \a grpc_channel_args objects to its caller */ struct grpc_resolver { const grpc_resolver_vtable *vtable; @@ -41,17 +43,17 @@ struct grpc_resolver_vtable { grpc_channel_args **result, grpc_closure *on_complete); }; -#ifdef GRPC_RESOLVER_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p), __FILE__, __LINE__, (r)) -#define GRPC_RESOLVER_UNREF(cl, p, r) \ - grpc_resolver_unref((cl), (p), __FILE__, __LINE__, (r)) +#define GRPC_RESOLVER_UNREF(e, p, r) \ + grpc_resolver_unref((e), (p), __FILE__, __LINE__, (r)) void grpc_resolver_ref(grpc_resolver *policy, const char *file, int line, const char *reason); -void grpc_resolver_unref(grpc_resolver *policy, grpc_closure_list *closure_list, +void grpc_resolver_unref(grpc_exec_ctx *exec_ctx, grpc_resolver *policy, const char *file, int line, const char *reason); #else #define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p)) -#define GRPC_RESOLVER_UNREF(cl, p, r) grpc_resolver_unref((cl), (p)) +#define GRPC_RESOLVER_UNREF(e, p, r) grpc_resolver_unref((e), (p)) void grpc_resolver_ref(grpc_resolver *policy); void grpc_resolver_unref(grpc_exec_ctx *exec_ctx, grpc_resolver *policy); #endif diff --git a/src/core/ext/filters/client_channel/subchannel.c b/src/core/ext/filters/client_channel/subchannel.c index 37dd96726e..c85b31002e 100644 --- a/src/core/ext/filters/client_channel/subchannel.c +++ b/src/core/ext/filters/client_channel/subchannel.c @@ -140,25 +140,13 @@ struct grpc_subchannel_call { static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *subchannel, grpc_error *error); -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG #define REF_REASON reason -#define REF_LOG(name, p) \ - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "%s: %p ref %d -> %d %s", \ - (name), (p), (p)->refs.count, (p)->refs.count + 1, reason) -#define UNREF_LOG(name, p) \ - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "%s: %p unref %d -> %d %s", \ - (name), (p), (p)->refs.count, (p)->refs.count - 1, reason) #define REF_MUTATE_EXTRA_ARGS \ GRPC_SUBCHANNEL_REF_EXTRA_ARGS, const char *purpose #define REF_MUTATE_PURPOSE(x) , file, line, reason, x #else #define REF_REASON "" -#define REF_LOG(name, p) \ - do { \ - } while (0) -#define UNREF_LOG(name, p) \ - do { \ - } while (0) #define REF_MUTATE_EXTRA_ARGS #define REF_MUTATE_PURPOSE(x) #endif @@ -207,10 +195,12 @@ static gpr_atm ref_mutate(grpc_subchannel *c, gpr_atm delta, int barrier REF_MUTATE_EXTRA_ARGS) { gpr_atm old_val = barrier ? gpr_atm_full_fetch_add(&c->ref_pair, delta) : gpr_atm_no_barrier_fetch_add(&c->ref_pair, delta); -#ifdef GRPC_STREAM_REFCOUNT_DEBUG - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "SUBCHANNEL: %p %s 0x%08" PRIxPTR " -> 0x%08" PRIxPTR " [%s]", c, - purpose, old_val, old_val + delta, reason); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_stream_refcount)) { + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "SUBCHANNEL: %p %s 0x%08" PRIxPTR " -> 0x%08" PRIxPTR " [%s]", c, + purpose, old_val, old_val + delta, reason); + } #endif return old_val; } diff --git a/src/core/ext/filters/client_channel/subchannel.h b/src/core/ext/filters/client_channel/subchannel.h index f38bf42803..6d2abb04df 100644 --- a/src/core/ext/filters/client_channel/subchannel.h +++ b/src/core/ext/filters/client_channel/subchannel.h @@ -37,7 +37,7 @@ typedef struct grpc_subchannel_call grpc_subchannel_call; typedef struct grpc_subchannel_args grpc_subchannel_args; typedef struct grpc_subchannel_key grpc_subchannel_key; -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_SUBCHANNEL_REF(p, r) \ grpc_subchannel_ref((p), __FILE__, __LINE__, (r)) #define GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(p, r) \ diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 0ad63d1af2..aeee1b4789 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -620,7 +620,7 @@ static void close_transport_locked(grpc_exec_ctx *exec_ctx, GRPC_ERROR_UNREF(error); } -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_chttp2_stream_ref(grpc_chttp2_stream *s, const char *reason) { grpc_stream_ref(s->refcount, reason); } diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 4041b29fec..f07456332e 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -748,7 +748,7 @@ void grpc_chttp2_mark_stream_closed(grpc_exec_ctx *exec_ctx, void grpc_chttp2_start_writing(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t); -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_CHTTP2_STREAM_REF(stream, reason) \ grpc_chttp2_stream_ref(stream, reason) #define GRPC_CHTTP2_STREAM_UNREF(exec_ctx, stream, reason) \ diff --git a/src/core/lib/channel/channel_stack.h b/src/core/lib/channel/channel_stack.h index b0559ad745..a80f8aa826 100644 --- a/src/core/lib/channel/channel_stack.h +++ b/src/core/lib/channel/channel_stack.h @@ -234,7 +234,7 @@ void grpc_call_stack_set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx, grpc_call_stack *call_stack, grpc_polling_entity *pollent); -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_CALL_STACK_REF(call_stack, reason) \ grpc_stream_ref(&(call_stack)->refcount, reason) #define GRPC_CALL_STACK_UNREF(exec_ctx, call_stack, reason) \ diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index b499219e17..bea75bc2d6 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -457,7 +457,7 @@ void grpc_call_set_completion_queue(grpc_exec_ctx *exec_ctx, grpc_call *call, exec_ctx, CALL_STACK_FROM_CALL(call), &call->pollent); } -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG #define REF_REASON reason #define REF_ARG , const char *reason #else diff --git a/src/core/lib/surface/call.h b/src/core/lib/surface/call.h index 60b661cf8c..185bfccb77 100644 --- a/src/core/lib/surface/call.h +++ b/src/core/lib/surface/call.h @@ -62,7 +62,7 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx, void grpc_call_set_completion_queue(grpc_exec_ctx *exec_ctx, grpc_call *call, grpc_completion_queue *cq); -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_call_internal_ref(grpc_call *call, const char *reason); void grpc_call_internal_unref(grpc_exec_ctx *exec_ctx, grpc_call *call, const char *reason); diff --git a/src/core/lib/surface/channel.c b/src/core/lib/surface/channel.c index 5647dff28b..5780a18ce8 100644 --- a/src/core/lib/surface/channel.c +++ b/src/core/lib/surface/channel.c @@ -345,7 +345,7 @@ grpc_call *grpc_channel_create_registered_call( return call; } -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG #define REF_REASON reason #define REF_ARG , const char *reason #else diff --git a/src/core/lib/surface/channel.h b/src/core/lib/surface/channel.h index 848debc7c5..528bb868e2 100644 --- a/src/core/lib/surface/channel.h +++ b/src/core/lib/surface/channel.h @@ -59,7 +59,7 @@ grpc_mdelem grpc_channel_get_reffed_status_elem(grpc_exec_ctx *exec_ctx, size_t grpc_channel_get_call_size_estimate(grpc_channel *channel); void grpc_channel_update_call_size_estimate(grpc_channel *channel, size_t size); -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_channel_internal_ref(grpc_channel *channel, const char *reason); void grpc_channel_internal_unref(grpc_exec_ctx *exec_ctx, grpc_channel *channel, const char *reason); diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index 9b8077bc6c..449022c781 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -47,6 +47,11 @@ #include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/transport/transport_impl.h" +#ifndef NDEBUG +#include "src/core/ext/filters/client_channel/lb_policy.h" +#include "src/core/ext/filters/client_channel/resolver.h" +#endif + /* (generated) built in registry of plugins */ extern void grpc_register_built_in_plugins(void); @@ -140,6 +145,9 @@ void grpc_init(void) { grpc_register_tracer("pending_tags", &grpc_trace_pending_tags); grpc_register_tracer("closure", &grpc_trace_closure); grpc_register_tracer("error_refcount", &grpc_trace_error_refcount); + grpc_register_tracer("lb_policy_refcount", &grpc_trace_lb_policy_refcount); + grpc_register_tracer("resolver_refcount", &grpc_trace_resolver_refcount); + grpc_register_tracer("stream_refcount", &grpc_trace_stream_refcount); #endif grpc_security_pre_init(); grpc_iomgr_init(&exec_ctx); diff --git a/src/core/lib/transport/transport.c b/src/core/lib/transport/transport.c index c2afedec58..2bedbcd290 100644 --- a/src/core/lib/transport/transport.c +++ b/src/core/lib/transport/transport.c @@ -31,25 +31,31 @@ #include "src/core/lib/support/string.h" #include "src/core/lib/transport/transport_impl.h" -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +grpc_tracer_flag grpc_trace_stream_refcount = GRPC_TRACER_INITIALIZER(false); + +#ifndef NDEBUG void grpc_stream_ref(grpc_stream_refcount *refcount, const char *reason) { - gpr_atm val = gpr_atm_no_barrier_load(&refcount->refs.count); - gpr_log(GPR_DEBUG, "%s %p:%p REF %" PRIdPTR "->%" PRIdPTR " %s", - refcount->object_type, refcount, refcount->destroy.cb_arg, val, - val + 1, reason); + if (GRPC_TRACER_ON(grpc_trace_stream_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&refcount->refs.count); + gpr_log(GPR_DEBUG, "%s %p:%p REF %" PRIdPTR "->%" PRIdPTR " %s", + refcount->object_type, refcount, refcount->destroy.cb_arg, val, + val + 1, reason); + } #else void grpc_stream_ref(grpc_stream_refcount *refcount) { #endif gpr_ref_non_zero(&refcount->refs); } -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_stream_unref(grpc_exec_ctx *exec_ctx, grpc_stream_refcount *refcount, const char *reason) { - gpr_atm val = gpr_atm_no_barrier_load(&refcount->refs.count); - gpr_log(GPR_DEBUG, "%s %p:%p UNREF %" PRIdPTR "->%" PRIdPTR " %s", - refcount->object_type, refcount, refcount->destroy.cb_arg, val, - val - 1, reason); + if (GRPC_TRACER_ON(grpc_trace_stream_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&refcount->refs.count); + gpr_log(GPR_DEBUG, "%s %p:%p UNREF %" PRIdPTR "->%" PRIdPTR " %s", + refcount->object_type, refcount, refcount->destroy.cb_arg, val, + val - 1, reason); + } #else void grpc_stream_unref(grpc_exec_ctx *exec_ctx, grpc_stream_refcount *refcount) { @@ -74,7 +80,7 @@ void grpc_stream_unref(grpc_exec_ctx *exec_ctx, offsetof(grpc_stream_refcount, slice_refcount))) static void slice_stream_ref(void *p) { -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG grpc_stream_ref(STREAM_REF_FROM_SLICE_REF(p), "slice"); #else grpc_stream_ref(STREAM_REF_FROM_SLICE_REF(p)); @@ -82,7 +88,7 @@ static void slice_stream_ref(void *p) { } static void slice_stream_unref(grpc_exec_ctx *exec_ctx, void *p) { -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG grpc_stream_unref(exec_ctx, STREAM_REF_FROM_SLICE_REF(p), "slice"); #else grpc_stream_unref(exec_ctx, STREAM_REF_FROM_SLICE_REF(p)); @@ -102,7 +108,7 @@ static const grpc_slice_refcount_vtable stream_ref_slice_vtable = { .eq = grpc_slice_default_eq_impl, .hash = grpc_slice_default_hash_impl}; -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_stream_ref_init(grpc_stream_refcount *refcount, int initial_refs, grpc_iomgr_cb_func cb, void *cb_arg, const char *object_type) { diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index d231157c87..57c18d1e30 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -42,18 +42,18 @@ typedef struct grpc_transport grpc_transport; for a stream. */ typedef struct grpc_stream grpc_stream; -//#define GRPC_STREAM_REFCOUNT_DEBUG +extern grpc_tracer_flag grpc_trace_stream_refcount; typedef struct grpc_stream_refcount { gpr_refcount refs; grpc_closure destroy; -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG const char *object_type; #endif grpc_slice_refcount slice_refcount; } grpc_stream_refcount; -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_stream_ref_init(grpc_stream_refcount *refcount, int initial_refs, grpc_iomgr_cb_func cb, void *cb_arg, const char *object_type); -- cgit v1.2.3 From a135485bb8ecbbea027727525c0828e4dce5d3da Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 8 Jun 2017 16:25:53 -0700 Subject: Add workqueue tracer --- src/core/ext/filters/client_channel/lb_policy.c | 3 +++ src/core/ext/filters/client_channel/lb_policy.h | 2 ++ src/core/ext/filters/client_channel/resolver.c | 2 ++ src/core/ext/filters/client_channel/resolver.h | 2 ++ src/core/lib/iomgr/closure.c | 2 ++ src/core/lib/iomgr/closure.h | 2 ++ src/core/lib/iomgr/combiner.c | 8 ++++---- src/core/lib/iomgr/combiner.h | 3 +-- src/core/lib/iomgr/error.c | 2 ++ src/core/lib/iomgr/error.h | 2 ++ src/core/lib/iomgr/ev_epollsig_linux.c | 27 ++++++++++++++----------- src/core/lib/iomgr/ev_poll_posix.c | 1 + src/core/lib/iomgr/ev_posix.c | 1 + src/core/lib/transport/transport.c | 3 +++ src/core/lib/transport/transport.h | 2 ++ 15 files changed, 44 insertions(+), 18 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy.c b/src/core/ext/filters/client_channel/lb_policy.c index a2fd1b6c47..6fc9b4bc15 100644 --- a/src/core/ext/filters/client_channel/lb_policy.c +++ b/src/core/ext/filters/client_channel/lb_policy.c @@ -21,7 +21,10 @@ #define WEAK_REF_BITS 16 +#ifndef NDEBUG grpc_tracer_flag grpc_trace_lb_policy_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + void grpc_lb_policy_init(grpc_lb_policy *policy, const grpc_lb_policy_vtable *vtable, diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h index 5783c81bec..645d51e138 100644 --- a/src/core/ext/filters/client_channel/lb_policy.h +++ b/src/core/ext/filters/client_channel/lb_policy.h @@ -29,7 +29,9 @@ typedef struct grpc_lb_policy grpc_lb_policy; typedef struct grpc_lb_policy_vtable grpc_lb_policy_vtable; typedef struct grpc_lb_policy_args grpc_lb_policy_args; +#ifndef NDEBUG extern grpc_tracer_flag grpc_trace_lb_policy_refcount; +#endif struct grpc_lb_policy { const grpc_lb_policy_vtable *vtable; diff --git a/src/core/ext/filters/client_channel/resolver.c b/src/core/ext/filters/client_channel/resolver.c index bf1ddcc666..6a3e82eff6 100644 --- a/src/core/ext/filters/client_channel/resolver.c +++ b/src/core/ext/filters/client_channel/resolver.c @@ -19,7 +19,9 @@ #include "src/core/ext/filters/client_channel/resolver.h" #include "src/core/lib/iomgr/combiner.h" +#ifndef NDEBUG grpc_tracer_flag grpc_trace_resolver_refcount = GRPC_TRACER_INITIALIZER(false); +#endif void grpc_resolver_init(grpc_resolver *resolver, const grpc_resolver_vtable *vtable, diff --git a/src/core/ext/filters/client_channel/resolver.h b/src/core/ext/filters/client_channel/resolver.h index 8f9e8e83e9..ae9c8f66fe 100644 --- a/src/core/ext/filters/client_channel/resolver.h +++ b/src/core/ext/filters/client_channel/resolver.h @@ -25,7 +25,9 @@ typedef struct grpc_resolver grpc_resolver; typedef struct grpc_resolver_vtable grpc_resolver_vtable; +#ifndef NDEBUG extern grpc_tracer_flag grpc_trace_resolver_refcount; +#endif /** \a grpc_resolver provides \a grpc_channel_args objects to its caller */ struct grpc_resolver { diff --git a/src/core/lib/iomgr/closure.c b/src/core/lib/iomgr/closure.c index c1535fbabe..e028e72ed6 100644 --- a/src/core/lib/iomgr/closure.c +++ b/src/core/lib/iomgr/closure.c @@ -24,7 +24,9 @@ #include "src/core/lib/profiling/timers.h" +#ifndef NDEBUG grpc_tracer_flag grpc_trace_closure = GRPC_TRACER_INITIALIZER(false); +#endif #ifndef NDEBUG grpc_closure *grpc_closure_init(const char *file, int line, diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index 874d08d29e..2ec6f77e76 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -29,7 +29,9 @@ struct grpc_closure; typedef struct grpc_closure grpc_closure; +#ifndef NDEBUG extern grpc_tracer_flag grpc_trace_closure; +#endif typedef struct grpc_closure_list { grpc_closure *head; diff --git a/src/core/lib/iomgr/combiner.c b/src/core/lib/iomgr/combiner.c index d1377a942a..06e638d4cf 100644 --- a/src/core/lib/iomgr/combiner.c +++ b/src/core/lib/iomgr/combiner.c @@ -102,12 +102,12 @@ static void start_destroy(grpc_exec_ctx *exec_ctx, grpc_combiner *lock) { } } -#ifdef GRPC_COMBINER_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_COMBINER_DEBUG_SPAM(op, delta) \ - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, \ - "combiner[%p] %s %" PRIdPTR " --> %" PRIdPTR " %s", lock, (op), \ + if (GRPC_TRACER_ON(grpc_combiner_trace)) { gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, \ + "C:%p %s %" PRIdPTR " --> %" PRIdPTR " %s", lock, (op), \ gpr_atm_no_barrier_load(&lock->refs.count), \ - gpr_atm_no_barrier_load(&lock->refs.count) + (delta), reason); + gpr_atm_no_barrier_load(&lock->refs.count) + (delta), reason); } #else #define GRPC_COMBINER_DEBUG_SPAM(op, delta) #endif diff --git a/src/core/lib/iomgr/combiner.h b/src/core/lib/iomgr/combiner.h index a616113ca0..8e0434369d 100644 --- a/src/core/lib/iomgr/combiner.h +++ b/src/core/lib/iomgr/combiner.h @@ -35,8 +35,7 @@ // necessary grpc_combiner *grpc_combiner_create(void); -//#define GRPC_COMBINER_REFCOUNT_DEBUG -#ifdef GRPC_COMBINER_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_COMBINER_DEBUG_ARGS \ , const char *file, int line, const char *reason #define GRPC_COMBINER_REF(combiner, reason) \ diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index 30a6a0fd2c..6fb0f4d624 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -34,7 +34,9 @@ #include "src/core/lib/profiling/timers.h" #include "src/core/lib/slice/slice_internal.h" +#ifndef NDEBUG grpc_tracer_flag grpc_trace_error_refcount = GRPC_TRACER_INITIALIZER(false); +#endif static const char *error_int_name(grpc_error_ints key) { switch (key) { diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index 729f4eb70c..fb8e19f643 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -38,7 +38,9 @@ extern "C" { typedef struct grpc_error grpc_error; +#ifndef NDEBUG extern grpc_tracer_flag grpc_trace_error_refcount; +#endif typedef enum { /// 'errno' from the operating system diff --git a/src/core/lib/iomgr/ev_epollsig_linux.c b/src/core/lib/iomgr/ev_epollsig_linux.c index fa4b4e8d0a..90f730e66a 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.c +++ b/src/core/lib/iomgr/ev_epollsig_linux.c @@ -161,20 +161,18 @@ static void fd_global_shutdown(void); * Polling island Declarations */ -//#define PI_REFCOUNT_DEBUG - -#ifdef PI_REFCOUNT_DEBUG +#ifndef NDEBUG #define PI_ADD_REF(p, r) pi_add_ref_dbg((p), (r), __FILE__, __LINE__) #define PI_UNREF(exec_ctx, p, r) \ pi_unref_dbg((exec_ctx), (p), (r), __FILE__, __LINE__) -#else /* defined(GRPC_WORKQUEUE_REFCOUNT_DEBUG) */ +#else #define PI_ADD_REF(p, r) pi_add_ref((p)) #define PI_UNREF(exec_ctx, p, r) pi_unref((exec_ctx), (p)) -#endif /* !defined(GRPC_PI_REF_COUNT_DEBUG) */ +#endif /* This is also used as grpc_workqueue (by directly casing it) */ typedef struct polling_island { @@ -287,21 +285,26 @@ gpr_atm g_epoll_sync; static void pi_add_ref(polling_island *pi); static void pi_unref(grpc_exec_ctx *exec_ctx, polling_island *pi); -#ifdef PI_REFCOUNT_DEBUG +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_workqueue_refcount = GRPC_TRACER_INITIALIZER(false); static void pi_add_ref_dbg(polling_island *pi, const char *reason, const char *file, int line) { - long old_cnt = gpr_atm_acq_load(&pi->ref_count); - pi_add_ref(pi); - gpr_log(GPR_DEBUG, "Add ref pi: %p, old: %ld -> new:%ld (%s) - (%s, %d)", + if (GRPC_TRACER_ON(grpc_trace_workqueue_refcount)) { + long old_cnt = gpr_atm_acq_load(&pi->ref_count); + gpr_log(GPR_DEBUG, "Add ref pi: %p, old: %ld -> new:%ld (%s) - (%s, %d)", (void *)pi, old_cnt, old_cnt + 1, reason, file, line); + } + pi_add_ref(pi); } static void pi_unref_dbg(grpc_exec_ctx *exec_ctx, polling_island *pi, const char *reason, const char *file, int line) { - long old_cnt = gpr_atm_acq_load(&pi->ref_count); - pi_unref(exec_ctx, pi); - gpr_log(GPR_DEBUG, "Unref pi: %p, old:%ld -> new:%ld (%s) - (%s, %d)", + if (GRPC_TRACER_ON(grpc_trace_workqueue_refcount)) { + long old_cnt = gpr_atm_acq_load(&pi->ref_count); + gpr_log(GPR_DEBUG, "Unref pi: %p, old:%ld -> new:%ld (%s) - (%s, %d)", (void *)pi, old_cnt, (old_cnt - 1), reason, file, line); + } + pi_unref(exec_ctx, pi); } #endif diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index d1a27b8228..0023cdba6f 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -1272,6 +1272,7 @@ static void pollset_set_del_fd(grpc_exec_ctx *exec_ctx, } /******************************************************************************* + * Condition Variable polling extensions */ diff --git a/src/core/lib/iomgr/ev_posix.c b/src/core/lib/iomgr/ev_posix.c index 54960d1ecc..a43763e92a 100644 --- a/src/core/lib/iomgr/ev_posix.c +++ b/src/core/lib/iomgr/ev_posix.c @@ -38,6 +38,7 @@ #include "src/core/lib/iomgr/ev_poll_posix.h" #include "src/core/lib/support/env.h" + grpc_tracer_flag grpc_polling_trace = GRPC_TRACER_INITIALIZER(false); /* Disabled by default */ diff --git a/src/core/lib/transport/transport.c b/src/core/lib/transport/transport.c index 2bedbcd290..4d7b942da9 100644 --- a/src/core/lib/transport/transport.c +++ b/src/core/lib/transport/transport.c @@ -31,7 +31,10 @@ #include "src/core/lib/support/string.h" #include "src/core/lib/transport/transport_impl.h" + +#ifndef NDEBUG grpc_tracer_flag grpc_trace_stream_refcount = GRPC_TRACER_INITIALIZER(false); +#endif #ifndef NDEBUG void grpc_stream_ref(grpc_stream_refcount *refcount, const char *reason) { diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index 57c18d1e30..811610ffbf 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -42,7 +42,9 @@ typedef struct grpc_transport grpc_transport; for a stream. */ typedef struct grpc_stream grpc_stream; +#ifndef NDEBUG extern grpc_tracer_flag grpc_trace_stream_refcount; +#endif typedef struct grpc_stream_refcount { gpr_refcount refs; -- cgit v1.2.3 From 0e3aee3dff24f6db5d76d553bc137d64132fa316 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 8 Jun 2017 16:32:24 -0700 Subject: Add refcount to tcp tracer --- src/core/lib/iomgr/tcp_posix.c | 17 +++++++++++------ src/core/lib/iomgr/tcp_uv.c | 19 +++++++++++-------- src/core/lib/iomgr/tcp_windows.c | 19 +++++++++++++------ test/core/end2end/fixtures/http_proxy_fixture.c | 2 +- 4 files changed, 36 insertions(+), 21 deletions(-) diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c index 66e81bf81f..48e4dfe7ed 100644 --- a/src/core/lib/iomgr/tcp_posix.c +++ b/src/core/lib/iomgr/tcp_posix.c @@ -163,15 +163,17 @@ static void tcp_free(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { gpr_free(tcp); } -/*#define GRPC_TCP_REFCOUNT_DEBUG*/ -#ifdef GRPC_TCP_REFCOUNT_DEBUG +#ifndef NDEBUG #define TCP_UNREF(cl, tcp, reason) \ tcp_unref((cl), (tcp), (reason), __FILE__, __LINE__) #define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), __FILE__, __LINE__) static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP unref %p : %s %d -> %d", tcp, - reason, tcp->refcount.count, tcp->refcount.count - 1); + if (GRPC_TRACER_ON(grpc_tcp_trace)) { + gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, + reason, val, val - 1); + } if (gpr_unref(&tcp->refcount)) { tcp_free(exec_ctx, tcp); } @@ -179,8 +181,11 @@ static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, static void tcp_ref(grpc_tcp *tcp, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP ref %p : %s %d -> %d", tcp, - reason, tcp->refcount.count, tcp->refcount.count + 1); + if (GRPC_TRACER_ON(grpc_tcp_trace)) { + gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, + reason, val, val + 1); + } gpr_ref(&tcp->refcount); } #else diff --git a/src/core/lib/iomgr/tcp_uv.c b/src/core/lib/iomgr/tcp_uv.c index ab5bb9f7da..996581e8c2 100644 --- a/src/core/lib/iomgr/tcp_uv.c +++ b/src/core/lib/iomgr/tcp_uv.c @@ -69,16 +69,17 @@ static void tcp_free(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { gpr_free(tcp); } -/*#define GRPC_TCP_REFCOUNT_DEBUG*/ -#ifdef GRPC_TCP_REFCOUNT_DEBUG +#ifndef NDEBUG #define TCP_UNREF(exec_ctx, tcp, reason) \ tcp_unref((exec_ctx), (tcp), (reason), __FILE__, __LINE__) #define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), __FILE__, __LINE__) static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "TCP unref %p : %s %" PRIiPTR " -> %" PRIiPTR, tcp, reason, - tcp->refcount.count, tcp->refcount.count - 1); + if (GRPC_TRACER_ON(grpc_tcp_trace)) { + gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, + reason, val, val - 1); + } if (gpr_unref(&tcp->refcount)) { tcp_free(exec_ctx, tcp); } @@ -86,9 +87,11 @@ static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, static void tcp_ref(grpc_tcp *tcp, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "TCP ref %p : %s %" PRIiPTR " -> %" PRIiPTR, tcp, reason, - tcp->refcount.count, tcp->refcount.count + 1); + if (GRPC_TRACER_ON(grpc_tcp_trace)) { + gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, + reason, val, val + 1); + } gpr_ref(&tcp->refcount); } #else diff --git a/src/core/lib/iomgr/tcp_windows.c b/src/core/lib/iomgr/tcp_windows.c index 161b397534..dd5ed2c62c 100644 --- a/src/core/lib/iomgr/tcp_windows.c +++ b/src/core/lib/iomgr/tcp_windows.c @@ -48,6 +48,8 @@ #define GRPC_FIONBIO FIONBIO #endif +int grpc_tcp_trace = 0; + static grpc_error *set_non_block(SOCKET sock) { int status; uint32_t param = 1; @@ -115,15 +117,17 @@ static void tcp_free(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { gpr_free(tcp); } -/*#define GRPC_TCP_REFCOUNT_DEBUG*/ -#ifdef GRPC_TCP_REFCOUNT_DEBUG +#ifndef NDEBUG #define TCP_UNREF(exec_ctx, tcp, reason) \ tcp_unref((exec_ctx), (tcp), (reason), __FILE__, __LINE__) #define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), __FILE__, __LINE__) static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP unref %p : %s %d -> %d", tcp, - reason, tcp->refcount.count, tcp->refcount.count - 1); + if (GRPC_TRACER_ON(grpc_tcp_trace)) { + gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, + reason, val, val - 1); + } if (gpr_unref(&tcp->refcount)) { tcp_free(exec_ctx, tcp); } @@ -131,8 +135,11 @@ static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, static void tcp_ref(grpc_tcp *tcp, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP ref %p : %s %d -> %d", tcp, - reason, tcp->refcount.count, tcp->refcount.count + 1); + if (GRPC_TRACER_ON(grpc_tcp_trace)) { + gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, + reason, val, val + 1); + } gpr_ref(&tcp->refcount); } #else diff --git a/test/core/end2end/fixtures/http_proxy_fixture.c b/test/core/end2end/fixtures/http_proxy_fixture.c index 248f721cbb..54693c4900 100644 --- a/test/core/end2end/fixtures/http_proxy_fixture.c +++ b/test/core/end2end/fixtures/http_proxy_fixture.c @@ -493,7 +493,7 @@ void grpc_end2end_http_proxy_destroy(grpc_end2end_http_proxy* proxy) { grpc_pollset_shutdown(&exec_ctx, proxy->pollset, GRPC_CLOSURE_CREATE(destroy_pollset, proxy->pollset, grpc_schedule_on_exec_ctx)); - grpc_combiner_unref(&exec_ctx, proxy->combiner); + GRPC_COMBINER_UNREF(&exec_ctx, proxy->combiner, "test"); gpr_free(proxy); grpc_exec_ctx_finish(&exec_ctx); } -- cgit v1.2.3 From 4b584054b9cba502adbfb13b36bd22edee5019ae Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 8 Jun 2017 16:44:38 -0700 Subject: Add metadata, secendp, sec conn tracers --- .../filters/client_channel/client_channel_plugin.c | 3 + .../client_channel/lb_policy/grpclb/grpclb.c | 3 + src/core/lib/security/context/security_context.c | 26 ++-- src/core/lib/security/context/security_context.h | 6 +- src/core/lib/security/transport/secure_endpoint.c | 21 ++-- .../lib/security/transport/security_connector.c | 26 ++-- .../lib/security/transport/security_connector.h | 6 +- src/core/lib/surface/init.c | 16 +-- src/core/lib/transport/metadata.c | 135 ++++++++++++--------- src/core/lib/transport/metadata.h | 8 +- 10 files changed, 153 insertions(+), 97 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel_plugin.c b/src/core/ext/filters/client_channel/client_channel_plugin.c index 06a3d9e25a..5dc1441344 100644 --- a/src/core/ext/filters/client_channel/client_channel_plugin.c +++ b/src/core/ext/filters/client_channel/client_channel_plugin.c @@ -80,6 +80,9 @@ void grpc_client_channel_init(void) { GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, append_filter, (void *)&grpc_client_channel_filter); grpc_http_connect_register_handshaker_factory(); +#ifndef NDEBUG + grpc_register_tracer("resolver_refcount", &grpc_trace_resolver_refcount); +#endif } void grpc_client_channel_shutdown(void) { diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c index 8d3c1c8e72..cf442ce669 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c @@ -1882,6 +1882,9 @@ static bool maybe_add_client_load_reporting_filter( void grpc_lb_policy_grpclb_init() { grpc_register_lb_policy(grpc_glb_lb_factory_create()); grpc_register_tracer("glb", &grpc_lb_glb_trace); +#ifndef NDEBUG + grpc_register_tracer("lb_policy_refcount", &grpc_trace_lb_policy_refcount); +#endif grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, maybe_add_client_load_reporting_filter, diff --git a/src/core/lib/security/context/security_context.c b/src/core/lib/security/context/security_context.c index e528428650..9d95d48057 100644 --- a/src/core/lib/security/context/security_context.c +++ b/src/core/lib/security/context/security_context.c @@ -28,6 +28,10 @@ #include #include +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_auth_context_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + /* --- grpc_call --- */ grpc_call_error grpc_call_set_credentials(grpc_call *call, @@ -121,14 +125,17 @@ grpc_auth_context *grpc_auth_context_create(grpc_auth_context *chained) { return ctx; } -#ifdef GRPC_AUTH_CONTEXT_REFCOUNT_DEBUG +#ifndef NDEBUG grpc_auth_context *grpc_auth_context_ref(grpc_auth_context *ctx, const char *file, int line, const char *reason) { if (ctx == NULL) return NULL; - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "AUTH_CONTEXT:%p ref %d -> %d %s", ctx, (int)ctx->refcount.count, - (int)ctx->refcount.count + 1, reason); + if (GRPC_TRACER_ON(grpc_trace_auth_context_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&ctx->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "AUTH_CONTEXT:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", ctx, val, + val + 1, reason); + } #else grpc_auth_context *grpc_auth_context_ref(grpc_auth_context *ctx) { if (ctx == NULL) return NULL; @@ -137,13 +144,16 @@ grpc_auth_context *grpc_auth_context_ref(grpc_auth_context *ctx) { return ctx; } -#ifdef GRPC_AUTH_CONTEXT_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_auth_context_unref(grpc_auth_context *ctx, const char *file, int line, const char *reason) { if (ctx == NULL) return; - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "AUTH_CONTEXT:%p unref %d -> %d %s", ctx, (int)ctx->refcount.count, - (int)ctx->refcount.count - 1, reason); + if (GRPC_TRACER_ON(grpc_trace_auth_context_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&ctx->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "AUTH_CONTEXT:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", ctx, val, + val - 1, reason); + } #else void grpc_auth_context_unref(grpc_auth_context *ctx) { if (ctx == NULL) return; diff --git a/src/core/lib/security/context/security_context.h b/src/core/lib/security/context/security_context.h index 102f9d6e2f..0df39257a7 100644 --- a/src/core/lib/security/context/security_context.h +++ b/src/core/lib/security/context/security_context.h @@ -22,6 +22,10 @@ #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/security/credentials/credentials.h" +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_auth_context_refcount; +#endif + #ifdef __cplusplus extern "C" { #endif @@ -50,7 +54,7 @@ struct grpc_auth_context { grpc_auth_context *grpc_auth_context_create(grpc_auth_context *chained); /* Refcounting. */ -#ifdef GRPC_AUTH_CONTEXT_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_AUTH_CONTEXT_REF(p, r) \ grpc_auth_context_ref((p), __FILE__, __LINE__, (r)) #define GRPC_AUTH_CONTEXT_UNREF(p, r) \ diff --git a/src/core/lib/security/transport/secure_endpoint.c b/src/core/lib/security/transport/secure_endpoint.c index 140cf294ae..cdcab858ae 100644 --- a/src/core/lib/security/transport/secure_endpoint.c +++ b/src/core/lib/security/transport/secure_endpoint.c @@ -75,18 +75,20 @@ static void destroy(grpc_exec_ctx *exec_ctx, secure_endpoint *secure_ep) { gpr_free(ep); } -/*#define GRPC_SECURE_ENDPOINT_REFCOUNT_DEBUG*/ -#ifdef GRPC_SECURE_ENDPOINT_REFCOUNT_DEBUG +#ifndef NDEBUG #define SECURE_ENDPOINT_UNREF(exec_ctx, ep, reason) \ secure_endpoint_unref((exec_ctx), (ep), (reason), __FILE__, __LINE__) #define SECURE_ENDPOINT_REF(ep, reason) \ secure_endpoint_ref((ep), (reason), __FILE__, __LINE__) -static void secure_endpoint_unref(secure_endpoint *ep, - grpc_closure_list *closure_list, +static void secure_endpoint_unref(grpc_exec_ctx *exec_ctx, + secure_endpoint *ep, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "SECENDP unref %p : %s %d -> %d", - ep, reason, ep->ref.count, ep->ref.count - 1); + if (GRPC_TRACER_ON(grpc_trace_secure_endpoint)) { + gpr_atm val = gpr_atm_no_barrier_load(&ep->ref.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "SECENDP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, + ep, reason, val, val - 1); + } if (gpr_unref(&ep->ref)) { destroy(exec_ctx, ep); } @@ -94,8 +96,11 @@ static void secure_endpoint_unref(secure_endpoint *ep, static void secure_endpoint_ref(secure_endpoint *ep, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "SECENDP ref %p : %s %d -> %d", - ep, reason, ep->ref.count, ep->ref.count + 1); + if (GRPC_TRACER_ON(grpc_trace_secure_endpoint)) { + gpr_atm val = gpr_atm_no_barrier_load(&ep->ref.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "SECENDP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, + ep, reason, val, val + 1); + } gpr_ref(&ep->ref); } #else diff --git a/src/core/lib/security/transport/security_connector.c b/src/core/lib/security/transport/security_connector.c index 30a74302e1..662b6449ba 100644 --- a/src/core/lib/security/transport/security_connector.c +++ b/src/core/lib/security/transport/security_connector.c @@ -43,6 +43,10 @@ #include "src/core/tsi/ssl_transport_security.h" #include "src/core/tsi/transport_security_adapter.h" +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_security_connector_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + /* -- Constants. -- */ #ifndef INSTALL_PREFIX @@ -142,14 +146,17 @@ void grpc_channel_security_connector_check_call_host( } } -#ifdef GRPC_SECURITY_CONNECTOR_REFCOUNT_DEBUG +#ifndef NDEBUG grpc_security_connector *grpc_security_connector_ref( grpc_security_connector *sc, const char *file, int line, const char *reason) { if (sc == NULL) return NULL; - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "SECURITY_CONNECTOR:%p ref %d -> %d %s", sc, - (int)sc->refcount.count, (int)sc->refcount.count + 1, reason); + if (GRPC_TRACER_ON(grpc_trace_security_connector_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&sc->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "SECURITY_CONNECTOR:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", sc, + val, val + 1, reason); + } #else grpc_security_connector *grpc_security_connector_ref( grpc_security_connector *sc) { @@ -159,15 +166,18 @@ grpc_security_connector *grpc_security_connector_ref( return sc; } -#ifdef GRPC_SECURITY_CONNECTOR_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_security_connector_unref(grpc_exec_ctx *exec_ctx, grpc_security_connector *sc, const char *file, int line, const char *reason) { if (sc == NULL) return; - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "SECURITY_CONNECTOR:%p unref %d -> %d %s", sc, - (int)sc->refcount.count, (int)sc->refcount.count - 1, reason); + if (GRPC_TRACER_ON(grpc_trace_security_connector_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&sc->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "SECURITY_CONNECTOR:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", sc, + val, val - 1, reason); + } #else void grpc_security_connector_unref(grpc_exec_ctx *exec_ctx, grpc_security_connector *sc) { diff --git a/src/core/lib/security/transport/security_connector.h b/src/core/lib/security/transport/security_connector.h index 24b1086ee3..1c0fe40045 100644 --- a/src/core/lib/security/transport/security_connector.h +++ b/src/core/lib/security/transport/security_connector.h @@ -29,6 +29,10 @@ #include "src/core/tsi/ssl_transport_security.h" #include "src/core/tsi/transport_security_interface.h" +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_security_connector_refcount; +#endif + /* --- status enum. --- */ typedef enum { GRPC_SECURITY_OK = 0, GRPC_SECURITY_ERROR } grpc_security_status; @@ -66,7 +70,7 @@ struct grpc_security_connector { }; /* Refcounting. */ -#ifdef GRPC_SECURITY_CONNECTOR_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_SECURITY_CONNECTOR_REF(p, r) \ grpc_security_connector_ref((p), __FILE__, __LINE__, (r)) #define GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, p, r) \ diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index 449022c781..2ed7692607 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -48,8 +48,8 @@ #include "src/core/lib/transport/transport_impl.h" #ifndef NDEBUG -#include "src/core/ext/filters/client_channel/lb_policy.h" -#include "src/core/ext/filters/client_channel/resolver.h" +#include "src/core/lib/security/context/security_context.h" +#include "src/core/lib/security/transport/security_connector.h" #endif /* (generated) built in registry of plugins */ @@ -131,13 +131,11 @@ void grpc_init(void) { grpc_register_tracer("channel_stack_builder", &grpc_trace_channel_stack_builder); grpc_register_tracer("http1", &grpc_http1_trace); - grpc_register_tracer("queue_pluck", &grpc_cq_pluck_trace); + grpc_register_tracer("queue_pluck", &grpc_cq_pluck_trace); // default on grpc_register_tracer("combiner", &grpc_combiner_trace); grpc_register_tracer("server_channel", &grpc_server_channel_trace); grpc_register_tracer("bdp_estimator", &grpc_bdp_estimator_trace); - // Default pluck trace to 1 - grpc_register_tracer("queue_timeout", &grpc_cq_event_timeout_trace); - // Default timeout trace to 1 + grpc_register_tracer("queue_timeout", &grpc_cq_event_timeout_trace); // default on grpc_register_tracer("op_failure", &grpc_trace_operation_failures); grpc_register_tracer("resource_quota", &grpc_resource_quota_trace); grpc_register_tracer("call_error", &grpc_call_error_trace); @@ -145,9 +143,11 @@ void grpc_init(void) { grpc_register_tracer("pending_tags", &grpc_trace_pending_tags); grpc_register_tracer("closure", &grpc_trace_closure); grpc_register_tracer("error_refcount", &grpc_trace_error_refcount); - grpc_register_tracer("lb_policy_refcount", &grpc_trace_lb_policy_refcount); - grpc_register_tracer("resolver_refcount", &grpc_trace_resolver_refcount); grpc_register_tracer("stream_refcount", &grpc_trace_stream_refcount); + // TODO(ncteisen): re-enable after rebasing + // grpc_register_tracer("auth_context_refcount", &grpc_trace_auth_context_refcount); + // grpc_register_tracer("security_connector_refcount", &grpc_trace_security_connector_refcount); + grpc_register_tracer("metadata", &grpc_trace_metadata); #endif grpc_security_pre_init(); grpc_iomgr_init(&exec_ctx); diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c index 9491730719..a78d3e871a 100644 --- a/src/core/lib/transport/metadata.c +++ b/src/core/lib/transport/metadata.c @@ -47,7 +47,8 @@ * used to determine which kind of element a pointer refers to. */ -#ifdef GRPC_METADATA_REFCOUNT_DEBUG +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_metadata = GRPC_TRACER_INITIALIZER(false); #define DEBUG_ARGS , const char *file, int line #define FWD_DEBUG_ARGS , file, line #define REF_MD_LOCKED(shard, s) ref_md_locked((shard), (s), __FILE__, __LINE__) @@ -144,15 +145,17 @@ static int is_mdelem_static(grpc_mdelem e) { static void ref_md_locked(mdtab_shard *shard, interned_metadata *md DEBUG_ARGS) { -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(md->key); - char *value_str = grpc_slice_to_c_string(md->value); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), - gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(md->key); + char *value_str = grpc_slice_to_c_string(md->value); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md, + gpr_atm_no_barrier_load(&md->refcnt), + gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif if (0 == gpr_atm_no_barrier_fetch_add(&md->refcnt, 1)) { gpr_atm_no_barrier_fetch_add(&shard->free_estimate, -1); @@ -243,13 +246,15 @@ grpc_mdelem grpc_mdelem_create( allocated->key = grpc_slice_ref_internal(key); allocated->value = grpc_slice_ref_internal(value); gpr_atm_rel_store(&allocated->refcnt, 1); -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(allocated->key); - char *value_str = grpc_slice_to_c_string(allocated->value); - gpr_log(GPR_DEBUG, "ELM ALLOC:%p:%zu: '%s' = '%s'", (void *)allocated, - gpr_atm_no_barrier_load(&allocated->refcnt), key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(allocated->key); + char *value_str = grpc_slice_to_c_string(allocated->value); + gpr_log(GPR_DEBUG, "ELM ALLOC:%p:%zu: '%s' = '%s'", (void *)allocated, + gpr_atm_no_barrier_load(&allocated->refcnt), key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif return GRPC_MAKE_MDELEM(allocated, GRPC_MDELEM_STORAGE_ALLOCATED); } @@ -294,13 +299,15 @@ grpc_mdelem grpc_mdelem_create( md->bucket_next = shard->elems[idx]; shard->elems[idx] = md; gpr_mu_init(&md->mu_user_data); -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(md->key); - char *value_str = grpc_slice_to_c_string(md->value); - gpr_log(GPR_DEBUG, "ELM NEW:%p:%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(md->key); + char *value_str = grpc_slice_to_c_string(md->value); + gpr_log(GPR_DEBUG, "ELM NEW:%p:%zu: '%s' = '%s'", (void *)md, + gpr_atm_no_barrier_load(&md->refcnt), key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif shard->count++; @@ -356,15 +363,17 @@ grpc_mdelem grpc_mdelem_ref(grpc_mdelem gmd DEBUG_ARGS) { break; case GRPC_MDELEM_STORAGE_INTERNED: { interned_metadata *md = (interned_metadata *)GRPC_MDELEM_DATA(gmd); -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(md->key); - char *value_str = grpc_slice_to_c_string(md->value); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), - gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(md->key); + char *value_str = grpc_slice_to_c_string(md->value); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md, + gpr_atm_no_barrier_load(&md->refcnt), + gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif /* we can assume the ref count is >= 1 as the application is calling this function - meaning that no adjustment to mdtab_free is necessary, @@ -376,15 +385,17 @@ grpc_mdelem grpc_mdelem_ref(grpc_mdelem gmd DEBUG_ARGS) { } case GRPC_MDELEM_STORAGE_ALLOCATED: { allocated_metadata *md = (allocated_metadata *)GRPC_MDELEM_DATA(gmd); -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(md->key); - char *value_str = grpc_slice_to_c_string(md->value); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), - gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(md->key); + char *value_str = grpc_slice_to_c_string(md->value); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md, + gpr_atm_no_barrier_load(&md->refcnt), + gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif /* we can assume the ref count is >= 1 as the application is calling this function - meaning that no adjustment to mdtab_free is necessary, @@ -404,15 +415,17 @@ void grpc_mdelem_unref(grpc_exec_ctx *exec_ctx, grpc_mdelem gmd DEBUG_ARGS) { break; case GRPC_MDELEM_STORAGE_INTERNED: { interned_metadata *md = (interned_metadata *)GRPC_MDELEM_DATA(gmd); -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(md->key); - char *value_str = grpc_slice_to_c_string(md->value); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM UNREF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), - gpr_atm_no_barrier_load(&md->refcnt) - 1, key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(md->key); + char *value_str = grpc_slice_to_c_string(md->value); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "ELM UNREF:%p:%zu->%zu: '%s' = '%s'", (void *)md, + gpr_atm_no_barrier_load(&md->refcnt), + gpr_atm_no_barrier_load(&md->refcnt) - 1, key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif uint32_t hash = GRPC_MDSTR_KV_HASH(grpc_slice_hash(md->key), grpc_slice_hash(md->value)); @@ -428,15 +441,17 @@ void grpc_mdelem_unref(grpc_exec_ctx *exec_ctx, grpc_mdelem gmd DEBUG_ARGS) { } case GRPC_MDELEM_STORAGE_ALLOCATED: { allocated_metadata *md = (allocated_metadata *)GRPC_MDELEM_DATA(gmd); -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(md->key); - char *value_str = grpc_slice_to_c_string(md->value); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM UNREF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), - gpr_atm_no_barrier_load(&md->refcnt) - 1, key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(md->key); + char *value_str = grpc_slice_to_c_string(md->value); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "ELM UNREF:%p:%zu->%zu: '%s' = '%s'", (void *)md, + gpr_atm_no_barrier_load(&md->refcnt), + gpr_atm_no_barrier_load(&md->refcnt) - 1, key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif const gpr_atm prev_refcount = gpr_atm_full_fetch_add(&md->refcnt, -1); GPR_ASSERT(prev_refcount >= 1); diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h index 5e1afecd2e..974469e436 100644 --- a/src/core/lib/transport/metadata.h +++ b/src/core/lib/transport/metadata.h @@ -25,6 +25,10 @@ #include "src/core/lib/iomgr/exec_ctx.h" +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_metadata; +#endif + #ifdef __cplusplus extern "C" { #endif @@ -132,9 +136,7 @@ void *grpc_mdelem_get_user_data(grpc_mdelem md, void *grpc_mdelem_set_user_data(grpc_mdelem md, void (*destroy_func)(void *), void *user_data); -/* Reference counting */ -//#define GRPC_METADATA_REFCOUNT_DEBUG -#ifdef GRPC_METADATA_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_MDELEM_REF(s) grpc_mdelem_ref((s), __FILE__, __LINE__) #define GRPC_MDELEM_UNREF(exec_ctx, s) \ grpc_mdelem_unref((exec_ctx), (s), __FILE__, __LINE__) -- cgit v1.2.3 From d39010e68a2fc8a11030d1770574a8eab8975a3f Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 8 Jun 2017 17:08:07 -0700 Subject: Add cq and fd tracer --- src/core/lib/iomgr/error.c | 16 ++++----- src/core/lib/iomgr/error.h | 11 +++---- src/core/lib/iomgr/ev_epollsig_linux.c | 40 +++++++++++++---------- src/core/lib/iomgr/ev_poll_posix.c | 39 +++++++++++++--------- src/core/lib/iomgr/ev_posix.h | 4 +++ src/core/lib/iomgr/tcp_posix.c | 10 +++--- src/core/lib/iomgr/tcp_uv.c | 10 +++--- src/core/lib/iomgr/tcp_windows.c | 10 +++--- src/core/lib/security/transport/secure_endpoint.c | 13 ++++---- src/core/lib/surface/completion_queue.c | 21 ++++++++---- src/core/lib/surface/completion_queue.h | 6 ++-- src/core/lib/surface/init.c | 5 ++- src/core/lib/surface/init_secure.c | 10 ++++++ src/core/lib/transport/metadata.c | 2 +- 14 files changed, 117 insertions(+), 80 deletions(-) diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index 6fb0f4d624..d8fd92f89a 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -124,14 +124,12 @@ bool grpc_error_is_special(grpc_error *err) { } #ifndef NDEBUG -grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line, - const char *func) { +grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line) { if (grpc_error_is_special(err)) return err; if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { - gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d %s]", err, + gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d]", err, gpr_atm_no_barrier_load(&err->atomics.refs.count), - gpr_atm_no_barrier_load(&err->atomics.refs.count) + 1, file, line, - func); + gpr_atm_no_barrier_load(&err->atomics.refs.count) + 1, file, line); } gpr_ref(&err->atomics.refs); return err; @@ -179,14 +177,12 @@ static void error_destroy(grpc_error *err) { } #ifndef NDEBUG -void grpc_error_unref(grpc_error *err, const char *file, int line, - const char *func) { +void grpc_error_unref(grpc_error *err, const char *file, int line) { if (grpc_error_is_special(err)) return; if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { - gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d %s]", err, + gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d]", err, gpr_atm_no_barrier_load(&err->atomics.refs.count), - gpr_atm_no_barrier_load(&err->atomics.refs.count) - 1, file, line, - func); + gpr_atm_no_barrier_load(&err->atomics.refs.count) - 1, file, line); } if (gpr_unref(&err->atomics.refs)) { error_destroy(err); diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index fb8e19f643..b362948691 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -156,13 +156,10 @@ grpc_error *grpc_error_create(const char *file, int line, grpc_slice desc, errs, count) #ifndef NDEBUG -grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line, - const char *func); -void grpc_error_unref(grpc_error *err, const char *file, int line, - const char *func); -#define GRPC_ERROR_REF(err) grpc_error_ref(err, __FILE__, __LINE__, __func__) -#define GRPC_ERROR_UNREF(err) \ - grpc_error_unref(err, __FILE__, __LINE__, __func__) +grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line); +void grpc_error_unref(grpc_error *err, const char *file, int line); +#define GRPC_ERROR_REF(err) grpc_error_ref(err, __FILE__, __LINE__) +#define GRPC_ERROR_UNREF(err) grpc_error_unref(err, __FILE__, __LINE__) #else grpc_error *grpc_error_ref(grpc_error *err); void grpc_error_unref(grpc_error *err); diff --git a/src/core/lib/iomgr/ev_epollsig_linux.c b/src/core/lib/iomgr/ev_epollsig_linux.c index 90f730e66a..b1eaf6a4f2 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.c +++ b/src/core/lib/iomgr/ev_epollsig_linux.c @@ -49,6 +49,10 @@ #define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker *)1) +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + #define GRPC_POLLING_TRACE(...) \ if (GRPC_TRACER_ON(grpc_polling_trace)) { \ gpr_log(GPR_INFO, __VA_ARGS__); \ @@ -141,7 +145,7 @@ struct grpc_fd { /* Reference counting for fds */ // #define GRPC_FD_REF_COUNT_DEBUG -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void fd_ref(grpc_fd *fd, const char *reason, const char *file, int line); static void fd_unref(grpc_fd *fd, const char *reason, const char *file, int line); @@ -167,7 +171,7 @@ static void fd_global_shutdown(void); #define PI_UNREF(exec_ctx, p, r) \ pi_unref_dbg((exec_ctx), (p), (r), __FILE__, __LINE__) -#else +#else #define PI_ADD_REF(p, r) pi_add_ref((p)) #define PI_UNREF(exec_ctx, p, r) pi_unref((exec_ctx), (p)) @@ -286,13 +290,12 @@ static void pi_add_ref(polling_island *pi); static void pi_unref(grpc_exec_ctx *exec_ctx, polling_island *pi); #ifndef NDEBUG -grpc_tracer_flag grpc_trace_workqueue_refcount = GRPC_TRACER_INITIALIZER(false); static void pi_add_ref_dbg(polling_island *pi, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_trace_workqueue_refcount)) { long old_cnt = gpr_atm_acq_load(&pi->ref_count); gpr_log(GPR_DEBUG, "Add ref pi: %p, old: %ld -> new:%ld (%s) - (%s, %d)", - (void *)pi, old_cnt, old_cnt + 1, reason, file, line); + (void *)pi, old_cnt, old_cnt + 1, reason, file, line); } pi_add_ref(pi); } @@ -302,7 +305,7 @@ static void pi_unref_dbg(grpc_exec_ctx *exec_ctx, polling_island *pi, if (GRPC_TRACER_ON(grpc_trace_workqueue_refcount)) { long old_cnt = gpr_atm_acq_load(&pi->ref_count); gpr_log(GPR_DEBUG, "Unref pi: %p, old:%ld -> new:%ld (%s) - (%s, %d)", - (void *)pi, old_cnt, (old_cnt - 1), reason, file, line); + (void *)pi, old_cnt, (old_cnt - 1), reason, file, line); } pi_unref(exec_ctx, pi); } @@ -723,14 +726,16 @@ static void polling_island_global_shutdown() { static grpc_fd *fd_freelist = NULL; static gpr_mu fd_freelist_mu; -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG #define REF_BY(fd, n, reason) ref_by(fd, n, reason, __FILE__, __LINE__) #define UNREF_BY(fd, n, reason) unref_by(fd, n, reason, __FILE__, __LINE__) static void ref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_log(GPR_DEBUG, "FD %d %p ref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, "FD %d %p ref %d %ld -> %ld [%s; %s:%d]", fd->fd, + (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + } #else #define REF_BY(fd, n, reason) ref_by(fd, n) #define UNREF_BY(fd, n, reason) unref_by(fd, n) @@ -739,17 +744,18 @@ static void ref_by(grpc_fd *fd, int n) { GPR_ASSERT(gpr_atm_no_barrier_fetch_add(&fd->refst, n) > 0); } -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void unref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_atm old; - gpr_log(GPR_DEBUG, "FD %d %p unref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, "FD %d %p unref %d %ld -> %ld [%s; %s:%d]", fd->fd, + (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + } #else static void unref_by(grpc_fd *fd, int n) { - gpr_atm old; #endif + gpr_atm old; old = gpr_atm_full_fetch_add(&fd->refst, -n); if (old == n) { /* Add the fd to the freelist */ @@ -768,7 +774,7 @@ static void unref_by(grpc_fd *fd, int n) { } /* Increment refcount by two to avoid changing the orphan bit */ -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void fd_ref(grpc_fd *fd, const char *reason, const char *file, int line) { ref_by(fd, 2, reason, file, line); @@ -836,7 +842,7 @@ static grpc_fd *fd_create(int fd, const char *name) { char *fd_name; gpr_asprintf(&fd_name, "%s fd=%d", name, fd); grpc_iomgr_register_object(&new_fd->iomgr_object, fd_name); -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, (void *)new_fd, fd_name); #endif gpr_free(fd_name); diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index 0023cdba6f..4d2ecd6300 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -45,6 +45,10 @@ #define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker *)1) +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + /******************************************************************************* * FD declarations */ @@ -134,9 +138,7 @@ static void fd_end_poll(grpc_exec_ctx *exec_ctx, grpc_fd_watcher *rec, /* Return 1 if this fd is orphaned, 0 otherwise */ static bool fd_is_orphaned(grpc_fd *fd); -/* Reference counting for fds */ -//#define GRPC_FD_REF_COUNT_DEBUG -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void fd_ref(grpc_fd *fd, const char *reason, const char *file, int line); static void fd_unref(grpc_fd *fd, const char *reason, const char *file, int line); @@ -263,14 +265,16 @@ cv_fd_table g_cvfds; * fd_posix.c */ -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG #define REF_BY(fd, n, reason) ref_by(fd, n, reason, __FILE__, __LINE__) #define UNREF_BY(fd, n, reason) unref_by(fd, n, reason, __FILE__, __LINE__) static void ref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_log(GPR_DEBUG, "FD %d %p ref %d %d -> %d [%s; %s:%d]", fd->fd, fd, n, - (int)gpr_atm_no_barrier_load(&fd->refst), - (int)gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, "FD %d %p ref %d %d -> %d [%s; %s:%d]", fd->fd, fd, n, + (int)gpr_atm_no_barrier_load(&fd->refst), + (int)gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + } #else #define REF_BY(fd, n, reason) ref_by(fd, n) #define UNREF_BY(fd, n, reason) unref_by(fd, n) @@ -279,17 +283,18 @@ static void ref_by(grpc_fd *fd, int n) { GPR_ASSERT(gpr_atm_no_barrier_fetch_add(&fd->refst, n) > 0); } -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void unref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_atm old; - gpr_log(GPR_DEBUG, "FD %d %p unref %d %d -> %d [%s; %s:%d]", fd->fd, fd, n, - (int)gpr_atm_no_barrier_load(&fd->refst), - (int)gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, "FD %d %p unref %d %d -> %d [%s; %s:%d]", fd->fd, fd, n, + (int)gpr_atm_no_barrier_load(&fd->refst), + (int)gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + } #else static void unref_by(grpc_fd *fd, int n) { - gpr_atm old; #endif + gpr_atm old; old = gpr_atm_full_fetch_add(&fd->refst, -n); if (old == n) { gpr_mu_destroy(&fd->mu); @@ -321,8 +326,10 @@ static grpc_fd *fd_create(int fd, const char *name) { gpr_asprintf(&name2, "%s fd=%d", name, fd); grpc_iomgr_register_object(&r->iomgr_object, name2); gpr_free(name2); -#ifdef GRPC_FD_REF_COUNT_DEBUG - gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, r, name); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, r, name); + } #endif return r; } @@ -417,7 +424,7 @@ static void fd_orphan(grpc_exec_ctx *exec_ctx, grpc_fd *fd, } /* increment refcount by two to avoid changing the orphan bit */ -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void fd_ref(grpc_fd *fd, const char *reason, const char *file, int line) { ref_by(fd, 2, reason, file, line); diff --git a/src/core/lib/iomgr/ev_posix.h b/src/core/lib/iomgr/ev_posix.h index 54c4f2ee11..7f0a21be86 100644 --- a/src/core/lib/iomgr/ev_posix.h +++ b/src/core/lib/iomgr/ev_posix.h @@ -29,6 +29,10 @@ extern grpc_tracer_flag grpc_polling_trace; /* Disabled by default */ +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_fd_refcount; +#endif + typedef struct grpc_fd grpc_fd; typedef struct grpc_event_engine_vtable { diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c index 48e4dfe7ed..5de2b0f4ee 100644 --- a/src/core/lib/iomgr/tcp_posix.c +++ b/src/core/lib/iomgr/tcp_posix.c @@ -171,8 +171,9 @@ static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_tcp_trace)) { gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, - reason, val, val - 1); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, + val - 1); } if (gpr_unref(&tcp->refcount)) { tcp_free(exec_ctx, tcp); @@ -183,8 +184,9 @@ static void tcp_ref(grpc_tcp *tcp, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_tcp_trace)) { gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, - reason, val, val + 1); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "TCP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, + val + 1); } gpr_ref(&tcp->refcount); } diff --git a/src/core/lib/iomgr/tcp_uv.c b/src/core/lib/iomgr/tcp_uv.c index 996581e8c2..7c21b44e76 100644 --- a/src/core/lib/iomgr/tcp_uv.c +++ b/src/core/lib/iomgr/tcp_uv.c @@ -77,8 +77,9 @@ static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_tcp_trace)) { gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, - reason, val, val - 1); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, + val - 1); } if (gpr_unref(&tcp->refcount)) { tcp_free(exec_ctx, tcp); @@ -89,8 +90,9 @@ static void tcp_ref(grpc_tcp *tcp, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_tcp_trace)) { gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, - reason, val, val + 1); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "TCP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, + val + 1); } gpr_ref(&tcp->refcount); } diff --git a/src/core/lib/iomgr/tcp_windows.c b/src/core/lib/iomgr/tcp_windows.c index dd5ed2c62c..2312b5b86a 100644 --- a/src/core/lib/iomgr/tcp_windows.c +++ b/src/core/lib/iomgr/tcp_windows.c @@ -125,8 +125,9 @@ static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_tcp_trace)) { gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, - reason, val, val - 1); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, + val - 1); } if (gpr_unref(&tcp->refcount)) { tcp_free(exec_ctx, tcp); @@ -137,8 +138,9 @@ static void tcp_ref(grpc_tcp *tcp, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_tcp_trace)) { gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, - reason, val, val + 1); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "TCP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, + val + 1); } gpr_ref(&tcp->refcount); } diff --git a/src/core/lib/security/transport/secure_endpoint.c b/src/core/lib/security/transport/secure_endpoint.c index cdcab858ae..f4ed81db1a 100644 --- a/src/core/lib/security/transport/secure_endpoint.c +++ b/src/core/lib/security/transport/secure_endpoint.c @@ -80,14 +80,14 @@ static void destroy(grpc_exec_ctx *exec_ctx, secure_endpoint *secure_ep) { secure_endpoint_unref((exec_ctx), (ep), (reason), __FILE__, __LINE__) #define SECURE_ENDPOINT_REF(ep, reason) \ secure_endpoint_ref((ep), (reason), __FILE__, __LINE__) -static void secure_endpoint_unref(grpc_exec_ctx *exec_ctx, - secure_endpoint *ep, +static void secure_endpoint_unref(grpc_exec_ctx *exec_ctx, secure_endpoint *ep, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_trace_secure_endpoint)) { gpr_atm val = gpr_atm_no_barrier_load(&ep->ref.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "SECENDP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, - ep, reason, val, val - 1); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "SECENDP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, ep, reason, val, + val - 1); } if (gpr_unref(&ep->ref)) { destroy(exec_ctx, ep); @@ -98,8 +98,9 @@ static void secure_endpoint_ref(secure_endpoint *ep, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_trace_secure_endpoint)) { gpr_atm val = gpr_atm_no_barrier_load(&ep->ref.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "SECENDP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, - ep, reason, val, val + 1); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "SECENDP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, ep, reason, val, + val + 1); } gpr_ref(&ep->ref); } diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index 1a5c721214..f008d7b83c 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -38,6 +38,7 @@ grpc_tracer_flag grpc_trace_operation_failures = GRPC_TRACER_INITIALIZER(false); #ifndef NDEBUG grpc_tracer_flag grpc_trace_pending_tags = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_cq_refcount = GRPC_TRACER_INITIALIZER(false); #endif typedef struct { @@ -437,12 +438,15 @@ int grpc_get_cq_poll_num(grpc_completion_queue *cc) { return cur_num_polls; } -#ifdef GRPC_CQ_REF_COUNT_DEBUG +#ifndef NDEBUG void grpc_cq_internal_ref(grpc_completion_queue *cc, const char *reason, const char *file, int line) { cq_data *cqd = &cc->data; - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "CQ:%p ref %d -> %d %s", cc, - (int)cqd->owning_refs.count, (int)cqd->owning_refs.count + 1, reason); + if (GRPC_TRACER_ON(grpc_trace_cq_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&cqd->owning_refs.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "CQ:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", cc, + val, val + 1, reason); + } #else void grpc_cq_internal_ref(grpc_completion_queue *cc) { cq_data *cqd = &cc->data; @@ -456,12 +460,15 @@ static void on_pollset_shutdown_done(grpc_exec_ctx *exec_ctx, void *arg, GRPC_CQ_INTERNAL_UNREF(exec_ctx, cc, "pollset_destroy"); } -#ifdef GRPC_CQ_REF_COUNT_DEBUG -void grpc_cq_internal_unref(grpc_completion_queue *cc, const char *reason, +#ifndef NDEBUG +void grpc_cq_internal_unref(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc, const char *reason, const char *file, int line) { cq_data *cqd = &cc->data; - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "CQ:%p unref %d -> %d %s", cc, - (int)cqd->owning_refs.count, (int)cqd->owning_refs.count - 1, reason); + if (GRPC_TRACER_ON(grpc_trace_cq_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&cqd->owning_refs.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "CQ:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", cc, + val, val - 1, reason); + } #else void grpc_cq_internal_unref(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc) { diff --git a/src/core/lib/surface/completion_queue.h b/src/core/lib/surface/completion_queue.h index 49097bac39..97ea9cae20 100644 --- a/src/core/lib/surface/completion_queue.h +++ b/src/core/lib/surface/completion_queue.h @@ -30,8 +30,10 @@ extern grpc_tracer_flag grpc_cq_pluck_trace; extern grpc_tracer_flag grpc_cq_event_timeout_trace; extern grpc_tracer_flag grpc_trace_operation_failures; + #ifndef NDEBUG extern grpc_tracer_flag grpc_trace_pending_tags; +extern grpc_tracer_flag grpc_trace_cq_refcount; #endif #ifdef __cplusplus @@ -52,9 +54,7 @@ typedef struct grpc_cq_completion { uintptr_t next; } grpc_cq_completion; -//#define GRPC_CQ_REF_COUNT_DEBUG - -#ifdef GRPC_CQ_REF_COUNT_DEBUG +#ifndef NDEBUG void grpc_cq_internal_ref(grpc_completion_queue *cc, const char *reason, const char *file, int line); void grpc_cq_internal_unref(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc, diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index 2ed7692607..1ec54dd2cd 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -48,6 +48,7 @@ #include "src/core/lib/transport/transport_impl.h" #ifndef NDEBUG +#include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/security/context/security_context.h" #include "src/core/lib/security/transport/security_connector.h" #endif @@ -141,12 +142,14 @@ void grpc_init(void) { grpc_register_tracer("call_error", &grpc_call_error_trace); #ifndef NDEBUG grpc_register_tracer("pending_tags", &grpc_trace_pending_tags); + grpc_register_tracer("queue_refcount", &grpc_trace_cq_refcount); grpc_register_tracer("closure", &grpc_trace_closure); grpc_register_tracer("error_refcount", &grpc_trace_error_refcount); grpc_register_tracer("stream_refcount", &grpc_trace_stream_refcount); - // TODO(ncteisen): re-enable after rebasing + // TODO(ncteisen): fix this after rebase // grpc_register_tracer("auth_context_refcount", &grpc_trace_auth_context_refcount); // grpc_register_tracer("security_connector_refcount", &grpc_trace_security_connector_refcount); + grpc_register_tracer("fd_refcount", &grpc_trace_fd_refcount); grpc_register_tracer("metadata", &grpc_trace_metadata); #endif grpc_security_pre_init(); diff --git a/src/core/lib/surface/init_secure.c b/src/core/lib/surface/init_secure.c index fb6635716d..7dbea581d0 100644 --- a/src/core/lib/surface/init_secure.c +++ b/src/core/lib/surface/init_secure.c @@ -32,9 +32,19 @@ #include "src/core/lib/surface/channel_init.h" #include "src/core/tsi/transport_security_interface.h" +#ifndef NDEBUG +#include "src/core/lib/security/context/security_context.h" +#endif + void grpc_security_pre_init(void) { grpc_register_tracer("secure_endpoint", &grpc_trace_secure_endpoint); grpc_register_tracer("transport_security", &tsi_tracing_enabled); +#ifndef NDEBUG + grpc_register_tracer("auth_context_refcount", + &grpc_trace_auth_context_refcount); + grpc_register_tracer("security_connector_refcount", + &grpc_trace_security_connector_refcount); +#endif } static bool maybe_prepend_client_auth_filter( diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c index a78d3e871a..9c78e1ccf8 100644 --- a/src/core/lib/transport/metadata.c +++ b/src/core/lib/transport/metadata.c @@ -395,7 +395,7 @@ grpc_mdelem grpc_mdelem_ref(grpc_mdelem gmd DEBUG_ARGS) { gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); gpr_free(key_str); gpr_free(value_str); - } + } #endif /* we can assume the ref count is >= 1 as the application is calling this function - meaning that no adjustment to mdtab_free is necessary, -- cgit v1.2.3 From ffe7209279f60ffc5ea832a13643179b8c81fcb3 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Mon, 24 Apr 2017 15:36:56 -0700 Subject: Add chttp2 trace --- .../ext/transport/chttp2/transport/chttp2_plugin.c | 3 +++ .../transport/chttp2/transport/chttp2_transport.c | 20 +++++++++++++++----- .../transport/chttp2/transport/chttp2_transport.h | 4 ++++ src/core/ext/transport/chttp2/transport/internal.h | 3 +-- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_plugin.c b/src/core/ext/transport/chttp2/transport/chttp2_plugin.c index b0ffdc0cf9..6a8c81445a 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_plugin.c @@ -23,6 +23,9 @@ void grpc_chttp2_plugin_init(void) { grpc_register_tracer("http", &grpc_http_trace); grpc_register_tracer("flowctl", &grpc_flowctl_trace); +#ifndef NDEBUG + grpc_register_tracer("chttp2_refcount", &grpc_trace_chttp2_refcount); +#endif } void grpc_chttp2_plugin_shutdown(void) {} diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index aeee1b4789..7210c62405 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -76,6 +76,10 @@ static bool g_default_keepalive_permit_without_calls = grpc_tracer_flag grpc_http_trace = GRPC_TRACER_INITIALIZER(false); grpc_tracer_flag grpc_flowctl_trace = GRPC_TRACER_INITIALIZER(false); +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_chttp2_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + static const grpc_transport_vtable vtable; /* forward declarations of various callbacks that we'll build closures around */ @@ -212,20 +216,26 @@ static void destruct_transport(grpc_exec_ctx *exec_ctx, gpr_free(t); } -#ifdef GRPC_CHTTP2_REFCOUNTING_DEBUG +#ifndef NDEBUG void grpc_chttp2_unref_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, const char *reason, const char *file, int line) { - gpr_log(GPR_DEBUG, "chttp2:unref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", t, - t->refs.count, t->refs.count - 1, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_chttp2_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&t->refs.count); + gpr_log(GPR_DEBUG, "chttp2:unref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", + t, val, val - 1, reason, file, line); + } if (!gpr_unref(&t->refs)) return; destruct_transport(exec_ctx, t); } void grpc_chttp2_ref_transport(grpc_chttp2_transport *t, const char *reason, const char *file, int line) { - gpr_log(GPR_DEBUG, "chttp2: ref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", t, - t->refs.count, t->refs.count + 1, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_chttp2_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&t->refs.count); + gpr_log(GPR_DEBUG, "chttp2: ref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", + t, val, val + 1, reason, file, line); + } gpr_ref(&t->refs); } #else diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.h b/src/core/ext/transport/chttp2/transport/chttp2_transport.h index 0a1fb4d772..0c4e2a91c0 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.h +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.h @@ -26,6 +26,10 @@ extern grpc_tracer_flag grpc_http_trace; extern grpc_tracer_flag grpc_flowctl_trace; +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_chttp2_refcount; +#endif + grpc_transport *grpc_create_chttp2_transport( grpc_exec_ctx *exec_ctx, const grpc_channel_args *channel_args, grpc_endpoint *ep, int is_client); diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index f07456332e..b7ac744795 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -764,8 +764,7 @@ void grpc_chttp2_stream_ref(grpc_chttp2_stream *s); void grpc_chttp2_stream_unref(grpc_exec_ctx *exec_ctx, grpc_chttp2_stream *s); #endif -//#define GRPC_CHTTP2_REFCOUNTING_DEBUG 1 -#ifdef GRPC_CHTTP2_REFCOUNTING_DEBUG +#ifndef NDEBUG #define GRPC_CHTTP2_REF_TRANSPORT(t, r) \ grpc_chttp2_ref_transport(t, r, __FILE__, __LINE__) #define GRPC_CHTTP2_UNREF_TRANSPORT(cl, t, r) \ -- cgit v1.2.3 From 8e331bf8e8b05ca1f40c7a9dd211c975948a748e Mon Sep 17 00:00:00 2001 From: ncteisen Date: Tue, 25 Apr 2017 08:30:16 -0700 Subject: Update env var doc --- doc/environment_variables.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/environment_variables.md b/doc/environment_variables.md index 47efb3a1d8..62a988f267 100644 --- a/doc/environment_variables.md +++ b/doc/environment_variables.md @@ -47,8 +47,6 @@ some configuration as environment variables that can be set. - flowctl - traces http2 flow control - op_failure - traces error information when failure is pushed onto a completion queue - - pending_tags - [debug builds only] traces still-in-progress tags on - completion queues - round_robin - traces the round_robin load balancing policy - glb - traces the grpclb load balancer - queue_pluck @@ -58,6 +56,20 @@ some configuration as environment variables that can be set. - timer - timers (alarms) in the grpc internals - transport_security - traces metadata about secure channel establishment - tcp - traces bytes in and out of a channel + - DEBUG builds only: + * metadata - tracks creation and mutation of metadata + * closure - tracks closure creation, scheduling, and completion + * pending_tags - traces still-in-progress tags on completion queues + * queue_refcount + * error_refcount + * stream_refcount + * workqueue_refcount + * fd_refcount + * auth_context_refcount + * security_connector_refcount + * resolver_refcount + * lb_policy_refcount + * chttp2_refcount 'all' can additionally be used to turn all traces on. Individual traces can be disabled by prefixing them with '-'. -- cgit v1.2.3 From 837375048400372ffb97c06a5da16ec515cdd118 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Fri, 9 Jun 2017 07:27:16 -0700 Subject: Change default for SETTINGS_MAX_HEADER_LIST_SIZE from 16KiB to 8KiB. --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index bdebc8eeec..ca82d4d818 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -52,7 +52,7 @@ #define DEFAULT_CONNECTION_WINDOW_TARGET (1024 * 1024) #define MAX_WINDOW 0x7fffffffu #define MAX_WRITE_BUFFER_SIZE (64 * 1024 * 1024) -#define DEFAULT_MAX_HEADER_LIST_SIZE (16 * 1024) +#define DEFAULT_MAX_HEADER_LIST_SIZE (8 * 1024) #define DEFAULT_CLIENT_KEEPALIVE_TIME_MS INT_MAX #define DEFAULT_CLIENT_KEEPALIVE_TIMEOUT_MS 20000 /* 20 seconds */ -- cgit v1.2.3 From 3bc255818b297b8ba3c7652351de496faff66b6d Mon Sep 17 00:00:00 2001 From: ncteisen Date: Fri, 9 Jun 2017 10:35:35 -0700 Subject: clang fmt --- src/core/ext/filters/client_channel/lb_policy.c | 1 - src/core/ext/filters/client_channel/resolver.c | 20 ++++++++++---------- src/core/lib/iomgr/combiner.c | 12 +++++++----- src/core/lib/iomgr/error.c | 6 +++--- src/core/lib/iomgr/ev_posix.c | 1 - src/core/lib/iomgr/exec_ctx.c | 2 +- src/core/lib/security/context/security_context.c | 3 ++- src/core/lib/security/transport/security_connector.c | 3 ++- src/core/lib/surface/completion_queue.c | 14 ++++++++------ src/core/lib/surface/init.c | 11 +++++++---- src/core/lib/transport/transport.c | 1 - 11 files changed, 40 insertions(+), 34 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy.c b/src/core/ext/filters/client_channel/lb_policy.c index 6fc9b4bc15..dd2fefb412 100644 --- a/src/core/ext/filters/client_channel/lb_policy.c +++ b/src/core/ext/filters/client_channel/lb_policy.c @@ -25,7 +25,6 @@ grpc_tracer_flag grpc_trace_lb_policy_refcount = GRPC_TRACER_INITIALIZER(false); #endif - void grpc_lb_policy_init(grpc_lb_policy *policy, const grpc_lb_policy_vtable *vtable, grpc_combiner *combiner) { diff --git a/src/core/ext/filters/client_channel/resolver.c b/src/core/ext/filters/client_channel/resolver.c index 6a3e82eff6..7d35c05b19 100644 --- a/src/core/ext/filters/client_channel/resolver.c +++ b/src/core/ext/filters/client_channel/resolver.c @@ -32,13 +32,13 @@ void grpc_resolver_init(grpc_resolver *resolver, } #ifndef NDEBUG -void grpc_resolver_ref(grpc_resolver *resolver, - const char *file, int line, const char *reason) { +void grpc_resolver_ref(grpc_resolver *resolver, const char *file, int line, + const char *reason) { if (GRPC_TRACER_ON(grpc_trace_resolver_refcount)) { long old_refs = gpr_atm_no_barrier_load(&resolver->refs.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "RESOLVER:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", - resolver, old_refs, old_refs + 1, - reason); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "RESOLVER:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", resolver, + old_refs, old_refs + 1, reason); } #else void grpc_resolver_ref(grpc_resolver *resolver) { @@ -47,13 +47,13 @@ void grpc_resolver_ref(grpc_resolver *resolver) { } #ifndef NDEBUG -void grpc_resolver_unref(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver, const char *file, - int line, const char *reason) { +void grpc_resolver_unref(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver, + const char *file, int line, const char *reason) { if (GRPC_TRACER_ON(grpc_trace_resolver_refcount)) { long old_refs = gpr_atm_no_barrier_load(&resolver->refs.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "RESOLVER:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", - resolver, old_refs, old_refs - 1, - reason); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "RESOLVER:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", resolver, + old_refs, old_refs - 1, reason); } #else void grpc_resolver_unref(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver) { diff --git a/src/core/lib/iomgr/combiner.c b/src/core/lib/iomgr/combiner.c index ca2e1623ba..5e88aeed10 100644 --- a/src/core/lib/iomgr/combiner.c +++ b/src/core/lib/iomgr/combiner.c @@ -103,11 +103,13 @@ static void start_destroy(grpc_exec_ctx *exec_ctx, grpc_combiner *lock) { } #ifndef NDEBUG -#define GRPC_COMBINER_DEBUG_SPAM(op, delta) \ - if (GRPC_TRACER_ON(grpc_combiner_trace)) { gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, \ - "C:%p %s %" PRIdPTR " --> %" PRIdPTR " %s", lock, (op), \ - gpr_atm_no_barrier_load(&lock->refs.count), \ - gpr_atm_no_barrier_load(&lock->refs.count) + (delta), reason); } +#define GRPC_COMBINER_DEBUG_SPAM(op, delta) \ + if (GRPC_TRACER_ON(grpc_combiner_trace)) { \ + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, \ + "C:%p %s %" PRIdPTR " --> %" PRIdPTR " %s", lock, (op), \ + gpr_atm_no_barrier_load(&lock->refs.count), \ + gpr_atm_no_barrier_load(&lock->refs.count) + (delta), reason); \ + } #else #define GRPC_COMBINER_DEBUG_SPAM(op, delta) #endif diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index d8fd92f89a..b0cc61a43f 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -127,9 +127,9 @@ bool grpc_error_is_special(grpc_error *err) { grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line) { if (grpc_error_is_special(err)) return err; if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { - gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d]", err, - gpr_atm_no_barrier_load(&err->atomics.refs.count), - gpr_atm_no_barrier_load(&err->atomics.refs.count) + 1, file, line); + gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d]", err, + gpr_atm_no_barrier_load(&err->atomics.refs.count), + gpr_atm_no_barrier_load(&err->atomics.refs.count) + 1, file, line); } gpr_ref(&err->atomics.refs); return err; diff --git a/src/core/lib/iomgr/ev_posix.c b/src/core/lib/iomgr/ev_posix.c index a43763e92a..54960d1ecc 100644 --- a/src/core/lib/iomgr/ev_posix.c +++ b/src/core/lib/iomgr/ev_posix.c @@ -38,7 +38,6 @@ #include "src/core/lib/iomgr/ev_poll_posix.h" #include "src/core/lib/support/env.h" - grpc_tracer_flag grpc_polling_trace = GRPC_TRACER_INITIALIZER(false); /* Disabled by default */ diff --git a/src/core/lib/iomgr/exec_ctx.c b/src/core/lib/iomgr/exec_ctx.c index ad856295e7..a2bd71ea9b 100644 --- a/src/core/lib/iomgr/exec_ctx.c +++ b/src/core/lib/iomgr/exec_ctx.c @@ -88,7 +88,7 @@ static void exec_ctx_run(grpc_exec_ctx *exec_ctx, grpc_closure *closure, #ifdef GRPC_CLOSURE_RICH_DEBUG closure->scheduled = false; if (GRPC_TRACER_ON(grpc_trace_closure)) { - gpr_log(GPR_DEBUG, "running closure %p: created [%s:%d]: %s [%s:%d]", + gpr_log(GPR_DEBUG, "running closure %p: created [%s:%d]: %s [%s:%d]", closure, closure->file_created, closure->line_created, closure->run ? "run" : "scheduled", closure->file_initiated, closure->line_initiated); diff --git a/src/core/lib/security/context/security_context.c b/src/core/lib/security/context/security_context.c index 9d95d48057..e7c3dd45c8 100644 --- a/src/core/lib/security/context/security_context.c +++ b/src/core/lib/security/context/security_context.c @@ -29,7 +29,8 @@ #include #ifndef NDEBUG -grpc_tracer_flag grpc_trace_auth_context_refcount = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_auth_context_refcount = + GRPC_TRACER_INITIALIZER(false); #endif /* --- grpc_call --- */ diff --git a/src/core/lib/security/transport/security_connector.c b/src/core/lib/security/transport/security_connector.c index 662b6449ba..5d879e9935 100644 --- a/src/core/lib/security/transport/security_connector.c +++ b/src/core/lib/security/transport/security_connector.c @@ -44,7 +44,8 @@ #include "src/core/tsi/transport_security_adapter.h" #ifndef NDEBUG -grpc_tracer_flag grpc_trace_security_connector_refcount = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_security_connector_refcount = + GRPC_TRACER_INITIALIZER(false); #endif /* -- Constants. -- */ diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index f008d7b83c..b04aee6c73 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -444,8 +444,9 @@ void grpc_cq_internal_ref(grpc_completion_queue *cc, const char *reason, cq_data *cqd = &cc->data; if (GRPC_TRACER_ON(grpc_trace_cq_refcount)) { gpr_atm val = gpr_atm_no_barrier_load(&cqd->owning_refs.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "CQ:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", cc, - val, val + 1, reason); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "CQ:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", cc, val, val + 1, + reason); } #else void grpc_cq_internal_ref(grpc_completion_queue *cc) { @@ -461,13 +462,14 @@ static void on_pollset_shutdown_done(grpc_exec_ctx *exec_ctx, void *arg, } #ifndef NDEBUG -void grpc_cq_internal_unref(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc, const char *reason, - const char *file, int line) { +void grpc_cq_internal_unref(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc, + const char *reason, const char *file, int line) { cq_data *cqd = &cc->data; if (GRPC_TRACER_ON(grpc_trace_cq_refcount)) { gpr_atm val = gpr_atm_no_barrier_load(&cqd->owning_refs.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "CQ:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", cc, - val, val - 1, reason); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "CQ:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", cc, val, val - 1, + reason); } #else void grpc_cq_internal_unref(grpc_exec_ctx *exec_ctx, diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index 1ec54dd2cd..731aa4aba9 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -132,11 +132,12 @@ void grpc_init(void) { grpc_register_tracer("channel_stack_builder", &grpc_trace_channel_stack_builder); grpc_register_tracer("http1", &grpc_http1_trace); - grpc_register_tracer("queue_pluck", &grpc_cq_pluck_trace); // default on + grpc_register_tracer("queue_pluck", &grpc_cq_pluck_trace); // default on grpc_register_tracer("combiner", &grpc_combiner_trace); grpc_register_tracer("server_channel", &grpc_server_channel_trace); grpc_register_tracer("bdp_estimator", &grpc_bdp_estimator_trace); - grpc_register_tracer("queue_timeout", &grpc_cq_event_timeout_trace); // default on + grpc_register_tracer("queue_timeout", + &grpc_cq_event_timeout_trace); // default on grpc_register_tracer("op_failure", &grpc_trace_operation_failures); grpc_register_tracer("resource_quota", &grpc_resource_quota_trace); grpc_register_tracer("call_error", &grpc_call_error_trace); @@ -147,8 +148,10 @@ void grpc_init(void) { grpc_register_tracer("error_refcount", &grpc_trace_error_refcount); grpc_register_tracer("stream_refcount", &grpc_trace_stream_refcount); // TODO(ncteisen): fix this after rebase - // grpc_register_tracer("auth_context_refcount", &grpc_trace_auth_context_refcount); - // grpc_register_tracer("security_connector_refcount", &grpc_trace_security_connector_refcount); + // grpc_register_tracer("auth_context_refcount", + // &grpc_trace_auth_context_refcount); + // grpc_register_tracer("security_connector_refcount", + // &grpc_trace_security_connector_refcount); grpc_register_tracer("fd_refcount", &grpc_trace_fd_refcount); grpc_register_tracer("metadata", &grpc_trace_metadata); #endif diff --git a/src/core/lib/transport/transport.c b/src/core/lib/transport/transport.c index 4d7b942da9..52725846e6 100644 --- a/src/core/lib/transport/transport.c +++ b/src/core/lib/transport/transport.c @@ -31,7 +31,6 @@ #include "src/core/lib/support/string.h" #include "src/core/lib/transport/transport_impl.h" - #ifndef NDEBUG grpc_tracer_flag grpc_trace_stream_refcount = GRPC_TRACER_INITIALIZER(false); #endif -- cgit v1.2.3 From bf91d9bbf74c8b923d41643868adbd2105954e81 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 9 Jun 2017 13:04:28 -0700 Subject: Node: add test for reconnecting client after server restart --- src/node/test/surface_test.js | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index f8eaf62aaf..11577e797d 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -1378,3 +1378,50 @@ describe('Cancelling surface client', function() { call.cancel(); }); }); +describe('Client reconnect', function() { + var server; + var Client; + var client; + var port; + beforeEach(function() { + var test_proto = ProtoBuf.loadProtoFile(__dirname + '/echo_service.proto'); + var echo_service = test_proto.lookup('EchoService'); + Client = grpc.loadObject(echo_service); + server = new grpc.Server(); + server.addService(Client.service, { + echo: function(call, callback) { + callback(null, call.request); + } + }); + port = server.bind('localhost:0', server_insecure_creds); + client = new Client('localhost:' + port, grpc.credentials.createInsecure()); + server.start(); + }); + afterEach(function() { + server.forceShutdown(); + }); + it('should reconnect after server restart', function(done) { + client.echo({value: 'test value', value2: 3}, function(error, response) { + assert.ifError(error); + assert.deepEqual(response, {value: 'test value', value2: 3}); + server.tryShutdown(function() { + server = new grpc.Server(); + server.addService(Client.service, { + echo: function(call, callback) { + callback(null, call.request); + } + }); + server.bind('localhost:' + port, server_insecure_creds); + server.start(); + client.echo(undefined, function(error, response) { + if (error) { + console.log(error); + } + assert.ifError(error); + assert.deepEqual(response, {value: '', value2: 0}); + done(); + }); + }); + }); + }); +}); -- cgit v1.2.3 From 9f639871cc26b7f5bfb87fc8951c2249977913e5 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 9 Jun 2017 14:19:35 -0700 Subject: s/CURRENT_TIMESTAMP/_DATE/ in BQ, for caching --- tools/run_tests/run_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 35fe42c6b7..7bb668ac62 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -81,7 +81,7 @@ def get_flaky_tests(limit=None): FROM [grpc-testing:jenkins_test_results.aggregate_results] WHERE - timestamp >= DATE_ADD(DATE(CURRENT_TIMESTAMP()), -1, "WEEK") + timestamp >= DATE_ADD(CURRENT_DATE(), -1, "WEEK") AND NOT REGEXP_MATCH(job_name, '.*portability.*') AND REGEXP_MATCH(job_name, '.*master.*') GROUP BY -- cgit v1.2.3 From f8061e88eaee4973ceb82319cdb987741534dd8f Mon Sep 17 00:00:00 2001 From: ncteisen Date: Fri, 9 Jun 2017 10:44:42 -0700 Subject: Fix compile. WIP probably --- src/core/lib/iomgr/combiner.c | 4 ++-- src/core/lib/iomgr/ev_epollsig_linux.c | 7 ++----- src/core/lib/iomgr/ev_poll_posix.c | 4 ---- src/core/lib/iomgr/ev_posix.c | 4 ++++ src/core/lib/iomgr/ev_posix.h | 4 ---- src/core/lib/iomgr/exec_ctx.c | 4 ++-- src/core/lib/iomgr/executor.c | 2 +- src/core/lib/iomgr/pollset.h | 4 ++++ src/core/lib/iomgr/pollset_uv.c | 4 ++++ src/core/lib/iomgr/pollset_windows.c | 4 ++++ src/core/lib/iomgr/tcp_windows.c | 2 +- src/core/lib/surface/init.c | 11 ----------- 12 files changed, 24 insertions(+), 30 deletions(-) diff --git a/src/core/lib/iomgr/combiner.c b/src/core/lib/iomgr/combiner.c index 5e88aeed10..7f9c5d837f 100644 --- a/src/core/lib/iomgr/combiner.c +++ b/src/core/lib/iomgr/combiner.c @@ -249,7 +249,7 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx) { GPR_TIMER_BEGIN("combiner.exec1", 0); grpc_closure *cl = (grpc_closure *)n; grpc_error *cl_err = cl->error_data.error; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG cl->scheduled = false; #endif cl->cb(exec_ctx, cl->cb_arg, cl_err); @@ -266,7 +266,7 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx) { gpr_log(GPR_DEBUG, "C:%p execute_final[%d] c=%p", lock, loops, c)); grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG c->scheduled = false; #endif c->cb(exec_ctx, c->cb_arg, error); diff --git a/src/core/lib/iomgr/ev_epollsig_linux.c b/src/core/lib/iomgr/ev_epollsig_linux.c index b1eaf6a4f2..9508e6ffb6 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.c +++ b/src/core/lib/iomgr/ev_epollsig_linux.c @@ -49,9 +49,6 @@ #define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker *)1) -#ifndef NDEBUG -grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); -#endif #define GRPC_POLLING_TRACE(...) \ if (GRPC_TRACER_ON(grpc_polling_trace)) { \ @@ -292,7 +289,7 @@ static void pi_unref(grpc_exec_ctx *exec_ctx, polling_island *pi); #ifndef NDEBUG static void pi_add_ref_dbg(polling_island *pi, const char *reason, const char *file, int line) { - if (GRPC_TRACER_ON(grpc_trace_workqueue_refcount)) { + if (GRPC_TRACER_ON(grpc_polling_trace)) { long old_cnt = gpr_atm_acq_load(&pi->ref_count); gpr_log(GPR_DEBUG, "Add ref pi: %p, old: %ld -> new:%ld (%s) - (%s, %d)", (void *)pi, old_cnt, old_cnt + 1, reason, file, line); @@ -302,7 +299,7 @@ static void pi_add_ref_dbg(polling_island *pi, const char *reason, static void pi_unref_dbg(grpc_exec_ctx *exec_ctx, polling_island *pi, const char *reason, const char *file, int line) { - if (GRPC_TRACER_ON(grpc_trace_workqueue_refcount)) { + if (GRPC_TRACER_ON(grpc_polling_trace)) { long old_cnt = gpr_atm_acq_load(&pi->ref_count); gpr_log(GPR_DEBUG, "Unref pi: %p, old:%ld -> new:%ld (%s) - (%s, %d)", (void *)pi, old_cnt, (old_cnt - 1), reason, file, line); diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index 4d2ecd6300..57d0ca254f 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -45,10 +45,6 @@ #define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker *)1) -#ifndef NDEBUG -grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); -#endif - /******************************************************************************* * FD declarations */ diff --git a/src/core/lib/iomgr/ev_posix.c b/src/core/lib/iomgr/ev_posix.c index 54960d1ecc..668407b4ce 100644 --- a/src/core/lib/iomgr/ev_posix.c +++ b/src/core/lib/iomgr/ev_posix.c @@ -41,6 +41,10 @@ grpc_tracer_flag grpc_polling_trace = GRPC_TRACER_INITIALIZER(false); /* Disabled by default */ +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + /** Default poll() function - a pointer so that it can be overridden by some * tests */ grpc_poll_function_type grpc_poll_function = poll; diff --git a/src/core/lib/iomgr/ev_posix.h b/src/core/lib/iomgr/ev_posix.h index 7f0a21be86..54c4f2ee11 100644 --- a/src/core/lib/iomgr/ev_posix.h +++ b/src/core/lib/iomgr/ev_posix.h @@ -29,10 +29,6 @@ extern grpc_tracer_flag grpc_polling_trace; /* Disabled by default */ -#ifndef NDEBUG -extern grpc_tracer_flag grpc_trace_fd_refcount; -#endif - typedef struct grpc_fd grpc_fd; typedef struct grpc_event_engine_vtable { diff --git a/src/core/lib/iomgr/exec_ctx.c b/src/core/lib/iomgr/exec_ctx.c index a2bd71ea9b..833170ceed 100644 --- a/src/core/lib/iomgr/exec_ctx.c +++ b/src/core/lib/iomgr/exec_ctx.c @@ -62,7 +62,7 @@ bool grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx) { grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; did_something = true; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG c->scheduled = false; #endif c->cb(exec_ctx, c->cb_arg, error); @@ -85,7 +85,7 @@ void grpc_exec_ctx_finish(grpc_exec_ctx *exec_ctx) { static void exec_ctx_run(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error) { -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG closure->scheduled = false; if (GRPC_TRACER_ON(grpc_trace_closure)) { gpr_log(GPR_DEBUG, "running closure %p: created [%s:%d]: %s [%s:%d]", diff --git a/src/core/lib/iomgr/executor.c b/src/core/lib/iomgr/executor.c index fda274e797..7621a7fe75 100644 --- a/src/core/lib/iomgr/executor.c +++ b/src/core/lib/iomgr/executor.c @@ -58,7 +58,7 @@ static size_t run_closures(grpc_exec_ctx *exec_ctx, grpc_closure_list list) { while (c != NULL) { grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG c->scheduled = false; #endif c->cb(exec_ctx, c->cb_arg, error); diff --git a/src/core/lib/iomgr/pollset.h b/src/core/lib/iomgr/pollset.h index 3ff878e596..a609a3877a 100644 --- a/src/core/lib/iomgr/pollset.h +++ b/src/core/lib/iomgr/pollset.h @@ -25,6 +25,10 @@ #include "src/core/lib/iomgr/exec_ctx.h" +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_fd_refcount; +#endif + /* A grpc_pollset is a set of file descriptors that a higher level item is interested in. For example: - a server will typically keep a pollset containing all connected channels, diff --git a/src/core/lib/iomgr/pollset_uv.c b/src/core/lib/iomgr/pollset_uv.c index 07c7c04559..034b7ff270 100644 --- a/src/core/lib/iomgr/pollset_uv.c +++ b/src/core/lib/iomgr/pollset_uv.c @@ -20,6 +20,10 @@ #ifdef GRPC_UV +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + #include #include diff --git a/src/core/lib/iomgr/pollset_windows.c b/src/core/lib/iomgr/pollset_windows.c index d5a03732cb..1bfc2a22a8 100644 --- a/src/core/lib/iomgr/pollset_windows.c +++ b/src/core/lib/iomgr/pollset_windows.c @@ -30,6 +30,10 @@ #define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker *)1) +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + gpr_mu grpc_polling_mu; static grpc_pollset_worker *g_active_poller; static grpc_pollset_worker g_global_root_worker; diff --git a/src/core/lib/iomgr/tcp_windows.c b/src/core/lib/iomgr/tcp_windows.c index 2312b5b86a..6704a158ce 100644 --- a/src/core/lib/iomgr/tcp_windows.c +++ b/src/core/lib/iomgr/tcp_windows.c @@ -48,7 +48,7 @@ #define GRPC_FIONBIO FIONBIO #endif -int grpc_tcp_trace = 0; +grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false); static grpc_error *set_non_block(SOCKET sock) { int status; diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index 731aa4aba9..14a86bfa0a 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -47,12 +47,6 @@ #include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/transport/transport_impl.h" -#ifndef NDEBUG -#include "src/core/lib/iomgr/ev_posix.h" -#include "src/core/lib/security/context/security_context.h" -#include "src/core/lib/security/transport/security_connector.h" -#endif - /* (generated) built in registry of plugins */ extern void grpc_register_built_in_plugins(void); @@ -147,11 +141,6 @@ void grpc_init(void) { grpc_register_tracer("closure", &grpc_trace_closure); grpc_register_tracer("error_refcount", &grpc_trace_error_refcount); grpc_register_tracer("stream_refcount", &grpc_trace_stream_refcount); - // TODO(ncteisen): fix this after rebase - // grpc_register_tracer("auth_context_refcount", - // &grpc_trace_auth_context_refcount); - // grpc_register_tracer("security_connector_refcount", - // &grpc_trace_security_connector_refcount); grpc_register_tracer("fd_refcount", &grpc_trace_fd_refcount); grpc_register_tracer("metadata", &grpc_trace_metadata); #endif -- cgit v1.2.3 From 1d8e46559bc109e3108063e98e48e8011d552958 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Mon, 12 Jun 2017 13:18:17 -0700 Subject: fixes #11473 --- third_party/cares/cares.BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/third_party/cares/cares.BUILD b/third_party/cares/cares.BUILD index 3583720ef3..978e9b1ed9 100644 --- a/third_party/cares/cares.BUILD +++ b/third_party/cares/cares.BUILD @@ -78,6 +78,7 @@ cc_library( "cares/ares_version.h", "cares/bitncmp.h", "cares/config-win32.h", + "cares/nameser.h", "cares/setup_once.h", ] + select({ ":darwin": ["config_darwin/ares_config.h"], -- cgit v1.2.3 From 8f596ae2cdb3d3bc2a4c1885467df91cfd01f841 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 13 Jun 2017 10:41:11 -0700 Subject: Change bound port to get Node distrib tests to work again --- test/distrib/node/run_distrib_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/distrib/node/run_distrib_test.sh b/test/distrib/node/run_distrib_test.sh index d429eb27e1..4bd02112fe 100755 --- a/test/distrib/node/run_distrib_test.sh +++ b/test/distrib/node/run_distrib_test.sh @@ -49,8 +49,8 @@ npm install -g node-static STATIC_SERVER=127.0.0.1 # If port_server is running, get port from that. Otherwise, assume we're in -# docker and use 8080 -STATIC_PORT=$(curl 'localhost:32767/get' || echo '8080') +# docker and use 12345 +STATIC_PORT=$(curl 'localhost:32767/get' || echo '12345') # Serves the input_artifacts directory statically at localhost: static "$EXTERNAL_GIT_ROOT/input_artifacts" -a $STATIC_SERVER -p $STATIC_PORT & -- cgit v1.2.3 From 973863d466a03e5438b97bdbafc529aafaacc004 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Mon, 12 Jun 2017 10:28:50 -0700 Subject: Fix some type warning --- src/core/ext/filters/client_channel/resolver.c | 4 ++-- src/core/lib/iomgr/error.c | 1 + src/core/lib/iomgr/ev_epollsig_linux.c | 11 ++++++----- src/core/lib/iomgr/ev_poll_posix.c | 4 +--- src/core/lib/iomgr/pollset_uv.c | 10 ++++++---- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/core/ext/filters/client_channel/resolver.c b/src/core/ext/filters/client_channel/resolver.c index 7d35c05b19..de9a8ce41b 100644 --- a/src/core/ext/filters/client_channel/resolver.c +++ b/src/core/ext/filters/client_channel/resolver.c @@ -35,7 +35,7 @@ void grpc_resolver_init(grpc_resolver *resolver, void grpc_resolver_ref(grpc_resolver *resolver, const char *file, int line, const char *reason) { if (GRPC_TRACER_ON(grpc_trace_resolver_refcount)) { - long old_refs = gpr_atm_no_barrier_load(&resolver->refs.count); + gpr_atm old_refs = gpr_atm_no_barrier_load(&resolver->refs.count); gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "RESOLVER:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", resolver, old_refs, old_refs + 1, reason); @@ -50,7 +50,7 @@ void grpc_resolver_ref(grpc_resolver *resolver) { void grpc_resolver_unref(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver, const char *file, int line, const char *reason) { if (GRPC_TRACER_ON(grpc_trace_resolver_refcount)) { - long old_refs = gpr_atm_no_barrier_load(&resolver->refs.count); + gpr_atm old_refs = gpr_atm_no_barrier_load(&resolver->refs.count); gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "RESOLVER:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", resolver, old_refs, old_refs - 1, reason); diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index b0cc61a43f..a95929a1fb 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -30,6 +30,7 @@ #include #endif +#include "src/core/lib/debug/trace.h" #include "src/core/lib/iomgr/error_internal.h" #include "src/core/lib/profiling/timers.h" #include "src/core/lib/slice/slice_internal.h" diff --git a/src/core/lib/iomgr/ev_epollsig_linux.c b/src/core/lib/iomgr/ev_epollsig_linux.c index 9508e6ffb6..a822560ab9 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.c +++ b/src/core/lib/iomgr/ev_epollsig_linux.c @@ -49,7 +49,6 @@ #define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker *)1) - #define GRPC_POLLING_TRACE(...) \ if (GRPC_TRACER_ON(grpc_polling_trace)) { \ gpr_log(GPR_INFO, __VA_ARGS__); \ @@ -729,8 +728,9 @@ static gpr_mu fd_freelist_mu; static void ref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { - gpr_log(GPR_DEBUG, "FD %d %p ref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_log(GPR_DEBUG, + "FD %d %p ref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); } #else @@ -745,8 +745,9 @@ static void ref_by(grpc_fd *fd, int n) { static void unref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { - gpr_log(GPR_DEBUG, "FD %d %p unref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_log(GPR_DEBUG, + "FD %d %p unref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); } #else diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index 57d0ca254f..81158669d3 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -290,8 +290,7 @@ static void unref_by(grpc_fd *fd, int n, const char *reason, const char *file, #else static void unref_by(grpc_fd *fd, int n) { #endif - gpr_atm old; - old = gpr_atm_full_fetch_add(&fd->refst, -n); + gpr_atm old = gpr_atm_full_fetch_add(&fd->refst, -n); if (old == n) { gpr_mu_destroy(&fd->mu); grpc_iomgr_unregister_object(&fd->iomgr_object); @@ -1275,7 +1274,6 @@ static void pollset_set_del_fd(grpc_exec_ctx *exec_ctx, } /******************************************************************************* - * Condition Variable polling extensions */ diff --git a/src/core/lib/iomgr/pollset_uv.c b/src/core/lib/iomgr/pollset_uv.c index 034b7ff270..1a54065a91 100644 --- a/src/core/lib/iomgr/pollset_uv.c +++ b/src/core/lib/iomgr/pollset_uv.c @@ -20,10 +20,6 @@ #ifdef GRPC_UV -#ifndef NDEBUG -grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); -#endif - #include #include @@ -35,6 +31,12 @@ grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/iomgr/pollset_uv.h" +#include "src/core/lib/debug/trace.h" + +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + struct grpc_pollset { uv_timer_t timer; int shutting_down; -- cgit v1.2.3 From f8d6fb7a94f3ff57f01322f87c34a48667f124ae Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Thu, 15 Jun 2017 17:32:49 -0700 Subject: Update boringssl --- Makefile | 788 ++++----------------- binding.gyp | 38 +- config.m4 | 24 +- config.w32 | 22 +- grpc.gemspec | 29 +- package.xml | 29 +- setup.py | 6 +- src/boringssl/err_data.c | 536 +++++++------- src/python/grpcio/grpc_core_dependencies.py | 22 +- templates/Makefile.template | 3 + templates/binding.gyp.template | 16 +- third_party/boringssl | 2 +- third_party/rake-compiler-dock/Dockerfile | 2 + tools/run_tests/artifacts/build_artifact_node.bat | 4 +- tools/run_tests/artifacts/build_artifact_node.sh | 4 +- tools/run_tests/generated/sources_and_headers.json | 255 +------ tools/run_tests/generated/tests.json | 256 +------ tools/run_tests/sanity/check_submodules.sh | 2 +- tools/ubsan_suppressions.txt | 1 + vsprojects/vcxproj/boringssl/boringssl.vcxproj | 47 +- .../vcxproj/boringssl/boringssl.vcxproj.filters | 87 ++- .../boringssl_chacha_test.vcxproj | 198 ------ .../boringssl_chacha_test.vcxproj.filters | 7 - .../boringssl_chacha_test_lib.vcxproj | 170 ----- .../boringssl_chacha_test_lib.vcxproj.filters | 24 - .../boringssl_constant_time_test_lib.vcxproj | 2 +- ...oringssl_constant_time_test_lib.vcxproj.filters | 2 +- .../boringssl_dh_test/boringssl_dh_test.vcxproj | 198 ------ .../boringssl_dh_test.vcxproj.filters | 7 - .../boringssl_dh_test_lib.vcxproj | 170 ----- .../boringssl_dh_test_lib.vcxproj.filters | 24 - .../boringssl_dsa_test/boringssl_dsa_test.vcxproj | 198 ------ .../boringssl_dsa_test.vcxproj.filters | 7 - .../boringssl_dsa_test_lib.vcxproj | 170 ----- .../boringssl_dsa_test_lib.vcxproj.filters | 24 - .../boringssl_ec_test/boringssl_ec_test.vcxproj | 198 ------ .../boringssl_ec_test.vcxproj.filters | 7 - .../boringssl_ec_test_lib.vcxproj | 170 ----- .../boringssl_ec_test_lib.vcxproj.filters | 24 - .../boringssl_err_test/boringssl_err_test.vcxproj | 198 ------ .../boringssl_err_test.vcxproj.filters | 7 - .../boringssl_err_test_lib.vcxproj | 170 ----- .../boringssl_err_test_lib.vcxproj.filters | 24 - .../boringssl_hkdf_test_lib.vcxproj | 2 +- .../boringssl_hkdf_test_lib.vcxproj.filters | 2 +- .../boringssl_lhash_test_lib.vcxproj | 2 +- .../boringssl_lhash_test_lib.vcxproj.filters | 2 +- .../boringssl_newhope_statistical_test.vcxproj | 198 ------ ...ingssl_newhope_statistical_test.vcxproj.filters | 7 - .../boringssl_newhope_statistical_test_lib.vcxproj | 170 ----- ...sl_newhope_statistical_test_lib.vcxproj.filters | 24 - .../boringssl_newhope_test.vcxproj | 198 ------ .../boringssl_newhope_test.vcxproj.filters | 7 - .../boringssl_newhope_test_lib.vcxproj | 170 ----- .../boringssl_newhope_test_lib.vcxproj.filters | 24 - .../boringssl_newhope_vectors_test.vcxproj | 198 ------ .../boringssl_newhope_vectors_test.vcxproj.filters | 7 - .../boringssl_newhope_vectors_test_lib.vcxproj | 170 ----- ...ingssl_newhope_vectors_test_lib.vcxproj.filters | 24 - .../boringssl_p256-x86_64_test.vcxproj | 198 ++++++ .../boringssl_p256-x86_64_test.vcxproj.filters | 7 + .../boringssl_p256-x86_64_test_lib.vcxproj | 170 +++++ .../boringssl_p256-x86_64_test_lib.vcxproj.filters | 24 + .../boringssl_pool_test.vcxproj | 198 ++++++ .../boringssl_pool_test.vcxproj.filters | 7 + .../boringssl_pool_test_lib.vcxproj | 170 +++++ .../boringssl_pool_test_lib.vcxproj.filters | 24 + .../boringssl_refcount_test_lib.vcxproj | 2 +- .../boringssl_refcount_test_lib.vcxproj.filters | 2 +- .../boringssl_rsa_test/boringssl_rsa_test.vcxproj | 198 ------ .../boringssl_rsa_test.vcxproj.filters | 7 - .../boringssl_rsa_test_lib.vcxproj | 170 ----- .../boringssl_rsa_test_lib.vcxproj.filters | 24 - .../boringssl_ssl_test/boringssl_ssl_test.vcxproj | 198 ------ .../boringssl_ssl_test.vcxproj.filters | 7 - .../boringssl_ssl_test_lib.vcxproj | 170 ----- .../boringssl_ssl_test_lib.vcxproj.filters | 21 - 77 files changed, 1445 insertions(+), 5529 deletions(-) delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_dh_test/boringssl_dh_test.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_dh_test/boringssl_dh_test.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test/boringssl_p256-x86_64_test.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test/boringssl_p256-x86_64_test.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_pool_test/boringssl_pool_test.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_pool_test/boringssl_pool_test.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj.filters delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj delete mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj.filters diff --git a/Makefile b/Makefile index 75f75da324..28a76accb1 100644 --- a/Makefile +++ b/Makefile @@ -324,6 +324,9 @@ HOST_LDXX ?= $(LDXX) CFLAGS += -std=c99 -Wsign-conversion -Wconversion $(W_SHADOW) $(W_EXTRA_SEMI) CXXFLAGS += -std=c++11 +ifeq ($(SYSTEM),Darwin) +CXXFLAGS += -stdlib=libc++ +endif CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -DOSATOMIC_USE_INLINED=1 LDFLAGS += -g @@ -1177,7 +1180,6 @@ boringssl_base64_test: $(BINDIR)/$(CONFIG)/boringssl_base64_test boringssl_bio_test: $(BINDIR)/$(CONFIG)/boringssl_bio_test boringssl_bn_test: $(BINDIR)/$(CONFIG)/boringssl_bn_test boringssl_bytestring_test: $(BINDIR)/$(CONFIG)/boringssl_bytestring_test -boringssl_chacha_test: $(BINDIR)/$(CONFIG)/boringssl_chacha_test boringssl_aead_test: $(BINDIR)/$(CONFIG)/boringssl_aead_test boringssl_cipher_test: $(BINDIR)/$(CONFIG)/boringssl_cipher_test boringssl_cmac_test: $(BINDIR)/$(CONFIG)/boringssl_cmac_test @@ -1185,16 +1187,13 @@ boringssl_constant_time_test: $(BINDIR)/$(CONFIG)/boringssl_constant_time_test boringssl_ed25519_test: $(BINDIR)/$(CONFIG)/boringssl_ed25519_test boringssl_spake25519_test: $(BINDIR)/$(CONFIG)/boringssl_spake25519_test boringssl_x25519_test: $(BINDIR)/$(CONFIG)/boringssl_x25519_test -boringssl_dh_test: $(BINDIR)/$(CONFIG)/boringssl_dh_test boringssl_digest_test: $(BINDIR)/$(CONFIG)/boringssl_digest_test -boringssl_dsa_test: $(BINDIR)/$(CONFIG)/boringssl_dsa_test -boringssl_ec_test: $(BINDIR)/$(CONFIG)/boringssl_ec_test boringssl_example_mul: $(BINDIR)/$(CONFIG)/boringssl_example_mul +boringssl_p256-x86_64_test: $(BINDIR)/$(CONFIG)/boringssl_p256-x86_64_test boringssl_ecdh_test: $(BINDIR)/$(CONFIG)/boringssl_ecdh_test boringssl_ecdsa_sign_test: $(BINDIR)/$(CONFIG)/boringssl_ecdsa_sign_test boringssl_ecdsa_test: $(BINDIR)/$(CONFIG)/boringssl_ecdsa_test boringssl_ecdsa_verify_test: $(BINDIR)/$(CONFIG)/boringssl_ecdsa_verify_test -boringssl_err_test: $(BINDIR)/$(CONFIG)/boringssl_err_test boringssl_evp_extra_test: $(BINDIR)/$(CONFIG)/boringssl_evp_extra_test boringssl_evp_test: $(BINDIR)/$(CONFIG)/boringssl_evp_test boringssl_pbkdf_test: $(BINDIR)/$(CONFIG)/boringssl_pbkdf_test @@ -1202,21 +1201,17 @@ boringssl_hkdf_test: $(BINDIR)/$(CONFIG)/boringssl_hkdf_test boringssl_hmac_test: $(BINDIR)/$(CONFIG)/boringssl_hmac_test boringssl_lhash_test: $(BINDIR)/$(CONFIG)/boringssl_lhash_test boringssl_gcm_test: $(BINDIR)/$(CONFIG)/boringssl_gcm_test -boringssl_newhope_statistical_test: $(BINDIR)/$(CONFIG)/boringssl_newhope_statistical_test -boringssl_newhope_test: $(BINDIR)/$(CONFIG)/boringssl_newhope_test -boringssl_newhope_vectors_test: $(BINDIR)/$(CONFIG)/boringssl_newhope_vectors_test boringssl_obj_test: $(BINDIR)/$(CONFIG)/boringssl_obj_test boringssl_pkcs12_test: $(BINDIR)/$(CONFIG)/boringssl_pkcs12_test boringssl_pkcs8_test: $(BINDIR)/$(CONFIG)/boringssl_pkcs8_test boringssl_poly1305_test: $(BINDIR)/$(CONFIG)/boringssl_poly1305_test +boringssl_pool_test: $(BINDIR)/$(CONFIG)/boringssl_pool_test boringssl_refcount_test: $(BINDIR)/$(CONFIG)/boringssl_refcount_test -boringssl_rsa_test: $(BINDIR)/$(CONFIG)/boringssl_rsa_test boringssl_thread_test: $(BINDIR)/$(CONFIG)/boringssl_thread_test boringssl_pkcs7_test: $(BINDIR)/$(CONFIG)/boringssl_pkcs7_test boringssl_x509_test: $(BINDIR)/$(CONFIG)/boringssl_x509_test boringssl_tab_test: $(BINDIR)/$(CONFIG)/boringssl_tab_test boringssl_v3name_test: $(BINDIR)/$(CONFIG)/boringssl_v3name_test -boringssl_ssl_test: $(BINDIR)/$(CONFIG)/boringssl_ssl_test badreq_bad_client_test: $(BINDIR)/$(CONFIG)/badreq_bad_client_test connection_prefix_bad_client_test: $(BINDIR)/$(CONFIG)/connection_prefix_bad_client_test head_of_line_blocking_bad_client_test: $(BINDIR)/$(CONFIG)/head_of_line_blocking_bad_client_test @@ -1328,7 +1323,7 @@ pc_cxx: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc ifeq ($(EMBED_OPENSSL),true) -privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_proto_reflection_desc_db.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libhttp2_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_client_helper.a $(LIBDIR)/$(CONFIG)/libinterop_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_server_helper.a $(LIBDIR)/$(CONFIG)/libinterop_server_lib.a $(LIBDIR)/$(CONFIG)/libinterop_server_main.a $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl_aes_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_asn1_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_base64_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bio_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bn_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bytestring_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_aead_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cipher_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ed25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_spake25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_digest_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_sign_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_verify_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_extra_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pbkdf_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_hmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_gcm_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_obj_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs12_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs8_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_poly1305_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x509_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a $(LIBDIR)/$(CONFIG)/libbenchmark.a +privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_proto_reflection_desc_db.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libhttp2_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_client_helper.a $(LIBDIR)/$(CONFIG)/libinterop_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_server_helper.a $(LIBDIR)/$(CONFIG)/libinterop_server_lib.a $(LIBDIR)/$(CONFIG)/libinterop_server_main.a $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl_aes_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_asn1_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_base64_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bio_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bn_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bytestring_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_aead_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cipher_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_constant_time_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ed25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_spake25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_digest_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_sign_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_verify_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_extra_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pbkdf_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_hkdf_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_hmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_lhash_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_gcm_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_obj_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs12_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs8_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_poly1305_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x509_test_lib.a $(LIBDIR)/$(CONFIG)/libbenchmark.a else privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_proto_reflection_desc_db.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libhttp2_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_client_helper.a $(LIBDIR)/$(CONFIG)/libinterop_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_server_helper.a $(LIBDIR)/$(CONFIG)/libinterop_server_lib.a $(LIBDIR)/$(CONFIG)/libinterop_server_main.a $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libbenchmark.a endif @@ -1607,7 +1602,6 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/boringssl_bio_test \ $(BINDIR)/$(CONFIG)/boringssl_bn_test \ $(BINDIR)/$(CONFIG)/boringssl_bytestring_test \ - $(BINDIR)/$(CONFIG)/boringssl_chacha_test \ $(BINDIR)/$(CONFIG)/boringssl_aead_test \ $(BINDIR)/$(CONFIG)/boringssl_cipher_test \ $(BINDIR)/$(CONFIG)/boringssl_cmac_test \ @@ -1615,16 +1609,13 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/boringssl_ed25519_test \ $(BINDIR)/$(CONFIG)/boringssl_spake25519_test \ $(BINDIR)/$(CONFIG)/boringssl_x25519_test \ - $(BINDIR)/$(CONFIG)/boringssl_dh_test \ $(BINDIR)/$(CONFIG)/boringssl_digest_test \ - $(BINDIR)/$(CONFIG)/boringssl_dsa_test \ - $(BINDIR)/$(CONFIG)/boringssl_ec_test \ $(BINDIR)/$(CONFIG)/boringssl_example_mul \ + $(BINDIR)/$(CONFIG)/boringssl_p256-x86_64_test \ $(BINDIR)/$(CONFIG)/boringssl_ecdh_test \ $(BINDIR)/$(CONFIG)/boringssl_ecdsa_sign_test \ $(BINDIR)/$(CONFIG)/boringssl_ecdsa_test \ $(BINDIR)/$(CONFIG)/boringssl_ecdsa_verify_test \ - $(BINDIR)/$(CONFIG)/boringssl_err_test \ $(BINDIR)/$(CONFIG)/boringssl_evp_extra_test \ $(BINDIR)/$(CONFIG)/boringssl_evp_test \ $(BINDIR)/$(CONFIG)/boringssl_pbkdf_test \ @@ -1632,21 +1623,17 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/boringssl_hmac_test \ $(BINDIR)/$(CONFIG)/boringssl_lhash_test \ $(BINDIR)/$(CONFIG)/boringssl_gcm_test \ - $(BINDIR)/$(CONFIG)/boringssl_newhope_statistical_test \ - $(BINDIR)/$(CONFIG)/boringssl_newhope_test \ - $(BINDIR)/$(CONFIG)/boringssl_newhope_vectors_test \ $(BINDIR)/$(CONFIG)/boringssl_obj_test \ $(BINDIR)/$(CONFIG)/boringssl_pkcs12_test \ $(BINDIR)/$(CONFIG)/boringssl_pkcs8_test \ $(BINDIR)/$(CONFIG)/boringssl_poly1305_test \ + $(BINDIR)/$(CONFIG)/boringssl_pool_test \ $(BINDIR)/$(CONFIG)/boringssl_refcount_test \ - $(BINDIR)/$(CONFIG)/boringssl_rsa_test \ $(BINDIR)/$(CONFIG)/boringssl_thread_test \ $(BINDIR)/$(CONFIG)/boringssl_pkcs7_test \ $(BINDIR)/$(CONFIG)/boringssl_x509_test \ $(BINDIR)/$(CONFIG)/boringssl_tab_test \ $(BINDIR)/$(CONFIG)/boringssl_v3name_test \ - $(BINDIR)/$(CONFIG)/boringssl_ssl_test \ else buildtests_cxx: privatelibs_cxx \ @@ -5901,6 +5888,7 @@ endif LIBBORINGSSL_SRC = \ src/boringssl/err_data.c \ third_party/boringssl/crypto/aes/aes.c \ + third_party/boringssl/crypto/aes/key_wrap.c \ third_party/boringssl/crypto/aes/mode_wrappers.c \ third_party/boringssl/crypto/asn1/a_bitstr.c \ third_party/boringssl/crypto/asn1/a_bool.c \ @@ -5932,12 +5920,12 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/asn1/tasn_new.c \ third_party/boringssl/crypto/asn1/tasn_typ.c \ third_party/boringssl/crypto/asn1/tasn_utl.c \ + third_party/boringssl/crypto/asn1/time_support.c \ third_party/boringssl/crypto/asn1/x_bignum.c \ third_party/boringssl/crypto/asn1/x_long.c \ third_party/boringssl/crypto/base64/base64.c \ third_party/boringssl/crypto/bio/bio.c \ third_party/boringssl/crypto/bio/bio_mem.c \ - third_party/boringssl/crypto/bio/buffer.c \ third_party/boringssl/crypto/bio/connect.c \ third_party/boringssl/crypto/bio/fd.c \ third_party/boringssl/crypto/bio/file.c \ @@ -6044,12 +6032,7 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/modes/ctr.c \ third_party/boringssl/crypto/modes/gcm.c \ third_party/boringssl/crypto/modes/ofb.c \ - third_party/boringssl/crypto/newhope/error_correction.c \ - third_party/boringssl/crypto/newhope/newhope.c \ - third_party/boringssl/crypto/newhope/ntt.c \ - third_party/boringssl/crypto/newhope/poly.c \ - third_party/boringssl/crypto/newhope/precomp.c \ - third_party/boringssl/crypto/newhope/reduce.c \ + third_party/boringssl/crypto/modes/polyval.c \ third_party/boringssl/crypto/obj/obj.c \ third_party/boringssl/crypto/obj/obj_xref.c \ third_party/boringssl/crypto/pem/pem_all.c \ @@ -6060,14 +6043,15 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/pem/pem_pkey.c \ third_party/boringssl/crypto/pem/pem_x509.c \ third_party/boringssl/crypto/pem/pem_xaux.c \ - third_party/boringssl/crypto/pkcs8/p5_pbe.c \ third_party/boringssl/crypto/pkcs8/p5_pbev2.c \ third_party/boringssl/crypto/pkcs8/p8_pkey.c \ third_party/boringssl/crypto/pkcs8/pkcs8.c \ third_party/boringssl/crypto/poly1305/poly1305.c \ third_party/boringssl/crypto/poly1305/poly1305_arm.c \ third_party/boringssl/crypto/poly1305/poly1305_vec.c \ + third_party/boringssl/crypto/pool/pool.c \ third_party/boringssl/crypto/rand/deterministic.c \ + third_party/boringssl/crypto/rand/fuchsia.c \ third_party/boringssl/crypto/rand/rand.c \ third_party/boringssl/crypto/rand/urandom.c \ third_party/boringssl/crypto/rand/windows.c \ @@ -6079,6 +6063,7 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/rsa/rsa.c \ third_party/boringssl/crypto/rsa/rsa_asn1.c \ third_party/boringssl/crypto/rsa/rsa_impl.c \ + third_party/boringssl/crypto/sha/sha1-altivec.c \ third_party/boringssl/crypto/sha/sha1.c \ third_party/boringssl/crypto/sha/sha256.c \ third_party/boringssl/crypto/sha/sha512.c \ @@ -6087,7 +6072,6 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/thread_none.c \ third_party/boringssl/crypto/thread_pthread.c \ third_party/boringssl/crypto/thread_win.c \ - third_party/boringssl/crypto/time_support.c \ third_party/boringssl/crypto/x509/a_digest.c \ third_party/boringssl/crypto/x509/a_sign.c \ third_party/boringssl/crypto/x509/a_strex.c \ @@ -6171,6 +6155,7 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/x509v3/v3_skey.c \ third_party/boringssl/crypto/x509v3/v3_sxnet.c \ third_party/boringssl/crypto/x509v3/v3_utl.c \ + third_party/boringssl/ssl/bio_ssl.c \ third_party/boringssl/ssl/custom_extensions.c \ third_party/boringssl/ssl/d1_both.c \ third_party/boringssl/ssl/d1_lib.c \ @@ -6181,7 +6166,6 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/ssl/handshake_client.c \ third_party/boringssl/ssl/handshake_server.c \ third_party/boringssl/ssl/s3_both.c \ - third_party/boringssl/ssl/s3_enc.c \ third_party/boringssl/ssl/s3_lib.c \ third_party/boringssl/ssl/s3_pkt.c \ third_party/boringssl/ssl/ssl_aead_ctx.c \ @@ -6192,9 +6176,12 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/ssl/ssl_ecdh.c \ third_party/boringssl/ssl/ssl_file.c \ third_party/boringssl/ssl/ssl_lib.c \ - third_party/boringssl/ssl/ssl_rsa.c \ + third_party/boringssl/ssl/ssl_privkey.c \ + third_party/boringssl/ssl/ssl_privkey_cc.cc \ third_party/boringssl/ssl/ssl_session.c \ third_party/boringssl/ssl/ssl_stat.c \ + third_party/boringssl/ssl/ssl_transcript.c \ + third_party/boringssl/ssl/ssl_x509.c \ third_party/boringssl/ssl/t1_enc.c \ third_party/boringssl/ssl/t1_lib.c \ third_party/boringssl/ssl/tls13_both.c \ @@ -6496,44 +6483,6 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_CHACHA_TEST_LIB_SRC = \ - third_party/boringssl/crypto/chacha/chacha_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_CHACHA_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_CHACHA_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_CHACHA_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_CHACHA_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_CHACHA_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a $(LIBBORINGSSL_CHACHA_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_CHACHA_TEST_LIB_OBJS:.o=.dep) -endif - - LIBBORINGSSL_AEAD_TEST_LIB_SRC = \ third_party/boringssl/crypto/cipher/aead_test.cc \ @@ -6649,16 +6598,25 @@ endif LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_SRC = \ - third_party/boringssl/crypto/constant_time_test.c \ + third_party/boringssl/crypto/constant_time_test.cc \ -PUBLIC_HEADERS_C += \ +PUBLIC_HEADERS_CXX += \ LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_SRC)))) $(LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) -$(LIBDIR)/$(CONFIG)/libboringssl_constant_time_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS) +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +$(LIBDIR)/$(CONFIG)/libboringssl_constant_time_test_lib.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libboringssl_constant_time_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_constant_time_test_lib.a @@ -6670,6 +6628,8 @@ endif +endif + ifneq ($(NO_DEPS),true) -include $(LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS:.o=.dep) endif @@ -6789,44 +6749,6 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_DH_TEST_LIB_SRC = \ - third_party/boringssl/crypto/dh/dh_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_DH_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_DH_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_DH_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_DH_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_DH_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a $(LIBBORINGSSL_DH_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_DH_TEST_LIB_OBJS:.o=.dep) -endif - - LIBBORINGSSL_DIGEST_TEST_LIB_SRC = \ third_party/boringssl/crypto/digest/digest_test.cc \ @@ -6865,59 +6787,59 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_DSA_TEST_LIB_SRC = \ - third_party/boringssl/crypto/dsa/dsa_test.c \ +LIBBORINGSSL_EXAMPLE_MUL_LIB_SRC = \ + third_party/boringssl/crypto/ec/example_mul.c \ PUBLIC_HEADERS_C += \ -LIBBORINGSSL_DSA_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_DSA_TEST_LIB_SRC)))) +LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_EXAMPLE_MUL_LIB_SRC)))) -$(LIBBORINGSSL_DSA_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_DSA_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) -$(LIBDIR)/$(CONFIG)/libboringssl_dsa_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_DSA_TEST_LIB_OBJS) +$(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_dsa_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_dsa_test_lib.a $(LIBBORINGSSL_DSA_TEST_LIB_OBJS) + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a $(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS) ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_dsa_test_lib.a + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a endif ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_DSA_TEST_LIB_OBJS:.o=.dep) +-include $(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS:.o=.dep) endif -LIBBORINGSSL_EC_TEST_LIB_SRC = \ - third_party/boringssl/crypto/ec/ec_test.cc \ +LIBBORINGSSL_P256-X86_64_TEST_LIB_SRC = \ + third_party/boringssl/crypto/ec/p256-x86_64_test.cc \ PUBLIC_HEADERS_CXX += \ -LIBBORINGSSL_EC_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_EC_TEST_LIB_SRC)))) +LIBBORINGSSL_P256-X86_64_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_P256-X86_64_TEST_LIB_SRC)))) -$(LIBBORINGSSL_EC_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_EC_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(LIBBORINGSSL_P256-X86_64_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(LIBBORINGSSL_P256-X86_64_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) ifeq ($(NO_PROTOBUF),true) # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. -$(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a: protobuf_dep_error +$(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a: protobuf_dep_error else -$(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_EC_TEST_LIB_OBJS) +$(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_P256-X86_64_TEST_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a $(LIBBORINGSSL_EC_TEST_LIB_OBJS) + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a $(LIBBORINGSSL_P256-X86_64_TEST_LIB_OBJS) ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a endif @@ -6926,34 +6848,7 @@ endif endif ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_EC_TEST_LIB_OBJS:.o=.dep) -endif - - -LIBBORINGSSL_EXAMPLE_MUL_LIB_SRC = \ - third_party/boringssl/crypto/ec/example_mul.c \ - -PUBLIC_HEADERS_C += \ - -LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_EXAMPLE_MUL_LIB_SRC)))) - -$(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -$(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a $(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a -endif - - - - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS:.o=.dep) +-include $(LIBBORINGSSL_P256-X86_64_TEST_LIB_OBJS:.o=.dep) endif @@ -7109,44 +7004,6 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_ERR_TEST_LIB_SRC = \ - third_party/boringssl/crypto/err/err_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_ERR_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_ERR_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_ERR_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_ERR_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_ERR_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a $(LIBBORINGSSL_ERR_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_ERR_TEST_LIB_OBJS:.o=.dep) -endif - - LIBBORINGSSL_EVP_EXTRA_TEST_LIB_SRC = \ third_party/boringssl/crypto/evp/evp_extra_test.cc \ @@ -7262,16 +7119,25 @@ endif LIBBORINGSSL_HKDF_TEST_LIB_SRC = \ - third_party/boringssl/crypto/hkdf/hkdf_test.c \ + third_party/boringssl/crypto/hkdf/hkdf_test.cc \ -PUBLIC_HEADERS_C += \ +PUBLIC_HEADERS_CXX += \ LIBBORINGSSL_HKDF_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_HKDF_TEST_LIB_SRC)))) $(LIBBORINGSSL_HKDF_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(LIBBORINGSSL_HKDF_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) -$(LIBDIR)/$(CONFIG)/libboringssl_hkdf_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_HKDF_TEST_LIB_OBJS) +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +$(LIBDIR)/$(CONFIG)/libboringssl_hkdf_test_lib.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libboringssl_hkdf_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_HKDF_TEST_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_hkdf_test_lib.a @@ -7283,6 +7149,8 @@ endif +endif + ifneq ($(NO_DEPS),true) -include $(LIBBORINGSSL_HKDF_TEST_LIB_OBJS:.o=.dep) endif @@ -7327,16 +7195,25 @@ endif LIBBORINGSSL_LHASH_TEST_LIB_SRC = \ - third_party/boringssl/crypto/lhash/lhash_test.c \ + third_party/boringssl/crypto/lhash/lhash_test.cc \ -PUBLIC_HEADERS_C += \ +PUBLIC_HEADERS_CXX += \ LIBBORINGSSL_LHASH_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_LHASH_TEST_LIB_SRC)))) $(LIBBORINGSSL_LHASH_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(LIBBORINGSSL_LHASH_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) -$(LIBDIR)/$(CONFIG)/libboringssl_lhash_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_LHASH_TEST_LIB_OBJS) +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +$(LIBDIR)/$(CONFIG)/libboringssl_lhash_test_lib.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libboringssl_lhash_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_LHASH_TEST_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_lhash_test_lib.a @@ -7348,6 +7225,8 @@ endif +endif + ifneq ($(NO_DEPS),true) -include $(LIBBORINGSSL_LHASH_TEST_LIB_OBJS:.o=.dep) endif @@ -7391,120 +7270,6 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_SRC = \ - third_party/boringssl/crypto/newhope/newhope_statistical_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a $(LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_OBJS:.o=.dep) -endif - - -LIBBORINGSSL_NEWHOPE_TEST_LIB_SRC = \ - third_party/boringssl/crypto/newhope/newhope_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_NEWHOPE_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_NEWHOPE_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_NEWHOPE_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_NEWHOPE_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_NEWHOPE_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a $(LIBBORINGSSL_NEWHOPE_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_NEWHOPE_TEST_LIB_OBJS:.o=.dep) -endif - - -LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_SRC = \ - third_party/boringssl/crypto/newhope/newhope_vectors_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a $(LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_OBJS:.o=.dep) -endif - - LIBBORINGSSL_OBJ_TEST_LIB_SRC = \ third_party/boringssl/crypto/obj/obj_test.cc \ @@ -7657,59 +7422,70 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_REFCOUNT_TEST_LIB_SRC = \ - third_party/boringssl/crypto/refcount_test.c \ +LIBBORINGSSL_POOL_TEST_LIB_SRC = \ + third_party/boringssl/crypto/pool/pool_test.cc \ -PUBLIC_HEADERS_C += \ +PUBLIC_HEADERS_CXX += \ -LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_REFCOUNT_TEST_LIB_SRC)))) +LIBBORINGSSL_POOL_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_POOL_TEST_LIB_SRC)))) -$(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(LIBBORINGSSL_POOL_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(LIBBORINGSSL_POOL_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) + +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +$(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a: protobuf_dep_error + + +else -$(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS) +$(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_POOL_TEST_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS) + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a $(LIBBORINGSSL_POOL_TEST_LIB_OBJS) ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a endif +endif + ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS:.o=.dep) +-include $(LIBBORINGSSL_POOL_TEST_LIB_OBJS:.o=.dep) endif -LIBBORINGSSL_RSA_TEST_LIB_SRC = \ - third_party/boringssl/crypto/rsa/rsa_test.cc \ +LIBBORINGSSL_REFCOUNT_TEST_LIB_SRC = \ + third_party/boringssl/crypto/refcount_test.cc \ PUBLIC_HEADERS_CXX += \ -LIBBORINGSSL_RSA_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_RSA_TEST_LIB_SRC)))) +LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_REFCOUNT_TEST_LIB_SRC)))) -$(LIBBORINGSSL_RSA_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_RSA_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) ifeq ($(NO_PROTOBUF),true) # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. -$(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a: protobuf_dep_error +$(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a: protobuf_dep_error else -$(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_RSA_TEST_LIB_OBJS) +$(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a $(LIBBORINGSSL_RSA_TEST_LIB_OBJS) + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS) ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a endif @@ -7718,7 +7494,7 @@ endif endif ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_RSA_TEST_LIB_OBJS:.o=.dep) +-include $(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS:.o=.dep) endif @@ -7868,44 +7644,6 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_SSL_TEST_LIB_SRC = \ - third_party/boringssl/ssl/ssl_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_SSL_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_SSL_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_SSL_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_SSL_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_SSL_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a $(LIBBORINGSSL_SSL_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_SSL_TEST_LIB_OBJS:.o=.dep) -endif - - LIBBENCHMARK_SRC = \ third_party/benchmark/src/benchmark.cc \ third_party/benchmark/src/benchmark_register.cc \ @@ -16758,35 +16496,6 @@ $(BORINGSSL_BYTESTRING_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversio -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_CHACHA_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_CHACHA_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_CHACHA_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_chacha_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_chacha_test: $(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_chacha_test - -endif - -$(BORINGSSL_CHACHA_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_CHACHA_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment @@ -16990,35 +16699,6 @@ $(BORINGSSL_X25519_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -W -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_DH_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_DH_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_DH_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_dh_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_dh_test: $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_dh_test - -endif - -$(BORINGSSL_DH_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_DH_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment @@ -17051,57 +16731,28 @@ $(BORINGSSL_DIGEST_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -W # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment -$(BORINGSSL_DSA_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_DSA_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_DSA_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_dsa_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_dsa_test: $(LIBDIR)/$(CONFIG)/libboringssl_dsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_dsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_dsa_test - -endif - -$(BORINGSSL_DSA_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_DSA_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_EC_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_EC_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_EC_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE +$(BORINGSSL_EXAMPLE_MUL_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) +$(BORINGSSL_EXAMPLE_MUL_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) +$(BORINGSSL_EXAMPLE_MUL_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/boringssl_ec_test: protobuf_dep_error +$(BINDIR)/$(CONFIG)/boringssl_example_mul: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/boringssl_ec_test: $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a +$(BINDIR)/$(CONFIG)/boringssl_example_mul: $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_ec_test + $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_example_mul endif -$(BORINGSSL_EC_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_EC_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(BORINGSSL_EXAMPLE_MUL_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(BORINGSSL_EXAMPLE_MUL_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) @@ -17109,28 +16760,28 @@ $(BORINGSSL_EC_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-u # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment -$(BORINGSSL_EXAMPLE_MUL_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_EXAMPLE_MUL_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_EXAMPLE_MUL_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE +$(BORINGSSL_P256-X86_64_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) +$(BORINGSSL_P256-X86_64_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) +$(BORINGSSL_P256-X86_64_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/boringssl_example_mul: protobuf_dep_error +$(BINDIR)/$(CONFIG)/boringssl_p256-x86_64_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/boringssl_example_mul: $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a +$(BINDIR)/$(CONFIG)/boringssl_p256-x86_64_test: $(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_example_mul + $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_p256-x86_64_test endif -$(BORINGSSL_EXAMPLE_MUL_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_EXAMPLE_MUL_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(BORINGSSL_P256-X86_64_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(BORINGSSL_P256-X86_64_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) @@ -17251,35 +16902,6 @@ $(BORINGSSL_ECDSA_VERIFY_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-convers -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_ERR_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_ERR_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_ERR_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_err_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_err_test: $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_err_test - -endif - -$(BORINGSSL_ERR_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_ERR_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment @@ -17483,93 +17105,6 @@ $(BORINGSSL_GCM_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno- -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_NEWHOPE_STATISTICAL_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_NEWHOPE_STATISTICAL_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_NEWHOPE_STATISTICAL_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_newhope_statistical_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_newhope_statistical_test: $(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_newhope_statistical_test - -endif - -$(BORINGSSL_NEWHOPE_STATISTICAL_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_NEWHOPE_STATISTICAL_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_NEWHOPE_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_NEWHOPE_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_NEWHOPE_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_newhope_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_newhope_test: $(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_newhope_test - -endif - -$(BORINGSSL_NEWHOPE_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_NEWHOPE_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_NEWHOPE_VECTORS_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_NEWHOPE_VECTORS_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_NEWHOPE_VECTORS_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_newhope_vectors_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_newhope_vectors_test: $(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_newhope_vectors_test - -endif - -$(BORINGSSL_NEWHOPE_VECTORS_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_NEWHOPE_VECTORS_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment @@ -17689,28 +17224,28 @@ $(BORINGSSL_POLY1305_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment -$(BORINGSSL_REFCOUNT_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_REFCOUNT_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_REFCOUNT_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE +$(BORINGSSL_POOL_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) +$(BORINGSSL_POOL_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) +$(BORINGSSL_POOL_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/boringssl_refcount_test: protobuf_dep_error +$(BINDIR)/$(CONFIG)/boringssl_pool_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/boringssl_refcount_test: $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a +$(BINDIR)/$(CONFIG)/boringssl_pool_test: $(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_refcount_test + $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_pool_test endif -$(BORINGSSL_REFCOUNT_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_REFCOUNT_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(BORINGSSL_POOL_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(BORINGSSL_POOL_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) @@ -17718,28 +17253,28 @@ $(BORINGSSL_REFCOUNT_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment -$(BORINGSSL_RSA_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_RSA_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_RSA_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE +$(BORINGSSL_REFCOUNT_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) +$(BORINGSSL_REFCOUNT_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) +$(BORINGSSL_REFCOUNT_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/boringssl_rsa_test: protobuf_dep_error +$(BINDIR)/$(CONFIG)/boringssl_refcount_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/boringssl_rsa_test: $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a +$(BINDIR)/$(CONFIG)/boringssl_refcount_test: $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_rsa_test + $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_refcount_test endif -$(BORINGSSL_RSA_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_RSA_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(BORINGSSL_REFCOUNT_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(BORINGSSL_REFCOUNT_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) @@ -17888,35 +17423,6 @@ $(BORINGSSL_V3NAME_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -W - -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_SSL_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_SSL_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_SSL_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_ssl_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_ssl_test: $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_ssl_test - -endif - -$(BORINGSSL_SSL_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_SSL_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - BADREQ_BAD_CLIENT_TEST_SRC = \ test/core/bad_client/tests/badreq.c \ diff --git a/binding.gyp b/binding.gyp index d5bb27f6da..86beaf1357 100644 --- a/binding.gyp +++ b/binding.gyp @@ -174,6 +174,7 @@ 'targets': [ { 'cflags': [ + '-std=c++11', '-std=c99', '-Wall', '-Werror' @@ -186,6 +187,7 @@ 'sources': [ 'src/boringssl/err_data.c', 'third_party/boringssl/crypto/aes/aes.c', + 'third_party/boringssl/crypto/aes/key_wrap.c', 'third_party/boringssl/crypto/aes/mode_wrappers.c', 'third_party/boringssl/crypto/asn1/a_bitstr.c', 'third_party/boringssl/crypto/asn1/a_bool.c', @@ -217,12 +219,12 @@ 'third_party/boringssl/crypto/asn1/tasn_new.c', 'third_party/boringssl/crypto/asn1/tasn_typ.c', 'third_party/boringssl/crypto/asn1/tasn_utl.c', + 'third_party/boringssl/crypto/asn1/time_support.c', 'third_party/boringssl/crypto/asn1/x_bignum.c', 'third_party/boringssl/crypto/asn1/x_long.c', 'third_party/boringssl/crypto/base64/base64.c', 'third_party/boringssl/crypto/bio/bio.c', 'third_party/boringssl/crypto/bio/bio_mem.c', - 'third_party/boringssl/crypto/bio/buffer.c', 'third_party/boringssl/crypto/bio/connect.c', 'third_party/boringssl/crypto/bio/fd.c', 'third_party/boringssl/crypto/bio/file.c', @@ -329,12 +331,7 @@ 'third_party/boringssl/crypto/modes/ctr.c', 'third_party/boringssl/crypto/modes/gcm.c', 'third_party/boringssl/crypto/modes/ofb.c', - 'third_party/boringssl/crypto/newhope/error_correction.c', - 'third_party/boringssl/crypto/newhope/newhope.c', - 'third_party/boringssl/crypto/newhope/ntt.c', - 'third_party/boringssl/crypto/newhope/poly.c', - 'third_party/boringssl/crypto/newhope/precomp.c', - 'third_party/boringssl/crypto/newhope/reduce.c', + 'third_party/boringssl/crypto/modes/polyval.c', 'third_party/boringssl/crypto/obj/obj.c', 'third_party/boringssl/crypto/obj/obj_xref.c', 'third_party/boringssl/crypto/pem/pem_all.c', @@ -345,14 +342,15 @@ 'third_party/boringssl/crypto/pem/pem_pkey.c', 'third_party/boringssl/crypto/pem/pem_x509.c', 'third_party/boringssl/crypto/pem/pem_xaux.c', - 'third_party/boringssl/crypto/pkcs8/p5_pbe.c', 'third_party/boringssl/crypto/pkcs8/p5_pbev2.c', 'third_party/boringssl/crypto/pkcs8/p8_pkey.c', 'third_party/boringssl/crypto/pkcs8/pkcs8.c', 'third_party/boringssl/crypto/poly1305/poly1305.c', 'third_party/boringssl/crypto/poly1305/poly1305_arm.c', 'third_party/boringssl/crypto/poly1305/poly1305_vec.c', + 'third_party/boringssl/crypto/pool/pool.c', 'third_party/boringssl/crypto/rand/deterministic.c', + 'third_party/boringssl/crypto/rand/fuchsia.c', 'third_party/boringssl/crypto/rand/rand.c', 'third_party/boringssl/crypto/rand/urandom.c', 'third_party/boringssl/crypto/rand/windows.c', @@ -364,6 +362,7 @@ 'third_party/boringssl/crypto/rsa/rsa.c', 'third_party/boringssl/crypto/rsa/rsa_asn1.c', 'third_party/boringssl/crypto/rsa/rsa_impl.c', + 'third_party/boringssl/crypto/sha/sha1-altivec.c', 'third_party/boringssl/crypto/sha/sha1.c', 'third_party/boringssl/crypto/sha/sha256.c', 'third_party/boringssl/crypto/sha/sha512.c', @@ -372,7 +371,6 @@ 'third_party/boringssl/crypto/thread_none.c', 'third_party/boringssl/crypto/thread_pthread.c', 'third_party/boringssl/crypto/thread_win.c', - 'third_party/boringssl/crypto/time_support.c', 'third_party/boringssl/crypto/x509/a_digest.c', 'third_party/boringssl/crypto/x509/a_sign.c', 'third_party/boringssl/crypto/x509/a_strex.c', @@ -456,6 +454,7 @@ 'third_party/boringssl/crypto/x509v3/v3_skey.c', 'third_party/boringssl/crypto/x509v3/v3_sxnet.c', 'third_party/boringssl/crypto/x509v3/v3_utl.c', + 'third_party/boringssl/ssl/bio_ssl.c', 'third_party/boringssl/ssl/custom_extensions.c', 'third_party/boringssl/ssl/d1_both.c', 'third_party/boringssl/ssl/d1_lib.c', @@ -466,7 +465,6 @@ 'third_party/boringssl/ssl/handshake_client.c', 'third_party/boringssl/ssl/handshake_server.c', 'third_party/boringssl/ssl/s3_both.c', - 'third_party/boringssl/ssl/s3_enc.c', 'third_party/boringssl/ssl/s3_lib.c', 'third_party/boringssl/ssl/s3_pkt.c', 'third_party/boringssl/ssl/ssl_aead_ctx.c', @@ -477,9 +475,12 @@ 'third_party/boringssl/ssl/ssl_ecdh.c', 'third_party/boringssl/ssl/ssl_file.c', 'third_party/boringssl/ssl/ssl_lib.c', - 'third_party/boringssl/ssl/ssl_rsa.c', + 'third_party/boringssl/ssl/ssl_privkey.c', + 'third_party/boringssl/ssl/ssl_privkey_cc.cc', 'third_party/boringssl/ssl/ssl_session.c', 'third_party/boringssl/ssl/ssl_stat.c', + 'third_party/boringssl/ssl/ssl_transcript.c', + 'third_party/boringssl/ssl/ssl_x509.c', 'third_party/boringssl/ssl/t1_enc.c', 'third_party/boringssl/ssl/t1_lib.c', 'third_party/boringssl/ssl/tls13_both.c', @@ -488,9 +489,20 @@ 'third_party/boringssl/ssl/tls13_server.c', 'third_party/boringssl/ssl/tls_method.c', 'third_party/boringssl/ssl/tls_record.c', - ] + ], + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'MACOSX_DEPLOYMENT_TARGET': '10.9', + 'OTHER_CPLUSPLUSFLAGS': [ + '-stdlib=libc++', + '-std=c++11' + ], + } + }], + ], }, - ] + ], }], ['OS == "win" and runtime!="electron"', { 'targets': [ diff --git a/config.m4 b/config.m4 index 0049b72d48..d3a5dc440e 100644 --- a/config.m4 +++ b/config.m4 @@ -336,6 +336,7 @@ if test "$PHP_GRPC" != "no"; then src/core/plugin_registry/grpc_plugin_registry.c \ src/boringssl/err_data.c \ third_party/boringssl/crypto/aes/aes.c \ + third_party/boringssl/crypto/aes/key_wrap.c \ third_party/boringssl/crypto/aes/mode_wrappers.c \ third_party/boringssl/crypto/asn1/a_bitstr.c \ third_party/boringssl/crypto/asn1/a_bool.c \ @@ -367,12 +368,12 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/asn1/tasn_new.c \ third_party/boringssl/crypto/asn1/tasn_typ.c \ third_party/boringssl/crypto/asn1/tasn_utl.c \ + third_party/boringssl/crypto/asn1/time_support.c \ third_party/boringssl/crypto/asn1/x_bignum.c \ third_party/boringssl/crypto/asn1/x_long.c \ third_party/boringssl/crypto/base64/base64.c \ third_party/boringssl/crypto/bio/bio.c \ third_party/boringssl/crypto/bio/bio_mem.c \ - third_party/boringssl/crypto/bio/buffer.c \ third_party/boringssl/crypto/bio/connect.c \ third_party/boringssl/crypto/bio/fd.c \ third_party/boringssl/crypto/bio/file.c \ @@ -479,12 +480,7 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/modes/ctr.c \ third_party/boringssl/crypto/modes/gcm.c \ third_party/boringssl/crypto/modes/ofb.c \ - third_party/boringssl/crypto/newhope/error_correction.c \ - third_party/boringssl/crypto/newhope/newhope.c \ - third_party/boringssl/crypto/newhope/ntt.c \ - third_party/boringssl/crypto/newhope/poly.c \ - third_party/boringssl/crypto/newhope/precomp.c \ - third_party/boringssl/crypto/newhope/reduce.c \ + third_party/boringssl/crypto/modes/polyval.c \ third_party/boringssl/crypto/obj/obj.c \ third_party/boringssl/crypto/obj/obj_xref.c \ third_party/boringssl/crypto/pem/pem_all.c \ @@ -495,14 +491,15 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/pem/pem_pkey.c \ third_party/boringssl/crypto/pem/pem_x509.c \ third_party/boringssl/crypto/pem/pem_xaux.c \ - third_party/boringssl/crypto/pkcs8/p5_pbe.c \ third_party/boringssl/crypto/pkcs8/p5_pbev2.c \ third_party/boringssl/crypto/pkcs8/p8_pkey.c \ third_party/boringssl/crypto/pkcs8/pkcs8.c \ third_party/boringssl/crypto/poly1305/poly1305.c \ third_party/boringssl/crypto/poly1305/poly1305_arm.c \ third_party/boringssl/crypto/poly1305/poly1305_vec.c \ + third_party/boringssl/crypto/pool/pool.c \ third_party/boringssl/crypto/rand/deterministic.c \ + third_party/boringssl/crypto/rand/fuchsia.c \ third_party/boringssl/crypto/rand/rand.c \ third_party/boringssl/crypto/rand/urandom.c \ third_party/boringssl/crypto/rand/windows.c \ @@ -514,6 +511,7 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/rsa/rsa.c \ third_party/boringssl/crypto/rsa/rsa_asn1.c \ third_party/boringssl/crypto/rsa/rsa_impl.c \ + third_party/boringssl/crypto/sha/sha1-altivec.c \ third_party/boringssl/crypto/sha/sha1.c \ third_party/boringssl/crypto/sha/sha256.c \ third_party/boringssl/crypto/sha/sha512.c \ @@ -522,7 +520,6 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/thread_none.c \ third_party/boringssl/crypto/thread_pthread.c \ third_party/boringssl/crypto/thread_win.c \ - third_party/boringssl/crypto/time_support.c \ third_party/boringssl/crypto/x509/a_digest.c \ third_party/boringssl/crypto/x509/a_sign.c \ third_party/boringssl/crypto/x509/a_strex.c \ @@ -606,6 +603,7 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/x509v3/v3_skey.c \ third_party/boringssl/crypto/x509v3/v3_sxnet.c \ third_party/boringssl/crypto/x509v3/v3_utl.c \ + third_party/boringssl/ssl/bio_ssl.c \ third_party/boringssl/ssl/custom_extensions.c \ third_party/boringssl/ssl/d1_both.c \ third_party/boringssl/ssl/d1_lib.c \ @@ -616,7 +614,6 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/ssl/handshake_client.c \ third_party/boringssl/ssl/handshake_server.c \ third_party/boringssl/ssl/s3_both.c \ - third_party/boringssl/ssl/s3_enc.c \ third_party/boringssl/ssl/s3_lib.c \ third_party/boringssl/ssl/s3_pkt.c \ third_party/boringssl/ssl/ssl_aead_ctx.c \ @@ -627,9 +624,12 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/ssl/ssl_ecdh.c \ third_party/boringssl/ssl/ssl_file.c \ third_party/boringssl/ssl/ssl_lib.c \ - third_party/boringssl/ssl/ssl_rsa.c \ + third_party/boringssl/ssl/ssl_privkey.c \ + third_party/boringssl/ssl/ssl_privkey_cc.cc \ third_party/boringssl/ssl/ssl_session.c \ third_party/boringssl/ssl/ssl_stat.c \ + third_party/boringssl/ssl/ssl_transcript.c \ + third_party/boringssl/ssl/ssl_x509.c \ third_party/boringssl/ssl/t1_enc.c \ third_party/boringssl/ssl/t1_lib.c \ third_party/boringssl/ssl/tls13_both.c \ @@ -728,11 +728,11 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/md4) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/md5) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/modes) - PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/newhope) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/obj) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/pem) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/pkcs8) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/poly1305) + PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/pool) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/rand) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/rc4) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/rsa) diff --git a/config.w32 b/config.w32 index 919587dc58..752e5095e5 100644 --- a/config.w32 +++ b/config.w32 @@ -313,6 +313,7 @@ if (PHP_GRPC != "no") { "src\\core\\plugin_registry\\grpc_plugin_registry.c " + "src\\boringssl\\err_data.c " + "third_party\\boringssl\\crypto\\aes\\aes.c " + + "third_party\\boringssl\\crypto\\aes\\key_wrap.c " + "third_party\\boringssl\\crypto\\aes\\mode_wrappers.c " + "third_party\\boringssl\\crypto\\asn1\\a_bitstr.c " + "third_party\\boringssl\\crypto\\asn1\\a_bool.c " + @@ -344,12 +345,12 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\crypto\\asn1\\tasn_new.c " + "third_party\\boringssl\\crypto\\asn1\\tasn_typ.c " + "third_party\\boringssl\\crypto\\asn1\\tasn_utl.c " + + "third_party\\boringssl\\crypto\\asn1\\time_support.c " + "third_party\\boringssl\\crypto\\asn1\\x_bignum.c " + "third_party\\boringssl\\crypto\\asn1\\x_long.c " + "third_party\\boringssl\\crypto\\base64\\base64.c " + "third_party\\boringssl\\crypto\\bio\\bio.c " + "third_party\\boringssl\\crypto\\bio\\bio_mem.c " + - "third_party\\boringssl\\crypto\\bio\\buffer.c " + "third_party\\boringssl\\crypto\\bio\\connect.c " + "third_party\\boringssl\\crypto\\bio\\fd.c " + "third_party\\boringssl\\crypto\\bio\\file.c " + @@ -456,12 +457,7 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\crypto\\modes\\ctr.c " + "third_party\\boringssl\\crypto\\modes\\gcm.c " + "third_party\\boringssl\\crypto\\modes\\ofb.c " + - "third_party\\boringssl\\crypto\\newhope\\error_correction.c " + - "third_party\\boringssl\\crypto\\newhope\\newhope.c " + - "third_party\\boringssl\\crypto\\newhope\\ntt.c " + - "third_party\\boringssl\\crypto\\newhope\\poly.c " + - "third_party\\boringssl\\crypto\\newhope\\precomp.c " + - "third_party\\boringssl\\crypto\\newhope\\reduce.c " + + "third_party\\boringssl\\crypto\\modes\\polyval.c " + "third_party\\boringssl\\crypto\\obj\\obj.c " + "third_party\\boringssl\\crypto\\obj\\obj_xref.c " + "third_party\\boringssl\\crypto\\pem\\pem_all.c " + @@ -472,14 +468,15 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\crypto\\pem\\pem_pkey.c " + "third_party\\boringssl\\crypto\\pem\\pem_x509.c " + "third_party\\boringssl\\crypto\\pem\\pem_xaux.c " + - "third_party\\boringssl\\crypto\\pkcs8\\p5_pbe.c " + "third_party\\boringssl\\crypto\\pkcs8\\p5_pbev2.c " + "third_party\\boringssl\\crypto\\pkcs8\\p8_pkey.c " + "third_party\\boringssl\\crypto\\pkcs8\\pkcs8.c " + "third_party\\boringssl\\crypto\\poly1305\\poly1305.c " + "third_party\\boringssl\\crypto\\poly1305\\poly1305_arm.c " + "third_party\\boringssl\\crypto\\poly1305\\poly1305_vec.c " + + "third_party\\boringssl\\crypto\\pool\\pool.c " + "third_party\\boringssl\\crypto\\rand\\deterministic.c " + + "third_party\\boringssl\\crypto\\rand\\fuchsia.c " + "third_party\\boringssl\\crypto\\rand\\rand.c " + "third_party\\boringssl\\crypto\\rand\\urandom.c " + "third_party\\boringssl\\crypto\\rand\\windows.c " + @@ -491,6 +488,7 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\crypto\\rsa\\rsa.c " + "third_party\\boringssl\\crypto\\rsa\\rsa_asn1.c " + "third_party\\boringssl\\crypto\\rsa\\rsa_impl.c " + + "third_party\\boringssl\\crypto\\sha\\sha1-altivec.c " + "third_party\\boringssl\\crypto\\sha\\sha1.c " + "third_party\\boringssl\\crypto\\sha\\sha256.c " + "third_party\\boringssl\\crypto\\sha\\sha512.c " + @@ -499,7 +497,6 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\crypto\\thread_none.c " + "third_party\\boringssl\\crypto\\thread_pthread.c " + "third_party\\boringssl\\crypto\\thread_win.c " + - "third_party\\boringssl\\crypto\\time_support.c " + "third_party\\boringssl\\crypto\\x509\\a_digest.c " + "third_party\\boringssl\\crypto\\x509\\a_sign.c " + "third_party\\boringssl\\crypto\\x509\\a_strex.c " + @@ -583,6 +580,7 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\crypto\\x509v3\\v3_skey.c " + "third_party\\boringssl\\crypto\\x509v3\\v3_sxnet.c " + "third_party\\boringssl\\crypto\\x509v3\\v3_utl.c " + + "third_party\\boringssl\\ssl\\bio_ssl.c " + "third_party\\boringssl\\ssl\\custom_extensions.c " + "third_party\\boringssl\\ssl\\d1_both.c " + "third_party\\boringssl\\ssl\\d1_lib.c " + @@ -593,7 +591,6 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\ssl\\handshake_client.c " + "third_party\\boringssl\\ssl\\handshake_server.c " + "third_party\\boringssl\\ssl\\s3_both.c " + - "third_party\\boringssl\\ssl\\s3_enc.c " + "third_party\\boringssl\\ssl\\s3_lib.c " + "third_party\\boringssl\\ssl\\s3_pkt.c " + "third_party\\boringssl\\ssl\\ssl_aead_ctx.c " + @@ -604,9 +601,12 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\ssl\\ssl_ecdh.c " + "third_party\\boringssl\\ssl\\ssl_file.c " + "third_party\\boringssl\\ssl\\ssl_lib.c " + - "third_party\\boringssl\\ssl\\ssl_rsa.c " + + "third_party\\boringssl\\ssl\\ssl_privkey.c " + + "third_party\\boringssl\\ssl\\ssl_privkey_cc.cc " + "third_party\\boringssl\\ssl\\ssl_session.c " + "third_party\\boringssl\\ssl\\ssl_stat.c " + + "third_party\\boringssl\\ssl\\ssl_transcript.c " + + "third_party\\boringssl\\ssl\\ssl_x509.c " + "third_party\\boringssl\\ssl\\t1_enc.c " + "third_party\\boringssl\\ssl\\t1_lib.c " + "third_party\\boringssl\\ssl\\tls13_both.c " + diff --git a/grpc.gemspec b/grpc.gemspec index a4e22dfbdf..663915b75e 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -656,14 +656,14 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/digest/md32_common.h ) s.files += %w( third_party/boringssl/crypto/ec/internal.h ) s.files += %w( third_party/boringssl/crypto/ec/p256-x86_64-table.h ) + s.files += %w( third_party/boringssl/crypto/ec/p256-x86_64.h ) s.files += %w( third_party/boringssl/crypto/evp/internal.h ) s.files += %w( third_party/boringssl/crypto/internal.h ) s.files += %w( third_party/boringssl/crypto/modes/internal.h ) - s.files += %w( third_party/boringssl/crypto/newhope/internal.h ) s.files += %w( third_party/boringssl/crypto/obj/obj_dat.h ) - s.files += %w( third_party/boringssl/crypto/obj/obj_xref.h ) s.files += %w( third_party/boringssl/crypto/pkcs8/internal.h ) s.files += %w( third_party/boringssl/crypto/poly1305/internal.h ) + s.files += %w( third_party/boringssl/crypto/pool/internal.h ) s.files += %w( third_party/boringssl/crypto/rand/internal.h ) s.files += %w( third_party/boringssl/crypto/rsa/internal.h ) s.files += %w( third_party/boringssl/crypto/x509/charmap.h ) @@ -713,7 +713,6 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/include/openssl/md4.h ) s.files += %w( third_party/boringssl/include/openssl/md5.h ) s.files += %w( third_party/boringssl/include/openssl/mem.h ) - s.files += %w( third_party/boringssl/include/openssl/newhope.h ) s.files += %w( third_party/boringssl/include/openssl/nid.h ) s.files += %w( third_party/boringssl/include/openssl/obj.h ) s.files += %w( third_party/boringssl/include/openssl/obj_mac.h ) @@ -726,6 +725,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/include/openssl/pkcs7.h ) s.files += %w( third_party/boringssl/include/openssl/pkcs8.h ) s.files += %w( third_party/boringssl/include/openssl/poly1305.h ) + s.files += %w( third_party/boringssl/include/openssl/pool.h ) s.files += %w( third_party/boringssl/include/openssl/rand.h ) s.files += %w( third_party/boringssl/include/openssl/rc4.h ) s.files += %w( third_party/boringssl/include/openssl/ripemd.h ) @@ -738,7 +738,6 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/include/openssl/stack.h ) s.files += %w( third_party/boringssl/include/openssl/stack_macros.h ) s.files += %w( third_party/boringssl/include/openssl/thread.h ) - s.files += %w( third_party/boringssl/include/openssl/time_support.h ) s.files += %w( third_party/boringssl/include/openssl/tls1.h ) s.files += %w( third_party/boringssl/include/openssl/type_check.h ) s.files += %w( third_party/boringssl/include/openssl/x509.h ) @@ -747,6 +746,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/ssl/internal.h ) s.files += %w( src/boringssl/err_data.c ) s.files += %w( third_party/boringssl/crypto/aes/aes.c ) + s.files += %w( third_party/boringssl/crypto/aes/key_wrap.c ) s.files += %w( third_party/boringssl/crypto/aes/mode_wrappers.c ) s.files += %w( third_party/boringssl/crypto/asn1/a_bitstr.c ) s.files += %w( third_party/boringssl/crypto/asn1/a_bool.c ) @@ -778,12 +778,12 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/asn1/tasn_new.c ) s.files += %w( third_party/boringssl/crypto/asn1/tasn_typ.c ) s.files += %w( third_party/boringssl/crypto/asn1/tasn_utl.c ) + s.files += %w( third_party/boringssl/crypto/asn1/time_support.c ) s.files += %w( third_party/boringssl/crypto/asn1/x_bignum.c ) s.files += %w( third_party/boringssl/crypto/asn1/x_long.c ) s.files += %w( third_party/boringssl/crypto/base64/base64.c ) s.files += %w( third_party/boringssl/crypto/bio/bio.c ) s.files += %w( third_party/boringssl/crypto/bio/bio_mem.c ) - s.files += %w( third_party/boringssl/crypto/bio/buffer.c ) s.files += %w( third_party/boringssl/crypto/bio/connect.c ) s.files += %w( third_party/boringssl/crypto/bio/fd.c ) s.files += %w( third_party/boringssl/crypto/bio/file.c ) @@ -890,12 +890,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/modes/ctr.c ) s.files += %w( third_party/boringssl/crypto/modes/gcm.c ) s.files += %w( third_party/boringssl/crypto/modes/ofb.c ) - s.files += %w( third_party/boringssl/crypto/newhope/error_correction.c ) - s.files += %w( third_party/boringssl/crypto/newhope/newhope.c ) - s.files += %w( third_party/boringssl/crypto/newhope/ntt.c ) - s.files += %w( third_party/boringssl/crypto/newhope/poly.c ) - s.files += %w( third_party/boringssl/crypto/newhope/precomp.c ) - s.files += %w( third_party/boringssl/crypto/newhope/reduce.c ) + s.files += %w( third_party/boringssl/crypto/modes/polyval.c ) s.files += %w( third_party/boringssl/crypto/obj/obj.c ) s.files += %w( third_party/boringssl/crypto/obj/obj_xref.c ) s.files += %w( third_party/boringssl/crypto/pem/pem_all.c ) @@ -906,14 +901,15 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/pem/pem_pkey.c ) s.files += %w( third_party/boringssl/crypto/pem/pem_x509.c ) s.files += %w( third_party/boringssl/crypto/pem/pem_xaux.c ) - s.files += %w( third_party/boringssl/crypto/pkcs8/p5_pbe.c ) s.files += %w( third_party/boringssl/crypto/pkcs8/p5_pbev2.c ) s.files += %w( third_party/boringssl/crypto/pkcs8/p8_pkey.c ) s.files += %w( third_party/boringssl/crypto/pkcs8/pkcs8.c ) s.files += %w( third_party/boringssl/crypto/poly1305/poly1305.c ) s.files += %w( third_party/boringssl/crypto/poly1305/poly1305_arm.c ) s.files += %w( third_party/boringssl/crypto/poly1305/poly1305_vec.c ) + s.files += %w( third_party/boringssl/crypto/pool/pool.c ) s.files += %w( third_party/boringssl/crypto/rand/deterministic.c ) + s.files += %w( third_party/boringssl/crypto/rand/fuchsia.c ) s.files += %w( third_party/boringssl/crypto/rand/rand.c ) s.files += %w( third_party/boringssl/crypto/rand/urandom.c ) s.files += %w( third_party/boringssl/crypto/rand/windows.c ) @@ -925,6 +921,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/rsa/rsa.c ) s.files += %w( third_party/boringssl/crypto/rsa/rsa_asn1.c ) s.files += %w( third_party/boringssl/crypto/rsa/rsa_impl.c ) + s.files += %w( third_party/boringssl/crypto/sha/sha1-altivec.c ) s.files += %w( third_party/boringssl/crypto/sha/sha1.c ) s.files += %w( third_party/boringssl/crypto/sha/sha256.c ) s.files += %w( third_party/boringssl/crypto/sha/sha512.c ) @@ -933,7 +930,6 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/thread_none.c ) s.files += %w( third_party/boringssl/crypto/thread_pthread.c ) s.files += %w( third_party/boringssl/crypto/thread_win.c ) - s.files += %w( third_party/boringssl/crypto/time_support.c ) s.files += %w( third_party/boringssl/crypto/x509/a_digest.c ) s.files += %w( third_party/boringssl/crypto/x509/a_sign.c ) s.files += %w( third_party/boringssl/crypto/x509/a_strex.c ) @@ -1017,6 +1013,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/x509v3/v3_skey.c ) s.files += %w( third_party/boringssl/crypto/x509v3/v3_sxnet.c ) s.files += %w( third_party/boringssl/crypto/x509v3/v3_utl.c ) + s.files += %w( third_party/boringssl/ssl/bio_ssl.c ) s.files += %w( third_party/boringssl/ssl/custom_extensions.c ) s.files += %w( third_party/boringssl/ssl/d1_both.c ) s.files += %w( third_party/boringssl/ssl/d1_lib.c ) @@ -1027,7 +1024,6 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/ssl/handshake_client.c ) s.files += %w( third_party/boringssl/ssl/handshake_server.c ) s.files += %w( third_party/boringssl/ssl/s3_both.c ) - s.files += %w( third_party/boringssl/ssl/s3_enc.c ) s.files += %w( third_party/boringssl/ssl/s3_lib.c ) s.files += %w( third_party/boringssl/ssl/s3_pkt.c ) s.files += %w( third_party/boringssl/ssl/ssl_aead_ctx.c ) @@ -1038,9 +1034,12 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/ssl/ssl_ecdh.c ) s.files += %w( third_party/boringssl/ssl/ssl_file.c ) s.files += %w( third_party/boringssl/ssl/ssl_lib.c ) - s.files += %w( third_party/boringssl/ssl/ssl_rsa.c ) + s.files += %w( third_party/boringssl/ssl/ssl_privkey.c ) + s.files += %w( third_party/boringssl/ssl/ssl_privkey_cc.cc ) s.files += %w( third_party/boringssl/ssl/ssl_session.c ) s.files += %w( third_party/boringssl/ssl/ssl_stat.c ) + s.files += %w( third_party/boringssl/ssl/ssl_transcript.c ) + s.files += %w( third_party/boringssl/ssl/ssl_x509.c ) s.files += %w( third_party/boringssl/ssl/t1_enc.c ) s.files += %w( third_party/boringssl/ssl/t1_lib.c ) s.files += %w( third_party/boringssl/ssl/tls13_both.c ) diff --git a/package.xml b/package.xml index 18b1d639b9..cfa45f06d7 100644 --- a/package.xml +++ b/package.xml @@ -670,14 +670,14 @@ + - - + @@ -727,7 +727,6 @@ - @@ -740,6 +739,7 @@ + @@ -752,7 +752,6 @@ - @@ -761,6 +760,7 @@ + @@ -792,12 +792,12 @@ + - @@ -904,12 +904,7 @@ - - - - - - + @@ -920,14 +915,15 @@ - + + @@ -939,6 +935,7 @@ + @@ -947,7 +944,6 @@ - @@ -1031,6 +1027,7 @@ + @@ -1041,7 +1038,6 @@ - @@ -1052,9 +1048,12 @@ - + + + + diff --git a/setup.py b/setup.py index 98d812aaac..8ca3e4fe0c 100644 --- a/setup.py +++ b/setup.py @@ -101,9 +101,9 @@ if EXTRA_ENV_COMPILE_ARGS is None: elif 'win32' in sys.platform: EXTRA_ENV_COMPILE_ARGS += ' -D_PYTHON_MSVC' elif "linux" in sys.platform: - EXTRA_ENV_COMPILE_ARGS += ' -std=c++11 -std=gnu99 -fvisibility=hidden -fno-wrapv' + EXTRA_ENV_COMPILE_ARGS += ' -std=c++11 -std=gnu99 -fvisibility=hidden -fno-wrapv -fno-exceptions' elif "darwin" in sys.platform: - EXTRA_ENV_COMPILE_ARGS += ' -fvisibility=hidden -fno-wrapv' + EXTRA_ENV_COMPILE_ARGS += ' -fvisibility=hidden -fno-wrapv -fno-exceptions' if EXTRA_ENV_LINK_ARGS is None: EXTRA_ENV_LINK_ARGS = '' @@ -117,7 +117,7 @@ if EXTRA_ENV_LINK_ARGS is None: ' -static-libgcc -static-libstdc++ -mcrtdll={msvcr} ' '-static'.format(msvcr=msvcr)) if "linux" in sys.platform: - EXTRA_ENV_LINK_ARGS += ' -Wl,-wrap,memcpy' + EXTRA_ENV_LINK_ARGS += ' -Wl,-wrap,memcpy -static-libgcc' EXTRA_COMPILE_ARGS = shlex.split(EXTRA_ENV_COMPILE_ARGS) EXTRA_LINK_ARGS = shlex.split(EXTRA_ENV_LINK_ARGS) diff --git a/src/boringssl/err_data.c b/src/boringssl/err_data.c index c1257cdc78..88462d1376 100644 --- a/src/boringssl/err_data.c +++ b/src/boringssl/err_data.c @@ -178,42 +178,42 @@ const uint32_t kOpenSSLReasonValues[] = { 0x28340c19, 0x283480ac, 0x283500ea, - 0x2c3228ca, - 0x2c32a8d8, - 0x2c3328ea, - 0x2c33a8fc, - 0x2c342910, - 0x2c34a922, - 0x2c35293d, - 0x2c35a94f, - 0x2c362962, + 0x2c3229b1, + 0x2c32a9bf, + 0x2c3329d1, + 0x2c33a9e3, + 0x2c3429f7, + 0x2c34aa09, + 0x2c352a24, + 0x2c35aa36, + 0x2c362a49, 0x2c36832d, - 0x2c37296f, - 0x2c37a981, - 0x2c382994, - 0x2c38a9ab, - 0x2c3929b9, - 0x2c39a9c9, - 0x2c3a29db, - 0x2c3aa9ef, - 0x2c3b2a00, - 0x2c3baa1f, - 0x2c3c2a33, - 0x2c3caa49, - 0x2c3d2a62, - 0x2c3daa7f, - 0x2c3e2a90, - 0x2c3eaa9e, - 0x2c3f2ab6, - 0x2c3faace, - 0x2c402adb, + 0x2c372a56, + 0x2c37aa68, + 0x2c382a7b, + 0x2c38aa92, + 0x2c392aa0, + 0x2c39aab0, + 0x2c3a2ac2, + 0x2c3aaad6, + 0x2c3b2ae7, + 0x2c3bab06, + 0x2c3c2b1a, + 0x2c3cab30, + 0x2c3d2b49, + 0x2c3dab66, + 0x2c3e2b77, + 0x2c3eab85, + 0x2c3f2b9d, + 0x2c3fabb5, + 0x2c402bc2, 0x2c4090e7, - 0x2c412aec, - 0x2c41aaff, + 0x2c412bd3, + 0x2c41abe6, 0x2c4210c0, - 0x2c42ab10, + 0x2c42abf7, 0x2c430720, - 0x2c43aa11, + 0x2c43aaf8, 0x30320000, 0x30328015, 0x3033001f, @@ -366,180 +366,189 @@ const uint32_t kOpenSSLReasonValues[] = { 0x403b9861, 0x403c0064, 0x403c8083, - 0x403d18aa, - 0x403d98c0, - 0x403e18cf, - 0x403e98e2, - 0x403f18fc, - 0x403f990a, - 0x4040191f, - 0x40409933, - 0x40411950, - 0x4041996b, - 0x40421984, - 0x40429997, - 0x404319ab, - 0x404399c3, - 0x404419da, + 0x403d18c1, + 0x403d98d7, + 0x403e18e6, + 0x403e98f9, + 0x403f1913, + 0x403f9921, + 0x40401936, + 0x4040994a, + 0x40411967, + 0x40419982, + 0x4042199b, + 0x404299ae, + 0x404319c2, + 0x404399da, + 0x404419f1, 0x404480ac, - 0x404519ef, - 0x40459a01, - 0x40461a25, - 0x40469a45, - 0x40471a53, - 0x40479a7a, - 0x40481ab7, - 0x40489ad0, - 0x40491ae7, - 0x40499b01, - 0x404a1b18, - 0x404a9b36, - 0x404b1b4e, - 0x404b9b65, - 0x404c1b7b, - 0x404c9b8d, - 0x404d1bae, - 0x404d9bd0, - 0x404e1be4, - 0x404e9bf1, - 0x404f1c1e, - 0x404f9c47, - 0x40501c71, - 0x40509c85, - 0x40511ca0, - 0x40519cb0, - 0x40521cc7, - 0x40529ceb, - 0x40531d03, - 0x40539d16, - 0x40541d2b, - 0x40549d4e, - 0x40551d5c, - 0x40559d79, - 0x40561d86, - 0x40569d9f, - 0x40571db7, - 0x40579dca, - 0x40581ddf, - 0x40589e06, - 0x40591e35, - 0x40599e62, - 0x405a1e76, - 0x405a9e86, - 0x405b1e9e, - 0x405b9eaf, - 0x405c1ec2, - 0x405c9ed3, - 0x405d1ee0, - 0x405d9ef7, - 0x405e1f17, + 0x40451a06, + 0x40459a18, + 0x40461a3c, + 0x40469a5c, + 0x40471a6a, + 0x40479a91, + 0x40481ace, + 0x40489ae7, + 0x40491afe, + 0x40499b18, + 0x404a1b2f, + 0x404a9b4d, + 0x404b1b65, + 0x404b9b7c, + 0x404c1b92, + 0x404c9ba4, + 0x404d1bc5, + 0x404d9be7, + 0x404e1bfb, + 0x404e9c08, + 0x404f1c35, + 0x404f9c5e, + 0x40501c99, + 0x40509cad, + 0x40511cc8, + 0x40519cd8, + 0x40521cef, + 0x40529d13, + 0x40531d2b, + 0x40539d3e, + 0x40541d53, + 0x40549d76, + 0x40551d84, + 0x40559da1, + 0x40561dae, + 0x40569dc7, + 0x40571ddf, + 0x40579df2, + 0x40581e07, + 0x40589e2e, + 0x40591e5d, + 0x40599e8a, + 0x405a1e9e, + 0x405a9eae, + 0x405b1ec6, + 0x405b9ed7, + 0x405c1eea, + 0x405c9f0b, + 0x405d1f18, + 0x405d9f2f, + 0x405e1f6d, 0x405e8a95, - 0x405f1f38, - 0x405f9f45, - 0x40601f53, - 0x40609f75, - 0x40611f9d, - 0x40619fb2, - 0x40621fc9, - 0x40629fda, - 0x40631feb, - 0x4063a000, - 0x40642017, - 0x4064a043, - 0x4065205e, - 0x4065a075, - 0x4066208d, - 0x4066a0b7, - 0x406720e2, - 0x4067a103, - 0x40682116, - 0x4068a137, - 0x40692169, - 0x4069a197, - 0x406a21b8, - 0x406aa1d8, - 0x406b2360, - 0x406ba383, - 0x406c2399, - 0x406ca5c5, - 0x406d25f4, - 0x406da61c, - 0x406e264a, - 0x406ea662, - 0x406f2681, - 0x406fa696, - 0x407026a9, - 0x4070a6c6, + 0x405f1f8e, + 0x405f9f9b, + 0x40601fa9, + 0x40609fcb, + 0x4061200f, + 0x4061a047, + 0x4062205e, + 0x4062a06f, + 0x40632080, + 0x4063a095, + 0x406420ac, + 0x4064a0d8, + 0x406520f3, + 0x4065a10a, + 0x40662122, + 0x4066a14c, + 0x40672177, + 0x4067a198, + 0x406821ab, + 0x4068a1cc, + 0x406921fe, + 0x4069a22c, + 0x406a224d, + 0x406aa26d, + 0x406b23f5, + 0x406ba418, + 0x406c242e, + 0x406ca690, + 0x406d26bf, + 0x406da6e7, + 0x406e2715, + 0x406ea749, + 0x406f2768, + 0x406fa77d, + 0x40702790, + 0x4070a7ad, 0x40710800, - 0x4071a6d8, - 0x407226eb, - 0x4072a704, - 0x4073271c, + 0x4071a7bf, + 0x407227d2, + 0x4072a7eb, + 0x40732803, 0x4073936d, - 0x40742730, - 0x4074a74a, - 0x4075275b, - 0x4075a76f, - 0x4076277d, + 0x40742817, + 0x4074a831, + 0x40752842, + 0x4075a856, + 0x40762864, 0x407691aa, - 0x407727a2, - 0x4077a7c4, - 0x407827df, - 0x4078a818, - 0x4079282f, - 0x4079a845, - 0x407a2851, - 0x407aa864, - 0x407b2879, - 0x407ba88b, - 0x407c28a0, - 0x407ca8a9, - 0x407d2152, - 0x407d9c57, - 0x407e27f4, - 0x407e9e16, - 0x407f1a67, + 0x40772889, + 0x4077a8ab, + 0x407828c6, + 0x4078a8ff, + 0x40792916, + 0x4079a92c, + 0x407a2938, + 0x407aa94b, + 0x407b2960, + 0x407ba972, + 0x407c2987, + 0x407ca990, + 0x407d21e7, + 0x407d9c6e, + 0x407e28db, + 0x407e9e3e, + 0x407f1a7e, 0x407f9887, - 0x40801c2e, - 0x40809a8f, - 0x40811cd9, - 0x40819c08, - 0x40822635, + 0x40801c45, + 0x40809aa6, + 0x40811d01, + 0x40819c1f, + 0x40822700, 0x4082986d, - 0x40831df1, - 0x4083a028, - 0x40841aa3, - 0x40849e4e, - 0x41f4228b, - 0x41f9231d, - 0x41fe2210, - 0x41fea3ec, - 0x41ff24dd, - 0x420322a4, - 0x420822c6, - 0x4208a302, - 0x420921f4, - 0x4209a33c, - 0x420a224b, - 0x420aa22b, - 0x420b226b, - 0x420ba2e4, - 0x420c24f9, - 0x420ca3b9, - 0x420d23d3, - 0x420da40a, - 0x42122424, - 0x421724c0, - 0x4217a466, - 0x421c2488, - 0x421f2443, - 0x42212510, - 0x422624a3, - 0x422b25a9, - 0x422ba572, - 0x422c2591, - 0x422ca54c, - 0x422d252b, + 0x40831e19, + 0x4083a0bd, + 0x40841aba, + 0x40849e76, + 0x40851efb, + 0x40859ff3, + 0x40861f4f, + 0x40869c88, + 0x4087272d, + 0x4087a024, + 0x408818aa, + 0x41f42320, + 0x41f923b2, + 0x41fe22a5, + 0x41fea481, + 0x41ff2572, + 0x42032339, + 0x4208235b, + 0x4208a397, + 0x42092289, + 0x4209a3d1, + 0x420a22e0, + 0x420aa2c0, + 0x420b2300, + 0x420ba379, + 0x420c258e, + 0x420ca44e, + 0x420d2468, + 0x420da49f, + 0x421224b9, + 0x42172555, + 0x4217a4fb, + 0x421c251d, + 0x421f24d8, + 0x422125a5, + 0x42262538, + 0x422b2674, + 0x422ba622, + 0x422c265c, + 0x422ca5e1, + 0x422d25c0, + 0x422da641, + 0x422e2607, 0x4432072b, 0x4432873a, 0x44330746, @@ -582,69 +591,69 @@ const uint32_t kOpenSSLReasonValues[] = { 0x4c3d136d, 0x4c3d937c, 0x4c3e1389, - 0x50322b22, - 0x5032ab31, - 0x50332b3c, - 0x5033ab4c, - 0x50342b65, - 0x5034ab7f, - 0x50352b8d, - 0x5035aba3, - 0x50362bb5, - 0x5036abcb, - 0x50372be4, - 0x5037abf7, - 0x50382c0f, - 0x5038ac20, - 0x50392c35, - 0x5039ac49, - 0x503a2c69, - 0x503aac7f, - 0x503b2c97, - 0x503baca9, - 0x503c2cc5, - 0x503cacdc, - 0x503d2cf5, - 0x503dad0b, - 0x503e2d18, - 0x503ead2e, - 0x503f2d40, + 0x50322c09, + 0x5032ac18, + 0x50332c23, + 0x5033ac33, + 0x50342c4c, + 0x5034ac66, + 0x50352c74, + 0x5035ac8a, + 0x50362c9c, + 0x5036acb2, + 0x50372ccb, + 0x5037acde, + 0x50382cf6, + 0x5038ad07, + 0x50392d1c, + 0x5039ad30, + 0x503a2d50, + 0x503aad66, + 0x503b2d7e, + 0x503bad90, + 0x503c2dac, + 0x503cadc3, + 0x503d2ddc, + 0x503dadf2, + 0x503e2dff, + 0x503eae15, + 0x503f2e27, 0x503f8382, - 0x50402d53, - 0x5040ad63, - 0x50412d7d, - 0x5041ad8c, - 0x50422da6, - 0x5042adc3, - 0x50432dd3, - 0x5043ade3, - 0x50442df2, + 0x50402e3a, + 0x5040ae4a, + 0x50412e64, + 0x5041ae73, + 0x50422e8d, + 0x5042aeaa, + 0x50432eba, + 0x5043aeca, + 0x50442ed9, 0x5044843f, - 0x50452e06, - 0x5045ae24, - 0x50462e37, - 0x5046ae4d, - 0x50472e5f, - 0x5047ae74, - 0x50482e9a, - 0x5048aea8, - 0x50492ebb, - 0x5049aed0, - 0x504a2ee6, - 0x504aaef6, - 0x504b2f16, - 0x504baf29, - 0x504c2f4c, - 0x504caf7a, - 0x504d2f8c, - 0x504dafa9, - 0x504e2fc4, - 0x504eafe0, - 0x504f2ff2, - 0x504fb009, - 0x50503018, + 0x50452eed, + 0x5045af0b, + 0x50462f1e, + 0x5046af34, + 0x50472f46, + 0x5047af5b, + 0x50482f81, + 0x5048af8f, + 0x50492fa2, + 0x5049afb7, + 0x504a2fcd, + 0x504aafdd, + 0x504b2ffd, + 0x504bb010, + 0x504c3033, + 0x504cb061, + 0x504d3073, + 0x504db090, + 0x504e30ab, + 0x504eb0c7, + 0x504f30d9, + 0x504fb0f0, + 0x505030ff, 0x505086ef, - 0x5051302b, + 0x50513112, 0x58320ec9, 0x68320e8b, 0x68328c25, @@ -1007,6 +1016,7 @@ const char kOpenSSLReasonStringData[] = "BIO_NOT_SET\0" "BLOCK_CIPHER_PAD_IS_WRONG\0" "BUFFERED_MESSAGES_ON_CIPHER_CHANGE\0" + "CANNOT_PARSE_LEAF_CERT\0" "CA_DN_LENGTH_MISMATCH\0" "CA_DN_TOO_LONG\0" "CCS_RECEIVED_EARLY\0" @@ -1050,6 +1060,7 @@ const char kOpenSSLReasonStringData[] = "INVALID_COMPRESSION_LIST\0" "INVALID_MESSAGE\0" "INVALID_OUTER_RECORD_TYPE\0" + "INVALID_SCT_LIST\0" "INVALID_SSL_SESSION\0" "INVALID_TICKET_KEYS_LENGTH\0" "LENGTH_MISMATCH\0" @@ -1079,15 +1090,19 @@ const char kOpenSSLReasonStringData[] = "NO_RENEGOTIATION\0" "NO_REQUIRED_DIGEST\0" "NO_SHARED_CIPHER\0" + "NO_SHARED_GROUP\0" "NULL_SSL_CTX\0" "NULL_SSL_METHOD_PASSED\0" "OLD_SESSION_CIPHER_NOT_RETURNED\0" + "OLD_SESSION_PRF_HASH_MISMATCH\0" "OLD_SESSION_VERSION_NOT_RETURNED\0" "PARSE_TLSEXT\0" "PATH_TOO_LONG\0" "PEER_DID_NOT_RETURN_A_CERTIFICATE\0" "PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE\0" + "PRE_SHARED_KEY_MUST_BE_LAST\0" "PROTOCOL_IS_SHUTDOWN\0" + "PSK_IDENTITY_BINDER_COUNT_MISMATCH\0" "PSK_IDENTITY_NOT_FOUND\0" "PSK_NO_CLIENT_CB\0" "PSK_NO_SERVER_CB\0" @@ -1139,7 +1154,9 @@ const char kOpenSSLReasonStringData[] = "TLSV1_ALERT_USER_CANCELLED\0" "TLSV1_BAD_CERTIFICATE_HASH_VALUE\0" "TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE\0" + "TLSV1_CERTIFICATE_REQUIRED\0" "TLSV1_CERTIFICATE_UNOBTAINABLE\0" + "TLSV1_UNKNOWN_PSK_IDENTITY\0" "TLSV1_UNRECOGNIZED_NAME\0" "TLSV1_UNSUPPORTED_EXTENSION\0" "TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST\0" @@ -1147,6 +1164,7 @@ const char kOpenSSLReasonStringData[] = "TOO_MANY_EMPTY_FRAGMENTS\0" "TOO_MANY_KEY_UPDATES\0" "TOO_MANY_WARNING_ALERTS\0" + "TOO_MUCH_SKIPPED_EARLY_DATA\0" "UNABLE_TO_FIND_ECDH_PARAMETERS\0" "UNEXPECTED_EXTENSION\0" "UNEXPECTED_MESSAGE\0" diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 48782174a7..ea5bdbae58 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -312,6 +312,7 @@ CORE_SOURCE_FILES = [ 'src/core/plugin_registry/grpc_plugin_registry.c', 'src/boringssl/err_data.c', 'third_party/boringssl/crypto/aes/aes.c', + 'third_party/boringssl/crypto/aes/key_wrap.c', 'third_party/boringssl/crypto/aes/mode_wrappers.c', 'third_party/boringssl/crypto/asn1/a_bitstr.c', 'third_party/boringssl/crypto/asn1/a_bool.c', @@ -343,12 +344,12 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/asn1/tasn_new.c', 'third_party/boringssl/crypto/asn1/tasn_typ.c', 'third_party/boringssl/crypto/asn1/tasn_utl.c', + 'third_party/boringssl/crypto/asn1/time_support.c', 'third_party/boringssl/crypto/asn1/x_bignum.c', 'third_party/boringssl/crypto/asn1/x_long.c', 'third_party/boringssl/crypto/base64/base64.c', 'third_party/boringssl/crypto/bio/bio.c', 'third_party/boringssl/crypto/bio/bio_mem.c', - 'third_party/boringssl/crypto/bio/buffer.c', 'third_party/boringssl/crypto/bio/connect.c', 'third_party/boringssl/crypto/bio/fd.c', 'third_party/boringssl/crypto/bio/file.c', @@ -455,12 +456,7 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/modes/ctr.c', 'third_party/boringssl/crypto/modes/gcm.c', 'third_party/boringssl/crypto/modes/ofb.c', - 'third_party/boringssl/crypto/newhope/error_correction.c', - 'third_party/boringssl/crypto/newhope/newhope.c', - 'third_party/boringssl/crypto/newhope/ntt.c', - 'third_party/boringssl/crypto/newhope/poly.c', - 'third_party/boringssl/crypto/newhope/precomp.c', - 'third_party/boringssl/crypto/newhope/reduce.c', + 'third_party/boringssl/crypto/modes/polyval.c', 'third_party/boringssl/crypto/obj/obj.c', 'third_party/boringssl/crypto/obj/obj_xref.c', 'third_party/boringssl/crypto/pem/pem_all.c', @@ -471,14 +467,15 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/pem/pem_pkey.c', 'third_party/boringssl/crypto/pem/pem_x509.c', 'third_party/boringssl/crypto/pem/pem_xaux.c', - 'third_party/boringssl/crypto/pkcs8/p5_pbe.c', 'third_party/boringssl/crypto/pkcs8/p5_pbev2.c', 'third_party/boringssl/crypto/pkcs8/p8_pkey.c', 'third_party/boringssl/crypto/pkcs8/pkcs8.c', 'third_party/boringssl/crypto/poly1305/poly1305.c', 'third_party/boringssl/crypto/poly1305/poly1305_arm.c', 'third_party/boringssl/crypto/poly1305/poly1305_vec.c', + 'third_party/boringssl/crypto/pool/pool.c', 'third_party/boringssl/crypto/rand/deterministic.c', + 'third_party/boringssl/crypto/rand/fuchsia.c', 'third_party/boringssl/crypto/rand/rand.c', 'third_party/boringssl/crypto/rand/urandom.c', 'third_party/boringssl/crypto/rand/windows.c', @@ -490,6 +487,7 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/rsa/rsa.c', 'third_party/boringssl/crypto/rsa/rsa_asn1.c', 'third_party/boringssl/crypto/rsa/rsa_impl.c', + 'third_party/boringssl/crypto/sha/sha1-altivec.c', 'third_party/boringssl/crypto/sha/sha1.c', 'third_party/boringssl/crypto/sha/sha256.c', 'third_party/boringssl/crypto/sha/sha512.c', @@ -498,7 +496,6 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/thread_none.c', 'third_party/boringssl/crypto/thread_pthread.c', 'third_party/boringssl/crypto/thread_win.c', - 'third_party/boringssl/crypto/time_support.c', 'third_party/boringssl/crypto/x509/a_digest.c', 'third_party/boringssl/crypto/x509/a_sign.c', 'third_party/boringssl/crypto/x509/a_strex.c', @@ -582,6 +579,7 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/x509v3/v3_skey.c', 'third_party/boringssl/crypto/x509v3/v3_sxnet.c', 'third_party/boringssl/crypto/x509v3/v3_utl.c', + 'third_party/boringssl/ssl/bio_ssl.c', 'third_party/boringssl/ssl/custom_extensions.c', 'third_party/boringssl/ssl/d1_both.c', 'third_party/boringssl/ssl/d1_lib.c', @@ -592,7 +590,6 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/ssl/handshake_client.c', 'third_party/boringssl/ssl/handshake_server.c', 'third_party/boringssl/ssl/s3_both.c', - 'third_party/boringssl/ssl/s3_enc.c', 'third_party/boringssl/ssl/s3_lib.c', 'third_party/boringssl/ssl/s3_pkt.c', 'third_party/boringssl/ssl/ssl_aead_ctx.c', @@ -603,9 +600,12 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/ssl/ssl_ecdh.c', 'third_party/boringssl/ssl/ssl_file.c', 'third_party/boringssl/ssl/ssl_lib.c', - 'third_party/boringssl/ssl/ssl_rsa.c', + 'third_party/boringssl/ssl/ssl_privkey.c', + 'third_party/boringssl/ssl/ssl_privkey_cc.cc', 'third_party/boringssl/ssl/ssl_session.c', 'third_party/boringssl/ssl/ssl_stat.c', + 'third_party/boringssl/ssl/ssl_transcript.c', + 'third_party/boringssl/ssl/ssl_x509.c', 'third_party/boringssl/ssl/t1_enc.c', 'third_party/boringssl/ssl/t1_lib.c', 'third_party/boringssl/ssl/tls13_both.c', diff --git a/templates/Makefile.template b/templates/Makefile.template index 59a0aaa7cf..051a475d47 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -212,6 +212,9 @@ CFLAGS += -std=c99 -Wsign-conversion -Wconversion ${' '.join(warning_var('$(W_%s)', warning) for warning in PREFERRED_WARNINGS)} CXXFLAGS += -std=c++11 + ifeq ($(SYSTEM),Darwin) + CXXFLAGS += -stdlib=libc++ + endif % for arg in ['CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'LDFLAGS', 'DEFINES']: % if defaults.get('global', []).get(arg, None) is not None: ${arg} += ${defaults.get('global').get(arg)} diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index 935943158d..921cd8c8c5 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -167,6 +167,7 @@ % if lib.name in module.transitive_deps and lib.name == 'boringssl': { 'cflags': [ + '-std=c++11', '-std=c99', '-Wall', '-Werror' @@ -183,12 +184,23 @@ % for source in lib.src: '${source}', % endfor - ] + ], + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'MACOSX_DEPLOYMENT_TARGET': '10.9', + 'OTHER_CPLUSPLUSFLAGS': [ + '-stdlib=libc++', + '-std=c++11' + ], + } + }], + ], }, % endif % endfor % endfor - ] + ], }], ['OS == "win" and runtime!="electron"', { 'targets': [ diff --git a/third_party/boringssl b/third_party/boringssl index 78684e5b22..be2ee342d3 160000 --- a/third_party/boringssl +++ b/third_party/boringssl @@ -1 +1 @@ -Subproject commit 78684e5b222645828ca302e56b40b9daff2b2d27 +Subproject commit be2ee342d3781ddb954f91f8a7e660c6f59e87e5 diff --git a/third_party/rake-compiler-dock/Dockerfile b/third_party/rake-compiler-dock/Dockerfile index 475c6a8d3d..e7165b7e69 100644 --- a/third_party/rake-compiler-dock/Dockerfile +++ b/third_party/rake-compiler-dock/Dockerfile @@ -213,4 +213,6 @@ RUN echo '!' > /usr/local/rake-compiler/ruby/i686-linux-gnu/ruby-2.4.0/lib ENV RUBY_CC_VERSION 2.4.0:2.3.0:2.2.2:2.1.5:2.0.0 +RUN apt-get install -y g++-multilib + CMD bash diff --git a/tools/run_tests/artifacts/build_artifact_node.bat b/tools/run_tests/artifacts/build_artifact_node.bat index a71db79b2d..78dd28a06e 100644 --- a/tools/run_tests/artifacts/build_artifact_node.bat +++ b/tools/run_tests/artifacts/build_artifact_node.bat @@ -30,13 +30,13 @@ for %%v in (%node_versions%) do ( @rem Try again after removing openssl headers rmdir "%HOMEDRIVE%%HOMEPATH%\.node-gyp\%%v\include\node\openssl" /S /Q rmdir "%HOMEDRIVE%%HOMEPATH%\.node-gyp\iojs-%%v\include\node\openssl" /S /Q - call .\node_modules\.bin\node-pre-gyp.cmd build package testpackage --target=%%v --target_arch=%1 || goto :error + call .\node_modules\.bin\node-pre-gyp.cmd build package --target=%%v --target_arch=%1 || goto :error xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error ) for %%v in (%electron_versions%) do ( - cmd /V /C "set "HOME=%HOMEDRIVE%%HOMEPATH%\electron-gyp" && call .\node_modules\.bin\node-pre-gyp.cmd configure rebuild package testpackage --runtime=electron --target=%%v --target_arch=%1 --disturl=https://atom.io/download/electron" || goto :error + cmd /V /C "set "HOME=%HOMEDRIVE%%HOMEPATH%\electron-gyp" && call .\node_modules\.bin\node-pre-gyp.cmd configure rebuild package --runtime=electron --target=%%v --target_arch=%1 --disturl=https://atom.io/download/electron" || goto :error xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error ) diff --git a/tools/run_tests/artifacts/build_artifact_node.sh b/tools/run_tests/artifacts/build_artifact_node.sh index 5f7f7d28a4..01ec24f35e 100755 --- a/tools/run_tests/artifacts/build_artifact_node.sh +++ b/tools/run_tests/artifacts/build_artifact_node.sh @@ -33,12 +33,12 @@ electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 ) for version in ${node_versions[@]} do - ./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --target=$version --target_arch=$NODE_TARGET_ARCH --grpc_alpine=true + ./node_modules/.bin/node-pre-gyp configure rebuild package --target=$version --target_arch=$NODE_TARGET_ARCH --grpc_alpine=true cp -r build/stage/* "${ARTIFACTS_OUT}"/ done for version in ${electron_versions[@]} do - HOME=~/.electron-gyp ./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --runtime=electron --target=$version --target_arch=$NODE_TARGET_ARCH --disturl=https://atom.io/download/electron + HOME=~/.electron-gyp ./node_modules/.bin/node-pre-gyp configure rebuild package --runtime=electron --target=$version --target_arch=$NODE_TARGET_ARCH --disturl=https://atom.io/download/electron cp -r build/stage/* "${ARTIFACTS_OUT}"/ done diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 16ff417a27..4e1d01a788 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -4186,20 +4186,6 @@ "third_party": true, "type": "target" }, - { - "deps": [ - "boringssl", - "boringssl_chacha_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_chacha_test", - "src": [], - "third_party": true, - "type": "target" - }, { "deps": [ "boringssl", @@ -4298,20 +4284,6 @@ "third_party": true, "type": "target" }, - { - "deps": [ - "boringssl", - "boringssl_dh_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_dh_test", - "src": [], - "third_party": true, - "type": "target" - }, { "deps": [ "boringssl", @@ -4329,27 +4301,13 @@ { "deps": [ "boringssl", - "boringssl_dsa_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_dsa_test", - "src": [], - "third_party": true, - "type": "target" - }, - { - "deps": [ - "boringssl", - "boringssl_ec_test_lib", + "boringssl_example_mul_lib", "boringssl_test_util" ], "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_ec_test", + "name": "boringssl_example_mul", "src": [], "third_party": true, "type": "target" @@ -4357,13 +4315,13 @@ { "deps": [ "boringssl", - "boringssl_example_mul_lib", + "boringssl_p256-x86_64_test_lib", "boringssl_test_util" ], "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_example_mul", + "name": "boringssl_p256-x86_64_test", "src": [], "third_party": true, "type": "target" @@ -4424,20 +4382,6 @@ "third_party": true, "type": "target" }, - { - "deps": [ - "boringssl", - "boringssl_err_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_err_test", - "src": [], - "third_party": true, - "type": "target" - }, { "deps": [ "boringssl", @@ -4536,48 +4480,6 @@ "third_party": true, "type": "target" }, - { - "deps": [ - "boringssl", - "boringssl_newhope_statistical_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_newhope_statistical_test", - "src": [], - "third_party": true, - "type": "target" - }, - { - "deps": [ - "boringssl", - "boringssl_newhope_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_newhope_test", - "src": [], - "third_party": true, - "type": "target" - }, - { - "deps": [ - "boringssl", - "boringssl_newhope_vectors_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_newhope_vectors_test", - "src": [], - "third_party": true, - "type": "target" - }, { "deps": [ "boringssl", @@ -4637,13 +4539,13 @@ { "deps": [ "boringssl", - "boringssl_refcount_test_lib", + "boringssl_pool_test_lib", "boringssl_test_util" ], "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_refcount_test", + "name": "boringssl_pool_test", "src": [], "third_party": true, "type": "target" @@ -4651,13 +4553,13 @@ { "deps": [ "boringssl", - "boringssl_rsa_test_lib", + "boringssl_refcount_test_lib", "boringssl_test_util" ], "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_rsa_test", + "name": "boringssl_refcount_test", "src": [], "third_party": true, "type": "target" @@ -4732,20 +4634,6 @@ "third_party": true, "type": "target" }, - { - "deps": [ - "boringssl", - "boringssl_ssl_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_ssl_test", - "src": [], - "third_party": true, - "type": "target" - }, { "deps": [ "bad_client_test", @@ -6574,14 +6462,14 @@ "third_party/boringssl/crypto/digest/md32_common.h", "third_party/boringssl/crypto/ec/internal.h", "third_party/boringssl/crypto/ec/p256-x86_64-table.h", + "third_party/boringssl/crypto/ec/p256-x86_64.h", "third_party/boringssl/crypto/evp/internal.h", "third_party/boringssl/crypto/internal.h", "third_party/boringssl/crypto/modes/internal.h", - "third_party/boringssl/crypto/newhope/internal.h", "third_party/boringssl/crypto/obj/obj_dat.h", - "third_party/boringssl/crypto/obj/obj_xref.h", "third_party/boringssl/crypto/pkcs8/internal.h", "third_party/boringssl/crypto/poly1305/internal.h", + "third_party/boringssl/crypto/pool/internal.h", "third_party/boringssl/crypto/rand/internal.h", "third_party/boringssl/crypto/rsa/internal.h", "third_party/boringssl/crypto/x509/charmap.h", @@ -6631,7 +6519,6 @@ "third_party/boringssl/include/openssl/md4.h", "third_party/boringssl/include/openssl/md5.h", "third_party/boringssl/include/openssl/mem.h", - "third_party/boringssl/include/openssl/newhope.h", "third_party/boringssl/include/openssl/nid.h", "third_party/boringssl/include/openssl/obj.h", "third_party/boringssl/include/openssl/obj_mac.h", @@ -6644,6 +6531,7 @@ "third_party/boringssl/include/openssl/pkcs7.h", "third_party/boringssl/include/openssl/pkcs8.h", "third_party/boringssl/include/openssl/poly1305.h", + "third_party/boringssl/include/openssl/pool.h", "third_party/boringssl/include/openssl/rand.h", "third_party/boringssl/include/openssl/rc4.h", "third_party/boringssl/include/openssl/ripemd.h", @@ -6656,7 +6544,6 @@ "third_party/boringssl/include/openssl/stack.h", "third_party/boringssl/include/openssl/stack_macros.h", "third_party/boringssl/include/openssl/thread.h", - "third_party/boringssl/include/openssl/time_support.h", "third_party/boringssl/include/openssl/tls1.h", "third_party/boringssl/include/openssl/type_check.h", "third_party/boringssl/include/openssl/x509.h", @@ -6761,19 +6648,6 @@ "third_party": true, "type": "lib" }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_chacha_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, { "deps": [ "boringssl", @@ -6820,7 +6694,7 @@ ], "headers": [], "is_filegroup": false, - "language": "c", + "language": "c++", "name": "boringssl_constant_time_test_lib", "src": [], "third_party": true, @@ -6865,19 +6739,6 @@ "third_party": true, "type": "lib" }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_dh_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, { "deps": [ "boringssl", @@ -6899,7 +6760,7 @@ "headers": [], "is_filegroup": false, "language": "c", - "name": "boringssl_dsa_test_lib", + "name": "boringssl_example_mul_lib", "src": [], "third_party": true, "type": "lib" @@ -6912,20 +6773,7 @@ "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_ec_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "boringssl_example_mul_lib", + "name": "boringssl_p256-x86_64_test_lib", "src": [], "third_party": true, "type": "lib" @@ -6982,19 +6830,6 @@ "third_party": true, "type": "lib" }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_err_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, { "deps": [ "boringssl", @@ -7041,7 +6876,7 @@ ], "headers": [], "is_filegroup": false, - "language": "c", + "language": "c++", "name": "boringssl_hkdf_test_lib", "src": [], "third_party": true, @@ -7067,7 +6902,7 @@ ], "headers": [], "is_filegroup": false, - "language": "c", + "language": "c++", "name": "boringssl_lhash_test_lib", "src": [], "third_party": true, @@ -7086,45 +6921,6 @@ "third_party": true, "type": "lib" }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_newhope_statistical_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_newhope_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_newhope_vectors_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, { "deps": [ "boringssl", @@ -7184,8 +6980,8 @@ ], "headers": [], "is_filegroup": false, - "language": "c", - "name": "boringssl_refcount_test_lib", + "language": "c++", + "name": "boringssl_pool_test_lib", "src": [], "third_party": true, "type": "lib" @@ -7198,7 +6994,7 @@ "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_rsa_test_lib", + "name": "boringssl_refcount_test_lib", "src": [], "third_party": true, "type": "lib" @@ -7268,19 +7064,6 @@ "third_party": true, "type": "lib" }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_ssl_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, { "deps": [], "headers": [ diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 8bb29be6b4..6881278783 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4252,7 +4252,9 @@ ] }, { - "args": [], + "args": [ + "third_party/boringssl/crypto/aes/aes_tests.txt" + ], "boringssl": true, "ci_platforms": [ "linux", @@ -4403,31 +4405,6 @@ "windows" ] }, - { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_chacha_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [ "aes-128-gcm", @@ -4456,34 +4433,6 @@ "windows" ] }, - { - "args": [ - "aes-128-key-wrap", - "third_party/boringssl/crypto/cipher/test/aes_128_key_wrap_tests.txt" - ], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_aead_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [ "aes-256-gcm", @@ -4514,8 +4463,8 @@ }, { "args": [ - "aes-256-key-wrap", - "third_party/boringssl/crypto/cipher/test/aes_256_key_wrap_tests.txt" + "aes-128-gcm-siv", + "third_party/boringssl/crypto/cipher/test/aes_128_gcm_siv_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -4542,8 +4491,8 @@ }, { "args": [ - "chacha20-poly1305", - "third_party/boringssl/crypto/cipher/test/chacha20_poly1305_tests.txt" + "aes-256-gcm-siv", + "third_party/boringssl/crypto/cipher/test/aes_256_gcm_siv_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -4570,8 +4519,8 @@ }, { "args": [ - "chacha20-poly1305-old", - "third_party/boringssl/crypto/cipher/test/chacha20_poly1305_old_tests.txt" + "chacha20-poly1305", + "third_party/boringssl/crypto/cipher/test/chacha20_poly1305_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -5142,31 +5091,6 @@ "windows" ] }, - { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_dh_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [], "boringssl": true, @@ -5209,7 +5133,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_dsa_test", + "name": "boringssl_example_mul", "platforms": [ "linux", "mac", @@ -5218,32 +5142,9 @@ ] }, { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" + "args": [ + "third_party/boringssl/crypto/ec/p256-x86_64_tests.txt" ], - "flaky": false, - "language": "c++", - "name": "boringssl_ec_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, - { - "args": [], "boringssl": true, "ci_platforms": [ "linux", @@ -5259,7 +5160,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_example_mul", + "name": "boringssl_p256-x86_64_test", "platforms": [ "linux", "mac", @@ -5373,31 +5274,6 @@ "windows" ] }, - { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_err_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [], "boringssl": true, @@ -5577,83 +5453,6 @@ "windows" ] }, - { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_newhope_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, - { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_newhope_statistical_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, - { - "args": [ - "third_party/boringssl/crypto/newhope/newhope_tests.txt" - ], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_newhope_vectors_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [], "boringssl": true, @@ -5773,7 +5572,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_refcount_test", + "name": "boringssl_pool_test", "platforms": [ "linux", "mac", @@ -5798,7 +5597,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_rsa_test", + "name": "boringssl_refcount_test", "platforms": [ "linux", "mac", @@ -5931,31 +5730,6 @@ "windows" ] }, - { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_ssl_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [ "authority_not_supported" diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index c95ef4fcd8..d856e22176 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -27,7 +27,7 @@ want_submodules=`mktemp /tmp/submXXXXXX` git submodule | awk '{ print $1 }' | sort > $submodules cat << EOF | awk '{ print $1 }' | sort > $want_submodules 44c25c892a6229b20db7cd9dc05584ea865896de third_party/benchmark (v0.1.0-343-g44c25c8) - 78684e5b222645828ca302e56b40b9daff2b2d27 third_party/boringssl (78684e5) + be2ee342d3781ddb954f91f8a7e660c6f59e87e5 third_party/boringssl (heads/chromium-stable) 886e7d75368e3f4fab3f4d0d3584e4abfc557755 third_party/boringssl-with-bazel (version_for_cocoapods_7.0-857-g886e7d7) 30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e third_party/gflags (v2.2.0) ec44c6c1675c25b9827aacd08c02433cccde7780 third_party/googletest (release-1.8.0) diff --git a/tools/ubsan_suppressions.txt b/tools/ubsan_suppressions.txt index 3384efcac9..83dcfc3d05 100644 --- a/tools/ubsan_suppressions.txt +++ b/tools/ubsan_suppressions.txt @@ -4,5 +4,6 @@ nonnull-attribute:CBB_add_bytes nonnull-attribute:rsa_blinding_get nonnull-attribute:ssl_copy_key_material alignment:CRYPTO_cbc128_encrypt +alignment:CRYPTO_gcm128_encrypt nonnull-attribute:google::protobuf::* alignment:google::protobuf::* diff --git a/vsprojects/vcxproj/boringssl/boringssl.vcxproj b/vsprojects/vcxproj/boringssl/boringssl.vcxproj index a67b2c3a5d..ed8a54da96 100644 --- a/vsprojects/vcxproj/boringssl/boringssl.vcxproj +++ b/vsprojects/vcxproj/boringssl/boringssl.vcxproj @@ -162,14 +162,14 @@ + - - + @@ -219,7 +219,6 @@ - @@ -232,6 +231,7 @@ + @@ -244,7 +244,6 @@ - @@ -257,6 +256,8 @@ + + @@ -319,6 +320,8 @@ + + @@ -329,8 +332,6 @@ - - @@ -543,17 +544,7 @@ - - - - - - - - - - - + @@ -575,8 +566,6 @@ - - @@ -589,8 +578,12 @@ + + + + @@ -613,6 +606,8 @@ + + @@ -629,8 +624,6 @@ - - @@ -797,6 +790,8 @@ + + @@ -817,8 +812,6 @@ - - @@ -839,12 +832,18 @@ - + + + + + + + diff --git a/vsprojects/vcxproj/boringssl/boringssl.vcxproj.filters b/vsprojects/vcxproj/boringssl/boringssl.vcxproj.filters index 09aa067f78..ad6732984d 100644 --- a/vsprojects/vcxproj/boringssl/boringssl.vcxproj.filters +++ b/vsprojects/vcxproj/boringssl/boringssl.vcxproj.filters @@ -7,6 +7,9 @@ third_party\boringssl\crypto\aes + + third_party\boringssl\crypto\aes + third_party\boringssl\crypto\aes @@ -100,6 +103,9 @@ third_party\boringssl\crypto\asn1 + + third_party\boringssl\crypto\asn1 + third_party\boringssl\crypto\asn1 @@ -115,9 +121,6 @@ third_party\boringssl\crypto\bio - - third_party\boringssl\crypto\bio - third_party\boringssl\crypto\bio @@ -436,23 +439,8 @@ third_party\boringssl\crypto\modes - - third_party\boringssl\crypto\newhope - - - third_party\boringssl\crypto\newhope - - - third_party\boringssl\crypto\newhope - - - third_party\boringssl\crypto\newhope - - - third_party\boringssl\crypto\newhope - - - third_party\boringssl\crypto\newhope + + third_party\boringssl\crypto\modes third_party\boringssl\crypto\obj @@ -484,9 +472,6 @@ third_party\boringssl\crypto\pem - - third_party\boringssl\crypto\pkcs8 - third_party\boringssl\crypto\pkcs8 @@ -505,9 +490,15 @@ third_party\boringssl\crypto\poly1305 + + third_party\boringssl\crypto\pool + third_party\boringssl\crypto\rand + + third_party\boringssl\crypto\rand + third_party\boringssl\crypto\rand @@ -541,6 +532,9 @@ third_party\boringssl\crypto\rsa + + third_party\boringssl\crypto\sha + third_party\boringssl\crypto\sha @@ -565,9 +559,6 @@ third_party\boringssl\crypto - - third_party\boringssl\crypto - third_party\boringssl\crypto\x509 @@ -817,6 +808,9 @@ third_party\boringssl\crypto\x509v3 + + third_party\boringssl\ssl + third_party\boringssl\ssl @@ -847,9 +841,6 @@ third_party\boringssl\ssl - - third_party\boringssl\ssl - third_party\boringssl\ssl @@ -880,7 +871,10 @@ third_party\boringssl\ssl - + + third_party\boringssl\ssl + + third_party\boringssl\ssl @@ -889,6 +883,12 @@ third_party\boringssl\ssl + + third_party\boringssl\ssl + + + third_party\boringssl\ssl + third_party\boringssl\ssl @@ -960,6 +960,9 @@ third_party\boringssl\crypto\ec + + third_party\boringssl\crypto\ec + third_party\boringssl\crypto\evp @@ -969,21 +972,18 @@ third_party\boringssl\crypto\modes - - third_party\boringssl\crypto\newhope - third_party\boringssl\crypto\obj - - third_party\boringssl\crypto\obj - third_party\boringssl\crypto\pkcs8 third_party\boringssl\crypto\poly1305 + + third_party\boringssl\crypto\pool + third_party\boringssl\crypto\rand @@ -1131,9 +1131,6 @@ third_party\boringssl\include\openssl - - third_party\boringssl\include\openssl - third_party\boringssl\include\openssl @@ -1170,6 +1167,9 @@ third_party\boringssl\include\openssl + + third_party\boringssl\include\openssl + third_party\boringssl\include\openssl @@ -1206,9 +1206,6 @@ third_party\boringssl\include\openssl - - third_party\boringssl\include\openssl - third_party\boringssl\include\openssl @@ -1332,9 +1329,6 @@ {63ca8fcd-7644-61d6-4357-5a0bcfdc395b} - - {2a39f7c3-62df-5021-0825-36f18f10ad12} - {59349deb-4276-df4c-f4cd-e2cf707c3b4c} @@ -1347,6 +1341,9 @@ {9fd1fe61-f5b5-11e0-48ad-a90302eacab0} + + {19132e87-6e82-85b5-4109-6d353978eb21} + {965f2392-a795-b06a-7b17-d123d8e84f8d} diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj deleted file mode 100644 index f893298367..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {0F12358C-9F7A-E3B5-23EC-250C29C9D3A2} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_chacha_test - static - Debug - static - Debug - - - boringssl_chacha_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {D15F1CF5-EC88-FDD5-55A0-CBE5DC8A9F29} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj deleted file mode 100644 index 3c4c382c56..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {D15F1CF5-EC88-FDD5-55A0-CBE5DC8A9F29} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_chacha_test_lib - - - boringssl_chacha_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj.filters deleted file mode 100644 index 5fb3e2fc49..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\chacha - - - - - - {4b736811-6554-6004-024b-74e526459c17} - - - {256ad378-581e-bc4f-e018-f4a4e4098091} - - - {7e6857c0-cc2b-da3a-bdf7-cf9f82aba586} - - - {02432684-f62e-6b57-5847-af2e296fbbab} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj index cc31162733..f75842ba58 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj @@ -147,7 +147,7 @@ - + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj.filters index 2a3689b010..99e90085bd 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj.filters +++ b/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj.filters @@ -1,7 +1,7 @@ - + third_party\boringssl\crypto diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test/boringssl_dh_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_dh_test/boringssl_dh_test.vcxproj deleted file mode 100644 index f8bc4f23c0..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test/boringssl_dh_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {26AFD763-4456-9AAF-2458-4C616281C668} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_dh_test - static - Debug - static - Debug - - - boringssl_dh_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {56A4B15E-3DB1-118D-1ED2-4527CA24FE81} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test/boringssl_dh_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_dh_test/boringssl_dh_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test/boringssl_dh_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj deleted file mode 100644 index aec7e2f64d..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {56A4B15E-3DB1-118D-1ED2-4527CA24FE81} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_dh_test_lib - - - boringssl_dh_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj.filters deleted file mode 100644 index 6d5de842c7..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\dh - - - - - - {65ed99ff-7fef-84bd-69ac-699784eaa2d5} - - - {20a54707-e604-4830-8245-e0332914fc02} - - - {059fef06-fd8b-f6dd-d545-1355d0d6f0fe} - - - {909105d9-54df-9980-9131-c9273ab8a135} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj deleted file mode 100644 index 52505e6cc7..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {D99910AE-2E0C-437C-D2AD-B69724AC5724} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_dsa_test - static - Debug - static - Debug - - - boringssl_dsa_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {4D7D265F-7184-79BB-CDCA-93ADFE0555CA} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj deleted file mode 100644 index 0d35de10a7..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4D7D265F-7184-79BB-CDCA-93ADFE0555CA} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_dsa_test_lib - - - boringssl_dsa_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj.filters deleted file mode 100644 index d4bcb3d412..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\dsa - - - - - - {e872ec56-f98e-8bf1-cf9f-f63207551aab} - - - {8d566f1f-48e0-4f2e-497d-1b2d3b3a94af} - - - {e161d8ba-c211-0c32-47d2-524b635a0de1} - - - {83748c5a-3e97-be8e-9881-c1f2ba816eb8} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj deleted file mode 100644 index dfa7d23aaf..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {6B7C8FF0-E60D-551F-61D8-4F865ED8F48E} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_ec_test - static - Debug - static - Debug - - - boringssl_ec_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {0B3020E4-6C92-E46A-CDD2-29CDAB97020B} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj deleted file mode 100644 index 644048ba52..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {0B3020E4-6C92-E46A-CDD2-29CDAB97020B} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_ec_test_lib - - - boringssl_ec_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj.filters deleted file mode 100644 index c6b6a253a3..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\ec - - - - - - {0c909793-7738-837f-28b9-e775ca31f1e0} - - - {845f42f3-1622-7f5a-d949-f6921e429143} - - - {971129bb-6f10-5a13-6770-3334e05d027e} - - - {0673821d-35d0-95dd-6e39-870eb33127fc} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj deleted file mode 100644 index 085b8ce0e8..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {E8595872-8ABC-0177-B646-0783F8C4ADEF} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_err_test - static - Debug - static - Debug - - - boringssl_err_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {11E8A736-EEA4-84A8-BCC8-08269674DCBF} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj deleted file mode 100644 index 87def13857..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {11E8A736-EEA4-84A8-BCC8-08269674DCBF} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_err_test_lib - - - boringssl_err_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj.filters deleted file mode 100644 index 2a9696d54b..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\err - - - - - - {1c12770a-24ce-cd11-bb90-f3b2e9216e03} - - - {f790f27a-bb2c-6ed0-ef88-abeb2a27a513} - - - {be436245-b188-a1ee-4e2b-d27f6cee0d88} - - - {027082a4-6859-7319-0e4a-c7b47e736762} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj index 0160850330..93493b0b4b 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj @@ -147,7 +147,7 @@ - + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj.filters index f3c142afff..c88d022b15 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj.filters +++ b/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj.filters @@ -1,7 +1,7 @@ - + third_party\boringssl\crypto\hkdf diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj index b12007d90d..fb297c99c5 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj @@ -147,7 +147,7 @@ - + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj.filters index d8606eade9..8031442256 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj.filters +++ b/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj.filters @@ -1,7 +1,7 @@ - + third_party\boringssl\crypto\lhash diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj deleted file mode 100644 index f3dde154ad..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {2DFF4B39-A402-0C88-ACE5-58BD7E5F7686} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_newhope_statistical_test - static - Debug - static - Debug - - - boringssl_newhope_statistical_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {95B2444A-04E1-7F0A-049C-30099AA62E84} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj deleted file mode 100644 index c9cb80a430..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {95B2444A-04E1-7F0A-049C-30099AA62E84} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_newhope_statistical_test_lib - - - boringssl_newhope_statistical_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj.filters deleted file mode 100644 index 95945c2467..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\newhope - - - - - - {25a9ae19-5707-441e-6d97-13ff38322368} - - - {e6e1e1f9-31eb-463f-a882-01c72cbe7a6e} - - - {37a6d595-952d-a224-060b-ea246359d76a} - - - {e0473499-9b3e-c3c3-5463-4706bd005f6c} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj deleted file mode 100644 index 7a085b638f..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {105DF9D7-2B9F-501B-9FC4-C98BF16FC9D3} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_newhope_test - static - Debug - static - Debug - - - boringssl_newhope_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {2E791A00-9907-8B9A-D201-4E0C357A6BB3} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj deleted file mode 100644 index 5504636061..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {2E791A00-9907-8B9A-D201-4E0C357A6BB3} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_newhope_test_lib - - - boringssl_newhope_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj.filters deleted file mode 100644 index f2dc0e6a5b..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\newhope - - - - - - {f6eddde4-4559-9adb-797f-897631281a89} - - - {81b307de-7498-3465-2ad4-7b634bf4788a} - - - {af9d3e32-2f0f-f0f3-f63f-4a8bd7f07c46} - - - {ea48f773-5060-8693-62ef-f257ccd47b21} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj deleted file mode 100644 index 505f7cf33a..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {E4C140A1-B7A3-0D00-A02F-CC90C9972F00} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_newhope_vectors_test - static - Debug - static - Debug - - - boringssl_newhope_vectors_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {0993166D-33B9-2E51-B0A9-5035A9086A2E} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj deleted file mode 100644 index 4f01ec4b70..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {0993166D-33B9-2E51-B0A9-5035A9086A2E} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_newhope_vectors_test_lib - - - boringssl_newhope_vectors_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj.filters deleted file mode 100644 index 27b208d350..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\newhope - - - - - - {678cf897-2d02-4bb5-1872-b6d6d61c528f} - - - {3cc5b2df-8409-e2e8-9504-748004a314f3} - - - {2a4fb92f-e756-007b-f6fc-d8f55fee6096} - - - {09155346-c8e7-ffdb-7791-4f623ac5d521} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test/boringssl_p256-x86_64_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test/boringssl_p256-x86_64_test.vcxproj new file mode 100644 index 0000000000..b99cdb0a3c --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test/boringssl_p256-x86_64_test.vcxproj @@ -0,0 +1,198 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {AB14282B-1904-75A7-14E9-5D796BA48A6E} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + boringssl_p256-x86_64_test + static + Debug + static + Debug + + + boringssl_p256-x86_64_test + static + Release + static + Release + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + false + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + false + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + false + None + false + + + Console + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + false + None + false + + + Console + true + false + true + true + + + + + + + + + + {41EDDD5E-AC73-5406-4816-B884A969A851} + + + {427037B1-B51B-D6F1-5025-AD12B200266A} + + + {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test/boringssl_p256-x86_64_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test/boringssl_p256-x86_64_test.vcxproj.filters new file mode 100644 index 0000000000..00e4276f1d --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test/boringssl_p256-x86_64_test.vcxproj.filters @@ -0,0 +1,7 @@ + + + + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj new file mode 100644 index 0000000000..ae27f91826 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj @@ -0,0 +1,170 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {41EDDD5E-AC73-5406-4816-B884A969A851} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + true + Unicode + + + + + + + + + + + + boringssl_p256-x86_64_test_lib + + + boringssl_p256-x86_64_test_lib + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + false + None + false + + + Windows + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + false + None + false + + + Windows + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + false + None + false + + + Windows + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + false + None + false + + + Windows + true + false + true + true + + + + + + + + + + {427037B1-B51B-D6F1-5025-AD12B200266A} + + + {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj.filters new file mode 100644 index 0000000000..2aedced8e6 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + third_party\boringssl\crypto\ec + + + + + + {d58c12fd-d68b-d1cf-8064-02ad7f5bd174} + + + {c404cc15-5ff2-192a-553a-c76dfd4dec24} + + + {59196cf4-477e-4d60-c632-11657bc8eb64} + + + {e1e4c8c7-c53c-3220-f39f-e10a3a0cf545} + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_pool_test/boringssl_pool_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test/boringssl_pool_test.vcxproj new file mode 100644 index 0000000000..9c3525e915 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test/boringssl_pool_test.vcxproj @@ -0,0 +1,198 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {35526D60-E216-B228-DDBA-0629A2F62E94} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + boringssl_pool_test + static + Debug + static + Debug + + + boringssl_pool_test + static + Release + static + Release + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + false + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + false + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + false + None + false + + + Console + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + false + None + false + + + Console + true + false + true + true + + + + + + + + + + {92D44604-E9C2-7E21-E2FD-E392F711DE69} + + + {427037B1-B51B-D6F1-5025-AD12B200266A} + + + {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_pool_test/boringssl_pool_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test/boringssl_pool_test.vcxproj.filters new file mode 100644 index 0000000000..00e4276f1d --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test/boringssl_pool_test.vcxproj.filters @@ -0,0 +1,7 @@ + + + + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj new file mode 100644 index 0000000000..d4d4f319a8 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj @@ -0,0 +1,170 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {92D44604-E9C2-7E21-E2FD-E392F711DE69} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + true + Unicode + + + + + + + + + + + + boringssl_pool_test_lib + + + boringssl_pool_test_lib + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + false + None + false + + + Windows + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + false + None + false + + + Windows + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + false + None + false + + + Windows + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + false + None + false + + + Windows + true + false + true + true + + + + + + + + + + {427037B1-B51B-D6F1-5025-AD12B200266A} + + + {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj.filters new file mode 100644 index 0000000000..2c79653ee7 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + third_party\boringssl\crypto\pool + + + + + + {33e3c83d-455d-40bd-1713-c6e23c795524} + + + {e5fa673d-d1f1-d059-ba9e-73f64e5c9d2d} + + + {171c153b-3e26-d38a-e68f-928ac1ea6abe} + + + {be0032f3-238e-9f9a-dbf8-3e3994743cd6} + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj index ab0bb50492..65f0cf5898 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj @@ -147,7 +147,7 @@ - + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj.filters index 58d3068efe..879bef7d84 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj.filters +++ b/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj.filters @@ -1,7 +1,7 @@ - + third_party\boringssl\crypto diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj deleted file mode 100644 index 4916f3ff18..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {2354090D-8BFD-2905-D2B4-89A211F2932A} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_rsa_test - static - Debug - static - Debug - - - boringssl_rsa_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {96D48EA8-C1E0-ECA1-7504-1F7CB7761937} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj deleted file mode 100644 index 420f70a5ce..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {96D48EA8-C1E0-ECA1-7504-1F7CB7761937} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_rsa_test_lib - - - boringssl_rsa_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj.filters deleted file mode 100644 index e3450798a9..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\rsa - - - - - - {68d305bc-5eb5-b25f-a31b-a1612d05ed35} - - - {b02ccca6-4460-f6a2-3e46-86c2f7bfc21d} - - - {6de000ba-ac5d-11d3-3932-f463ff3ed11e} - - - {25fda1e5-deda-f910-1f28-54b498b5e648} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj deleted file mode 100644 index eab2cabfd2..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {2D1CD121-38BD-1C90-FDEC-01DB235D4881} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_ssl_test - static - Debug - static - Debug - - - boringssl_ssl_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {E5224E90-A17D-5EC6-DDDE-36204B2F2601} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj deleted file mode 100644 index 58122a219d..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {E5224E90-A17D-5EC6-DDDE-36204B2F2601} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_ssl_test_lib - - - boringssl_ssl_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj.filters deleted file mode 100644 index aed49a863e..0000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj.filters +++ /dev/null @@ -1,21 +0,0 @@ - - - - - third_party\boringssl\ssl - - - - - - {63e7e5c0-fc47-80d3-1eba-465814020d80} - - - {7052a2bd-7144-f593-6ce0-41c21596a6e1} - - - {969234a8-1735-8a0f-d4b5-a59b08a3e246} - - - - -- cgit v1.2.3 From f1ce470b3038d3a42ab9146b59790f85deb5005c Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 16 Jun 2017 14:28:34 -0700 Subject: Release slice no longer owned --- src/objective-c/GRPCClient/private/GRPCChannel.m | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index 79fe7c6e05..ca494d5ff2 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -182,12 +182,15 @@ static grpc_channel_args *BuildChannelArgs(NSDictionary *dictionary) { - (grpc_call *)unmanagedCallWithPath:(NSString *)path completionQueue:(GRPCCompletionQueue *)queue { - return grpc_channel_create_call(_unmanagedChannel, - NULL, GRPC_PROPAGATE_DEFAULTS, - queue.unmanagedQueue, - grpc_slice_from_copied_string(path.UTF8String), - NULL, // Passing NULL for host - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + grpc_slice path_slice = grpc_slice_from_copied_string(path.UTF8String); + grpc_call *call = grpc_channel_create_call(_unmanagedChannel, + NULL, GRPC_PROPAGATE_DEFAULTS, + queue.unmanagedQueue, + path_slice, + NULL, // Passing NULL for host + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + grpc_slice_unref(path_slice); + return call; } @end -- cgit v1.2.3 From 0d8b988fbb7d4546675ff3417f2ec27edf5ef70a Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 16 Jun 2017 15:59:12 -0700 Subject: Update PHP protoc plugin generation - Use docblocks instead of single line comments - Escape '*/' - Indent 4 spaces to match protobuf - Use single line namespace to match protobuf --- src/compiler/php_generator.cc | 40 +++++++++++++++++++++--------------- src/compiler/php_generator_helpers.h | 15 +++++++++++++- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/src/compiler/php_generator.cc b/src/compiler/php_generator.cc index a7387d7223..6d34761fdf 100644 --- a/src/compiler/php_generator.cc +++ b/src/compiler/php_generator.cc @@ -52,14 +52,16 @@ void PrintMethod(const MethodDescriptor *method, Printer *out) { vars["input_type_id"] = MessageIdentifierName(input_type->full_name()); vars["output_type_id"] = MessageIdentifierName(output_type->full_name()); - out->Print(GetPHPComments(method, " //").c_str()); + out->Print("/**\n"); + out->Print(GetPHPComments(method, " *").c_str()); if (method->client_streaming()) { out->Print(vars, - " // @param array $$metadata metadata\n" - " // @param array $$options call options\n" + " * @param array $$metadata metadata\n" + " * @param array $$options call options\n */\n" "public function $name$($$metadata = [], " "$$options = []) {\n"); out->Indent(); + out->Indent(); if (method->server_streaming()) { out->Print("return $$this->_bidiRequest("); } else { @@ -71,12 +73,13 @@ void PrintMethod(const MethodDescriptor *method, Printer *out) { "$$metadata, $$options);\n"); } else { out->Print(vars, - " // @param \\$input_type_id$ $$argument input argument\n" - " // @param array $$metadata metadata\n" - " // @param array $$options call options\n" + " * @param \\$input_type_id$ $$argument input argument\n" + " * @param array $$metadata metadata\n" + " * @param array $$options call options\n */\n" "public function $name$(\\$input_type_id$ $$argument,\n" " $$metadata = [], $$options = []) {\n"); out->Indent(); + out->Indent(); if (method->server_streaming()) { out->Print("return $$this->_serverStreamRequest("); } else { @@ -89,26 +92,32 @@ void PrintMethod(const MethodDescriptor *method, Printer *out) { "$$metadata, $$options);\n"); } out->Outdent(); + out->Outdent(); out->Print("}\n\n"); } // Prints out the service descriptor object void PrintService(const ServiceDescriptor *service, Printer *out) { map vars; - out->Print(GetPHPComments(service, "//").c_str()); + out->Print("/**\n"); + out->Print(GetPHPComments(service, " *").c_str()); + out->Print(" */\n"); vars["name"] = service->name(); out->Print(vars, "class $name$Client extends \\Grpc\\BaseStub {\n\n"); out->Indent(); + out->Indent(); out->Print( - " // @param string $$hostname hostname\n" - " // @param array $$opts channel options\n" - " // @param \\Grpc\\Channel $$channel (optional) re-use channel " - "object\n" + "/**\n * @param string $$hostname hostname\n" + " * @param array $$opts channel options\n" + " * @param \\Grpc\\Channel $$channel (optional) re-use channel " + "object\n */\n" "public function __construct($$hostname, $$opts, " "$$channel = null) {\n"); out->Indent(); + out->Indent(); out->Print("parent::__construct($$hostname, $$opts, $$channel);\n"); out->Outdent(); + out->Outdent(); out->Print("}\n\n"); for (int i = 0; i < service->method_count(); i++) { grpc::string method_name = @@ -116,7 +125,8 @@ void PrintService(const ServiceDescriptor *service, Printer *out) { PrintMethod(service->method(i), out); } out->Outdent(); - out->Print("}\n\n"); + out->Outdent(); + out->Print("}\n"); } } @@ -138,13 +148,9 @@ grpc::string GenerateFile(const FileDescriptor *file, map vars; vars["package"] = MessageIdentifierName(file->package()); - out.Print(vars, "namespace $package$ {\n\n"); - out.Indent(); + out.Print(vars, "namespace $package$;\n\n"); PrintService(service, &out); - - out.Outdent(); - out.Print("}\n"); } return output; } diff --git a/src/compiler/php_generator_helpers.h b/src/compiler/php_generator_helpers.h index 8e35809357..8f59b90d04 100644 --- a/src/compiler/php_generator_helpers.h +++ b/src/compiler/php_generator_helpers.h @@ -39,12 +39,25 @@ inline grpc::string GetPHPServiceFilename( return oss.str() + "/" + service->name() + "Client.php"; } +// ReplaceAll replaces all instances of search with replace in s. +inline grpc::string ReplaceAll(grpc::string s, const grpc::string &search, + const grpc::string &replace) { + size_t pos = 0; + while ((pos = s.find(search, pos)) != grpc::string::npos) { + s.replace(pos, search.length(), replace); + pos += replace.length(); + } + return s; +} + // Get leading or trailing comments in a string. Comment lines start with "// ". // Leading detached comments are put in in front of leading comments. template inline grpc::string GetPHPComments(const DescriptorType *desc, grpc::string prefix) { - return grpc_generator::GetPrefixedComments(desc, true, prefix); + return ReplaceAll(grpc_generator::GetPrefixedComments(desc, true, prefix), + "*/", + "*/"); } } // namespace grpc_php_generator -- cgit v1.2.3 From fbb61ed25dd3080ff143f60efaaae6be435f56c5 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 19 Jun 2017 09:57:43 +0200 Subject: fix license file --- LICENSE | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 7750ce4fdd..d645695673 100644 --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,14 @@ Apache License Version 2.0, January 2004 - https://www.apache.org/licenses/ + http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. @@ -86,6 +87,7 @@ granted to You under this License for that Work shall terminate as of the date such litigation is filed. + 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: @@ -103,6 +105,7 @@ the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one @@ -120,7 +123,9 @@ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, @@ -171,7 +176,18 @@ END OF TERMS AND CONDITIONS - Copyright 2015-2017 gRPC authors. + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. -- cgit v1.2.3 From d2da5aa8a29754ca931a05fdebf9fb246ce8da53 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 19 Jun 2017 10:05:18 +0200 Subject: fix sanity --- tools/distrib/check_copyright.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 4179bf1cb8..6ecacede71 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -72,7 +72,6 @@ LICENSE_PREFIX = { '.mak': r'#\s*', 'Makefile': r'#\s*', 'Dockerfile': r'#\s*', - 'LICENSE': r'\s*', 'BUILD': r'#\s*', } @@ -124,7 +123,7 @@ def save(name, text): with open(name, 'w') as f: f.write(text) -assert(re.search(RE_LICENSE['LICENSE'], load('LICENSE'))) + assert(re.search(RE_LICENSE['Makefile'], load('Makefile'))) -- cgit v1.2.3 From 45e161b1c9cd48c769ce8977114bf1f057dd4bb3 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Fri, 16 Jun 2017 15:12:13 -0700 Subject: Make threshold toggleable --- tools/profiling/microbenchmarks/bm_diff/bm_diff.py | 2 +- tools/profiling/microbenchmarks/bm_diff/bm_speedup.py | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff/bm_diff.py index 73abf90ff5..ec1840e2a1 100755 --- a/tools/profiling/microbenchmarks/bm_diff/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_diff.py @@ -108,7 +108,7 @@ class Benchmark: mdn_diff = abs(_median(new) - _median(old)) _maybe_print('%s: %s=%r %s=%r mdn_diff=%r' % (f, new_name, new, old_name, old, mdn_diff)) - s = bm_speedup.speedup(new, old) + s = bm_speedup.speedup(new, old, 1e-10) if abs(s) > 3 and mdn_diff > 0.5: self.final[f] = '%+d%%' % s return self.final.keys() diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py b/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py index 3d126efa62..5bff8d0ca9 100755 --- a/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py @@ -17,8 +17,6 @@ from scipy import stats import math -_THRESHOLD = 1e-10 - def scale(a, mul): return [x * mul for x in a] @@ -28,18 +26,18 @@ def cmp(a, b): return stats.ttest_ind(a, b) -def speedup(new, old): +def speedup(new, old, threshold): if (len(set(new))) == 1 and new == old: return 0 s0, p0 = cmp(new, old) if math.isnan(p0): return 0 if s0 == 0: return 0 - if p0 > _THRESHOLD: return 0 + if p0 > threshold: return 0 if s0 < 0: pct = 1 while pct < 101: sp, pp = cmp(new, scale(old, 1 - pct / 100.0)) if sp > 0: break - if pp > _THRESHOLD: break + if pp > threshold: break pct += 1 return -(pct - 1) else: @@ -47,7 +45,7 @@ def speedup(new, old): while pct < 100000: sp, pp = cmp(new, scale(old, 1 + pct / 100.0)) if sp < 0: break - if pp > _THRESHOLD: break + if pp > threshold: break pct += 1 return pct - 1 -- cgit v1.2.3 From 3345e1ccf766d813dcd0f07324214cf623725ff0 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Mon, 19 Jun 2017 09:28:22 -0700 Subject: Actually enable trickle diff --- tools/jenkins/run_trickle_diff.sh | 2 +- .../microbenchmarks/bm_diff/bm_constants.py | 5 ++-- tools/profiling/microbenchmarks/bm_diff/bm_diff.py | 29 +++++++++++----------- .../microbenchmarks/bm_diff/bm_speedup.py | 12 ++++----- tools/profiling/microbenchmarks/bm_json.py | 2 ++ 5 files changed, 26 insertions(+), 24 deletions(-) diff --git a/tools/jenkins/run_trickle_diff.sh b/tools/jenkins/run_trickle_diff.sh index da905d0249..47dd8b44d6 100755 --- a/tools/jenkins/run_trickle_diff.sh +++ b/tools/jenkins/run_trickle_diff.sh @@ -20,4 +20,4 @@ set -ex cd $(dirname $0)/../.. tools/run_tests/start_port_server.py -tools/profiling/microbenchmarks/bm_diff/bm_main.py -d origin/$ghprbTargetBranch -b bm_fullstack_trickle -l 4 -t cli_transport_stalls cli_stream_stalls svr_transport_stalls svr_stream_stalls --no-counters --pr_comment_name trickle +tools/profiling/microbenchmarks/bm_diff/bm_main.py -d origin/$ghprbTargetBranch -b bm_fullstack_trickle -l 4 -t cli_transport_stalls_per_iteration cli_stream_stalls_per_iteration svr_transport_stalls_per_iteration svr_stream_stalls_per_iteration --no-counters --pr_comment_name trickle diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_constants.py b/tools/profiling/microbenchmarks/bm_diff/bm_constants.py index 4cd65867c3..ad79a0a197 100644 --- a/tools/profiling/microbenchmarks/bm_diff/bm_constants.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_constants.py @@ -26,5 +26,6 @@ _AVAILABLE_BENCHMARK_TESTS = [ _INTERESTING = ('cpu_time', 'real_time', 'locks_per_iteration', 'allocs_per_iteration', 'writes_per_iteration', 'atm_cas_per_iteration', 'atm_add_per_iteration', - 'nows_per_iteration', 'cli_transport_stalls', 'cli_stream_stalls', - 'svr_transport_stalls', 'svr_stream_stalls',) + 'nows_per_iteration', 'cli_transport_stalls_per_iteration', + 'cli_stream_stalls_per_iteration', 'svr_transport_stalls_per_iteration', + 'svr_stream_stalls_per_iteration',) diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff/bm_diff.py index ec1840e2a1..809817a1a8 100755 --- a/tools/profiling/microbenchmarks/bm_diff/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_diff.py @@ -108,9 +108,10 @@ class Benchmark: mdn_diff = abs(_median(new) - _median(old)) _maybe_print('%s: %s=%r %s=%r mdn_diff=%r' % (f, new_name, new, old_name, old, mdn_diff)) - s = bm_speedup.speedup(new, old, 1e-10) - if abs(s) > 3 and mdn_diff > 0.5: - self.final[f] = '%+d%%' % s + s = bm_speedup.speedup(new, old, 1e-5) + if abs(s) > 3: + if mdn_diff > 0.5 or 'trickle' in f: + self.final[f] = '%+d%%' % s return self.final.keys() def skip(self): @@ -172,18 +173,16 @@ def diff(bms, loops, track, old, new, counters): js_new_ctr = None js_old_ctr = None - if js_new_ctr: - for row in bm_json.expand_json(js_new_ctr, js_new_opt): - name = row['cpp_name'] - if name.endswith('_mean') or name.endswith('_stddev'): - continue - benchmarks[name].add_sample(track, row, True) - if js_old_ctr: - for row in bm_json.expand_json(js_old_ctr, js_old_opt): - name = row['cpp_name'] - if name.endswith('_mean') or name.endswith('_stddev'): - continue - benchmarks[name].add_sample(track, row, False) + for row in bm_json.expand_json(js_new_ctr, js_new_opt): + name = row['cpp_name'] + if name.endswith('_mean') or name.endswith('_stddev'): + continue + benchmarks[name].add_sample(track, row, True) + for row in bm_json.expand_json(js_old_ctr, js_old_opt): + name = row['cpp_name'] + if name.endswith('_mean') or name.endswith('_stddev'): + continue + benchmarks[name].add_sample(track, row, False) really_interesting = set() for name, bm in benchmarks.items(): diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py b/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py index 5bff8d0ca9..4bf59fb280 100755 --- a/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py @@ -34,7 +34,7 @@ def speedup(new, old, threshold): if p0 > threshold: return 0 if s0 < 0: pct = 1 - while pct < 101: + while pct < 100: sp, pp = cmp(new, scale(old, 1 - pct / 100.0)) if sp > 0: break if pp > threshold: break @@ -42,7 +42,7 @@ def speedup(new, old, threshold): return -(pct - 1) else: pct = 1 - while pct < 100000: + while pct < 10000: sp, pp = cmp(new, scale(old, 1 + pct / 100.0)) if sp < 0: break if pp > threshold: break @@ -51,7 +51,7 @@ def speedup(new, old, threshold): if __name__ == "__main__": - new = [1.0, 1.0, 1.0, 1.0] - old = [2.0, 2.0, 2.0, 2.0] - print speedup(new, old) - print speedup(old, new) + new = [0.0, 0.0, 0.0, 0.0] + old=[2.96608e-06, 3.35076e-06, 3.45384e-06, 3.34407e-06] + print speedup(new, old, 1e-5) + print speedup(old, new, 1e-5) diff --git a/tools/profiling/microbenchmarks/bm_json.py b/tools/profiling/microbenchmarks/bm_json.py index 062611f1c7..930287e0d6 100644 --- a/tools/profiling/microbenchmarks/bm_json.py +++ b/tools/profiling/microbenchmarks/bm_json.py @@ -167,6 +167,8 @@ def parse_name(name): return out def expand_json(js, js2 = None): + assert(js or js2) + if not js: js = js2 for bm in js['benchmarks']: if bm['name'].endswith('_stddev') or bm['name'].endswith('_mean'): continue context = js['context'] -- cgit v1.2.3 From 0aeede35a59ac1c996bb62bb55a29d0d7d7777ee Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 19 Jun 2017 14:30:14 -0700 Subject: Unref existing error before setting a new one. --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 0ad63d1af2..0211169c00 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2726,6 +2726,7 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( gpr_ref_init(&incoming_byte_stream->refs, 2); incoming_byte_stream->transport = t; incoming_byte_stream->stream = s; + GRPC_ERROR_UNREF(s->byte_stream_error); s->byte_stream_error = GRPC_ERROR_NONE; return incoming_byte_stream; } -- cgit v1.2.3 From 65fe1abed281fd911382d40fca72d79c14e9960a Mon Sep 17 00:00:00 2001 From: ncteisen Date: Mon, 19 Jun 2017 14:30:33 -0700 Subject: Address github comments --- tools/profiling/microbenchmarks/bm_diff/bm_speedup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py b/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py index 4bf59fb280..63e691af02 100755 --- a/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py @@ -17,6 +17,7 @@ from scipy import stats import math +_DEFAULT_THRESHOLD = 1e-10 def scale(a, mul): return [x * mul for x in a] @@ -26,7 +27,7 @@ def cmp(a, b): return stats.ttest_ind(a, b) -def speedup(new, old, threshold): +def speedup(new, old, threshold = _DEFAULT_THRESHOLD): if (len(set(new))) == 1 and new == old: return 0 s0, p0 = cmp(new, old) if math.isnan(p0): return 0 @@ -52,6 +53,6 @@ def speedup(new, old, threshold): if __name__ == "__main__": new = [0.0, 0.0, 0.0, 0.0] - old=[2.96608e-06, 3.35076e-06, 3.45384e-06, 3.34407e-06] + old = [2.96608e-06, 3.35076e-06, 3.45384e-06, 3.34407e-06] print speedup(new, old, 1e-5) print speedup(old, new, 1e-5) -- cgit v1.2.3 From 63aa9c8446e194df733c1845211c0862d5f00ba7 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Wed, 14 Jun 2017 16:58:09 -0700 Subject: Add QPS Diff --- test/cpp/qps/qps_diff.py | 164 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100755 test/cpp/qps/qps_diff.py diff --git a/test/cpp/qps/qps_diff.py b/test/cpp/qps/qps_diff.py new file mode 100755 index 0000000000..9db5f73194 --- /dev/null +++ b/test/cpp/qps/qps_diff.py @@ -0,0 +1,164 @@ +#!/usr/bin/env python2.7 +# +# Copyright 2017 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. +""" Computes the diff between two qps runs and outputs significant results """ + +import shutil +import subprocess +import os +import multiprocessing +import json +import sys +import tabulate +import argparse + +sys.path.append( + os.path.join( + os.path.dirname(sys.argv[0]), '..', '..', '..', 'tools', 'profiling', 'microbenchmarks', 'bm_diff')) +import bm_speedup + +sys.path.append( + os.path.join( + os.path.dirname(sys.argv[0]), '..', '..', '..', 'tools', 'run_tests', 'python_utils')) +import comment_on_pr + +_SCENARIOS = { + 'large-message-throughput': '{"scenarios":[{"name":"large-message-throughput", "spawn_local_worker_count": -2, "warmup_seconds": 30, "benchmark_seconds": 270, "num_servers": 1, "server_config": {"async_server_threads": 1, "security_params": null, "server_type": "ASYNC_SERVER"}, "num_clients": 1, "client_config": {"client_type": "ASYNC_CLIENT", "security_params": null, "payload_config": {"simple_params": {"resp_size": 1048576, "req_size": 1048576}}, "client_channels": 1, "async_client_threads": 1, "outstanding_rpcs_per_channel": 1, "rpc_type": "UNARY", "load_params": {"closed_loop": {}}, "histogram_params": {"max_possible": 60000000000.0, "resolution": 0.01}}}]}', + 'multi-channel-64-KiB': '{"scenarios":[{"name":"multi-channel-64-KiB", "spawn_local_worker_count": -3, "warmup_seconds": 30, "benchmark_seconds": 270, "num_servers": 1, "server_config": {"async_server_threads": 31, "security_params": null, "server_type": "ASYNC_SERVER"}, "num_clients": 2, "client_config": {"client_type": "ASYNC_CLIENT", "security_params": null, "payload_config": {"simple_params": {"resp_size": 65536, "req_size": 65536}}, "client_channels": 32, "async_client_threads": 31, "outstanding_rpcs_per_channel": 100, "rpc_type": "UNARY", "load_params": {"closed_loop": {}}, "histogram_params": {"max_possible": 60000000000.0, "resolution": 0.01}}}]}' +} + +def _args(): + argp = argparse.ArgumentParser( + description='Perform diff on QPS Driver') + argp.add_argument( + '-d', + '--diff_base', + type=str, + help='Commit or branch to compare the current one to') + argp.add_argument( + '-l', + '--loops', + type=int, + default=6, + help='Number of times to loops the benchmarks. More loops cuts down on noise' + ) + argp.add_argument( + '-j', + '--jobs', + type=int, + default=multiprocessing.cpu_count(), + help='Number of CPUs to use') + args = argp.parse_args() + assert args.diff_base, "diff_base must be set" + return args + +def _make_cmd(jobs): + return ['make', '-j', '%d' % jobs, 'qps_json_driver', 'qps_worker',] + +def build(name, jobs): + shutil.rmtree('qps_diff_%s' % name, ignore_errors=True) + subprocess.check_call(['git', 'submodule', 'update']) + try: + subprocess.check_call(_make_cmd(jobs)) + except subprocess.CalledProcessError, e: + subprocess.check_call(['make', 'clean']) + subprocess.check_call(_make_cmd(jobs)) + os.rename('bins', 'qps_diff_%s' % name) + +def _run_cmd(name, scenario, fname): + return ['qps_diff_%s/opt/qps_json_driver' % name, '--scenarios_json', scenario, '--json_file_out', fname] + +def run(name, scenarios, loops): + for sn in scenarios: + for i in range(0, loops): + fname = "%s.%s.%d.json" % (sn, name, i) + subprocess.check_call(_run_cmd(name, scenarios[sn], fname)) + +def _load_qps(fname): + try: + with open(fname) as f: + return json.loads(f.read())['qps'] + except IOError, e: + print("IOError occurred reading file: %s" % fname) + return None + except ValueError, e: + print("ValueError occurred reading file: %s" % fname) + return None + +def _median(ary): + assert (len(ary)) + ary = sorted(ary) + n = len(ary) + if n % 2 == 0: + return (ary[(n - 1) / 2] + ary[(n - 1) / 2 + 1]) / 2.0 + else: + return ary[n / 2] + +def diff(scenarios, loops, old, new): + old_data = {} + new_data = {} + + # collect data + for sn in scenarios: + old_data[sn] = [] + new_data[sn] = [] + for i in range(0, loops): + old_data[sn].append(_load_qps("%s.%s.%d.json" % (sn, old, i))) + new_data[sn].append(_load_qps("%s.%s.%d.json" % (sn, new, i))) + + # crunch data + headers = ['Benchmark', 'qps'] + rows = [] + for sn in scenarios: + mdn_diff = abs(_median(new_data[sn]) - _median(old_data[sn])) + print('%s: %s=%r %s=%r mdn_diff=%r' % (sn, new, new_data[sn], old, old_data[sn], mdn_diff)) + s = bm_speedup.speedup(new_data[sn], old_data[sn]) + if abs(s) > 3 and mdn_diff > 0.5: + rows.append([sn, '%+d%%' % s]) + + if rows: + return tabulate.tabulate(rows, headers=headers, floatfmt='+.2f') + else: + return None + +def main(args): + + build('new', args.jobs) + + if args.diff_base: + where_am_i = subprocess.check_output( + ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() + subprocess.check_call(['git', 'checkout', args.diff_base]) + try: + build('old', args.jobs) + finally: + subprocess.check_call(['git', 'checkout', where_am_i]) + subprocess.check_call(['git', 'submodule', 'update']) + + run('new', _SCENARIOS, args.loops) + run('old', _SCENARIOS, args.loops) + + diff = diff(_SCENARIOS, args.loops, 'old', 'new') + + if diff: + text = '[qps] Performance differences noted:\n%s' % diff + else: + text = '[qps] No significant performance differences' + print('%s' % text) + comment_on_pr.comment_on_pr('```\n%s\n```' % text) + +if __name__ == '__main__': + args = _args() + main(args); -- cgit v1.2.3 From 390668999f9af7997e9e49995333a56516738da6 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Fri, 16 Jun 2017 15:12:52 -0700 Subject: relax QPS diff threshold --- test/cpp/qps/qps_diff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/qps/qps_diff.py b/test/cpp/qps/qps_diff.py index 9db5f73194..a95f9b899a 100755 --- a/test/cpp/qps/qps_diff.py +++ b/test/cpp/qps/qps_diff.py @@ -124,7 +124,7 @@ def diff(scenarios, loops, old, new): for sn in scenarios: mdn_diff = abs(_median(new_data[sn]) - _median(old_data[sn])) print('%s: %s=%r %s=%r mdn_diff=%r' % (sn, new, new_data[sn], old, old_data[sn], mdn_diff)) - s = bm_speedup.speedup(new_data[sn], old_data[sn]) + s = bm_speedup.speedup(new_data[sn], old_data[sn], 10e-5) if abs(s) > 3 and mdn_diff > 0.5: rows.append([sn, '%+d%%' % s]) -- cgit v1.2.3 From 61a75993f5fca316a3636f4c7a44ae5831a9bec9 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Mon, 19 Jun 2017 09:05:34 -0700 Subject: Enable jenkins testing --- test/cpp/qps/qps_diff.py | 8 ++++---- tools/jenkins/run_performance.sh | 7 ++----- tools/jenkins/run_performance_old.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 9 deletions(-) create mode 100755 tools/jenkins/run_performance_old.sh diff --git a/test/cpp/qps/qps_diff.py b/test/cpp/qps/qps_diff.py index a95f9b899a..1dadd96adf 100755 --- a/test/cpp/qps/qps_diff.py +++ b/test/cpp/qps/qps_diff.py @@ -51,7 +51,7 @@ def _args(): '-l', '--loops', type=int, - default=6, + default=4, help='Number of times to loops the benchmarks. More loops cuts down on noise' ) argp.add_argument( @@ -150,10 +150,10 @@ def main(args): run('new', _SCENARIOS, args.loops) run('old', _SCENARIOS, args.loops) - diff = diff(_SCENARIOS, args.loops, 'old', 'new') + diff_output = diff(_SCENARIOS, args.loops, 'old', 'new') - if diff: - text = '[qps] Performance differences noted:\n%s' % diff + if diff_output: + text = '[qps] Performance differences noted:\n%s' % diff_output else: text = '[qps] No significant performance differences' print('%s' % text) diff --git a/tools/jenkins/run_performance.sh b/tools/jenkins/run_performance.sh index 3ce05cc7f1..3673fa6c40 100755 --- a/tools/jenkins/run_performance.sh +++ b/tools/jenkins/run_performance.sh @@ -13,14 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# This script is invoked by Jenkins and runs a diff on the microbenchmarks +# This script is invoked by Jenkins and runs a diff on the qps drivers set -ex -# List of benchmarks that provide good signal for analyzing performance changes in pull requests -BENCHMARKS_TO_RUN="bm_fullstack_unary_ping_pong bm_fullstack_streaming_ping_pong bm_fullstack_streaming_pump bm_closure bm_cq bm_call_create bm_error bm_chttp2_hpack bm_chttp2_transport bm_pollset bm_metadata" - # Enter the gRPC repo root cd $(dirname $0)/../.. tools/run_tests/start_port_server.py -tools/profiling/microbenchmarks/bm_diff/bm_main.py -d origin/$ghprbTargetBranch -b $BENCHMARKS_TO_RUN +test/cpp/qps/qps_diff.py -d origin/$ghprbTargetBranch diff --git a/tools/jenkins/run_performance_old.sh b/tools/jenkins/run_performance_old.sh new file mode 100755 index 0000000000..3ce05cc7f1 --- /dev/null +++ b/tools/jenkins/run_performance_old.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Copyright 2015 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. +# +# This script is invoked by Jenkins and runs a diff on the microbenchmarks +set -ex + +# List of benchmarks that provide good signal for analyzing performance changes in pull requests +BENCHMARKS_TO_RUN="bm_fullstack_unary_ping_pong bm_fullstack_streaming_ping_pong bm_fullstack_streaming_pump bm_closure bm_cq bm_call_create bm_error bm_chttp2_hpack bm_chttp2_transport bm_pollset bm_metadata" + +# Enter the gRPC repo root +cd $(dirname $0)/../.. + +tools/run_tests/start_port_server.py +tools/profiling/microbenchmarks/bm_diff/bm_main.py -d origin/$ghprbTargetBranch -b $BENCHMARKS_TO_RUN -- cgit v1.2.3 From 3d04e025bcffd1e583d502de4ee26625ea866b21 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Wed, 7 Jun 2017 12:45:26 -0700 Subject: Remove lockfree-stack implementation that is no longer used --- BUILD | 2 - CMakeLists.txt | 31 ---- Makefile | 37 ---- binding.gyp | 1 - build.yaml | 11 -- config.m4 | 1 - config.w32 | 1 - gRPC-Core.podspec | 3 - grpc.gemspec | 2 - package.xml | 2 - src/core/lib/support/stack_lockfree.c | 137 --------------- src/core/lib/support/stack_lockfree.h | 38 ---- src/python/grpcio/grpc_core_dependencies.py | 1 - test/core/support/BUILD | 10 -- test/core/support/stack_lockfree_test.c | 140 --------------- tools/doxygen/Doxyfile.core.internal | 2 - tools/run_tests/generated/sources_and_headers.json | 18 -- tools/run_tests/generated/tests.json | 22 --- vsprojects/buildtests_c.sln | 25 --- vsprojects/vcxproj/gpr/gpr.vcxproj | 3 - vsprojects/vcxproj/gpr/gpr.vcxproj.filters | 6 - .../gpr_stack_lockfree_test.vcxproj | 193 --------------------- .../gpr_stack_lockfree_test.vcxproj.filters | 21 --- 23 files changed, 707 deletions(-) delete mode 100644 src/core/lib/support/stack_lockfree.c delete mode 100644 src/core/lib/support/stack_lockfree.h delete mode 100644 test/core/support/stack_lockfree_test.c delete mode 100644 vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj delete mode 100644 vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj.filters diff --git a/BUILD b/BUILD index 495bb668eb..fa42326787 100644 --- a/BUILD +++ b/BUILD @@ -335,7 +335,6 @@ grpc_cc_library( "src/core/lib/support/log_windows.c", "src/core/lib/support/mpscq.c", "src/core/lib/support/murmur_hash.c", - "src/core/lib/support/stack_lockfree.c", "src/core/lib/support/string.c", "src/core/lib/support/string_posix.c", "src/core/lib/support/string_util_windows.c", @@ -371,7 +370,6 @@ grpc_cc_library( "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", "src/core/lib/support/spinlock.h", - "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.h", "src/core/lib/support/string_windows.h", "src/core/lib/support/thd_internal.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 710f1dc4e9..852eb2bf6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -427,7 +427,6 @@ add_dependencies(buildtests_c gpr_host_port_test) add_dependencies(buildtests_c gpr_log_test) add_dependencies(buildtests_c gpr_mpscq_test) add_dependencies(buildtests_c gpr_spinlock_test) -add_dependencies(buildtests_c gpr_stack_lockfree_test) add_dependencies(buildtests_c gpr_string_test) add_dependencies(buildtests_c gpr_sync_test) add_dependencies(buildtests_c gpr_thd_test) @@ -773,7 +772,6 @@ add_library(gpr src/core/lib/support/log_windows.c src/core/lib/support/mpscq.c src/core/lib/support/murmur_hash.c - src/core/lib/support/stack_lockfree.c src/core/lib/support/string.c src/core/lib/support/string_posix.c src/core/lib/support/string_util_windows.c @@ -5999,35 +5997,6 @@ target_link_libraries(gpr_spinlock_test endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) -add_executable(gpr_stack_lockfree_test - test/core/support/stack_lockfree_test.c -) - - -target_include_directories(gpr_stack_lockfree_test - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${BORINGSSL_ROOT_DIR}/include - PRIVATE ${PROTOBUF_ROOT_DIR}/src - PRIVATE ${BENCHMARK_ROOT_DIR}/include - PRIVATE ${ZLIB_ROOT_DIR} - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib - PRIVATE ${CARES_BUILD_INCLUDE_DIR} - PRIVATE ${CARES_INCLUDE_DIR} - PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include -) - -target_link_libraries(gpr_stack_lockfree_test - ${_gRPC_ALLTARGETS_LIBRARIES} - gpr_test_util - gpr -) - -endif (gRPC_BUILD_TESTS) -if (gRPC_BUILD_TESTS) - add_executable(gpr_string_test test/core/support/string_test.c ) diff --git a/Makefile b/Makefile index c7890cb8d5..1e7f78952b 100644 --- a/Makefile +++ b/Makefile @@ -992,7 +992,6 @@ gpr_host_port_test: $(BINDIR)/$(CONFIG)/gpr_host_port_test gpr_log_test: $(BINDIR)/$(CONFIG)/gpr_log_test gpr_mpscq_test: $(BINDIR)/$(CONFIG)/gpr_mpscq_test gpr_spinlock_test: $(BINDIR)/$(CONFIG)/gpr_spinlock_test -gpr_stack_lockfree_test: $(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test gpr_string_test: $(BINDIR)/$(CONFIG)/gpr_string_test gpr_sync_test: $(BINDIR)/$(CONFIG)/gpr_sync_test gpr_thd_test: $(BINDIR)/$(CONFIG)/gpr_thd_test @@ -1382,7 +1381,6 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/gpr_log_test \ $(BINDIR)/$(CONFIG)/gpr_mpscq_test \ $(BINDIR)/$(CONFIG)/gpr_spinlock_test \ - $(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test \ $(BINDIR)/$(CONFIG)/gpr_string_test \ $(BINDIR)/$(CONFIG)/gpr_sync_test \ $(BINDIR)/$(CONFIG)/gpr_thd_test \ @@ -1818,8 +1816,6 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/gpr_mpscq_test || ( echo test gpr_mpscq_test failed ; exit 1 ) $(E) "[RUN] Testing gpr_spinlock_test" $(Q) $(BINDIR)/$(CONFIG)/gpr_spinlock_test || ( echo test gpr_spinlock_test failed ; exit 1 ) - $(E) "[RUN] Testing gpr_stack_lockfree_test" - $(Q) $(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test || ( echo test gpr_stack_lockfree_test failed ; exit 1 ) $(E) "[RUN] Testing gpr_string_test" $(Q) $(BINDIR)/$(CONFIG)/gpr_string_test || ( echo test gpr_string_test failed ; exit 1 ) $(E) "[RUN] Testing gpr_sync_test" @@ -2765,7 +2761,6 @@ LIBGPR_SRC = \ src/core/lib/support/log_windows.c \ src/core/lib/support/mpscq.c \ src/core/lib/support/murmur_hash.c \ - src/core/lib/support/stack_lockfree.c \ src/core/lib/support/string.c \ src/core/lib/support/string_posix.c \ src/core/lib/support/string_util_windows.c \ @@ -9957,38 +9952,6 @@ endif endif -GPR_STACK_LOCKFREE_TEST_SRC = \ - test/core/support/stack_lockfree_test.c \ - -GPR_STACK_LOCKFREE_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GPR_STACK_LOCKFREE_TEST_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test: openssl_dep_error - -else - - - -$(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test: $(GPR_STACK_LOCKFREE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_STACK_LOCKFREE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test - -endif - -$(OBJDIR)/$(CONFIG)/test/core/support/stack_lockfree_test.o: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a - -deps_gpr_stack_lockfree_test: $(GPR_STACK_LOCKFREE_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(GPR_STACK_LOCKFREE_TEST_OBJS:.o=.dep) -endif -endif - - GPR_STRING_TEST_SRC = \ test/core/support/string_test.c \ diff --git a/binding.gyp b/binding.gyp index 94555f0b12..5e708c211a 100644 --- a/binding.gyp +++ b/binding.gyp @@ -592,7 +592,6 @@ 'src/core/lib/support/log_windows.c', 'src/core/lib/support/mpscq.c', 'src/core/lib/support/murmur_hash.c', - 'src/core/lib/support/stack_lockfree.c', 'src/core/lib/support/string.c', 'src/core/lib/support/string_posix.c', 'src/core/lib/support/string_util_windows.c', diff --git a/build.yaml b/build.yaml index e55c4ca301..940ca8902d 100644 --- a/build.yaml +++ b/build.yaml @@ -99,7 +99,6 @@ filegroups: - src/core/lib/support/mpscq.h - src/core/lib/support/murmur_hash.h - src/core/lib/support/spinlock.h - - src/core/lib/support/stack_lockfree.h - src/core/lib/support/string.h - src/core/lib/support/string_windows.h - src/core/lib/support/thd_internal.h @@ -130,7 +129,6 @@ filegroups: - src/core/lib/support/log_windows.c - src/core/lib/support/mpscq.c - src/core/lib/support/murmur_hash.c - - src/core/lib/support/stack_lockfree.c - src/core/lib/support/string.c - src/core/lib/support/string_posix.c - src/core/lib/support/string_util_windows.c @@ -2123,15 +2121,6 @@ targets: deps: - gpr_test_util - gpr -- name: gpr_stack_lockfree_test - cpu_cost: 7 - build: test - language: c - src: - - test/core/support/stack_lockfree_test.c - deps: - - gpr_test_util - - gpr - name: gpr_string_test build: test language: c diff --git a/config.m4 b/config.m4 index 0049b72d48..2a3be17934 100644 --- a/config.m4 +++ b/config.m4 @@ -63,7 +63,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/support/log_windows.c \ src/core/lib/support/mpscq.c \ src/core/lib/support/murmur_hash.c \ - src/core/lib/support/stack_lockfree.c \ src/core/lib/support/string.c \ src/core/lib/support/string_posix.c \ src/core/lib/support/string_util_windows.c \ diff --git a/config.w32 b/config.w32 index 5c82e348f5..b365d19903 100644 --- a/config.w32 +++ b/config.w32 @@ -40,7 +40,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\support\\log_windows.c " + "src\\core\\lib\\support\\mpscq.c " + "src\\core\\lib\\support\\murmur_hash.c " + - "src\\core\\lib\\support\\stack_lockfree.c " + "src\\core\\lib\\support\\string.c " + "src\\core\\lib\\support\\string_posix.c " + "src\\core\\lib\\support\\string_util_windows.c " + diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 277f97944c..782ebb8ae1 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -193,7 +193,6 @@ Pod::Spec.new do |s| 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', 'src/core/lib/support/spinlock.h', - 'src/core/lib/support/stack_lockfree.h', 'src/core/lib/support/string.h', 'src/core/lib/support/string_windows.h', 'src/core/lib/support/thd_internal.h', @@ -223,7 +222,6 @@ Pod::Spec.new do |s| 'src/core/lib/support/log_windows.c', 'src/core/lib/support/mpscq.c', 'src/core/lib/support/murmur_hash.c', - 'src/core/lib/support/stack_lockfree.c', 'src/core/lib/support/string.c', 'src/core/lib/support/string_posix.c', 'src/core/lib/support/string_util_windows.c', @@ -723,7 +721,6 @@ Pod::Spec.new do |s| 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', 'src/core/lib/support/spinlock.h', - 'src/core/lib/support/stack_lockfree.h', 'src/core/lib/support/string.h', 'src/core/lib/support/string_windows.h', 'src/core/lib/support/thd_internal.h', diff --git a/grpc.gemspec b/grpc.gemspec index a4e22dfbdf..3b3ce2aa75 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -92,7 +92,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/support/mpscq.h ) s.files += %w( src/core/lib/support/murmur_hash.h ) s.files += %w( src/core/lib/support/spinlock.h ) - s.files += %w( src/core/lib/support/stack_lockfree.h ) s.files += %w( src/core/lib/support/string.h ) s.files += %w( src/core/lib/support/string_windows.h ) s.files += %w( src/core/lib/support/thd_internal.h ) @@ -122,7 +121,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/support/log_windows.c ) s.files += %w( src/core/lib/support/mpscq.c ) s.files += %w( src/core/lib/support/murmur_hash.c ) - s.files += %w( src/core/lib/support/stack_lockfree.c ) s.files += %w( src/core/lib/support/string.c ) s.files += %w( src/core/lib/support/string_posix.c ) s.files += %w( src/core/lib/support/string_util_windows.c ) diff --git a/package.xml b/package.xml index 18b1d639b9..f9a67249df 100644 --- a/package.xml +++ b/package.xml @@ -106,7 +106,6 @@ - @@ -136,7 +135,6 @@ - diff --git a/src/core/lib/support/stack_lockfree.c b/src/core/lib/support/stack_lockfree.c deleted file mode 100644 index 0fb64ed001..0000000000 --- a/src/core/lib/support/stack_lockfree.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * - * Copyright 2015 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 "src/core/lib/support/stack_lockfree.h" - -#include -#include - -#include -#include -#include -#include - -/* The lockfree node structure is a single architecture-level - word that allows for an atomic CAS to set it up. */ -struct lockfree_node_contents { - /* next thing to look at. Actual index for head, next index otherwise */ - uint16_t index; -#ifdef GPR_ARCH_64 - uint16_t pad; - uint32_t aba_ctr; -#else -#ifdef GPR_ARCH_32 - uint16_t aba_ctr; -#else -#error Unsupported bit width architecture -#endif -#endif -}; - -/* Use a union to make sure that these are in the same bits as an atm word */ -typedef union lockfree_node { - gpr_atm atm; - struct lockfree_node_contents contents; -} lockfree_node; - -/* make sure that entries aligned to 8-bytes */ -#define ENTRY_ALIGNMENT_BITS 3 -/* reserve this entry as invalid */ -#define INVALID_ENTRY_INDEX ((1 << 16) - 1) - -struct gpr_stack_lockfree { - lockfree_node *entries; - lockfree_node head; /* An atomic entry describing curr head */ -}; - -gpr_stack_lockfree *gpr_stack_lockfree_create(size_t entries) { - gpr_stack_lockfree *stack; - stack = (gpr_stack_lockfree *)gpr_malloc(sizeof(*stack)); - /* Since we only allocate 16 bits to represent an entry number, - * make sure that we are within the desired range */ - /* Reserve the highest entry number as a dummy */ - GPR_ASSERT(entries < INVALID_ENTRY_INDEX); - stack->entries = (lockfree_node *)gpr_malloc_aligned( - entries * sizeof(stack->entries[0]), ENTRY_ALIGNMENT_BITS); - /* Clear out all entries */ - memset(stack->entries, 0, entries * sizeof(stack->entries[0])); - memset(&stack->head, 0, sizeof(stack->head)); - - GPR_ASSERT(sizeof(stack->entries->atm) == sizeof(stack->entries->contents)); - - /* Point the head at reserved dummy entry */ - stack->head.contents.index = INVALID_ENTRY_INDEX; -/* Fill in the pad and aba_ctr to avoid confusing memcheck tools */ -#ifdef GPR_ARCH_64 - stack->head.contents.pad = 0; -#endif - stack->head.contents.aba_ctr = 0; - return stack; -} - -void gpr_stack_lockfree_destroy(gpr_stack_lockfree *stack) { - gpr_free_aligned(stack->entries); - gpr_free(stack); -} - -int gpr_stack_lockfree_push(gpr_stack_lockfree *stack, int entry) { - lockfree_node head; - lockfree_node newhead; - lockfree_node curent; - lockfree_node newent; - - /* First fill in the entry's index and aba ctr for new head */ - newhead.contents.index = (uint16_t)entry; -#ifdef GPR_ARCH_64 - /* Fill in the pad to avoid confusing memcheck tools */ - newhead.contents.pad = 0; -#endif - - /* Also post-increment the aba_ctr */ - curent.atm = gpr_atm_no_barrier_load(&stack->entries[entry].atm); - newhead.contents.aba_ctr = ++curent.contents.aba_ctr; - gpr_atm_no_barrier_store(&stack->entries[entry].atm, curent.atm); - - do { - /* Atomically get the existing head value for use */ - head.atm = gpr_atm_no_barrier_load(&(stack->head.atm)); - /* Point to it */ - newent.atm = gpr_atm_no_barrier_load(&stack->entries[entry].atm); - newent.contents.index = head.contents.index; - gpr_atm_no_barrier_store(&stack->entries[entry].atm, newent.atm); - } while (!gpr_atm_rel_cas(&(stack->head.atm), head.atm, newhead.atm)); - /* Use rel_cas above to make sure that entry index is set properly */ - return head.contents.index == INVALID_ENTRY_INDEX; -} - -int gpr_stack_lockfree_pop(gpr_stack_lockfree *stack) { - lockfree_node head; - lockfree_node newhead; - - do { - head.atm = gpr_atm_acq_load(&(stack->head.atm)); - if (head.contents.index == INVALID_ENTRY_INDEX) { - return -1; - } - newhead.atm = - gpr_atm_no_barrier_load(&(stack->entries[head.contents.index].atm)); - - } while (!gpr_atm_no_barrier_cas(&(stack->head.atm), head.atm, newhead.atm)); - - return head.contents.index; -} diff --git a/src/core/lib/support/stack_lockfree.h b/src/core/lib/support/stack_lockfree.h deleted file mode 100644 index 6324211b72..0000000000 --- a/src/core/lib/support/stack_lockfree.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright 2015 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_CORE_LIB_SUPPORT_STACK_LOCKFREE_H -#define GRPC_CORE_LIB_SUPPORT_STACK_LOCKFREE_H - -#include - -typedef struct gpr_stack_lockfree gpr_stack_lockfree; - -/* This stack must specify the maximum number of entries to track. - The current implementation only allows up to 65534 entries */ -gpr_stack_lockfree *gpr_stack_lockfree_create(size_t entries); -void gpr_stack_lockfree_destroy(gpr_stack_lockfree *stack); - -/* Pass in a valid entry number for the next stack entry */ -/* Returns 1 if this is the first element on the stack, 0 otherwise */ -int gpr_stack_lockfree_push(gpr_stack_lockfree *, int entry); - -/* Returns -1 on empty or the actual entry number */ -int gpr_stack_lockfree_pop(gpr_stack_lockfree *stack); - -#endif /* GRPC_CORE_LIB_SUPPORT_STACK_LOCKFREE_H */ diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 48782174a7..c194004991 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -39,7 +39,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/support/log_windows.c', 'src/core/lib/support/mpscq.c', 'src/core/lib/support/murmur_hash.c', - 'src/core/lib/support/stack_lockfree.c', 'src/core/lib/support/string.c', 'src/core/lib/support/string_posix.c', 'src/core/lib/support/string_util_windows.c', diff --git a/test/core/support/BUILD b/test/core/support/BUILD index 37870d922d..298eebd9b8 100644 --- a/test/core/support/BUILD +++ b/test/core/support/BUILD @@ -126,16 +126,6 @@ grpc_cc_test( ], ) -grpc_cc_test( - name = "stack_lockfree_test", - srcs = ["stack_lockfree_test.c"], - language = "C", - deps = [ - "//:gpr", - "//test/core/util:gpr_test_util", - ], -) - grpc_cc_test( name = "string_test", srcs = ["string_test.c"], diff --git a/test/core/support/stack_lockfree_test.c b/test/core/support/stack_lockfree_test.c deleted file mode 100644 index 4b1f60ce01..0000000000 --- a/test/core/support/stack_lockfree_test.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * - * Copyright 2015 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 "src/core/lib/support/stack_lockfree.h" - -#include - -#include -#include -#include -#include -#include "test/core/util/test_config.h" - -/* max stack size supported */ -#define MAX_STACK_SIZE 65534 - -#define MAX_THREADS 32 - -static void test_serial_sized(size_t size) { - gpr_stack_lockfree *stack = gpr_stack_lockfree_create(size); - size_t i; - size_t j; - - /* First try popping empty */ - GPR_ASSERT(gpr_stack_lockfree_pop(stack) == -1); - - /* Now add one item and check it */ - gpr_stack_lockfree_push(stack, 3); - GPR_ASSERT(gpr_stack_lockfree_pop(stack) == 3); - GPR_ASSERT(gpr_stack_lockfree_pop(stack) == -1); - - /* Now add repeatedly more items and check them */ - for (i = 1; i < size; i *= 2) { - for (j = 0; j <= i; j++) { - GPR_ASSERT(gpr_stack_lockfree_push(stack, (int)j) == (j == 0)); - } - for (j = 0; j <= i; j++) { - GPR_ASSERT(gpr_stack_lockfree_pop(stack) == (int)(i - j)); - } - GPR_ASSERT(gpr_stack_lockfree_pop(stack) == -1); - } - - gpr_stack_lockfree_destroy(stack); -} - -static void test_serial() { - size_t i; - for (i = 128; i < MAX_STACK_SIZE; i *= 2) { - test_serial_sized(i); - } - test_serial_sized(MAX_STACK_SIZE); -} - -struct test_arg { - gpr_stack_lockfree *stack; - int stack_size; - int nthreads; - int rank; - int sum; -}; - -static void test_mt_body(void *v) { - struct test_arg *arg = (struct test_arg *)v; - int lo, hi; - int i; - int res; - lo = arg->rank * arg->stack_size / arg->nthreads; - hi = (arg->rank + 1) * arg->stack_size / arg->nthreads; - for (i = lo; i < hi; i++) { - gpr_stack_lockfree_push(arg->stack, i); - if ((res = gpr_stack_lockfree_pop(arg->stack)) != -1) { - arg->sum += res; - } - } - while ((res = gpr_stack_lockfree_pop(arg->stack)) != -1) { - arg->sum += res; - } -} - -static void test_mt_sized(size_t size, int nth) { - gpr_stack_lockfree *stack; - struct test_arg args[MAX_THREADS]; - gpr_thd_id thds[MAX_THREADS]; - int sum; - int i; - gpr_thd_options options = gpr_thd_options_default(); - - stack = gpr_stack_lockfree_create(size); - for (i = 0; i < nth; i++) { - args[i].stack = stack; - args[i].stack_size = (int)size; - args[i].nthreads = nth; - args[i].rank = i; - args[i].sum = 0; - } - gpr_thd_options_set_joinable(&options); - for (i = 0; i < nth; i++) { - GPR_ASSERT(gpr_thd_new(&thds[i], test_mt_body, &args[i], &options)); - } - sum = 0; - for (i = 0; i < nth; i++) { - gpr_thd_join(thds[i]); - sum = sum + args[i].sum; - } - GPR_ASSERT((unsigned)sum == ((unsigned)size * (size - 1)) / 2); - gpr_stack_lockfree_destroy(stack); -} - -static void test_mt() { - size_t size; - int nth; - for (nth = 1; nth < MAX_THREADS; nth++) { - for (size = 128; size < MAX_STACK_SIZE; size *= 2) { - test_mt_sized(size, nth); - } - test_mt_sized(MAX_STACK_SIZE, nth); - } -} - -int main(int argc, char **argv) { - grpc_test_init(argc, argv); - test_serial(); - test_mt(); - return 0; -} diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 766c20f59b..63067b3081 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1304,8 +1304,6 @@ src/core/lib/support/mpscq.h \ src/core/lib/support/murmur_hash.c \ src/core/lib/support/murmur_hash.h \ src/core/lib/support/spinlock.h \ -src/core/lib/support/stack_lockfree.c \ -src/core/lib/support/stack_lockfree.h \ src/core/lib/support/string.c \ src/core/lib/support/string.h \ src/core/lib/support/string_posix.c \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 956f45fc2d..ad142c5582 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -827,21 +827,6 @@ "third_party": false, "type": "target" }, - { - "deps": [ - "gpr", - "gpr_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_stack_lockfree_test", - "src": [ - "test/core/support/stack_lockfree_test.c" - ], - "third_party": false, - "type": "target" - }, { "deps": [ "gpr", @@ -7680,7 +7665,6 @@ "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", "src/core/lib/support/spinlock.h", - "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.h", "src/core/lib/support/string_windows.h", "src/core/lib/support/thd_internal.h", @@ -7753,8 +7737,6 @@ "src/core/lib/support/murmur_hash.c", "src/core/lib/support/murmur_hash.h", "src/core/lib/support/spinlock.h", - "src/core/lib/support/stack_lockfree.c", - "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.c", "src/core/lib/support/string.h", "src/core/lib/support/string_posix.c", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 77e657c7e4..22b124c7ca 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -947,28 +947,6 @@ "windows" ] }, - { - "args": [], - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 7, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "gtest": false, - "language": "c", - "name": "gpr_stack_lockfree_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [], "ci_platforms": [ diff --git a/vsprojects/buildtests_c.sln b/vsprojects/buildtests_c.sln index b7696a9965..3c6e8d8f34 100644 --- a/vsprojects/buildtests_c.sln +++ b/vsprojects/buildtests_c.sln @@ -484,15 +484,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_spinlock_test", "vcxpro {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_stack_lockfree_test", "vcxproj\test\gpr_stack_lockfree_test\gpr_stack_lockfree_test.vcxproj", "{AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}" - ProjectSection(myProperties) = preProject - lib = "False" - EndProjectSection - ProjectSection(ProjectDependencies) = postProject - {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037} - {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_string_test", "vcxproj\test\gpr_string_test\gpr_string_test.vcxproj", "{B453457D-8FBC-9C9F-A55E-C06FCE13B1F2}" ProjectSection(myProperties) = preProject lib = "False" @@ -2497,22 +2488,6 @@ Global {D8EDE51A-CBB2-0362-D59B-09AA92A94F45}.Release-DLL|Win32.Build.0 = Release|Win32 {D8EDE51A-CBB2-0362-D59B-09AA92A94F45}.Release-DLL|x64.ActiveCfg = Release|x64 {D8EDE51A-CBB2-0362-D59B-09AA92A94F45}.Release-DLL|x64.Build.0 = Release|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug|Win32.ActiveCfg = Debug|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug|x64.ActiveCfg = Debug|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release|Win32.ActiveCfg = Release|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release|x64.ActiveCfg = Release|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug|Win32.Build.0 = Debug|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug|x64.Build.0 = Debug|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release|Win32.Build.0 = Release|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release|x64.Build.0 = Release|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug-DLL|Win32.Build.0 = Debug|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug-DLL|x64.ActiveCfg = Debug|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug-DLL|x64.Build.0 = Debug|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release-DLL|Win32.ActiveCfg = Release|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release-DLL|Win32.Build.0 = Release|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release-DLL|x64.ActiveCfg = Release|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release-DLL|x64.Build.0 = Release|x64 {B453457D-8FBC-9C9F-A55E-C06FCE13B1F2}.Debug|Win32.ActiveCfg = Debug|Win32 {B453457D-8FBC-9C9F-A55E-C06FCE13B1F2}.Debug|x64.ActiveCfg = Debug|x64 {B453457D-8FBC-9C9F-A55E-C06FCE13B1F2}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/vsprojects/vcxproj/gpr/gpr.vcxproj b/vsprojects/vcxproj/gpr/gpr.vcxproj index 7fb81a7fbc..3f0dedd675 100644 --- a/vsprojects/vcxproj/gpr/gpr.vcxproj +++ b/vsprojects/vcxproj/gpr/gpr.vcxproj @@ -198,7 +198,6 @@ - @@ -254,8 +253,6 @@ - - diff --git a/vsprojects/vcxproj/gpr/gpr.vcxproj.filters b/vsprojects/vcxproj/gpr/gpr.vcxproj.filters index 27d9d2f38f..f8cccb5c08 100644 --- a/vsprojects/vcxproj/gpr/gpr.vcxproj.filters +++ b/vsprojects/vcxproj/gpr/gpr.vcxproj.filters @@ -73,9 +73,6 @@ src\core\lib\support - - src\core\lib\support - src\core\lib\support @@ -290,9 +287,6 @@ src\core\lib\support - - src\core\lib\support - src\core\lib\support diff --git a/vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj b/vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj deleted file mode 100644 index 218cff8ba9..0000000000 --- a/vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - gpr_stack_lockfree_test - static - Debug - static - Debug - - - gpr_stack_lockfree_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - true - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - true - None - false - - - Console - true - false - true - true - - - - - - - - - - {EAB0A629-17A9-44DB-B5FF-E91A721FE037} - - - {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj.filters b/vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj.filters deleted file mode 100644 index b222ab4128..0000000000 --- a/vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj.filters +++ /dev/null @@ -1,21 +0,0 @@ - - - - - test\core\support - - - - - - {de41d2bf-c9ce-7f55-6da3-8d3798fd8fe2} - - - {4867ad9b-2b88-de6a-a1df-7a733d389df9} - - - {fca98aa0-f0c0-9254-ab22-a2792b4b94f0} - - - - -- cgit v1.2.3 From 276886632001c32ab74a85178f76a50846bf3713 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Mon, 19 Jun 2017 16:53:43 -0700 Subject: Fix max_message_length --- test/core/end2end/tests/max_message_length.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index b85af6685e..01eb8d365e 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -68,11 +68,11 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), - grpc_timeout_seconds_to_deadline(5), - NULL) - .type == GRPC_OP_COMPLETE); + grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); + grpc_event ev = grpc_completion_queue_next( + f->cq, grpc_timeout_seconds_to_deadline(5), NULL); + GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); + GPR_ASSERT(ev.tag == tag(1000)); grpc_server_destroy(f->server); f->server = NULL; } -- cgit v1.2.3 From 32e16783271778aa4d65f96222f0c782011a2989 Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 19 Jun 2017 16:33:04 -0700 Subject: Still create channel if remotedb is false. Just do not use it in the file parsing --- test/cpp/util/grpc_tool.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/cpp/util/grpc_tool.cc b/test/cpp/util/grpc_tool.cc index af0afa9b55..bb6f878020 100644 --- a/test/cpp/util/grpc_tool.cc +++ b/test/cpp/util/grpc_tool.cc @@ -445,12 +445,10 @@ bool GrpcTool::CallMethod(int argc, const char** argv, bool print_mode = false; std::shared_ptr channel = - FLAGS_remotedb - ? grpc::CreateChannel(server_address, cred.GetCredentials()) - : nullptr; + grpc::CreateChannel(server_address, cred.GetCredentials()); - parser.reset(new grpc::testing::ProtoFileParser(channel, FLAGS_proto_path, - FLAGS_protofiles)); + parser.reset(new grpc::testing::ProtoFileParser( + FLAGS_remotedb ? channel : nullptr, FLAGS_proto_path, FLAGS_protofiles)); if (FLAGS_binary_input) { formatted_method_name = method_name; -- cgit v1.2.3 From 3ac64f826c6e489ac59a7194945fa56bca2a3bd0 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Mon, 19 Jun 2017 17:35:44 -0700 Subject: Fix windows segfault --- src/core/ext/filters/client_channel/lb_policy.c | 5 ++--- src/core/ext/filters/client_channel/subchannel.c | 2 +- src/core/lib/iomgr/ev_epollsig_linux.c | 20 ++++++++++--------- src/core/lib/iomgr/ev_poll_posix.c | 14 +++++++------ src/core/lib/transport/metadata.c | 25 ++++++++++++------------ 5 files changed, 35 insertions(+), 31 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy.c b/src/core/ext/filters/client_channel/lb_policy.c index dd2fefb412..8d69ba6af5 100644 --- a/src/core/ext/filters/client_channel/lb_policy.c +++ b/src/core/ext/filters/client_channel/lb_policy.c @@ -53,9 +53,8 @@ static gpr_atm ref_mutate(grpc_lb_policy *c, gpr_atm delta, #ifndef NDEBUG if (GRPC_TRACER_ON(grpc_trace_lb_policy_refcount)) { gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "LB_POLICY: 0x%" PRIxPTR " %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR - " [%s]", - (intptr_t)c, purpose, old_val, old_val + delta, reason); + "LB_POLICY: 0x%p %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR " [%s]", c, + purpose, old_val, old_val + delta, reason); } #endif return old_val; diff --git a/src/core/ext/filters/client_channel/subchannel.c b/src/core/ext/filters/client_channel/subchannel.c index 31a38b08ae..88157ed738 100644 --- a/src/core/ext/filters/client_channel/subchannel.c +++ b/src/core/ext/filters/client_channel/subchannel.c @@ -198,7 +198,7 @@ static gpr_atm ref_mutate(grpc_subchannel *c, gpr_atm delta, #ifndef NDEBUG if (GRPC_TRACER_ON(grpc_trace_stream_refcount)) { gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "SUBCHANNEL: %p %s 0x%08" PRIxPTR " -> 0x%08" PRIxPTR " [%s]", c, + "SUBCHANNEL: %p %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR " [%s]", c, purpose, old_val, old_val + delta, reason); } #endif diff --git a/src/core/lib/iomgr/ev_epollsig_linux.c b/src/core/lib/iomgr/ev_epollsig_linux.c index a822560ab9..7406036ca6 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.c +++ b/src/core/lib/iomgr/ev_epollsig_linux.c @@ -289,9 +289,10 @@ static void pi_unref(grpc_exec_ctx *exec_ctx, polling_island *pi); static void pi_add_ref_dbg(polling_island *pi, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_polling_trace)) { - long old_cnt = gpr_atm_acq_load(&pi->ref_count); - gpr_log(GPR_DEBUG, "Add ref pi: %p, old: %ld -> new:%ld (%s) - (%s, %d)", - (void *)pi, old_cnt, old_cnt + 1, reason, file, line); + gpr_atm old_cnt = gpr_atm_acq_load(&pi->ref_count); + gpr_log(GPR_DEBUG, "Add ref pi: %p, old:%" PRIdPTR " -> new:%" PRIdPTR + " (%s) - (%s, %d)", + pi, old_cnt, old_cnt + 1, reason, file, line); } pi_add_ref(pi); } @@ -299,9 +300,10 @@ static void pi_add_ref_dbg(polling_island *pi, const char *reason, static void pi_unref_dbg(grpc_exec_ctx *exec_ctx, polling_island *pi, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_polling_trace)) { - long old_cnt = gpr_atm_acq_load(&pi->ref_count); - gpr_log(GPR_DEBUG, "Unref pi: %p, old:%ld -> new:%ld (%s) - (%s, %d)", - (void *)pi, old_cnt, (old_cnt - 1), reason, file, line); + gpr_atm old_cnt = gpr_atm_acq_load(&pi->ref_count); + gpr_log(GPR_DEBUG, "Unref pi: %p, old:%" PRIdPTR " -> new:%" PRIdPTR + " (%s) - (%s, %d)", + pi, old_cnt, (old_cnt - 1), reason, file, line); } pi_unref(exec_ctx, pi); } @@ -730,7 +732,7 @@ static void ref_by(grpc_fd *fd, int n, const char *reason, const char *file, if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { gpr_log(GPR_DEBUG, "FD %d %p ref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", - fd->fd, (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); } #else @@ -747,7 +749,7 @@ static void unref_by(grpc_fd *fd, int n, const char *reason, const char *file, if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { gpr_log(GPR_DEBUG, "FD %d %p unref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", - fd->fd, (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); } #else @@ -841,7 +843,7 @@ static grpc_fd *fd_create(int fd, const char *name) { gpr_asprintf(&fd_name, "%s fd=%d", name, fd); grpc_iomgr_register_object(&new_fd->iomgr_object, fd_name); #ifndef NDEBUG - gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, (void *)new_fd, fd_name); + gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, new_fd, fd_name); #endif gpr_free(fd_name); return new_fd; diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index 81158669d3..1f66159c4a 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -267,9 +267,10 @@ cv_fd_table g_cvfds; static void ref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { - gpr_log(GPR_DEBUG, "FD %d %p ref %d %d -> %d [%s; %s:%d]", fd->fd, fd, n, - (int)gpr_atm_no_barrier_load(&fd->refst), - (int)gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + gpr_log(GPR_DEBUG, + "FD %d %p ref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); } #else #define REF_BY(fd, n, reason) ref_by(fd, n) @@ -283,9 +284,10 @@ static void ref_by(grpc_fd *fd, int n) { static void unref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { - gpr_log(GPR_DEBUG, "FD %d %p unref %d %d -> %d [%s; %s:%d]", fd->fd, fd, n, - (int)gpr_atm_no_barrier_load(&fd->refst), - (int)gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + gpr_log(GPR_DEBUG, + "FD %d %p unref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); } #else static void unref_by(grpc_fd *fd, int n) { diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c index 9c78e1ccf8..87a2abf344 100644 --- a/src/core/lib/transport/metadata.c +++ b/src/core/lib/transport/metadata.c @@ -150,7 +150,7 @@ static void ref_md_locked(mdtab_shard *shard, char *key_str = grpc_slice_to_c_string(md->key); char *value_str = grpc_slice_to_c_string(md->value); gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md, + "ELM REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", (void *)md, gpr_atm_no_barrier_load(&md->refcnt), gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); gpr_free(key_str); @@ -250,8 +250,9 @@ grpc_mdelem grpc_mdelem_create( if (GRPC_TRACER_ON(grpc_trace_metadata)) { char *key_str = grpc_slice_to_c_string(allocated->key); char *value_str = grpc_slice_to_c_string(allocated->value); - gpr_log(GPR_DEBUG, "ELM ALLOC:%p:%zu: '%s' = '%s'", (void *)allocated, - gpr_atm_no_barrier_load(&allocated->refcnt), key_str, value_str); + gpr_log(GPR_DEBUG, "ELM ALLOC:%p:%" PRIdPTR ": '%s' = '%s'", + (void *)allocated, gpr_atm_no_barrier_load(&allocated->refcnt), + key_str, value_str); gpr_free(key_str); gpr_free(value_str); } @@ -303,7 +304,7 @@ grpc_mdelem grpc_mdelem_create( if (GRPC_TRACER_ON(grpc_trace_metadata)) { char *key_str = grpc_slice_to_c_string(md->key); char *value_str = grpc_slice_to_c_string(md->value); - gpr_log(GPR_DEBUG, "ELM NEW:%p:%zu: '%s' = '%s'", (void *)md, + gpr_log(GPR_DEBUG, "ELM NEW:%p:%" PRIdPTR ": '%s' = '%s'", (void *)md, gpr_atm_no_barrier_load(&md->refcnt), key_str, value_str); gpr_free(key_str); gpr_free(value_str); @@ -368,8 +369,8 @@ grpc_mdelem grpc_mdelem_ref(grpc_mdelem gmd DEBUG_ARGS) { char *key_str = grpc_slice_to_c_string(md->key); char *value_str = grpc_slice_to_c_string(md->value); gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), + "ELM REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", + (void *)md, gpr_atm_no_barrier_load(&md->refcnt), gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); gpr_free(key_str); gpr_free(value_str); @@ -390,8 +391,8 @@ grpc_mdelem grpc_mdelem_ref(grpc_mdelem gmd DEBUG_ARGS) { char *key_str = grpc_slice_to_c_string(md->key); char *value_str = grpc_slice_to_c_string(md->value); gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), + "ELM REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", + (void *)md, gpr_atm_no_barrier_load(&md->refcnt), gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); gpr_free(key_str); gpr_free(value_str); @@ -420,8 +421,8 @@ void grpc_mdelem_unref(grpc_exec_ctx *exec_ctx, grpc_mdelem gmd DEBUG_ARGS) { char *key_str = grpc_slice_to_c_string(md->key); char *value_str = grpc_slice_to_c_string(md->value); gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM UNREF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), + "ELM UNREF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", + (void *)md, gpr_atm_no_barrier_load(&md->refcnt), gpr_atm_no_barrier_load(&md->refcnt) - 1, key_str, value_str); gpr_free(key_str); gpr_free(value_str); @@ -446,8 +447,8 @@ void grpc_mdelem_unref(grpc_exec_ctx *exec_ctx, grpc_mdelem gmd DEBUG_ARGS) { char *key_str = grpc_slice_to_c_string(md->key); char *value_str = grpc_slice_to_c_string(md->value); gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM UNREF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), + "ELM UNREF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", + (void *)md, gpr_atm_no_barrier_load(&md->refcnt), gpr_atm_no_barrier_load(&md->refcnt) - 1, key_str, value_str); gpr_free(key_str); gpr_free(value_str); -- cgit v1.2.3 From 0ca0be8b5624f69d617bc6af4c60bf8a0ae8dfba Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 20 Jun 2017 07:49:33 -0700 Subject: Clean up client_channel code and eliminate unnecessary allocations. --- .../ext/filters/client_channel/client_channel.c | 667 +++++++++------------ .../client_channel/resolver/fake/fake_resolver.c | 4 +- .../resolver/sockaddr/sockaddr_resolver.c | 4 +- 3 files changed, 303 insertions(+), 372 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.c b/src/core/ext/filters/client_channel/client_channel.c index f29c5d55ed..de516ab4c9 100644 --- a/src/core/ext/filters/client_channel/client_channel.c +++ b/src/core/ext/filters/client_channel/client_channel.c @@ -178,8 +178,8 @@ typedef struct client_channel_channel_data { grpc_slice_hash_table *method_params_table; /** incoming resolver result - set by resolver.next() */ grpc_channel_args *resolver_result; - /** a list of closures that are all waiting for config to come in */ - grpc_closure_list waiting_for_config_closures; + /** a list of closures that are all waiting for resolver result to come in */ + grpc_closure_list waiting_for_resolver_result_closures; /** resolver callback */ grpc_closure on_resolver_result_changed; /** connectivity state being tracked */ @@ -342,49 +342,15 @@ static void parse_retry_throttle_params(const grpc_json *field, void *arg) { } } -// Wrap a closure associated with \a lb_policy. The associated callback (\a -// wrapped_on_pick_closure_cb) is responsible for unref'ing \a lb_policy after -// scheduling \a wrapped_closure. -typedef struct wrapped_on_pick_closure_arg { - /* the closure instance using this struct as argument */ - grpc_closure wrapper_closure; - - /* the original closure. Usually a on_complete/notify cb for pick() and ping() - * calls against the internal RR instance, respectively. */ - grpc_closure *wrapped_closure; - - /* The policy instance related to the closure */ - grpc_lb_policy *lb_policy; -} wrapped_on_pick_closure_arg; - -// Invoke \a arg->wrapped_closure, unref \a arg->lb_policy and free \a arg. -static void wrapped_on_pick_closure_cb(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { - wrapped_on_pick_closure_arg *wc_arg = arg; - GPR_ASSERT(wc_arg != NULL); - GPR_ASSERT(wc_arg->wrapped_closure != NULL); - GPR_ASSERT(wc_arg->lb_policy != NULL); - GRPC_CLOSURE_RUN(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error)); - GRPC_LB_POLICY_UNREF(exec_ctx, wc_arg->lb_policy, "pick_subchannel_wrapping"); - gpr_free(wc_arg); -} - static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { channel_data *chand = arg; + // Extract the following fields from the resolver result, if non-NULL. char *lb_policy_name = NULL; - grpc_lb_policy *lb_policy = NULL; - grpc_lb_policy *old_lb_policy = NULL; - grpc_slice_hash_table *method_params_table = NULL; - grpc_connectivity_state state = GRPC_CHANNEL_TRANSIENT_FAILURE; - bool exit_idle = false; - grpc_error *state_error = - GRPC_ERROR_CREATE_FROM_STATIC_STRING("No load balancing policy"); + grpc_lb_policy *new_lb_policy = NULL; char *service_config_json = NULL; - service_config_parsing_state parsing_state; - memset(&parsing_state, 0, sizeof(parsing_state)); - - bool lb_policy_updated = false; + grpc_server_retry_throttle_data *retry_throttle_data = NULL; + grpc_slice_hash_table *method_params_table = NULL; if (chand->resolver_result != NULL) { // Find LB policy name. const grpc_arg *channel_arg = @@ -419,32 +385,29 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, // Use pick_first if nothing was specified and we didn't select grpclb // above. if (lb_policy_name == NULL) lb_policy_name = "pick_first"; - // Instantiate LB policy. grpc_lb_policy_args lb_policy_args; lb_policy_args.args = chand->resolver_result; lb_policy_args.client_channel_factory = chand->client_channel_factory; lb_policy_args.combiner = chand->combiner; - + // Check to see if we're already using the right LB policy. + // Note: It's safe to use chand->info_lb_policy_name here without + // taking a lock on chand->info_mu, because this function is the + // only thing that modifies its value, and it can only be invoked + // once at any given time. const bool lb_policy_type_changed = - (chand->info_lb_policy_name == NULL) || - (strcmp(chand->info_lb_policy_name, lb_policy_name) != 0); + chand->info_lb_policy_name == NULL || + strcmp(chand->info_lb_policy_name, lb_policy_name) != 0; if (chand->lb_policy != NULL && !lb_policy_type_changed) { - // update - lb_policy_updated = true; + // Continue using the same LB policy. Update with new addresses. grpc_lb_policy_update_locked(exec_ctx, chand->lb_policy, &lb_policy_args); } else { - lb_policy = + // Instantiate new LB policy. + new_lb_policy = grpc_lb_policy_create(exec_ctx, lb_policy_name, &lb_policy_args); - if (lb_policy != NULL) { - GRPC_LB_POLICY_REF(lb_policy, "config_change"); - GRPC_ERROR_UNREF(state_error); - state = grpc_lb_policy_check_connectivity_locked(exec_ctx, lb_policy, - &state_error); - old_lb_policy = chand->lb_policy; - chand->lb_policy = lb_policy; + if (new_lb_policy == NULL) { + gpr_log(GPR_ERROR, "could not create LB policy \"%s\"", lb_policy_name); } } - // Find service config. channel_arg = grpc_channel_args_find(chand->resolver_result, GRPC_ARG_SERVICE_CONFIG); @@ -461,12 +424,14 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, grpc_uri *uri = grpc_uri_parse(exec_ctx, channel_arg->value.string, true); GPR_ASSERT(uri->path[0] != '\0'); + service_config_parsing_state parsing_state; + memset(&parsing_state, 0, sizeof(parsing_state)); parsing_state.server_name = uri->path[0] == '/' ? uri->path + 1 : uri->path; grpc_service_config_parse_global_params( service_config, parse_retry_throttle_params, &parsing_state); - parsing_state.server_name = NULL; grpc_uri_destroy(uri); + retry_throttle_data = parsing_state.retry_throttle_data; method_params_table = grpc_service_config_create_method_config_table( exec_ctx, service_config, method_parameters_create_from_json, method_parameters_free); @@ -480,12 +445,11 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, grpc_channel_args_destroy(exec_ctx, chand->resolver_result); chand->resolver_result = NULL; } - - if (lb_policy != NULL) { - grpc_pollset_set_add_pollset_set(exec_ctx, lb_policy->interested_parties, - chand->interested_parties); - } - + // Now swap out fields in chand. Note that the new values may still + // be NULL if (e.g.) the resolver failed to return results or the + // results did not contain the necessary data. + // + // First, swap out the data used by cc_get_channel_info(). gpr_mu_lock(&chand->info_mu); if (lb_policy_name != NULL) { gpr_free(chand->info_lb_policy_name); @@ -496,75 +460,77 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, chand->info_service_config_json = service_config_json; } gpr_mu_unlock(&chand->info_mu); - + // Swap out the retry throttle data. if (chand->retry_throttle_data != NULL) { grpc_server_retry_throttle_data_unref(chand->retry_throttle_data); } - chand->retry_throttle_data = parsing_state.retry_throttle_data; + chand->retry_throttle_data = retry_throttle_data; + // Swap out the method params table. if (chand->method_params_table != NULL) { grpc_slice_hash_table_unref(exec_ctx, chand->method_params_table); } chand->method_params_table = method_params_table; - if (lb_policy != NULL) { - GRPC_CLOSURE_LIST_SCHED(exec_ctx, &chand->waiting_for_config_closures); - } else if (chand->resolver == NULL /* disconnected */) { - grpc_closure_list_fail_all(&chand->waiting_for_config_closures, - GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( - "Channel disconnected", &error, 1)); - GRPC_CLOSURE_LIST_SCHED(exec_ctx, &chand->waiting_for_config_closures); - } - if (!lb_policy_updated && lb_policy != NULL && - chand->exit_idle_when_lb_policy_arrives) { - GRPC_LB_POLICY_REF(lb_policy, "exit_idle"); - exit_idle = true; - chand->exit_idle_when_lb_policy_arrives = false; - } - - if (error == GRPC_ERROR_NONE && chand->resolver) { - if (!lb_policy_updated) { - set_channel_connectivity_state_locked(exec_ctx, chand, state, - GRPC_ERROR_REF(state_error), - "new_lb+resolver"); - if (lb_policy != NULL) { - watch_lb_policy_locked(exec_ctx, chand, lb_policy, state); - } + // If we have a new LB policy or are shutting down (in which case + // new_lb_policy will be NULL), swap out the LB policy, unreffing the + // old one and removing its fds from chand->interested_parties. + // Note that we do NOT do this if either (a) we updated the existing + // LB policy above or (b) we failed to create the new LB policy (in + // which case we want to continue using the most recent one we had). + if (new_lb_policy != NULL || error != GRPC_ERROR_NONE || + chand->resolver == NULL) { + if (chand->lb_policy != NULL) { + grpc_pollset_set_del_pollset_set(exec_ctx, + chand->lb_policy->interested_parties, + chand->interested_parties); + GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "channel"); } - GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver"); - grpc_resolver_next_locked(exec_ctx, chand->resolver, - &chand->resolver_result, - &chand->on_resolver_result_changed); - } else { + chand->lb_policy = new_lb_policy; + } + // Now that we've swapped out the relevant fields of chand, check for + // error or shutdown. + if (error != GRPC_ERROR_NONE || chand->resolver == NULL) { if (chand->resolver != NULL) { grpc_resolver_shutdown_locked(exec_ctx, chand->resolver); GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel"); chand->resolver = NULL; } - grpc_error *refs[] = {error, state_error}; set_channel_connectivity_state_locked( exec_ctx, chand, GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( - "Got config after disconnection", refs, GPR_ARRAY_SIZE(refs)), + "Got resolver result after disconnection", &error, 1), "resolver_gone"); + GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "resolver"); + grpc_closure_list_fail_all(&chand->waiting_for_resolver_result_closures, + GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( + "Channel disconnected", &error, 1)); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, + &chand->waiting_for_resolver_result_closures); + } else { // Not shutting down. + grpc_connectivity_state state = GRPC_CHANNEL_TRANSIENT_FAILURE; + grpc_error *state_error = + GRPC_ERROR_CREATE_FROM_STATIC_STRING("No load balancing policy"); + if (new_lb_policy != NULL) { + GRPC_ERROR_UNREF(state_error); + state = grpc_lb_policy_check_connectivity_locked(exec_ctx, new_lb_policy, + &state_error); + grpc_pollset_set_add_pollset_set(exec_ctx, + new_lb_policy->interested_parties, + chand->interested_parties); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, + &chand->waiting_for_resolver_result_closures); + if (chand->exit_idle_when_lb_policy_arrives) { + grpc_lb_policy_exit_idle_locked(exec_ctx, new_lb_policy); + chand->exit_idle_when_lb_policy_arrives = false; + } + watch_lb_policy_locked(exec_ctx, chand, new_lb_policy, state); + } + set_channel_connectivity_state_locked( + exec_ctx, chand, state, GRPC_ERROR_REF(state_error), "new_lb+resolver"); + grpc_resolver_next_locked(exec_ctx, chand->resolver, + &chand->resolver_result, + &chand->on_resolver_result_changed); + GRPC_ERROR_UNREF(state_error); } - - if (!lb_policy_updated && lb_policy != NULL && exit_idle) { - grpc_lb_policy_exit_idle_locked(exec_ctx, lb_policy); - GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "exit_idle"); - } - - if (old_lb_policy != NULL) { - grpc_pollset_set_del_pollset_set( - exec_ctx, old_lb_policy->interested_parties, chand->interested_parties); - GRPC_LB_POLICY_UNREF(exec_ctx, old_lb_policy, "channel"); - old_lb_policy = NULL; - } - - if (!lb_policy_updated && lb_policy != NULL) { - GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "config_change"); - } - - GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "resolver"); - GRPC_ERROR_UNREF(state_error); } static void start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg, @@ -602,9 +568,10 @@ static void start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg, GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel"); chand->resolver = NULL; if (!chand->started_resolving) { - grpc_closure_list_fail_all(&chand->waiting_for_config_closures, + grpc_closure_list_fail_all(&chand->waiting_for_resolver_result_closures, GRPC_ERROR_REF(op->disconnect_with_error)); - GRPC_CLOSURE_LIST_SCHED(exec_ctx, &chand->waiting_for_config_closures); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, + &chand->waiting_for_resolver_result_closures); } if (chand->lb_policy != NULL) { grpc_pollset_set_del_pollset_set(exec_ctx, @@ -770,6 +737,16 @@ static void cc_destroy_channel_elem(grpc_exec_ctx *exec_ctx, * PER-CALL FUNCTIONS */ +// Max number of batches that can be pending on a call at any given +// time. This includes: +// recv_initial_metadata +// send_initial_metadata +// recv_message +// send_message +// recv_trailing_metadata +// send_trailing_metadata +#define MAX_WAITING_BATCHES 6 + /** Call data. Holds a pointer to grpc_subchannel_call and the associated machinery to create such a pointer. Handles queueing of stream ops until a call object is ready, waiting @@ -800,11 +777,10 @@ typedef struct client_channel_call_data { grpc_call_context_element subchannel_call_context[GRPC_CONTEXT_COUNT]; grpc_polling_entity *pollent; - grpc_transport_stream_op_batch **waiting_ops; - size_t waiting_ops_count; - size_t waiting_ops_capacity; + grpc_transport_stream_op_batch *waiting_for_pick_batches[MAX_WAITING_BATCHES]; + size_t waiting_for_pick_batches_count; - grpc_closure next_step; + grpc_transport_stream_op_batch_payload *initial_metadata_payload; grpc_call_stack *owning_call; @@ -853,57 +829,44 @@ grpc_subchannel_call *grpc_client_channel_get_subchannel_call( return get_call_or_error(call_elem->call_data).subchannel_call; } -static void add_waiting_locked(call_data *calld, - grpc_transport_stream_op_batch *op) { - GPR_TIMER_BEGIN("add_waiting_locked", 0); - if (calld->waiting_ops_count == calld->waiting_ops_capacity) { - calld->waiting_ops_capacity = GPR_MAX(3, 2 * calld->waiting_ops_capacity); - calld->waiting_ops = - gpr_realloc(calld->waiting_ops, - calld->waiting_ops_capacity * sizeof(*calld->waiting_ops)); - } - calld->waiting_ops[calld->waiting_ops_count++] = op; - GPR_TIMER_END("add_waiting_locked", 0); +static void waiting_for_pick_batches_add_locked( + call_data *calld, grpc_transport_stream_op_batch *batch) { + GPR_ASSERT(calld->waiting_for_pick_batches_count < MAX_WAITING_BATCHES); + calld->waiting_for_pick_batches[calld->waiting_for_pick_batches_count++] = + batch; } -static void fail_locked(grpc_exec_ctx *exec_ctx, call_data *calld, - grpc_error *error) { - size_t i; - for (i = 0; i < calld->waiting_ops_count; i++) { +static void waiting_for_pick_batches_fail_locked(grpc_exec_ctx *exec_ctx, + call_data *calld, + grpc_error *error) { + for (size_t i = 0; i < calld->waiting_for_pick_batches_count; ++i) { grpc_transport_stream_op_batch_finish_with_failure( - exec_ctx, calld->waiting_ops[i], GRPC_ERROR_REF(error)); + exec_ctx, calld->waiting_for_pick_batches[i], GRPC_ERROR_REF(error)); } - calld->waiting_ops_count = 0; + calld->waiting_for_pick_batches_count = 0; GRPC_ERROR_UNREF(error); } -static void retry_waiting_locked(grpc_exec_ctx *exec_ctx, call_data *calld) { - if (calld->waiting_ops_count == 0) { - return; - } - - call_or_error call = get_call_or_error(calld); - grpc_transport_stream_op_batch **ops = calld->waiting_ops; - size_t nops = calld->waiting_ops_count; - if (call.error != GRPC_ERROR_NONE) { - fail_locked(exec_ctx, calld, GRPC_ERROR_REF(call.error)); +static void waiting_for_pick_batches_resume_locked(grpc_exec_ctx *exec_ctx, + call_data *calld) { + if (calld->waiting_for_pick_batches_count == 0) return; + call_or_error coe = get_call_or_error(calld); + if (coe.error != GRPC_ERROR_NONE) { + waiting_for_pick_batches_fail_locked(exec_ctx, calld, + GRPC_ERROR_REF(coe.error)); return; } - calld->waiting_ops = NULL; - calld->waiting_ops_count = 0; - calld->waiting_ops_capacity = 0; - for (size_t i = 0; i < nops; i++) { - grpc_subchannel_call_process_op(exec_ctx, call.subchannel_call, ops[i]); + for (size_t i = 0; i < calld->waiting_for_pick_batches_count; ++i) { + grpc_subchannel_call_process_op(exec_ctx, coe.subchannel_call, + calld->waiting_for_pick_batches[i]); } - gpr_free(ops); + calld->waiting_for_pick_batches_count = 0; } -// Sets calld->method_params and calld->retry_throttle_data. -// If the method params specify a timeout, populates -// *per_method_deadline and returns true. -static bool set_call_method_params_from_service_config_locked( - grpc_exec_ctx *exec_ctx, grpc_call_element *elem, - gpr_timespec *per_method_deadline) { +// Applies service config to the call. Must be invoked once we know +// that the resolver has returned results to the channel. +static void apply_service_config_to_call_locked(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem) { channel_data *chand = elem->channel_data; call_data *calld = elem->call_data; if (chand->retry_throttle_data != NULL) { @@ -915,39 +878,48 @@ static bool set_call_method_params_from_service_config_locked( exec_ctx, chand->method_params_table, calld->path); if (calld->method_params != NULL) { method_parameters_ref(calld->method_params); - if (gpr_time_cmp(calld->method_params->timeout, + // If the deadline from the service config is shorter than the one + // from the client API, reset the deadline timer. + if (chand->deadline_checking_enabled && + gpr_time_cmp(calld->method_params->timeout, gpr_time_0(GPR_TIMESPAN)) != 0) { - *per_method_deadline = + const gpr_timespec per_method_deadline = gpr_time_add(calld->call_start_time, calld->method_params->timeout); - return true; + if (gpr_time_cmp(per_method_deadline, calld->deadline) < 0) { + calld->deadline = per_method_deadline; + grpc_deadline_state_reset(exec_ctx, elem, calld->deadline); + } } } } - return false; } -static void apply_final_configuration_locked(grpc_exec_ctx *exec_ctx, - grpc_call_element *elem) { - /* apply service-config level configuration to the call (now that we're - * certain it exists) */ - call_data *calld = elem->call_data; - channel_data *chand = elem->channel_data; - gpr_timespec per_method_deadline; - if (set_call_method_params_from_service_config_locked(exec_ctx, elem, - &per_method_deadline)) { - // If the deadline from the service config is shorter than the one - // from the client API, reset the deadline timer. - if (chand->deadline_checking_enabled && - gpr_time_cmp(per_method_deadline, calld->deadline) < 0) { - calld->deadline = per_method_deadline; - grpc_deadline_state_reset(exec_ctx, elem, calld->deadline); - } +static void create_subchannel_call_locked(grpc_exec_ctx *exec_ctx, + call_data *calld, grpc_error *error) { + grpc_subchannel_call *subchannel_call = NULL; + const grpc_connected_subchannel_call_args call_args = { + .pollent = calld->pollent, + .path = calld->path, + .start_time = calld->call_start_time, + .deadline = calld->deadline, + .arena = calld->arena, + .context = calld->subchannel_call_context}; + grpc_error *new_error = grpc_connected_subchannel_create_call( + exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call); + GPR_ASSERT(set_call_or_error( + calld, (call_or_error){.subchannel_call = subchannel_call})); + if (new_error != GRPC_ERROR_NONE) { + new_error = grpc_error_add_child(new_error, error); + waiting_for_pick_batches_fail_locked(exec_ctx, calld, new_error); + } else { + waiting_for_pick_batches_resume_locked(exec_ctx, calld); } + GRPC_ERROR_UNREF(error); } -static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, void *arg, +static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem, grpc_error *error) { - grpc_call_element *elem = arg; call_data *calld = elem->call_data; channel_data *chand = elem->channel_data; GPR_ASSERT(calld->pick_pending); @@ -956,6 +928,7 @@ static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, void *arg, chand->interested_parties); call_or_error coe = get_call_or_error(calld); if (calld->connected_subchannel == NULL) { + // Failed to create subchannel. grpc_error *failure = error == GRPC_ERROR_NONE ? GRPC_ERROR_CREATE_FROM_STATIC_STRING( @@ -963,7 +936,7 @@ static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, void *arg, : GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Failed to create subchannel", &error, 1); set_call_or_error(calld, (call_or_error){.error = GRPC_ERROR_REF(failure)}); - fail_locked(exec_ctx, calld, failure); + waiting_for_pick_batches_fail_locked(exec_ctx, calld, failure); } else if (coe.error != GRPC_ERROR_NONE) { /* already cancelled before subchannel became ready */ grpc_error *child_errors[] = {error, coe.error}; @@ -977,29 +950,13 @@ static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error_set_int(cancellation_error, GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_DEADLINE_EXCEEDED); } - fail_locked(exec_ctx, calld, cancellation_error); + waiting_for_pick_batches_fail_locked(exec_ctx, calld, cancellation_error); } else { /* Create call on subchannel. */ - grpc_subchannel_call *subchannel_call = NULL; - const grpc_connected_subchannel_call_args call_args = { - .pollent = calld->pollent, - .path = calld->path, - .start_time = calld->call_start_time, - .deadline = calld->deadline, - .arena = calld->arena, - .context = calld->subchannel_call_context}; - grpc_error *new_error = grpc_connected_subchannel_create_call( - exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call); - GPR_ASSERT(set_call_or_error( - calld, (call_or_error){.subchannel_call = subchannel_call})); - if (new_error != GRPC_ERROR_NONE) { - new_error = grpc_error_add_child(new_error, error); - fail_locked(exec_ctx, calld, new_error); - } else { - retry_waiting_locked(exec_ctx, calld); - } + create_subchannel_call_locked(exec_ctx, calld, GRPC_ERROR_REF(error)); } GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "pick_subchannel"); + GRPC_ERROR_UNREF(error); } static char *cc_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { @@ -1013,41 +970,32 @@ static char *cc_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { } } +/** Return true if subchannel is available immediately (in which case + subchannel_ready_locked() should not be called), or false otherwise (in + which case subchannel_ready_locked() should be called when the subchannel + is available). */ +static bool pick_subchannel_locked(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem); + typedef struct { - grpc_metadata_batch *initial_metadata; - uint32_t initial_metadata_flags; - grpc_connected_subchannel **connected_subchannel; - grpc_call_context_element *subchannel_call_context; - grpc_closure *on_ready; grpc_call_element *elem; + bool cancelled; grpc_closure closure; -} continue_picking_args; +} pick_after_resolver_result_args; -/** Return true if subchannel is available immediately (in which case on_ready - should not be called), or false otherwise (in which case on_ready should be - called when the subchannel is available). */ -static bool pick_subchannel_locked( - grpc_exec_ctx *exec_ctx, grpc_call_element *elem, - grpc_metadata_batch *initial_metadata, uint32_t initial_metadata_flags, - grpc_connected_subchannel **connected_subchannel, - grpc_call_context_element *subchannel_call_context, grpc_closure *on_ready); - -static void continue_picking_locked(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { - continue_picking_args *cpa = arg; - if (cpa->connected_subchannel == NULL) { +static void continue_picking_after_resolver_result_locked( + grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { + pick_after_resolver_result_args *args = arg; + if (args->cancelled) { /* cancelled, do nothing */ } else if (error != GRPC_ERROR_NONE) { - GRPC_CLOSURE_SCHED(exec_ctx, cpa->on_ready, GRPC_ERROR_REF(error)); + subchannel_ready_locked(exec_ctx, args->elem, GRPC_ERROR_REF(error)); } else { - if (pick_subchannel_locked(exec_ctx, cpa->elem, cpa->initial_metadata, - cpa->initial_metadata_flags, - cpa->connected_subchannel, - cpa->subchannel_call_context, cpa->on_ready)) { - GRPC_CLOSURE_SCHED(exec_ctx, cpa->on_ready, GRPC_ERROR_NONE); + if (pick_subchannel_locked(exec_ctx, args->elem)) { + subchannel_ready_locked(exec_ctx, args->elem, GRPC_ERROR_NONE); } } - gpr_free(cpa); + gpr_free(args); } static void cancel_pick_locked(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, @@ -1059,39 +1007,85 @@ static void cancel_pick_locked(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, &calld->connected_subchannel, GRPC_ERROR_REF(error)); } - for (grpc_closure *closure = chand->waiting_for_config_closures.head; + // If we don't yet have a resolver result, then a closure for + // continue_picking_after_resolver_result_locked() will have been added to + // chand->waiting_for_resolver_result_closures, and it may not be invoked + // until after this call has been destroyed. We mark the operation as + // cancelled, so that when continue_picking_after_resolver_result_locked() + // is called, it will be a no-op. We also immediately invoke + // subchannel_ready_locked() to propagate the error back to the caller. + for (grpc_closure *closure = chand->waiting_for_resolver_result_closures.head; closure != NULL; closure = closure->next_data.next) { - continue_picking_args *cpa = closure->cb_arg; - if (cpa->connected_subchannel == &calld->connected_subchannel) { - cpa->connected_subchannel = NULL; - GRPC_CLOSURE_SCHED(exec_ctx, cpa->on_ready, - GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( - "Pick cancelled", &error, 1)); + pick_after_resolver_result_args *args = closure->cb_arg; + if (!args->cancelled && args->elem == elem) { + args->cancelled = true; + subchannel_ready_locked(exec_ctx, elem, + GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( + "Pick cancelled", &error, 1)); } } GRPC_ERROR_UNREF(error); } -static bool pick_subchannel_locked( - grpc_exec_ctx *exec_ctx, grpc_call_element *elem, - grpc_metadata_batch *initial_metadata, uint32_t initial_metadata_flags, - grpc_connected_subchannel **connected_subchannel, - grpc_call_context_element *subchannel_call_context, - grpc_closure *on_ready) { - GPR_TIMER_BEGIN("pick_subchannel", 0); +// State for pick callback that holds a reference to the LB policy +// from which the pick was requested. +typedef struct { + grpc_lb_policy *lb_policy; + grpc_call_element *elem; + grpc_closure closure; +} pick_callback_args; + +// Callback invoked by grpc_lb_policy_pick_locked() for async picks. +// Unrefs the LB policy after invoking subchannel_ready_locked(). +static void pick_callback_done_locked(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error) { + pick_callback_args *args = arg; + GPR_ASSERT(args != NULL); + GPR_ASSERT(args->lb_policy != NULL); + subchannel_ready_locked(exec_ctx, args->elem, GRPC_ERROR_REF(error)); + GRPC_LB_POLICY_UNREF(exec_ctx, args->lb_policy, "pick_subchannel"); + gpr_free(args); +} +// Takes a ref to chand->lb_policy and calls grpc_lb_policy_pick_locked(). +// If the pick was completed synchronously, unrefs the LB policy and +// returns true. +static bool pick_callback_start_locked(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem, + const grpc_lb_policy_pick_args *inputs) { channel_data *chand = elem->channel_data; call_data *calld = elem->call_data; + pick_callback_args *pick_args = gpr_zalloc(sizeof(*pick_args)); + GRPC_LB_POLICY_REF(chand->lb_policy, "pick_subchannel"); + pick_args->lb_policy = chand->lb_policy; + pick_args->elem = elem; + GRPC_CLOSURE_INIT(&pick_args->closure, pick_callback_done_locked, pick_args, + grpc_combiner_scheduler(chand->combiner)); + const bool pick_done = grpc_lb_policy_pick_locked( + exec_ctx, chand->lb_policy, inputs, &calld->connected_subchannel, + calld->subchannel_call_context, NULL, &pick_args->closure); + if (pick_done) { + /* synchronous grpc_lb_policy_pick call. Unref the LB policy. */ + GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "pick_subchannel"); + gpr_free(pick_args); + } + return pick_done; +} - GPR_ASSERT(connected_subchannel); - +static bool pick_subchannel_locked(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem) { + GPR_TIMER_BEGIN("pick_subchannel", 0); + channel_data *chand = elem->channel_data; + call_data *calld = elem->call_data; + bool pick_done = false; if (chand->lb_policy != NULL) { - apply_final_configuration_locked(exec_ctx, elem); - grpc_lb_policy *lb_policy = chand->lb_policy; - GRPC_LB_POLICY_REF(lb_policy, "pick_subchannel"); + apply_service_config_to_call_locked(exec_ctx, elem); // If the application explicitly set wait_for_ready, use that. // Otherwise, if the service config specified a value for this // method, use that. + uint32_t initial_metadata_flags = + calld->initial_metadata_payload->send_initial_metadata + .send_initial_metadata_flags; const bool wait_for_ready_set_from_api = initial_metadata_flags & GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET; @@ -1107,78 +1101,57 @@ static bool pick_subchannel_locked( } } const grpc_lb_policy_pick_args inputs = { - initial_metadata, initial_metadata_flags, &calld->lb_token_mdelem}; - - // Wrap the user-provided callback in order to hold a strong reference to - // the LB policy for the duration of the pick. - wrapped_on_pick_closure_arg *w_on_pick_arg = - gpr_zalloc(sizeof(*w_on_pick_arg)); - GRPC_CLOSURE_INIT(&w_on_pick_arg->wrapper_closure, - wrapped_on_pick_closure_cb, w_on_pick_arg, - grpc_schedule_on_exec_ctx); - w_on_pick_arg->wrapped_closure = on_ready; - GRPC_LB_POLICY_REF(lb_policy, "pick_subchannel_wrapping"); - w_on_pick_arg->lb_policy = lb_policy; - const bool pick_done = grpc_lb_policy_pick_locked( - exec_ctx, lb_policy, &inputs, connected_subchannel, - subchannel_call_context, NULL, &w_on_pick_arg->wrapper_closure); - if (pick_done) { - /* synchronous grpc_lb_policy_pick call. Unref the LB policy. */ - GRPC_LB_POLICY_UNREF(exec_ctx, w_on_pick_arg->lb_policy, - "pick_subchannel_wrapping"); - gpr_free(w_on_pick_arg); + calld->initial_metadata_payload->send_initial_metadata + .send_initial_metadata, + initial_metadata_flags, &calld->lb_token_mdelem}; + pick_done = pick_callback_start_locked(exec_ctx, elem, &inputs); + } else if (chand->resolver != NULL) { + if (!chand->started_resolving) { + chand->started_resolving = true; + GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver"); + grpc_resolver_next_locked(exec_ctx, chand->resolver, + &chand->resolver_result, + &chand->on_resolver_result_changed); } - GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "pick_subchannel"); - GPR_TIMER_END("pick_subchannel", 0); - return pick_done; - } - if (chand->resolver != NULL && !chand->started_resolving) { - chand->started_resolving = true; - GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver"); - grpc_resolver_next_locked(exec_ctx, chand->resolver, - &chand->resolver_result, - &chand->on_resolver_result_changed); - } - if (chand->resolver != NULL) { - continue_picking_args *cpa = gpr_malloc(sizeof(*cpa)); - cpa->initial_metadata = initial_metadata; - cpa->initial_metadata_flags = initial_metadata_flags; - cpa->connected_subchannel = connected_subchannel; - cpa->subchannel_call_context = subchannel_call_context; - cpa->on_ready = on_ready; - cpa->elem = elem; - GRPC_CLOSURE_INIT(&cpa->closure, continue_picking_locked, cpa, + pick_after_resolver_result_args *args = + (pick_after_resolver_result_args *)gpr_zalloc(sizeof(*args)); + args->elem = elem; + GRPC_CLOSURE_INIT(&args->closure, + continue_picking_after_resolver_result_locked, args, grpc_combiner_scheduler(chand->combiner)); - grpc_closure_list_append(&chand->waiting_for_config_closures, &cpa->closure, - GRPC_ERROR_NONE); + grpc_closure_list_append(&chand->waiting_for_resolver_result_closures, + &args->closure, GRPC_ERROR_NONE); } else { - GRPC_CLOSURE_SCHED(exec_ctx, on_ready, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected")); + subchannel_ready_locked( + exec_ctx, elem, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected")); } - GPR_TIMER_END("pick_subchannel", 0); - return false; + return pick_done; } -static void start_transport_stream_op_batch_locked_inner( - grpc_exec_ctx *exec_ctx, grpc_transport_stream_op_batch *op, - grpc_call_element *elem) { - channel_data *chand = elem->channel_data; +static void start_transport_stream_op_batch_locked(grpc_exec_ctx *exec_ctx, + void *arg, + grpc_error *error_ignored) { + GPR_TIMER_BEGIN("start_transport_stream_op_batch_locked", 0); + grpc_transport_stream_op_batch *op = arg; + grpc_call_element *elem = op->handler_private.extra_arg; call_data *calld = elem->call_data; - + channel_data *chand = elem->channel_data; /* need to recheck that another thread hasn't set the call */ call_or_error coe = get_call_or_error(calld); if (coe.error != GRPC_ERROR_NONE) { grpc_transport_stream_op_batch_finish_with_failure( exec_ctx, op, GRPC_ERROR_REF(coe.error)); - /* early out */ - return; + goto done; } if (coe.subchannel_call != NULL) { grpc_subchannel_call_process_op(exec_ctx, coe.subchannel_call, op); - /* early out */ - return; + goto done; } + // Add to waiting-for-pick list. If we succeed in getting a + // subchannel call below, we'll handle this batch (along with any + // other waiting batches) in waiting_for_pick_batches_resume_locked(). + waiting_for_pick_batches_add_locked(calld, op); /* if this is a cancellation, then we can raise our cancelled flag */ if (op->cancel_stream) { grpc_error *error = op->payload->cancel_stream.cancel_error; @@ -1190,30 +1163,22 @@ static void start_transport_stream_op_batch_locked_inner( set_call_or_error(calld, (call_or_error){.error = GRPC_ERROR_REF(error)}); if (calld->pick_pending) { cancel_pick_locked(exec_ctx, elem, GRPC_ERROR_REF(error)); - } else { - fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error)); } - grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, - GRPC_ERROR_REF(error)); - /* early out */ - return; + waiting_for_pick_batches_fail_locked(exec_ctx, calld, + GRPC_ERROR_REF(error)); + goto done; } /* if we don't have a subchannel, try to get one */ if (!calld->pick_pending && calld->connected_subchannel == NULL && op->send_initial_metadata) { + calld->initial_metadata_payload = op->payload; calld->pick_pending = true; - GRPC_CLOSURE_INIT(&calld->next_step, subchannel_ready_locked, elem, - grpc_combiner_scheduler(chand->combiner)); GRPC_CALL_STACK_REF(calld->owning_call, "pick_subchannel"); /* If a subchannel is not available immediately, the polling entity from call_data should be provided to channel_data's interested_parties, so that IO of the lb_policy and resolver could be done under it. */ - if (pick_subchannel_locked( - exec_ctx, elem, - op->payload->send_initial_metadata.send_initial_metadata, - op->payload->send_initial_metadata.send_initial_metadata_flags, - &calld->connected_subchannel, calld->subchannel_call_context, - &calld->next_step)) { + if (pick_subchannel_locked(exec_ctx, elem)) { + // Pick was returned synchronously. calld->pick_pending = false; GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "pick_subchannel"); if (calld->connected_subchannel == NULL) { @@ -1221,42 +1186,20 @@ static void start_transport_stream_op_batch_locked_inner( "Call dropped by load balancing policy"); set_call_or_error(calld, (call_or_error){.error = GRPC_ERROR_REF(error)}); - fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error)); - grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error); - return; // Early out. + waiting_for_pick_batches_fail_locked(exec_ctx, calld, error); + } else { + // Create subchannel call. + create_subchannel_call_locked(exec_ctx, calld, GRPC_ERROR_NONE); } } else { grpc_polling_entity_add_to_pollset_set(exec_ctx, calld->pollent, chand->interested_parties); } } - /* if we've got a subchannel, then let's ask it to create a call */ - if (!calld->pick_pending && calld->connected_subchannel != NULL) { - grpc_subchannel_call *subchannel_call = NULL; - const grpc_connected_subchannel_call_args call_args = { - .pollent = calld->pollent, - .path = calld->path, - .start_time = calld->call_start_time, - .deadline = calld->deadline, - .arena = calld->arena, - .context = calld->subchannel_call_context}; - grpc_error *error = grpc_connected_subchannel_create_call( - exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call); - GPR_ASSERT(set_call_or_error( - calld, (call_or_error){.subchannel_call = subchannel_call})); - if (error != GRPC_ERROR_NONE) { - fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error)); - grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error); - } else { - retry_waiting_locked(exec_ctx, calld); - /* recurse to retry */ - start_transport_stream_op_batch_locked_inner(exec_ctx, op, elem); - } - /* early out */ - return; - } - /* nothing to be done but wait */ - add_waiting_locked(calld, op); +done: + GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, + "start_transport_stream_op_batch"); + GPR_TIMER_END("start_transport_stream_op_batch_locked", 0); } static void on_complete(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { @@ -1279,30 +1222,6 @@ static void on_complete(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { GRPC_ERROR_REF(error)); } -static void start_transport_stream_op_batch_locked(grpc_exec_ctx *exec_ctx, - void *arg, - grpc_error *error_ignored) { - GPR_TIMER_BEGIN("start_transport_stream_op_batch_locked", 0); - - grpc_transport_stream_op_batch *op = arg; - grpc_call_element *elem = op->handler_private.extra_arg; - call_data *calld = elem->call_data; - - if (op->recv_trailing_metadata) { - GPR_ASSERT(op->on_complete != NULL); - calld->original_on_complete = op->on_complete; - GRPC_CLOSURE_INIT(&calld->on_complete, on_complete, elem, - grpc_schedule_on_exec_ctx); - op->on_complete = &calld->on_complete; - } - - start_transport_stream_op_batch_locked_inner(exec_ctx, op, elem); - - GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, - "start_transport_stream_op_batch"); - GPR_TIMER_END("start_transport_stream_op_batch_locked", 0); -} - /* The logic here is fairly complicated, due to (a) the fact that we need to handle the case where we receive the send op before the initial metadata op, and (b) the need for efficiency, especially in @@ -1321,6 +1240,15 @@ static void cc_start_transport_stream_op_batch( grpc_deadline_state_client_start_transport_stream_op_batch(exec_ctx, elem, op); } + // Intercept on_complete for recv_trailing_metadata so that we can + // check retry throttle status. + if (op->recv_trailing_metadata) { + GPR_ASSERT(op->on_complete != NULL); + calld->original_on_complete = op->on_complete; + GRPC_CLOSURE_INIT(&calld->on_complete, on_complete, elem, + grpc_schedule_on_exec_ctx); + op->on_complete = &calld->on_complete; + } /* try to (atomically) get the call */ call_or_error coe = get_call_or_error(calld); GPR_TIMER_BEGIN("cc_start_transport_stream_op_batch", 0); @@ -1390,7 +1318,7 @@ static void cc_destroy_call_elem(grpc_exec_ctx *exec_ctx, "client_channel_destroy_call"); } GPR_ASSERT(!calld->pick_pending); - GPR_ASSERT(calld->waiting_ops_count == 0); + GPR_ASSERT(calld->waiting_for_pick_batches_count == 0); if (calld->connected_subchannel != NULL) { GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, calld->connected_subchannel, "picked"); @@ -1401,7 +1329,6 @@ static void cc_destroy_call_elem(grpc_exec_ctx *exec_ctx, calld->subchannel_call_context[i].value); } } - gpr_free(calld->waiting_ops); GRPC_CLOSURE_SCHED(exec_ctx, then_schedule_closure, GRPC_ERROR_NONE); } diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c index 8e73d606aa..a311334d13 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c @@ -74,7 +74,9 @@ static void fake_resolver_shutdown_locked(grpc_exec_ctx* exec_ctx, fake_resolver* r = (fake_resolver*)resolver; if (r->next_completion != NULL) { *r->target_result = NULL; - GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED( + exec_ctx, r->next_completion, + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown")); r->next_completion = NULL; } } diff --git a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c index b5d2e5c92b..7b4fe38272 100644 --- a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +++ b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c @@ -73,7 +73,9 @@ static void sockaddr_shutdown_locked(grpc_exec_ctx *exec_ctx, sockaddr_resolver *r = (sockaddr_resolver *)resolver; if (r->next_completion != NULL) { *r->target_result = NULL; - GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED( + exec_ctx, r->next_completion, + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown")); r->next_completion = NULL; } } -- cgit v1.2.3 From 06795cb442226dd9b6766bc3adcd63aa15c9b10c Mon Sep 17 00:00:00 2001 From: ncteisen Date: Mon, 19 Jun 2017 20:14:23 -0700 Subject: Address github comments --- test/cpp/qps/qps_diff.py | 164 ---------------------------- tools/jenkins/run_performance.sh | 2 +- tools/profiling/microbenchmarks/bm_json.py | 2 +- tools/profiling/qps/qps_diff.py | 169 +++++++++++++++++++++++++++++ tools/profiling/qps/qps_scenarios.py | 21 ++++ 5 files changed, 192 insertions(+), 166 deletions(-) delete mode 100755 test/cpp/qps/qps_diff.py create mode 100755 tools/profiling/qps/qps_diff.py create mode 100644 tools/profiling/qps/qps_scenarios.py diff --git a/test/cpp/qps/qps_diff.py b/test/cpp/qps/qps_diff.py deleted file mode 100755 index 1dadd96adf..0000000000 --- a/test/cpp/qps/qps_diff.py +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env python2.7 -# -# Copyright 2017 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. -""" Computes the diff between two qps runs and outputs significant results """ - -import shutil -import subprocess -import os -import multiprocessing -import json -import sys -import tabulate -import argparse - -sys.path.append( - os.path.join( - os.path.dirname(sys.argv[0]), '..', '..', '..', 'tools', 'profiling', 'microbenchmarks', 'bm_diff')) -import bm_speedup - -sys.path.append( - os.path.join( - os.path.dirname(sys.argv[0]), '..', '..', '..', 'tools', 'run_tests', 'python_utils')) -import comment_on_pr - -_SCENARIOS = { - 'large-message-throughput': '{"scenarios":[{"name":"large-message-throughput", "spawn_local_worker_count": -2, "warmup_seconds": 30, "benchmark_seconds": 270, "num_servers": 1, "server_config": {"async_server_threads": 1, "security_params": null, "server_type": "ASYNC_SERVER"}, "num_clients": 1, "client_config": {"client_type": "ASYNC_CLIENT", "security_params": null, "payload_config": {"simple_params": {"resp_size": 1048576, "req_size": 1048576}}, "client_channels": 1, "async_client_threads": 1, "outstanding_rpcs_per_channel": 1, "rpc_type": "UNARY", "load_params": {"closed_loop": {}}, "histogram_params": {"max_possible": 60000000000.0, "resolution": 0.01}}}]}', - 'multi-channel-64-KiB': '{"scenarios":[{"name":"multi-channel-64-KiB", "spawn_local_worker_count": -3, "warmup_seconds": 30, "benchmark_seconds": 270, "num_servers": 1, "server_config": {"async_server_threads": 31, "security_params": null, "server_type": "ASYNC_SERVER"}, "num_clients": 2, "client_config": {"client_type": "ASYNC_CLIENT", "security_params": null, "payload_config": {"simple_params": {"resp_size": 65536, "req_size": 65536}}, "client_channels": 32, "async_client_threads": 31, "outstanding_rpcs_per_channel": 100, "rpc_type": "UNARY", "load_params": {"closed_loop": {}}, "histogram_params": {"max_possible": 60000000000.0, "resolution": 0.01}}}]}' -} - -def _args(): - argp = argparse.ArgumentParser( - description='Perform diff on QPS Driver') - argp.add_argument( - '-d', - '--diff_base', - type=str, - help='Commit or branch to compare the current one to') - argp.add_argument( - '-l', - '--loops', - type=int, - default=4, - help='Number of times to loops the benchmarks. More loops cuts down on noise' - ) - argp.add_argument( - '-j', - '--jobs', - type=int, - default=multiprocessing.cpu_count(), - help='Number of CPUs to use') - args = argp.parse_args() - assert args.diff_base, "diff_base must be set" - return args - -def _make_cmd(jobs): - return ['make', '-j', '%d' % jobs, 'qps_json_driver', 'qps_worker',] - -def build(name, jobs): - shutil.rmtree('qps_diff_%s' % name, ignore_errors=True) - subprocess.check_call(['git', 'submodule', 'update']) - try: - subprocess.check_call(_make_cmd(jobs)) - except subprocess.CalledProcessError, e: - subprocess.check_call(['make', 'clean']) - subprocess.check_call(_make_cmd(jobs)) - os.rename('bins', 'qps_diff_%s' % name) - -def _run_cmd(name, scenario, fname): - return ['qps_diff_%s/opt/qps_json_driver' % name, '--scenarios_json', scenario, '--json_file_out', fname] - -def run(name, scenarios, loops): - for sn in scenarios: - for i in range(0, loops): - fname = "%s.%s.%d.json" % (sn, name, i) - subprocess.check_call(_run_cmd(name, scenarios[sn], fname)) - -def _load_qps(fname): - try: - with open(fname) as f: - return json.loads(f.read())['qps'] - except IOError, e: - print("IOError occurred reading file: %s" % fname) - return None - except ValueError, e: - print("ValueError occurred reading file: %s" % fname) - return None - -def _median(ary): - assert (len(ary)) - ary = sorted(ary) - n = len(ary) - if n % 2 == 0: - return (ary[(n - 1) / 2] + ary[(n - 1) / 2 + 1]) / 2.0 - else: - return ary[n / 2] - -def diff(scenarios, loops, old, new): - old_data = {} - new_data = {} - - # collect data - for sn in scenarios: - old_data[sn] = [] - new_data[sn] = [] - for i in range(0, loops): - old_data[sn].append(_load_qps("%s.%s.%d.json" % (sn, old, i))) - new_data[sn].append(_load_qps("%s.%s.%d.json" % (sn, new, i))) - - # crunch data - headers = ['Benchmark', 'qps'] - rows = [] - for sn in scenarios: - mdn_diff = abs(_median(new_data[sn]) - _median(old_data[sn])) - print('%s: %s=%r %s=%r mdn_diff=%r' % (sn, new, new_data[sn], old, old_data[sn], mdn_diff)) - s = bm_speedup.speedup(new_data[sn], old_data[sn], 10e-5) - if abs(s) > 3 and mdn_diff > 0.5: - rows.append([sn, '%+d%%' % s]) - - if rows: - return tabulate.tabulate(rows, headers=headers, floatfmt='+.2f') - else: - return None - -def main(args): - - build('new', args.jobs) - - if args.diff_base: - where_am_i = subprocess.check_output( - ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() - subprocess.check_call(['git', 'checkout', args.diff_base]) - try: - build('old', args.jobs) - finally: - subprocess.check_call(['git', 'checkout', where_am_i]) - subprocess.check_call(['git', 'submodule', 'update']) - - run('new', _SCENARIOS, args.loops) - run('old', _SCENARIOS, args.loops) - - diff_output = diff(_SCENARIOS, args.loops, 'old', 'new') - - if diff_output: - text = '[qps] Performance differences noted:\n%s' % diff_output - else: - text = '[qps] No significant performance differences' - print('%s' % text) - comment_on_pr.comment_on_pr('```\n%s\n```' % text) - -if __name__ == '__main__': - args = _args() - main(args); diff --git a/tools/jenkins/run_performance.sh b/tools/jenkins/run_performance.sh index 3673fa6c40..9529b0126f 100755 --- a/tools/jenkins/run_performance.sh +++ b/tools/jenkins/run_performance.sh @@ -20,4 +20,4 @@ set -ex cd $(dirname $0)/../.. tools/run_tests/start_port_server.py -test/cpp/qps/qps_diff.py -d origin/$ghprbTargetBranch +tools/profiling/qps/qps_diff.py -d origin/$ghprbTargetBranch diff --git a/tools/profiling/microbenchmarks/bm_json.py b/tools/profiling/microbenchmarks/bm_json.py index 930287e0d6..f6082fe7b4 100644 --- a/tools/profiling/microbenchmarks/bm_json.py +++ b/tools/profiling/microbenchmarks/bm_json.py @@ -167,7 +167,7 @@ def parse_name(name): return out def expand_json(js, js2 = None): - assert(js or js2) + if not js and not js2: raise StopIteration() if not js: js = js2 for bm in js['benchmarks']: if bm['name'].endswith('_stddev') or bm['name'].endswith('_mean'): continue diff --git a/tools/profiling/qps/qps_diff.py b/tools/profiling/qps/qps_diff.py new file mode 100755 index 0000000000..65c845caa1 --- /dev/null +++ b/tools/profiling/qps/qps_diff.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python2.7 +# +# Copyright 2017 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. +""" Computes the diff between two qps runs and outputs significant results """ + +import argparse +import json +import multiprocessing +import os +import qps_scenarios +import shutil +import subprocess +import sys +import tabulate + +sys.path.append( + os.path.join( + os.path.dirname(sys.argv[0]), '..', 'microbenchmarks', 'bm_diff')) +import bm_speedup + +sys.path.append( + os.path.join( + os.path.dirname(sys.argv[0]), '..', '..', 'run_tests', 'python_utils')) +import comment_on_pr + + +def _args(): + argp = argparse.ArgumentParser( + description='Perform diff on QPS Driver') + argp.add_argument( + '-d', + '--diff_base', + type=str, + help='Commit or branch to compare the current one to') + argp.add_argument( + '-l', + '--loops', + type=int, + default=4, + help='Number of loops for each benchmark. More loops cuts down on noise' + ) + argp.add_argument( + '-j', + '--jobs', + type=int, + default=multiprocessing.cpu_count(), + help='Number of CPUs to use') + args = argp.parse_args() + assert args.diff_base, "diff_base must be set" + return args + + +def _make_cmd(jobs): + return ['make', '-j', '%d' % jobs, 'qps_json_driver', 'qps_worker'] + + +def build(name, jobs): + shutil.rmtree('qps_diff_%s' % name, ignore_errors=True) + subprocess.check_call(['git', 'submodule', 'update']) + try: + subprocess.check_call(_make_cmd(jobs)) + except subprocess.CalledProcessError, e: + subprocess.check_call(['make', 'clean']) + subprocess.check_call(_make_cmd(jobs)) + os.rename('bins', 'qps_diff_%s' % name) + + +def _run_cmd(name, scenario, fname): + return ['qps_diff_%s/opt/qps_json_driver' % name, '--scenarios_json', scenario, '--json_file_out', fname] + + +def run(name, scenarios, loops): + for sn in scenarios: + for i in range(0, loops): + fname = "%s.%s.%d.json" % (sn, name, i) + subprocess.check_call(_run_cmd(name, scenarios[sn], fname)) + + +def _load_qps(fname): + try: + with open(fname) as f: + return json.loads(f.read())['qps'] + except IOError, e: + print("IOError occurred reading file: %s" % fname) + return None + except ValueError, e: + print("ValueError occurred reading file: %s" % fname) + return None + + +def _median(ary): + assert (len(ary)) + ary = sorted(ary) + n = len(ary) + if n % 2 == 0: + return (ary[(n - 1) / 2] + ary[(n - 1) / 2 + 1]) / 2.0 + else: + return ary[n / 2] + + +def diff(scenarios, loops, old, new): + old_data = {} + new_data = {} + + # collect data + for sn in scenarios: + old_data[sn] = [] + new_data[sn] = [] + for i in range(0, loops): + old_data[sn].append(_load_qps("%s.%s.%d.json" % (sn, old, i))) + new_data[sn].append(_load_qps("%s.%s.%d.json" % (sn, new, i))) + + # crunch data + headers = ['Benchmark', 'qps'] + rows = [] + for sn in scenarios: + mdn_diff = abs(_median(new_data[sn]) - _median(old_data[sn])) + print('%s: %s=%r %s=%r mdn_diff=%r' % (sn, new, new_data[sn], old, old_data[sn], mdn_diff)) + s = bm_speedup.speedup(new_data[sn], old_data[sn], 10e-5) + if abs(s) > 3 and mdn_diff > 0.5: + rows.append([sn, '%+d%%' % s]) + + if rows: + return tabulate.tabulate(rows, headers=headers, floatfmt='+.2f') + else: + return None + + +def main(args): + build('new', args.jobs) + + if args.diff_base: + where_am_i = subprocess.check_output( + ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() + subprocess.check_call(['git', 'checkout', args.diff_base]) + try: + build('old', args.jobs) + finally: + subprocess.check_call(['git', 'checkout', where_am_i]) + subprocess.check_call(['git', 'submodule', 'update']) + + run('new', qps_scenarios._SCENARIOS, args.loops) + run('old', qps_scenarios._SCENARIOS, args.loops) + + diff_output = diff(qps_scenarios._SCENARIOS, args.loops, 'old', 'new') + + if diff_output: + text = '[qps] Performance differences noted:\n%s' % diff_output + else: + text = '[qps] No significant performance differences' + print('%s' % text) + comment_on_pr.comment_on_pr('```\n%s\n```' % text) + + +if __name__ == '__main__': + args = _args() + main(args) diff --git a/tools/profiling/qps/qps_scenarios.py b/tools/profiling/qps/qps_scenarios.py new file mode 100644 index 0000000000..d473d7cd24 --- /dev/null +++ b/tools/profiling/qps/qps_scenarios.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python2.7 +# +# Copyright 2017 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. +""" QPS Scenarios to run """ + +_SCENARIOS = { + 'large-message-throughput': '{"scenarios":[{"name":"large-message-throughput", "spawn_local_worker_count": -2, "warmup_seconds": 30, "benchmark_seconds": 270, "num_servers": 1, "server_config": {"async_server_threads": 1, "security_params": null, "server_type": "ASYNC_SERVER"}, "num_clients": 1, "client_config": {"client_type": "ASYNC_CLIENT", "security_params": null, "payload_config": {"simple_params": {"resp_size": 1048576, "req_size": 1048576}}, "client_channels": 1, "async_client_threads": 1, "outstanding_rpcs_per_channel": 1, "rpc_type": "UNARY", "load_params": {"closed_loop": {}}, "histogram_params": {"max_possible": 60000000000.0, "resolution": 0.01}}}]}', + 'multi-channel-64-KiB': '{"scenarios":[{"name":"multi-channel-64-KiB", "spawn_local_worker_count": -3, "warmup_seconds": 30, "benchmark_seconds": 270, "num_servers": 1, "server_config": {"async_server_threads": 31, "security_params": null, "server_type": "ASYNC_SERVER"}, "num_clients": 2, "client_config": {"client_type": "ASYNC_CLIENT", "security_params": null, "payload_config": {"simple_params": {"resp_size": 65536, "req_size": 65536}}, "client_channels": 32, "async_client_threads": 31, "outstanding_rpcs_per_channel": 100, "rpc_type": "UNARY", "load_params": {"closed_loop": {}}, "histogram_params": {"max_possible": 60000000000.0, "resolution": 0.01}}}]}' +} -- cgit v1.2.3 From 08cefa0408a55982d83413635ea1f1fd60e56f39 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Tue, 20 Jun 2017 11:29:26 -0700 Subject: Don't initiate writes on setting pushes --- .../transport/chttp2/transport/chttp2_transport.c | 42 ++++++++++++---------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 0211169c00..cd2c6cc492 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -91,8 +91,9 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *t, static void complete_fetch_locked(grpc_exec_ctx *exec_ctx, void *gs, grpc_error *error); /** Set a transport level setting, and push it to our peer */ -static void push_setting(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, - grpc_chttp2_setting_id id, uint32_t value); +static void queue_setting_update(grpc_exec_ctx *exec_ctx, + grpc_chttp2_transport *t, + grpc_chttp2_setting_id id, uint32_t value); static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_error *error); @@ -342,15 +343,16 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, /* configure http2 the way we like it */ if (is_client) { - push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_ENABLE_PUSH, 0); - push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 0); + queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_ENABLE_PUSH, 0); + queue_setting_update(exec_ctx, t, + GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 0); } - push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, - DEFAULT_WINDOW); - push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE, - DEFAULT_MAX_HEADER_LIST_SIZE); - push_setting(exec_ctx, t, - GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA, 1); + queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, + DEFAULT_WINDOW); + queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE, + DEFAULT_MAX_HEADER_LIST_SIZE); + queue_setting_update(exec_ctx, t, + GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA, 1); t->ping_policy = (grpc_chttp2_repeated_ping_policy){ .max_pings_without_data = DEFAULT_MAX_PINGS_BETWEEN_DATA, @@ -517,8 +519,8 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, int value = grpc_channel_arg_get_integer( &channel_args->args[i], settings_map[j].integer_options); if (value >= 0) { - push_setting(exec_ctx, t, settings_map[j].setting_id, - (uint32_t)value); + queue_setting_update(exec_ctx, t, settings_map[j].setting_id, + (uint32_t)value); } } break; @@ -929,8 +931,11 @@ static void write_action_end_locked(grpc_exec_ctx *exec_ctx, void *tp, GPR_TIMER_END("terminate_writing_with_lock", 0); } -static void push_setting(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, - grpc_chttp2_setting_id id, uint32_t value) { +// Dirties an HTTP2 setting to be sent out next time a writing path occurs. +// If the change needs to occur immediately, manually initiate a write. +static void queue_setting_update(grpc_exec_ctx *exec_ctx, + grpc_chttp2_transport *t, + grpc_chttp2_setting_id id, uint32_t value) { const grpc_chttp2_setting_parameters *sp = &grpc_chttp2_settings_parameters[id]; uint32_t use_value = GPR_CLAMP(value, sp->min_value, sp->max_value); @@ -941,7 +946,6 @@ static void push_setting(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, if (use_value != t->settings[GRPC_LOCAL_SETTINGS][id]) { t->settings[GRPC_LOCAL_SETTINGS][id] = use_value; t->dirtied_local_settings = 1; - grpc_chttp2_initiate_write(exec_ctx, t, "push_setting"); } } @@ -2107,8 +2111,8 @@ static void update_bdp(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, gpr_log(GPR_DEBUG, "%s: update initial window size to %d", t->peer_string, (int)bdp); } - push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, - (uint32_t)bdp); + queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, + (uint32_t)bdp); } static void update_frame(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, @@ -2127,8 +2131,8 @@ static void update_frame(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, gpr_log(GPR_DEBUG, "%s: update max_frame size to %d", t->peer_string, (int)frame_size); } - push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE, - (uint32_t)frame_size); + queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE, + (uint32_t)frame_size); } static grpc_error *try_http_parsing(grpc_exec_ctx *exec_ctx, -- cgit v1.2.3 From 54af639e0c31e86762a8faedd965baf5aaef325a Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 20 Jun 2017 14:20:54 -0700 Subject: Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 60131f2eab..24587a55e1 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -6,7 +6,7 @@ Create new issues for bugs and feature requests. An issue needs to be actionable - [grpc.io mailing list](https://groups.google.com/forum/#!forum/grpc-io) - [StackOverflow, with `grpc` tag](http://stackoverflow.com/questions/tagged/grpc) -*Please don't double post your questions in more locations, we are monitoring both channels and the time spent de-duplicating questions can is better spent answering more user questions.* +*Please don't double post your questions in more locations; we are monitoring both channels, and the time spent de-duplicating questions is better spent answering more user questions.* ### What version of gRPC and what language are you using? -- cgit v1.2.3 From 741ffb4b46891cf59d9868e79fdf82c4a8345477 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Tue, 20 Jun 2017 14:33:15 -0700 Subject: Rename files --- tools/jenkins/run_performance.sh | 7 +++++-- tools/jenkins/run_performance_old.sh | 26 -------------------------- tools/jenkins/run_qps_diff.sh | 23 +++++++++++++++++++++++ tools/profiling/qps/qps_diff.py | 2 +- tools/profiling/qps/qps_scenarios.py | 2 -- 5 files changed, 29 insertions(+), 31 deletions(-) delete mode 100755 tools/jenkins/run_performance_old.sh create mode 100755 tools/jenkins/run_qps_diff.sh diff --git a/tools/jenkins/run_performance.sh b/tools/jenkins/run_performance.sh index 9529b0126f..3ce05cc7f1 100755 --- a/tools/jenkins/run_performance.sh +++ b/tools/jenkins/run_performance.sh @@ -13,11 +13,14 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# This script is invoked by Jenkins and runs a diff on the qps drivers +# This script is invoked by Jenkins and runs a diff on the microbenchmarks set -ex +# List of benchmarks that provide good signal for analyzing performance changes in pull requests +BENCHMARKS_TO_RUN="bm_fullstack_unary_ping_pong bm_fullstack_streaming_ping_pong bm_fullstack_streaming_pump bm_closure bm_cq bm_call_create bm_error bm_chttp2_hpack bm_chttp2_transport bm_pollset bm_metadata" + # Enter the gRPC repo root cd $(dirname $0)/../.. tools/run_tests/start_port_server.py -tools/profiling/qps/qps_diff.py -d origin/$ghprbTargetBranch +tools/profiling/microbenchmarks/bm_diff/bm_main.py -d origin/$ghprbTargetBranch -b $BENCHMARKS_TO_RUN diff --git a/tools/jenkins/run_performance_old.sh b/tools/jenkins/run_performance_old.sh deleted file mode 100755 index 3ce05cc7f1..0000000000 --- a/tools/jenkins/run_performance_old.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2015 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. -# -# This script is invoked by Jenkins and runs a diff on the microbenchmarks -set -ex - -# List of benchmarks that provide good signal for analyzing performance changes in pull requests -BENCHMARKS_TO_RUN="bm_fullstack_unary_ping_pong bm_fullstack_streaming_ping_pong bm_fullstack_streaming_pump bm_closure bm_cq bm_call_create bm_error bm_chttp2_hpack bm_chttp2_transport bm_pollset bm_metadata" - -# Enter the gRPC repo root -cd $(dirname $0)/../.. - -tools/run_tests/start_port_server.py -tools/profiling/microbenchmarks/bm_diff/bm_main.py -d origin/$ghprbTargetBranch -b $BENCHMARKS_TO_RUN diff --git a/tools/jenkins/run_qps_diff.sh b/tools/jenkins/run_qps_diff.sh new file mode 100755 index 0000000000..9529b0126f --- /dev/null +++ b/tools/jenkins/run_qps_diff.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Copyright 2015 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. +# +# This script is invoked by Jenkins and runs a diff on the qps drivers +set -ex + +# Enter the gRPC repo root +cd $(dirname $0)/../.. + +tools/run_tests/start_port_server.py +tools/profiling/qps/qps_diff.py -d origin/$ghprbTargetBranch diff --git a/tools/profiling/qps/qps_diff.py b/tools/profiling/qps/qps_diff.py index 65c845caa1..0654f45666 100755 --- a/tools/profiling/qps/qps_diff.py +++ b/tools/profiling/qps/qps_diff.py @@ -118,7 +118,7 @@ def diff(scenarios, loops, old, new): for sn in scenarios: old_data[sn] = [] new_data[sn] = [] - for i in range(0, loops): + for i in range(loops): old_data[sn].append(_load_qps("%s.%s.%d.json" % (sn, old, i))) new_data[sn].append(_load_qps("%s.%s.%d.json" % (sn, new, i))) diff --git a/tools/profiling/qps/qps_scenarios.py b/tools/profiling/qps/qps_scenarios.py index d473d7cd24..4fbbdefc4d 100644 --- a/tools/profiling/qps/qps_scenarios.py +++ b/tools/profiling/qps/qps_scenarios.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python2.7 -# # Copyright 2017 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); -- cgit v1.2.3 From 847985a2c96403cbd9f5c3aafa9543cf2abc1b53 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Tue, 20 Jun 2017 15:41:50 -0700 Subject: Regenerate projects --- config.w32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.w32 b/config.w32 index dd4a704a61..cca3604045 100644 --- a/config.w32 +++ b/config.w32 @@ -746,11 +746,11 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\md4"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\md5"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\modes"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\newhope"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\obj"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\pem"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\pkcs8"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\poly1305"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\pool"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\rand"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\rc4"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\rsa"); -- cgit v1.2.3 From e48949f0b44d0f8755cbbc3837a2b591867cd0bf Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 19 Jun 2017 13:57:32 -0700 Subject: Make grpc::Alarm non-copyable --- include/grpc++/alarm.h | 21 +++++++++++++++++++-- test/cpp/common/alarm_cpp_test.cc | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/include/grpc++/alarm.h b/include/grpc++/alarm.h index bd000cf4f7..ed8dacbc94 100644 --- a/include/grpc++/alarm.h +++ b/include/grpc++/alarm.h @@ -52,8 +52,25 @@ class Alarm : private GrpcLibraryCodegen { alarm_(grpc_alarm_create(cq->cq(), TimePoint(deadline).raw_time(), static_cast(&tag_))) {} + /// Alarms aren't copyable. + Alarm(const Alarm&) = delete; + Alarm& operator=(const Alarm&) = delete; + + /// Alarms are movable. + Alarm(Alarm&& rhs) : tag_(rhs.tag_), alarm_(rhs.alarm_) { + rhs.alarm_ = nullptr; + } + Alarm& operator=(Alarm&& rhs) { + tag_ = rhs.tag_; + alarm_ = rhs.alarm_; + rhs.alarm_ = nullptr; + return *this; + } + /// Destroy the given completion queue alarm, cancelling it in the process. - ~Alarm() { grpc_alarm_destroy(alarm_); } + ~Alarm() { + if (alarm_ != nullptr) grpc_alarm_destroy(alarm_); + } /// Cancel a completion queue alarm. Calling this function over an alarm that /// has already fired has no effect. @@ -73,7 +90,7 @@ class Alarm : private GrpcLibraryCodegen { }; AlarmEntry tag_; - grpc_alarm* const alarm_; // owned + grpc_alarm* alarm_; // owned }; } // namespace grpc diff --git a/test/cpp/common/alarm_cpp_test.cc b/test/cpp/common/alarm_cpp_test.cc index 3e4999994a..760dd7b956 100644 --- a/test/cpp/common/alarm_cpp_test.cc +++ b/test/cpp/common/alarm_cpp_test.cc @@ -40,6 +40,25 @@ TEST(AlarmTest, RegularExpiry) { EXPECT_EQ(junk, output_tag); } +TEST(AlarmTest, Move) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + Alarm first(&cq, grpc_timeout_seconds_to_deadline(1), junk); + // Move constructor. + Alarm second(std::move(first)); + // Moving assignment. + first = std::move(second); + + void* output_tag; + bool ok; + const CompletionQueue::NextStatus status = cq.AsyncNext( + (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); + + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_TRUE(ok); + EXPECT_EQ(junk, output_tag); +} + TEST(AlarmTest, RegularExpiryChrono) { CompletionQueue cq; void* junk = reinterpret_cast(1618033); -- cgit v1.2.3 From 264879fec50a699c8c93fead66bcb4a6fe4a2bd5 Mon Sep 17 00:00:00 2001 From: Noah Eisen Date: Tue, 20 Jun 2017 17:14:47 -0700 Subject: Overhaul the new pollers --- src/core/lib/iomgr/ev_epoll1_linux.c | 6 +- .../lib/iomgr/ev_epoll_limited_pollers_linux.c | 65 ++++++++++++---------- src/core/lib/iomgr/ev_epoll_thread_pool_linux.c | 28 ++++++---- src/core/lib/iomgr/ev_epollex_linux.c | 32 ++++++----- src/core/lib/iomgr/ev_epollsig_linux.c | 8 +-- 5 files changed, 80 insertions(+), 59 deletions(-) diff --git a/src/core/lib/iomgr/ev_epoll1_linux.c b/src/core/lib/iomgr/ev_epoll1_linux.c index e0c05457e3..66ba601adb 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.c +++ b/src/core/lib/iomgr/ev_epoll1_linux.c @@ -194,8 +194,10 @@ static grpc_fd *fd_create(int fd, const char *name) { char *fd_name; gpr_asprintf(&fd_name, "%s fd=%d", name, fd); grpc_iomgr_register_object(&new_fd->iomgr_object, fd_name); -#ifdef GRPC_FD_REF_COUNT_DEBUG - gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, (void *)new_fd, fd_name); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, new_fd, fd_name); + } #endif gpr_free(fd_name); diff --git a/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c b/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c index 761e2ed5fe..2c91ad357c 100644 --- a/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +++ b/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c @@ -147,8 +147,7 @@ struct grpc_fd { }; /* Reference counting for fds */ -// #define GRPC_FD_REF_COUNT_DEBUG -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void fd_ref(grpc_fd *fd, const char *reason, const char *file, int line); static void fd_unref(grpc_fd *fd, const char *reason, const char *file, int line); @@ -168,20 +167,18 @@ static void fd_global_shutdown(void); * Polling island Declarations */ -//#define PI_REFCOUNT_DEBUG - -#ifdef PI_REFCOUNT_DEBUG +#ifndef NDEBUG #define PI_ADD_REF(p, r) pi_add_ref_dbg((p), (r), __FILE__, __LINE__) #define PI_UNREF(exec_ctx, p, r) \ pi_unref_dbg((exec_ctx), (p), (r), __FILE__, __LINE__) -#else /* defined(PI_REFCOUNT_DEBUG) */ +#else #define PI_ADD_REF(p, r) pi_add_ref((p)) #define PI_UNREF(exec_ctx, p, r) pi_unref((exec_ctx), (p)) -#endif /* !defined(GRPC_PI_REF_COUNT_DEBUG) */ +#endif typedef struct worker_node { struct worker_node *next; @@ -313,21 +310,27 @@ gpr_atm g_epoll_sync; static void pi_add_ref(polling_island *pi); static void pi_unref(grpc_exec_ctx *exec_ctx, polling_island *pi); -#ifdef PI_REFCOUNT_DEBUG +#ifndef NDEBUG static void pi_add_ref_dbg(polling_island *pi, const char *reason, const char *file, int line) { - long old_cnt = gpr_atm_acq_load(&pi->ref_count); + if (GRPC_TRACER_ON(grpc_polling_trace)) { + gpr_atm old_cnt = gpr_atm_acq_load(&pi->ref_count); + gpr_log(GPR_DEBUG, "Add ref pi: %p, old:%" PRIdPTR " -> new:%" PRIdPTR + " (%s) - (%s, %d)", + pi, old_cnt, old_cnt + 1, reason, file, line); + } pi_add_ref(pi); - gpr_log(GPR_DEBUG, "Add ref pi: %p, old: %ld -> new:%ld (%s) - (%s, %d)", - (void *)pi, old_cnt, old_cnt + 1, reason, file, line); } static void pi_unref_dbg(grpc_exec_ctx *exec_ctx, polling_island *pi, const char *reason, const char *file, int line) { - long old_cnt = gpr_atm_acq_load(&pi->ref_count); + if (GRPC_TRACER_ON(grpc_polling_trace)) { + gpr_atm old_cnt = gpr_atm_acq_load(&pi->ref_count); + gpr_log(GPR_DEBUG, "Unref pi: %p, old:%" PRIdPTR " -> new:%" PRIdPTR + " (%s) - (%s, %d)", + pi, old_cnt, (old_cnt - 1), reason, file, line); + } pi_unref(exec_ctx, pi); - gpr_log(GPR_DEBUG, "Unref pi: %p, old:%ld -> new:%ld (%s) - (%s, %d)", - (void *)pi, old_cnt, (old_cnt - 1), reason, file, line); } #endif @@ -792,14 +795,17 @@ static void polling_island_global_shutdown() { static grpc_fd *fd_freelist = NULL; static gpr_mu fd_freelist_mu; -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG #define REF_BY(fd, n, reason) ref_by(fd, n, reason, __FILE__, __LINE__) #define UNREF_BY(fd, n, reason) unref_by(fd, n, reason, __FILE__, __LINE__) static void ref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_log(GPR_DEBUG, "FD %d %p ref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, + "FD %d %p ref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + } #else #define REF_BY(fd, n, reason) ref_by(fd, n) #define UNREF_BY(fd, n, reason) unref_by(fd, n) @@ -808,18 +814,19 @@ static void ref_by(grpc_fd *fd, int n) { GPR_ASSERT(gpr_atm_no_barrier_fetch_add(&fd->refst, n) > 0); } -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void unref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_atm old; - gpr_log(GPR_DEBUG, "FD %d %p unref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, + "FD %d %p unref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + } #else static void unref_by(grpc_fd *fd, int n) { - gpr_atm old; #endif - old = gpr_atm_full_fetch_add(&fd->refst, -n); + gpr_atm old = gpr_atm_full_fetch_add(&fd->refst, -n); if (old == n) { /* Add the fd to the freelist */ gpr_mu_lock(&fd_freelist_mu); @@ -837,7 +844,7 @@ static void unref_by(grpc_fd *fd, int n) { } /* Increment refcount by two to avoid changing the orphan bit */ -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void fd_ref(grpc_fd *fd, const char *reason, const char *file, int line) { ref_by(fd, 2, reason, file, line); @@ -905,8 +912,10 @@ static grpc_fd *fd_create(int fd, const char *name) { char *fd_name; gpr_asprintf(&fd_name, "%s fd=%d", name, fd); grpc_iomgr_register_object(&new_fd->iomgr_object, fd_name); -#ifdef GRPC_FD_REF_COUNT_DEBUG - gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, (void *)new_fd, fd_name); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, new_fd, fd_name); + } #endif gpr_free(fd_name); return new_fd; diff --git a/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c b/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c index 0ab3594818..49be72c03e 100644 --- a/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +++ b/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c @@ -93,20 +93,18 @@ static void fd_global_shutdown(void); * epoll set Declarations */ -//#define EPS_REFCOUNT_DEBUG - -#ifdef EPS_REFCOUNT_DEBUG +#ifndef NDEBUG #define EPS_ADD_REF(p, r) eps_add_ref_dbg((p), (r), __FILE__, __LINE__) #define EPS_UNREF(exec_ctx, p, r) \ eps_unref_dbg((exec_ctx), (p), (r), __FILE__, __LINE__) -#else /* defined(EPS_REFCOUNT_DEBUG) */ +#else #define EPS_ADD_REF(p, r) eps_add_ref((p)) #define EPS_UNREF(exec_ctx, p, r) eps_unref((exec_ctx), (p)) -#endif /* !defined(GRPC_EPS_REF_COUNT_DEBUG) */ +#endif typedef struct epoll_set { /* Mutex poller should acquire to poll this. This enforces that only one @@ -226,21 +224,27 @@ gpr_atm g_epoll_sync; static void eps_add_ref(epoll_set *eps); static void eps_unref(grpc_exec_ctx *exec_ctx, epoll_set *eps); -#ifdef EPS_REFCOUNT_DEBUG +#ifndef NDEBUG static void eps_add_ref_dbg(epoll_set *eps, const char *reason, const char *file, int line) { - long old_cnt = gpr_atm_acq_load(&eps->ref_count); + if (GRPC_TRACER_ON(grpc_polling_trace)) { + gpr_atm old_cnt = gpr_atm_acq_load(&eps->ref_count); + gpr_log(GPR_DEBUG, "Add ref eps: %p, old:%" PRIdPTR " -> new:%" PRIdPTR + " (%s) - (%s, %d)", + eps, old_cnt, old_cnt + 1, reason, file, line); + } eps_add_ref(eps); - gpr_log(GPR_DEBUG, "Add ref eps: %p, old: %ld -> new:%ld (%s) - (%s, %d)", - (void *)eps, old_cnt, old_cnt + 1, reason, file, line); } static void eps_unref_dbg(grpc_exec_ctx *exec_ctx, epoll_set *eps, const char *reason, const char *file, int line) { - long old_cnt = gpr_atm_acq_load(&eps->ref_count); + if (GRPC_TRACER_ON(grpc_polling_trace)) { + gpr_atm old_cnt = gpr_atm_acq_load(&eps->ref_count); + gpr_log(GPR_DEBUG, "Unref eps: %p, old:%" PRIdPTR " -> new:%" PRIdPTR + " (%s) - (%s, %d)", + eps, old_cnt, (old_cnt - 1), reason, file, line); + } eps_unref(exec_ctx, eps); - gpr_log(GPR_DEBUG, "Unref eps: %p, old:%ld -> new:%ld (%s) - (%s, %d)", - (void *)eps, old_cnt, (old_cnt - 1), reason, file, line); } #endif diff --git a/src/core/lib/iomgr/ev_epollex_linux.c b/src/core/lib/iomgr/ev_epollex_linux.c index 949f8a845d..5574838187 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.c +++ b/src/core/lib/iomgr/ev_epollex_linux.c @@ -231,15 +231,18 @@ static bool append_error(grpc_error **composite, grpc_error *error, static grpc_fd *fd_freelist = NULL; static gpr_mu fd_freelist_mu; -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG #define REF_BY(fd, n, reason) ref_by(fd, n, reason, __FILE__, __LINE__) #define UNREF_BY(ec, fd, n, reason) \ unref_by(ec, fd, n, reason, __FILE__, __LINE__) static void ref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_log(GPR_DEBUG, "FD %d %p ref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, + "FD %d %p ref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + } #else #define REF_BY(fd, n, reason) ref_by(fd, n) #define UNREF_BY(ec, fd, n, reason) unref_by(ec, fd, n) @@ -264,18 +267,19 @@ static void fd_destroy(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { gpr_mu_unlock(&fd_freelist_mu); } -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void unref_by(grpc_exec_ctx *exec_ctx, grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_atm old; - gpr_log(GPR_DEBUG, "FD %d %p unref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, + "FD %d %p unref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + } #else static void unref_by(grpc_exec_ctx *exec_ctx, grpc_fd *fd, int n) { - gpr_atm old; #endif - old = gpr_atm_full_fetch_add(&fd->refst, -n); + gpr_atm old = gpr_atm_full_fetch_add(&fd->refst, -n); if (old == n) { GRPC_CLOSURE_SCHED(exec_ctx, GRPC_CLOSURE_CREATE(fd_destroy, fd, grpc_schedule_on_exec_ctx), @@ -328,8 +332,10 @@ static grpc_fd *fd_create(int fd, const char *name) { char *fd_name; gpr_asprintf(&fd_name, "%s fd=%d", name, fd); grpc_iomgr_register_object(&new_fd->iomgr_object, fd_name); -#ifdef GRPC_FD_REF_COUNT_DEBUG - gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, (void *)new_fd, fd_name); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, new_fd, fd_name); + } #endif gpr_free(fd_name); return new_fd; diff --git a/src/core/lib/iomgr/ev_epollsig_linux.c b/src/core/lib/iomgr/ev_epollsig_linux.c index 7406036ca6..17fef01e6e 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.c +++ b/src/core/lib/iomgr/ev_epollsig_linux.c @@ -140,7 +140,6 @@ struct grpc_fd { }; /* Reference counting for fds */ -// #define GRPC_FD_REF_COUNT_DEBUG #ifndef NDEBUG static void fd_ref(grpc_fd *fd, const char *reason, const char *file, int line); static void fd_unref(grpc_fd *fd, const char *reason, const char *file, @@ -755,8 +754,7 @@ static void unref_by(grpc_fd *fd, int n, const char *reason, const char *file, #else static void unref_by(grpc_fd *fd, int n) { #endif - gpr_atm old; - old = gpr_atm_full_fetch_add(&fd->refst, -n); + gpr_atm old = gpr_atm_full_fetch_add(&fd->refst, -n); if (old == n) { /* Add the fd to the freelist */ gpr_mu_lock(&fd_freelist_mu); @@ -843,7 +841,9 @@ static grpc_fd *fd_create(int fd, const char *name) { gpr_asprintf(&fd_name, "%s fd=%d", name, fd); grpc_iomgr_register_object(&new_fd->iomgr_object, fd_name); #ifndef NDEBUG - gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, new_fd, fd_name); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, new_fd, fd_name); + } #endif gpr_free(fd_name); return new_fd; -- cgit v1.2.3 From 9f3bd3340c94bcec2bde93a293aa63a28daac08f Mon Sep 17 00:00:00 2001 From: ncteisen Date: Tue, 20 Jun 2017 17:45:42 -0700 Subject: Updated doc --- doc/environment_variables.md | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/doc/environment_variables.md b/doc/environment_variables.md index 000f0e5ae7..0a289ac94d 100644 --- a/doc/environment_variables.md +++ b/doc/environment_variables.md @@ -60,20 +60,23 @@ some configuration as environment variables that can be set. - timer - timers (alarms) in the grpc internals - transport_security - traces metadata about secure channel establishment - tcp - traces bytes in and out of a channel - - DEBUG builds only: - * metadata - tracks creation and mutation of metadata - * closure - tracks closure creation, scheduling, and completion - * pending_tags - traces still-in-progress tags on completion queues - * queue_refcount - * error_refcount - * stream_refcount - * workqueue_refcount - * fd_refcount - * auth_context_refcount - * security_connector_refcount - * resolver_refcount - * lb_policy_refcount - * chttp2_refcount + + The following tracers will only run in binaries built in DEBUG mode. This is + accomplished by invoking `CONFIG=dbg make ` + - metadata - tracks creation and mutation of metadata + - closure - tracks closure creation, scheduling, and completion + - pending_tags - traces still-in-progress tags on completion queues + - polling - traces the selected polling engine + - queue_refcount + - error_refcount + - stream_refcount + - workqueue_refcount + - fd_refcount + - auth_context_refcount + - security_connector_refcount + - resolver_refcount + - lb_policy_refcount + - chttp2_refcount 'all' can additionally be used to turn all traces on. Individual traces can be disabled by prefixing them with '-'. -- cgit v1.2.3 From 86a4d998a18447caedfd79651026017481386a2f Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 20 Jun 2017 14:08:23 -0700 Subject: Remove 'long long' --- src/core/lib/support/time_precise.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/lib/support/time_precise.c b/src/core/lib/support/time_precise.c index 1de373e002..22971ef6c3 100644 --- a/src/core/lib/support/time_precise.c +++ b/src/core/lib/support/time_precise.c @@ -22,26 +22,26 @@ #ifdef GRPC_TIMERS_RDTSC #if defined(__i386__) -static void gpr_get_cycle_counter(long long int *clk) { - long long int ret; +static void gpr_get_cycle_counter(int64_t int *clk) { + int64_t int ret; __asm__ volatile("rdtsc" : "=A"(ret)); *clk = ret; } // ---------------------------------------------------------------- #elif defined(__x86_64__) || defined(__amd64__) -static void gpr_get_cycle_counter(long long int *clk) { - unsigned long long low, high; +static void gpr_get_cycle_counter(int64_t *clk) { + unsigned int64_t low, high; __asm__ volatile("rdtsc" : "=a"(low), "=d"(high)); - *clk = (long long)(high << 32) | (long long)low; + *clk = (int64_t)(high << 32) | (int64_t)low; } #endif static double cycles_per_second = 0; -static long long int start_cycle; +static int64_t start_cycle; void gpr_precise_clock_init(void) { time_t start; - long long end_cycle; + int64_t end_cycle; gpr_log(GPR_DEBUG, "Calibrating timers"); start = time(NULL); while (time(NULL) == start) @@ -55,7 +55,7 @@ void gpr_precise_clock_init(void) { } void gpr_precise_clock_now(gpr_timespec *clk) { - long long int counter; + int64_t counter; double secs; gpr_get_cycle_counter(&counter); secs = (double)(counter - start_cycle) / cycles_per_second; -- cgit v1.2.3 From fc539eb19334bdfde8bc798d94ccb56b686e5193 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Wed, 21 Jun 2017 16:17:35 -0700 Subject: Re-enable public constructor for ClientAsyncResponseReader to avoid busting client that bypassed code generator. This code is deprecated-on-arrival as it is a performance pessimization. This code path should not be used. --- include/grpc++/impl/codegen/async_unary_call.h | 90 ++++++++++++++++++++------ include/grpc++/impl/codegen/call.h | 20 ++++++ 2 files changed, 89 insertions(+), 21 deletions(-) diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h index 4aa4e25a9e..de0ab2372a 100644 --- a/include/grpc++/impl/codegen/async_unary_call.h +++ b/include/grpc++/impl/codegen/async_unary_call.h @@ -87,6 +87,28 @@ class ClientAsyncResponseReader final ClientAsyncResponseReader(call, context, request); } + /// TODO(vjpai): Delete the below constructor + /// PLEASE DO NOT USE THIS CONSTRUCTOR IN NEW CODE + /// This code is only present as a short-term workaround + /// for users that bypassed the code-generator and directly + /// created this struct rather than properly using a stub. + /// This code will not remain a valid public constructor for long. + template + ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq, + const RpcMethod& method, ClientContext* context, + const W& request) + : context_(context), + call_(channel->CreateCall(method, context, cq)), + collection_(std::make_shared()) { + collection_->init_buf_.SetCollection(collection_); + collection_->init_buf_.SendInitialMetadata( + context->send_initial_metadata_, context->initial_metadata_flags()); + // TODO(ctiller): don't assert + GPR_CODEGEN_ASSERT(collection_->init_buf_.SendMessage(request).ok()); + collection_->init_buf_.ClientSendClose(); + call_.PerformOps(&collection_->init_buf_); + } + // always allocated against a call arena, no memory free required static void operator delete(void* ptr, std::size_t size) { assert(size == sizeof(ClientAsyncResponseReader)); @@ -101,9 +123,18 @@ class ClientAsyncResponseReader final void ReadInitialMetadata(void* tag) { GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); - meta_buf_.set_output_tag(tag); - meta_buf_.RecvInitialMetadata(context_); - call_.PerformOps(&meta_buf_); + Ops& o = ops; + + // TODO(vjpai): Remove the collection_ specialization as soon + // as the public constructor is deleted + if (collection_) { + o = *collection_; + collection_->meta_buf_.SetCollection(collection_); + } + + o.meta_buf_.set_output_tag(tag); + o.meta_buf_.RecvInitialMetadata(context_); + call_.PerformOps(&o.meta_buf_); } /// See \a ClientAysncResponseReaderInterface::Finish for semantics. @@ -112,14 +143,23 @@ class ClientAsyncResponseReader final /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata sent from the server. void Finish(R* msg, Status* status, void* tag) { - finish_buf_.set_output_tag(tag); + Ops& o = ops; + + // TODO(vjpai): Remove the collection_ specialization as soon + // as the public constructor is deleted + if (collection_) { + o = *collection_; + collection_->finish_buf_.SetCollection(collection_); + } + + o.finish_buf_.set_output_tag(tag); if (!context_->initial_metadata_received_) { - finish_buf_.RecvInitialMetadata(context_); + o.finish_buf_.RecvInitialMetadata(context_); } - finish_buf_.RecvMessage(msg); - finish_buf_.AllowNoMessage(); - finish_buf_.ClientRecvStatus(context_, status); - call_.PerformOps(&finish_buf_); + o.finish_buf_.RecvMessage(msg); + o.finish_buf_.AllowNoMessage(); + o.finish_buf_.ClientRecvStatus(context_, status); + call_.PerformOps(&o.finish_buf_); } private: @@ -129,25 +169,33 @@ class ClientAsyncResponseReader final template ClientAsyncResponseReader(Call call, ClientContext* context, const W& request) : context_(context), call_(call) { - init_buf_.SendInitialMetadata(context->send_initial_metadata_, - context->initial_metadata_flags()); + ops.init_buf_.SendInitialMetadata(context->send_initial_metadata_, + context->initial_metadata_flags()); // TODO(ctiller): don't assert - GPR_CODEGEN_ASSERT(init_buf_.SendMessage(request).ok()); - init_buf_.ClientSendClose(); - call_.PerformOps(&init_buf_); + GPR_CODEGEN_ASSERT(ops.init_buf_.SendMessage(request).ok()); + ops.init_buf_.ClientSendClose(); + call_.PerformOps(&ops.init_buf_); } // disable operator new static void* operator new(std::size_t size); static void* operator new(std::size_t size, void* p) { return p; } - SneakyCallOpSet - init_buf_; - CallOpSet meta_buf_; - CallOpSet, - CallOpClientRecvStatus> - finish_buf_; + // TODO(vjpai): Remove the reference to CallOpSetCollectionInterface + // as soon as the related workaround (public constructor) is deleted + struct Ops : public CallOpSetCollectionInterface { + SneakyCallOpSet + init_buf_; + CallOpSet meta_buf_; + CallOpSet, + CallOpClientRecvStatus> + finish_buf_; + } ops; + + // TODO(vjpai): Remove the collection_ as soon as the related workaround + // (public constructor) is deleted + std::shared_ptr collection_; }; /// Async server-side API for handling unary calls, where the single diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index 2ded2d9776..dba53bc427 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -544,6 +544,11 @@ class CallOpClientRecvStatus { grpc_slice error_message_; }; +/// TODO(vjpai): Remove the existence of CallOpSetCollectionInterface +/// and references to it. This code is deprecated-on-arrival and is +/// only added for users that bypassed the code-generator. +class CallOpSetCollectionInterface {}; + /// An abstract collection of call ops, used to generate the /// grpc_call_op structure to pass down to the lower layers, /// and as it is-a CompletionQueueTag, also massages the final @@ -554,6 +559,18 @@ class CallOpSetInterface : public CompletionQueueTag { /// Fills in grpc_op, starting from ops[*nops] and moving /// upwards. virtual void FillOps(grpc_call* call, grpc_op* ops, size_t* nops) = 0; + + /// TODO(vjpai): Remove the SetCollection method and comment. This is only + /// a short-term workaround for users that bypassed the code generator + /// Mark this as belonging to a collection if needed + void SetCollection(std::shared_ptr collection) { + collection_ = collection; + } + + protected: + /// TODO(vjpai): Remove the collection_ field once the idea of bypassing the + /// code generator is forbidden. This is already deprecated + std::shared_ptr collection_; }; /// Primary implementaiton of CallOpSetInterface. @@ -594,6 +611,9 @@ class CallOpSet : public CallOpSetInterface, this->Op6::FinishOp(status); *tag = return_tag_; g_core_codegen_interface->grpc_call_unref(call_); + // TODO(vjpai): Remove the reference to collection_ once the idea of + // bypassing the code generator is forbidden. It is already deprecated + collection_.reset(); return true; } -- cgit v1.2.3 From 7cd1425e29274a32bdbf253a586dbca2318dfb29 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 22 Jun 2017 10:49:43 -0700 Subject: Fix handling of send_message before send_initial_metadata in compress filter. --- .../message_compress/message_compress_filter.c | 35 +++++---- test/core/end2end/tests/compressed_payload.c | 89 +++++++++++++++------- 2 files changed, 85 insertions(+), 39 deletions(-) diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.c b/src/core/ext/filters/http/message_compress/message_compress_filter.c index 04cb1d94f8..71a8bc5bec 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.c +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.c @@ -255,6 +255,23 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx, } } +static void handle_send_message_batch(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem, + grpc_transport_stream_op_batch *op, + bool has_compression_algorithm) { + call_data *calld = elem->call_data; + if (!skip_compression(elem, op->payload->send_message.send_message->flags, + has_compression_algorithm)) { + calld->send_op = op; + calld->send_length = op->payload->send_message.send_message->length; + calld->send_flags = op->payload->send_message.send_message->flags; + continue_send_message(exec_ctx, elem); + } else { + /* pass control down the stack */ + grpc_call_next_op(exec_ctx, elem, op); + } +} + static void compress_start_transport_stream_op_batch( grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op_batch *op) { @@ -307,8 +324,9 @@ static void compress_start_transport_stream_op_batch( goto retry_send_im; } if (cur != INITIAL_METADATA_UNSEEN) { - grpc_call_next_op(exec_ctx, elem, - (grpc_transport_stream_op_batch *)cur); + handle_send_message_batch(exec_ctx, elem, + (grpc_transport_stream_op_batch *)cur, + has_compression_algorithm); } } } @@ -325,17 +343,8 @@ static void compress_start_transport_stream_op_batch( break; case HAS_COMPRESSION_ALGORITHM: case NO_COMPRESSION_ALGORITHM: - if (!skip_compression(elem, - op->payload->send_message.send_message->flags, - cur == HAS_COMPRESSION_ALGORITHM)) { - calld->send_op = op; - calld->send_length = op->payload->send_message.send_message->length; - calld->send_flags = op->payload->send_message.send_message->flags; - continue_send_message(exec_ctx, elem); - } else { - /* pass control down the stack */ - grpc_call_next_op(exec_ctx, elem, op); - } + handle_send_message_batch(exec_ctx, elem, op, + cur == HAS_COMPRESSION_ALGORITHM); break; default: if (cur & CANCELLED_BIT) { diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 35e2fd13dd..e5e0a5ead4 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -274,7 +274,8 @@ static void request_with_payload_template( grpc_compression_algorithm expected_algorithm_from_client, grpc_compression_algorithm expected_algorithm_from_server, grpc_metadata *client_init_metadata, bool set_server_level, - grpc_compression_level server_compression_level) { + grpc_compression_level server_compression_level, + bool send_message_before_initial_metadata) { grpc_call *c; grpc_call *s; grpc_slice request_payload_slice; @@ -330,6 +331,20 @@ static void request_with_payload_template( grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + if (send_message_before_initial_metadata) { + request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload; + op->flags = client_send_flags_bitmask; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(2), true); + } + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; @@ -394,23 +409,21 @@ static void request_with_payload_template( GPR_ASSERT(GRPC_CALL_OK == error); for (int i = 0; i < 2; i++) { - request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1); - memset(ops, 0, sizeof(ops)); - op = ops; - op->op = GRPC_OP_SEND_MESSAGE; - op->data.send_message.send_message = request_payload; - op->flags = client_send_flags_bitmask; - op->reserved = NULL; - op++; - op->op = GRPC_OP_RECV_MESSAGE; - op->data.recv_message.recv_message = &response_payload_recv; - op->flags = 0; - op->reserved = NULL; - op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); - GPR_ASSERT(GRPC_CALL_OK == error); + if (i > 0 || !send_message_before_initial_metadata) { + request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload; + op->flags = client_send_flags_bitmask; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(2), 1); + } memset(ops, 0, sizeof(ops)); op = ops; @@ -421,6 +434,7 @@ static void request_with_payload_template( op++; error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(102), 1); cq_verify(cqv); @@ -438,8 +452,19 @@ static void request_with_payload_template( op++; error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &response_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(103), 1); - CQ_EXPECT_COMPLETION(cqv, tag(2), 1); + CQ_EXPECT_COMPLETION(cqv, tag(3), 1); cq_verify(cqv); GPR_ASSERT(response_payload_recv->type == GRPC_BB_RAW); @@ -469,7 +494,7 @@ static void request_with_payload_template( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), NULL); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -486,7 +511,7 @@ static void request_with_payload_template( GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); - CQ_EXPECT_COMPLETION(cqv, tag(3), 1); + CQ_EXPECT_COMPLETION(cqv, tag(4), 1); CQ_EXPECT_COMPLETION(cqv, tag(101), 1); CQ_EXPECT_COMPLETION(cqv, tag(104), 1); cq_verify(cqv); @@ -526,7 +551,7 @@ static void test_invoke_request_with_exceptionally_uncompressed_payload( config, "test_invoke_request_with_exceptionally_uncompressed_payload", GRPC_WRITE_NO_COMPRESS, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, NULL, false, - /* ignored */ GRPC_COMPRESS_LEVEL_NONE); + /* ignored */ GRPC_COMPRESS_LEVEL_NONE, false); } static void test_invoke_request_with_uncompressed_payload( @@ -534,7 +559,8 @@ static void test_invoke_request_with_uncompressed_payload( request_with_payload_template( config, "test_invoke_request_with_uncompressed_payload", 0, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, - GRPC_COMPRESS_NONE, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE); + GRPC_COMPRESS_NONE, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, + false); } static void test_invoke_request_with_compressed_payload( @@ -542,7 +568,17 @@ static void test_invoke_request_with_compressed_payload( request_with_payload_template( config, "test_invoke_request_with_compressed_payload", 0, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, - GRPC_COMPRESS_GZIP, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE); + GRPC_COMPRESS_GZIP, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, + false); +} + +static void test_invoke_request_with_send_message_before_initial_metadata( + grpc_end2end_test_config config) { + request_with_payload_template( + config, "test_invoke_request_with_compressed_payload", 0, + GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, + GRPC_COMPRESS_GZIP, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, + true); } static void test_invoke_request_with_server_level( @@ -550,7 +586,7 @@ static void test_invoke_request_with_server_level( request_with_payload_template( config, "test_invoke_request_with_server_level", 0, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE /* ignored */, - NULL, true, GRPC_COMPRESS_LEVEL_HIGH); + NULL, true, GRPC_COMPRESS_LEVEL_HIGH, false); } static void test_invoke_request_with_compressed_payload_md_override( @@ -574,21 +610,21 @@ static void test_invoke_request_with_compressed_payload_md_override( config, "test_invoke_request_with_compressed_payload_md_override_1", 0, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_NONE, &gzip_compression_override, false, - /*ignored*/ GRPC_COMPRESS_LEVEL_NONE); + /*ignored*/ GRPC_COMPRESS_LEVEL_NONE, false); /* Channel default DEFLATE, call override to GZIP */ request_with_payload_template( config, "test_invoke_request_with_compressed_payload_md_override_2", 0, GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_NONE, &gzip_compression_override, false, - /*ignored*/ GRPC_COMPRESS_LEVEL_NONE); + /*ignored*/ GRPC_COMPRESS_LEVEL_NONE, false); /* Channel default DEFLATE, call override to NONE (aka IDENTITY) */ request_with_payload_template( config, "test_invoke_request_with_compressed_payload_md_override_3", 0, GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, &identity_compression_override, false, - /*ignored*/ GRPC_COMPRESS_LEVEL_NONE); + /*ignored*/ GRPC_COMPRESS_LEVEL_NONE, false); } static void test_invoke_request_with_disabled_algorithm( @@ -602,6 +638,7 @@ void compressed_payload(grpc_end2end_test_config config) { test_invoke_request_with_exceptionally_uncompressed_payload(config); test_invoke_request_with_uncompressed_payload(config); test_invoke_request_with_compressed_payload(config); + test_invoke_request_with_send_message_before_initial_metadata(config); test_invoke_request_with_server_level(config); test_invoke_request_with_compressed_payload_md_override(config); test_invoke_request_with_disabled_algorithm(config); -- cgit v1.2.3 From bd3b93b4b55bf0acd50a88f5b062dcb21ba6ba93 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 22 Jun 2017 10:53:01 -0700 Subject: Add support for Trailers-Only responses. - When receiving a Trailers-Only response, return the metadata as trailing metadata instead of initial metadata. - Send Trailers-Only response when we have no non-default initial metadata, no message to send, and trailing metadata to send. --- .../transport/chttp2/transport/chttp2_transport.c | 2 + .../transport/chttp2/transport/frame_rst_stream.c | 2 +- .../ext/transport/chttp2/transport/hpack_encoder.c | 14 ++-- .../ext/transport/chttp2/transport/hpack_encoder.h | 2 + src/core/ext/transport/chttp2/transport/internal.h | 1 + src/core/ext/transport/chttp2/transport/parsing.c | 12 ++- src/core/ext/transport/chttp2/transport/writing.c | 87 ++++++++++++++++------ src/core/lib/surface/call.c | 53 ++++++------- src/core/lib/transport/transport.h | 4 + test/core/transport/chttp2/hpack_encoder_test.c | 6 +- test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 2 +- 11 files changed, 121 insertions(+), 64 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 0ad63d1af2..a14ddea39d 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1403,6 +1403,8 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, op_payload->recv_initial_metadata.recv_initial_metadata_ready; s->recv_initial_metadata = op_payload->recv_initial_metadata.recv_initial_metadata; + s->trailing_metadata_available = + op_payload->recv_initial_metadata.trailing_metadata_available; grpc_chttp2_maybe_complete_recv_initial_metadata(exec_ctx, t, s); } diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.c b/src/core/ext/transport/chttp2/transport/frame_rst_stream.c index ccca0f1871..689dc8935c 100644 --- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.c @@ -93,7 +93,7 @@ grpc_error *grpc_chttp2_rst_stream_parser_parse(grpc_exec_ctx *exec_ctx, (((uint32_t)p->reason_bytes[2]) << 8) | (((uint32_t)p->reason_bytes[3])); grpc_error *error = GRPC_ERROR_NONE; - if (reason != GRPC_HTTP2_NO_ERROR || s->header_frames_received < 2) { + if (reason != GRPC_HTTP2_NO_ERROR || s->metadata_buffer[1].size == 0) { char *message; gpr_asprintf(&message, "Received RST_STREAM with error code %d", reason); error = grpc_error_set_int( diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.c b/src/core/ext/transport/chttp2/transport/hpack_encoder.c index 28c6632695..a0e748e7b1 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.c +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.c @@ -608,15 +608,14 @@ void grpc_chttp2_hpack_compressor_set_max_table_size( void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_compressor *c, + grpc_mdelem **extra_headers, + size_t extra_headers_size, grpc_metadata_batch *metadata, const grpc_encode_header_options *options, grpc_slice_buffer *outbuf) { - framer_state st; - grpc_linked_mdelem *l; - gpr_timespec deadline; - GPR_ASSERT(options->stream_id != 0); + framer_state st; st.seen_regular_header = 0; st.stream_id = options->stream_id; st.output = outbuf; @@ -633,11 +632,14 @@ void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx, if (c->advertise_table_size_change != 0) { emit_advertise_table_size_change(c, &st); } + for (size_t i = 0; i < extra_headers_size; ++i) { + hpack_enc(exec_ctx, c, *extra_headers[i], &st); + } grpc_metadata_batch_assert_ok(metadata); - for (l = metadata->list.head; l; l = l->next) { + for (grpc_linked_mdelem *l = metadata->list.head; l; l = l->next) { hpack_enc(exec_ctx, c, l->md, &st); } - deadline = metadata->deadline; + gpr_timespec deadline = metadata->deadline; if (gpr_time_cmp(deadline, gpr_inf_future(deadline.clock_type)) != 0) { deadline_enc(exec_ctx, c, deadline, &st); } diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.h b/src/core/ext/transport/chttp2/transport/hpack_encoder.h index 84ab6dde2c..271192f894 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.h +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.h @@ -85,6 +85,8 @@ typedef struct { void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_compressor *c, + grpc_mdelem **extra_headers, + size_t extra_headers_size, grpc_metadata_batch *metadata, const grpc_encode_header_options *options, grpc_slice_buffer *outbuf); diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 4041b29fec..dec0003d55 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -447,6 +447,7 @@ struct grpc_chttp2_stream { grpc_metadata_batch *recv_initial_metadata; grpc_closure *recv_initial_metadata_ready; + bool *trailing_metadata_available; grpc_byte_stream **recv_message; grpc_closure *recv_message_ready; grpc_metadata_batch *recv_trailing_metadata; diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index 941260be9a..3c8b470b4f 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -681,9 +681,19 @@ static grpc_error *init_header_frame_parser(grpc_exec_ctx *exec_ctx, t->parser_data = &t->hpack_parser; switch (s->header_frames_received) { case 0: - t->hpack_parser.on_header = on_initial_header; + if (t->is_client && t->header_eof) { + GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "parsing Trailers-Only")); + if (s->trailing_metadata_available != NULL) { + *s->trailing_metadata_available = true; + } + t->hpack_parser.on_header = on_trailing_header; + } else { + GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "parsing initial_metadata")); + t->hpack_parser.on_header = on_initial_header; + } break; case 1: + GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "parsing trailing_metadata")); t->hpack_parser.on_header = on_trailing_header; break; case 2: diff --git a/src/core/ext/transport/chttp2/transport/writing.c b/src/core/ext/transport/chttp2/transport/writing.c index 4db0fbb098..315f2a67a2 100644 --- a/src/core/ext/transport/chttp2/transport/writing.c +++ b/src/core/ext/transport/chttp2/transport/writing.c @@ -162,6 +162,20 @@ static uint32_t target_write_size(grpc_chttp2_transport *t) { return 1024 * 1024; } +// Returns true if initial_metadata contains only default headers. +// +// TODO(roth): The fact that we hard-code these particular headers here +// is fairly ugly. Need some better way to know which headers are +// default, maybe via a bit in the static metadata table? +static bool is_default_initial_metadata(grpc_metadata_batch *initial_metadata) { + int num_default_fields = + (initial_metadata->idx.named.status != NULL) + + (initial_metadata->idx.named.content_type != NULL) + + (initial_metadata->idx.named.grpc_encoding != NULL) + + (initial_metadata->idx.named.grpc_accept_encoding != NULL); + return (size_t)num_default_fields == initial_metadata->list.count; +} + grpc_chttp2_begin_write_result grpc_chttp2_begin_write( grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { grpc_chttp2_stream *s; @@ -218,31 +232,59 @@ grpc_chttp2_begin_write_result grpc_chttp2_begin_write( t->is_client ? "CLIENT" : "SERVER", s->id, sent_initial_metadata, s->send_initial_metadata != NULL, s->announce_window)); + grpc_mdelem *extra_headers_for_trailing_metadata[2]; + size_t num_extra_headers_for_trailing_metadata = 0; + /* send initial metadata if it's available */ - if (!sent_initial_metadata && s->send_initial_metadata) { - grpc_encode_header_options hopt = { - .stream_id = s->id, - .is_eof = false, - .use_true_binary_metadata = - t->settings - [GRPC_PEER_SETTINGS] - [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != 0, - .max_frame_size = t->settings[GRPC_PEER_SETTINGS] - [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], - .stats = &s->stats.outgoing}; - grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, - s->send_initial_metadata, &hopt, &t->outbuf); + if (!sent_initial_metadata && s->send_initial_metadata != NULL) { + // We skip this on the server side if there is no custom initial + // metadata, there are no messages to send, and we are also sending + // trailing metadata. This results in a Trailers-Only response, + // which is required for retries, as per: + // https://github.com/grpc/proposal/blob/master/A6-client-retries.md#when-retries-are-valid + if (t->is_client || s->fetching_send_message != NULL || + s->flow_controlled_buffer.length != 0 || + s->send_trailing_metadata == NULL || + !is_default_initial_metadata(s->send_initial_metadata)) { + grpc_encode_header_options hopt = { + .stream_id = s->id, + .is_eof = false, + .use_true_binary_metadata = + t->settings + [GRPC_PEER_SETTINGS] + [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != 0, + .max_frame_size = t->settings[GRPC_PEER_SETTINGS] + [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], + .stats = &s->stats.outgoing}; + grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, NULL, 0, + s->send_initial_metadata, &hopt, &t->outbuf); + now_writing = true; + t->ping_state.pings_before_data_required = + t->ping_policy.max_pings_without_data; + if (!t->is_client) { + t->ping_recv_state.last_ping_recv_time = + gpr_inf_past(GPR_CLOCK_MONOTONIC); + t->ping_recv_state.ping_strikes = 0; + } + } else { + GRPC_CHTTP2_IF_TRACING( + gpr_log(GPR_INFO, "not sending initial_metadata (Trailers-Only)")); + // When sending Trailers-Only, we need to move the :status and + // content-type headers to the trailers. + if (s->send_initial_metadata->idx.named.status != NULL) { + extra_headers_for_trailing_metadata + [num_extra_headers_for_trailing_metadata++] = + &s->send_initial_metadata->idx.named.status->md; + } + if (s->send_initial_metadata->idx.named.content_type != NULL) { + extra_headers_for_trailing_metadata + [num_extra_headers_for_trailing_metadata++] = + &s->send_initial_metadata->idx.named.content_type->md; + } + } s->send_initial_metadata = NULL; s->sent_initial_metadata = true; sent_initial_metadata = true; - now_writing = true; - t->ping_state.pings_before_data_required = - t->ping_policy.max_pings_without_data; - if (!t->is_client) { - t->ping_recv_state.last_ping_recv_time = - gpr_inf_past(GPR_CLOCK_MONOTONIC); - t->ping_recv_state.ping_strikes = 0; - } } /* send any window updates */ if (s->announce_window > 0) { @@ -320,6 +362,7 @@ grpc_chttp2_begin_write_result grpc_chttp2_begin_write( if (s->send_trailing_metadata != NULL && s->fetching_send_message == NULL && s->flow_controlled_buffer.length == 0) { + GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "sending trailing_metadata")); if (grpc_metadata_batch_is_empty(s->send_trailing_metadata)) { grpc_chttp2_encode_data(s->id, &s->flow_controlled_buffer, 0, true, &s->stats.outgoing, &t->outbuf); @@ -337,6 +380,8 @@ grpc_chttp2_begin_write_result grpc_chttp2_begin_write( [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], .stats = &s->stats.outgoing}; grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, + extra_headers_for_trailing_metadata, + num_extra_headers_for_trailing_metadata, s->send_trailing_metadata, &hopt, &t->outbuf); } diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index b499219e17..b14f8c46c3 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -929,33 +929,6 @@ static grpc_compression_algorithm decode_compression(grpc_mdelem md) { return algorithm; } -static void recv_common_filter(grpc_exec_ctx *exec_ctx, grpc_call *call, - grpc_metadata_batch *b) { - if (b->idx.named.grpc_status != NULL) { - uint32_t status_code = decode_status(b->idx.named.grpc_status->md); - grpc_error *error = - status_code == GRPC_STATUS_OK - ? GRPC_ERROR_NONE - : grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING( - "Error received from peer"), - GRPC_ERROR_INT_GRPC_STATUS, - (intptr_t)status_code); - - if (b->idx.named.grpc_message != NULL) { - error = grpc_error_set_str( - error, GRPC_ERROR_STR_GRPC_MESSAGE, - grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.grpc_message->md))); - grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_message); - } else if (error != GRPC_ERROR_NONE) { - error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE, - grpc_empty_slice()); - } - - set_status_from_error(exec_ctx, call, STATUS_FROM_WIRE, error); - grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_status); - } -} - static void publish_app_metadata(grpc_call *call, grpc_metadata_batch *b, int is_trailing) { if (b->list.count == 0) return; @@ -980,8 +953,6 @@ static void publish_app_metadata(grpc_call *call, grpc_metadata_batch *b, static void recv_initial_filter(grpc_exec_ctx *exec_ctx, grpc_call *call, grpc_metadata_batch *b) { - recv_common_filter(exec_ctx, call, b); - if (b->idx.named.grpc_encoding != NULL) { GPR_TIMER_BEGIN("incoming_compression_algorithm", 0); set_incoming_compression_algorithm( @@ -989,7 +960,6 @@ static void recv_initial_filter(grpc_exec_ctx *exec_ctx, grpc_call *call, GPR_TIMER_END("incoming_compression_algorithm", 0); grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_encoding); } - if (b->idx.named.grpc_accept_encoding != NULL) { GPR_TIMER_BEGIN("encodings_accepted_by_peer", 0); set_encodings_accepted_by_peer(exec_ctx, call, @@ -997,14 +967,33 @@ static void recv_initial_filter(grpc_exec_ctx *exec_ctx, grpc_call *call, grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_accept_encoding); GPR_TIMER_END("encodings_accepted_by_peer", 0); } - publish_app_metadata(call, b, false); } static void recv_trailing_filter(grpc_exec_ctx *exec_ctx, void *args, grpc_metadata_batch *b) { grpc_call *call = args; - recv_common_filter(exec_ctx, call, b); + if (b->idx.named.grpc_status != NULL) { + uint32_t status_code = decode_status(b->idx.named.grpc_status->md); + grpc_error *error = + status_code == GRPC_STATUS_OK + ? GRPC_ERROR_NONE + : grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "Error received from peer"), + GRPC_ERROR_INT_GRPC_STATUS, + (intptr_t)status_code); + if (b->idx.named.grpc_message != NULL) { + error = grpc_error_set_str( + error, GRPC_ERROR_STR_GRPC_MESSAGE, + grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.grpc_message->md))); + grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_message); + } else if (error != GRPC_ERROR_NONE) { + error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE, + grpc_empty_slice()); + } + set_status_from_error(exec_ctx, call, STATUS_FROM_WIRE, error); + grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_status); + } publish_app_metadata(call, b, true); } diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index d231157c87..978ed0fd0b 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -165,6 +165,10 @@ struct grpc_transport_stream_op_batch_payload { uint32_t *recv_flags; /** Should be enqueued when initial metadata is ready to be processed. */ grpc_closure *recv_initial_metadata_ready; + // If not NULL, will be set to true if trailing metadata is + // immediately available. This may be a signal that we received a + // Trailers-Only response. + bool *trailing_metadata_available; } recv_initial_metadata; struct { diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.c index a12f31a048..ed51dd1859 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.c +++ b/test/core/transport/chttp2/hpack_encoder_test.c @@ -95,7 +95,8 @@ static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, bool eof, .max_frame_size = 16384, .stats = &stats, }; - grpc_chttp2_encode_header(exec_ctx, &g_compressor, &b, &hopt, &output); + grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt, + &output); merged = grpc_slice_merge(output.slices, output.count); grpc_slice_buffer_destroy_internal(exec_ctx, &output); grpc_metadata_batch_destroy(exec_ctx, &b); @@ -213,7 +214,8 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx, .use_true_binary_metadata = false, .max_frame_size = 16384, .stats = &stats}; - grpc_chttp2_encode_header(exec_ctx, &g_compressor, &b, &hopt, &output); + grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt, + &output); grpc_slice_buffer_destroy_internal(exec_ctx, &output); grpc_metadata_batch_destroy(exec_ctx, &b); diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 3457fd77cf..adbfa4d796 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -82,7 +82,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State &state) { (size_t)state.range(1), &stats, }; - grpc_chttp2_encode_header(&exec_ctx, &c, &b, &hopt, &outbuf); + grpc_chttp2_encode_header(&exec_ctx, &c, NULL, 0, &b, &hopt, &outbuf); if (!logged_representative_output && state.iterations() > 3) { logged_representative_output = true; for (size_t i = 0; i < outbuf.count; i++) { -- cgit v1.2.3 From d35730d18564a00a4b9acccaf8387ccb4bb565b8 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 22 Jun 2017 12:06:44 -0700 Subject: Fix use of terminal underscores in field names. --- include/grpc++/impl/codegen/async_unary_call.h | 52 +++++++++++++------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h index de0ab2372a..a5a698c640 100644 --- a/include/grpc++/impl/codegen/async_unary_call.h +++ b/include/grpc++/impl/codegen/async_unary_call.h @@ -100,13 +100,13 @@ class ClientAsyncResponseReader final : context_(context), call_(channel->CreateCall(method, context, cq)), collection_(std::make_shared()) { - collection_->init_buf_.SetCollection(collection_); - collection_->init_buf_.SendInitialMetadata( + collection_->init_buf.SetCollection(collection_); + collection_->init_buf.SendInitialMetadata( context->send_initial_metadata_, context->initial_metadata_flags()); // TODO(ctiller): don't assert - GPR_CODEGEN_ASSERT(collection_->init_buf_.SendMessage(request).ok()); - collection_->init_buf_.ClientSendClose(); - call_.PerformOps(&collection_->init_buf_); + GPR_CODEGEN_ASSERT(collection_->init_buf.SendMessage(request).ok()); + collection_->init_buf.ClientSendClose(); + call_.PerformOps(&collection_->init_buf); } // always allocated against a call arena, no memory free required @@ -123,18 +123,18 @@ class ClientAsyncResponseReader final void ReadInitialMetadata(void* tag) { GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); - Ops& o = ops; + Ops& o = ops_; // TODO(vjpai): Remove the collection_ specialization as soon // as the public constructor is deleted if (collection_) { o = *collection_; - collection_->meta_buf_.SetCollection(collection_); + collection_->meta_buf.SetCollection(collection_); } - o.meta_buf_.set_output_tag(tag); - o.meta_buf_.RecvInitialMetadata(context_); - call_.PerformOps(&o.meta_buf_); + o.meta_buf.set_output_tag(tag); + o.meta_buf.RecvInitialMetadata(context_); + call_.PerformOps(&o.meta_buf); } /// See \a ClientAysncResponseReaderInterface::Finish for semantics. @@ -143,23 +143,23 @@ class ClientAsyncResponseReader final /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata sent from the server. void Finish(R* msg, Status* status, void* tag) { - Ops& o = ops; + Ops& o = ops_; // TODO(vjpai): Remove the collection_ specialization as soon // as the public constructor is deleted if (collection_) { o = *collection_; - collection_->finish_buf_.SetCollection(collection_); + collection_->finish_buf.SetCollection(collection_); } - o.finish_buf_.set_output_tag(tag); + o.finish_buf.set_output_tag(tag); if (!context_->initial_metadata_received_) { - o.finish_buf_.RecvInitialMetadata(context_); + o.finish_buf.RecvInitialMetadata(context_); } - o.finish_buf_.RecvMessage(msg); - o.finish_buf_.AllowNoMessage(); - o.finish_buf_.ClientRecvStatus(context_, status); - call_.PerformOps(&o.finish_buf_); + o.finish_buf.RecvMessage(msg); + o.finish_buf.AllowNoMessage(); + o.finish_buf.ClientRecvStatus(context_, status); + call_.PerformOps(&o.finish_buf); } private: @@ -169,12 +169,12 @@ class ClientAsyncResponseReader final template ClientAsyncResponseReader(Call call, ClientContext* context, const W& request) : context_(context), call_(call) { - ops.init_buf_.SendInitialMetadata(context->send_initial_metadata_, + ops_.init_buf.SendInitialMetadata(context->send_initial_metadata_, context->initial_metadata_flags()); // TODO(ctiller): don't assert - GPR_CODEGEN_ASSERT(ops.init_buf_.SendMessage(request).ok()); - ops.init_buf_.ClientSendClose(); - call_.PerformOps(&ops.init_buf_); + GPR_CODEGEN_ASSERT(ops_.init_buf.SendMessage(request).ok()); + ops_.init_buf.ClientSendClose(); + call_.PerformOps(&ops_.init_buf); } // disable operator new @@ -186,12 +186,12 @@ class ClientAsyncResponseReader final struct Ops : public CallOpSetCollectionInterface { SneakyCallOpSet - init_buf_; - CallOpSet meta_buf_; + init_buf; + CallOpSet meta_buf; CallOpSet, CallOpClientRecvStatus> - finish_buf_; - } ops; + finish_buf; + } ops_; // TODO(vjpai): Remove the collection_ as soon as the related workaround // (public constructor) is deleted -- cgit v1.2.3 From 10c040d455289b274fe2c5de00a9ffeb79798681 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 22 Jun 2017 13:41:41 -0700 Subject: Move collection reset before unref (since unref could destroy obj) --- include/grpc++/impl/codegen/call.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index dba53bc427..342ea46203 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -610,10 +610,12 @@ class CallOpSet : public CallOpSetInterface, this->Op5::FinishOp(status); this->Op6::FinishOp(status); *tag = return_tag_; - g_core_codegen_interface->grpc_call_unref(call_); + // TODO(vjpai): Remove the reference to collection_ once the idea of // bypassing the code generator is forbidden. It is already deprecated collection_.reset(); + + g_core_codegen_interface->grpc_call_unref(call_); return true; } -- cgit v1.2.3 From 495e9ac023d8ae565d8f7069799e88a79f25b21a Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Thu, 22 Jun 2017 14:05:24 -0700 Subject: Run formatter --- src/compiler/php_generator_helpers.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/php_generator_helpers.h b/src/compiler/php_generator_helpers.h index 8f59b90d04..3a5c08b3e6 100644 --- a/src/compiler/php_generator_helpers.h +++ b/src/compiler/php_generator_helpers.h @@ -56,8 +56,7 @@ template inline grpc::string GetPHPComments(const DescriptorType *desc, grpc::string prefix) { return ReplaceAll(grpc_generator::GetPrefixedComments(desc, true, prefix), - "*/", - "*/"); + "*/", "*/"); } } // namespace grpc_php_generator -- cgit v1.2.3 From 74c74fb04e98fa3641a0eaddddb5526a921f3520 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 19 Jun 2017 16:14:50 +0200 Subject: workaround zlib cmake issue --- CMakeLists.txt | 3 +++ templates/CMakeLists.txt.template | 3 +++ 2 files changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 852eb2bf6c..e8094b7255 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,9 @@ if("${gRPC_ZLIB_PROVIDER}" STREQUAL "module") endif() set(ZLIB_INCLUDE_DIR "${ZLIB_ROOT_DIR}") if(EXISTS "${ZLIB_ROOT_DIR}/CMakeLists.txt") + # TODO(jtattermusch): workaround for https://github.com/madler/zlib/issues/218 + include_directories(${ZLIB_INCLUDE_DIR}) + add_subdirectory(${ZLIB_ROOT_DIR} third_party/zlib) if(TARGET zlibstatic) set(_gRPC_ZLIB_LIBRARIES zlibstatic) diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index ef0faccb2e..91bed9a6db 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -143,6 +143,9 @@ endif() set(ZLIB_INCLUDE_DIR "<%text>${ZLIB_ROOT_DIR}") if(EXISTS "<%text>${ZLIB_ROOT_DIR}/CMakeLists.txt") + # TODO(jtattermusch): workaround for https://github.com/madler/zlib/issues/218 + include_directories(<%text>${ZLIB_INCLUDE_DIR}) + add_subdirectory(<%text>${ZLIB_ROOT_DIR} third_party/zlib) if(TARGET zlibstatic) set(_gRPC_ZLIB_LIBRARIES zlibstatic) -- cgit v1.2.3 From b70df57c498a5757693266612bc51e45f2713ab3 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 19 Jun 2017 16:37:15 +0200 Subject: build protobuf without zlib --- CMakeLists.txt | 5 +++++ templates/CMakeLists.txt.template | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8094b7255..f5e863183b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,6 +162,11 @@ if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module") if(NOT protobuf_BUILD_TESTS) set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests") endif() + # Disable building protobuf with zlib. Building protobuf with zlib breaks + # the build if zlib is not installed on the system. + if(NOT protobuf_WITH_ZLIB) + set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib.") + endif() if(NOT PROTOBUF_ROOT_DIR) set(PROTOBUF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/protobuf) endif() diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index 91bed9a6db..d279d02553 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -207,6 +207,11 @@ if(NOT protobuf_BUILD_TESTS) set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests") endif() + # Disable building protobuf with zlib. Building protobuf with zlib breaks + # the build if zlib is not installed on the system. + if(NOT protobuf_WITH_ZLIB) + set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib.") + endif() if(NOT PROTOBUF_ROOT_DIR) set(PROTOBUF_ROOT_DIR <%text>${CMAKE_CURRENT_SOURCE_DIR}/third_party/protobuf) endif() -- cgit v1.2.3 From f3219f459d63b66e3ee06b994031608d7107fdd2 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 20 Jun 2017 13:21:53 +0200 Subject: make some headers public --- templates/CMakeLists.txt.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index d279d02553..2a5b12b412 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -514,8 +514,8 @@ % endfor target_include_directories(${lib.name} + PUBLIC <%text>$ $ PRIVATE <%text>${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE <%text>${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE <%text>${BORINGSSL_ROOT_DIR}/include PRIVATE <%text>${PROTOBUF_ROOT_DIR}/src PRIVATE <%text>${ZLIB_INCLUDE_DIR} -- cgit v1.2.3 From 456b713f06b09a2bff42dc7f9ff09fbde973dd58 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 20 Jun 2017 13:21:27 +0200 Subject: regenerate --- CMakeLists.txt | 66 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5e863183b..7e067d5277 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -816,8 +816,8 @@ endif() target_include_directories(gpr + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -908,8 +908,8 @@ endif() target_include_directories(gpr_test_util + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -1195,8 +1195,8 @@ endif() target_include_directories(grpc + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -1494,8 +1494,8 @@ endif() target_include_directories(grpc_cronet + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -1730,8 +1730,8 @@ endif() target_include_directories(grpc_test_util + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -1824,8 +1824,8 @@ endif() target_include_directories(grpc_test_util_unsecure + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2085,8 +2085,8 @@ endif() target_include_directories(grpc_unsecure + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2175,8 +2175,8 @@ endif() target_include_directories(reconnect_server + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2219,8 +2219,8 @@ endif() target_include_directories(test_tcp_server + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2305,8 +2305,8 @@ endif() target_include_directories(grpc++ + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2692,8 +2692,8 @@ endif() target_include_directories(grpc++_cronet + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2865,8 +2865,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(grpc++_error_details + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2932,8 +2932,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(grpc++_proto_reflection_desc_db + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2995,8 +2995,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(grpc++_reflection + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3055,8 +3055,8 @@ endif() target_include_directories(grpc++_test_config + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3135,8 +3135,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(grpc++_test_util + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3279,8 +3279,8 @@ endif() target_include_directories(grpc++_unsecure + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3433,8 +3433,8 @@ endif() target_include_directories(grpc_benchmark + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3494,8 +3494,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(grpc_cli_libs + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3556,8 +3556,8 @@ endif() target_include_directories(grpc_plugin_support + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3636,8 +3636,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(http2_client_main + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3693,8 +3693,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(interop_client_helper + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3765,8 +3765,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(interop_client_main + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3818,8 +3818,8 @@ endif() target_include_directories(interop_server_helper + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3889,8 +3889,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(interop_server_lib + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3942,8 +3942,8 @@ endif() target_include_directories(interop_server_main + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4032,8 +4032,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(qps + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4080,8 +4080,8 @@ endif() target_include_directories(grpc_csharp_ext + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4177,8 +4177,8 @@ endif() target_include_directories(ares + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4217,8 +4217,8 @@ endif() target_include_directories(bad_client_test + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4260,8 +4260,8 @@ endif() target_include_directories(bad_ssl_test_server + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4358,8 +4358,8 @@ endif() target_include_directories(end2end_tests + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4456,8 +4456,8 @@ endif() target_include_directories(end2end_nosec_tests + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} -- cgit v1.2.3 From f691556db43779f2c33ef29e94392cc7efd0b025 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 23 Jun 2017 14:53:55 +0200 Subject: dont reuse protobuf cmake install dirs --- templates/CMakeLists.txt.template | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index 2a5b12b412..1c76136ce3 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -73,6 +73,11 @@ set(PACKAGE_TARNAME "<%text>${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") project(<%text>${PACKAGE_NAME} C CXX) + + set(gRPC_INSTALL_BINDIR "<%text>${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") + set(gRPC_INSTALL_LIBDIR "<%text>${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") + set(gRPC_INSTALL_INCLUDEDIR "<%text>${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") + set(gRPC_INSTALL_CMAKEDIR "<%text>${CMAKE_INSTALL_PREFIX}/lib/cmake/${PACKAGE_NAME}" CACHE PATH "Installation directory for cmake config files") # Options option(gRPC_BUILD_TESTS "Build tests" OFF) @@ -335,11 +340,6 @@ set(_gRPC_BASELIB_LIBRARIES wsock32 ws2_32) endif() - include(GNUInstallDirs) - if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR) - set(CMAKE_INSTALL_CMAKEDIR "<%text>${CMAKE_INSTALL_LIBDIR}/cmake/gRPC") - endif() - # Create directory for generated .proto files set(_gRPC_PROTO_GENS_DIR <%text>${CMAKE_BINARY_DIR}/gens) file(MAKE_DIRECTORY <%text>${_gRPC_PROTO_GENS_DIR}) @@ -500,7 +500,7 @@ ) if (gRPC_INSTALL) install(FILES <%text>${CMAKE_CURRENT_BINARY_DIR}/${lib.name}.pdb - DESTINATION <%text>${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION <%text>${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -554,7 +554,7 @@ string(REPLACE "include/" "" _path <%text>${_hdr}) get_filename_component(_path <%text>${_path} PATH) install(FILES <%text>${_hdr} - DESTINATION "<%text>${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "<%text>${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() % endif @@ -622,16 +622,16 @@ <%def name="cc_install(tgt)"> if (gRPC_INSTALL) install(TARGETS ${tgt.name} EXPORT gRPCTargets - RUNTIME DESTINATION <%text>${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION <%text>${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION <%text>${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION <%text>${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION <%text>${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION <%text>${gRPC_INSTALL_LIBDIR} ) endif() if (gRPC_INSTALL) install(EXPORT gRPCTargets - DESTINATION <%text>${CMAKE_INSTALL_CMAKEDIR} + DESTINATION <%text>${gRPC_INSTALL_CMAKEDIR} NAMESPACE gRPC:: ) endif() @@ -640,6 +640,6 @@ configure_file(tools/cmake/<%text>${_config}.cmake.in <%text>${_config}.cmake @ONLY) install(FILES <%text>${CMAKE_CURRENT_BINARY_DIR}/${_config}.cmake - DESTINATION <%text>${CMAKE_INSTALL_CMAKEDIR} + DESTINATION <%text>${gRPC_INSTALL_CMAKEDIR} ) endforeach() -- cgit v1.2.3 From dca8d637c0ccba1ff0c9fdeaf7e57fc432258814 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 23 Jun 2017 15:52:40 +0200 Subject: regenerate --- CMakeLists.txt | 258 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 129 insertions(+), 129 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e067d5277..68955ebeea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,11 @@ set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") project(${PACKAGE_NAME} C CXX) +set(gRPC_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") +set(gRPC_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") +set(gRPC_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") +set(gRPC_INSTALL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/lib/cmake/${PACKAGE_NAME}" CACHE PATH "Installation directory for cmake config files") + # Options option(gRPC_BUILD_TESTS "Build tests" OFF) @@ -290,11 +295,6 @@ if(WIN32 AND MSVC) set(_gRPC_BASELIB_LIBRARIES wsock32 ws2_32) endif() -include(GNUInstallDirs) -if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR) - set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/gRPC") -endif() - # Create directory for generated .proto files set(_gRPC_PROTO_GENS_DIR ${CMAKE_BINARY_DIR}/gens) file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR}) @@ -809,7 +809,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gpr.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -876,16 +876,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS gpr EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -901,7 +901,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gpr_test_util.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -1188,7 +1188,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -1255,16 +1255,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -1487,7 +1487,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_cronet.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -1554,16 +1554,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc_cronet EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -1723,7 +1723,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_test_util.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -1786,7 +1786,7 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() @@ -1817,7 +1817,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_test_util_unsecure.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -2078,7 +2078,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_unsecure.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -2143,16 +2143,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc_unsecure EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -2168,7 +2168,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/reconnect_server.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -2212,7 +2212,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/test_tcp_server.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -2298,7 +2298,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -2428,16 +2428,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc++ EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -2685,7 +2685,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_cronet.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -2827,16 +2827,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc++_cronet EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -2855,7 +2855,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_error_details.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -2893,16 +2893,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc++_error_details EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -2922,7 +2922,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_proto_reflection_desc_db.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -2964,7 +2964,7 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() @@ -2985,7 +2985,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_reflection.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3023,16 +3023,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc++_reflection EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -3048,7 +3048,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_test_config.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3116,7 +3116,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_test_util.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3217,7 +3217,7 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() @@ -3272,7 +3272,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_unsecure.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3401,16 +3401,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc++_unsecure EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -3426,7 +3426,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_benchmark.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3484,7 +3484,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_cli_libs.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3527,7 +3527,7 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() @@ -3549,7 +3549,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_plugin_support.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3583,16 +3583,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc_plugin_support EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -3620,7 +3620,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/http2_client_main.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3683,7 +3683,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/interop_client_helper.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3749,7 +3749,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/interop_client_main.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3811,7 +3811,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/interop_server_helper.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3873,7 +3873,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/interop_server_lib.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3935,7 +3935,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/interop_server_main.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -4010,7 +4010,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qps.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -4073,7 +4073,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_csharp_ext.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -4104,9 +4104,9 @@ target_link_libraries(grpc_csharp_ext if (gRPC_INSTALL) install(TARGETS grpc_csharp_ext EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -4170,7 +4170,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ares.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -4210,7 +4210,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bad_client_test.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -4253,7 +4253,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bad_ssl_test_server.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -4351,7 +4351,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/end2end_tests.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -4449,7 +4449,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/end2end_nosec_tests.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -4938,9 +4938,9 @@ target_link_libraries(check_epollexclusive if (gRPC_INSTALL) install(TARGETS check_epollexclusive EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -5606,9 +5606,9 @@ target_link_libraries(gen_hpack_tables if (gRPC_INSTALL) install(TARGETS gen_hpack_tables EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -5640,9 +5640,9 @@ target_link_libraries(gen_legal_metadata_characters if (gRPC_INSTALL) install(TARGETS gen_legal_metadata_characters EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -5674,9 +5674,9 @@ target_link_libraries(gen_percent_encoding_tables if (gRPC_INSTALL) install(TARGETS gen_percent_encoding_tables EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -6425,9 +6425,9 @@ target_link_libraries(grpc_create_jwt if (gRPC_INSTALL) install(TARGETS grpc_create_jwt EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -6618,9 +6618,9 @@ target_link_libraries(grpc_print_google_default_creds_token if (gRPC_INSTALL) install(TARGETS grpc_print_google_default_creds_token EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -6685,9 +6685,9 @@ target_link_libraries(grpc_verify_jwt if (gRPC_INSTALL) install(TARGETS grpc_verify_jwt EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10328,9 +10328,9 @@ target_link_libraries(grpc_cpp_plugin if (gRPC_INSTALL) install(TARGETS grpc_cpp_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10366,9 +10366,9 @@ target_link_libraries(grpc_csharp_plugin if (gRPC_INSTALL) install(TARGETS grpc_csharp_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10404,9 +10404,9 @@ target_link_libraries(grpc_node_plugin if (gRPC_INSTALL) install(TARGETS grpc_node_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10442,9 +10442,9 @@ target_link_libraries(grpc_objective_c_plugin if (gRPC_INSTALL) install(TARGETS grpc_objective_c_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10480,9 +10480,9 @@ target_link_libraries(grpc_php_plugin if (gRPC_INSTALL) install(TARGETS grpc_php_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10518,9 +10518,9 @@ target_link_libraries(grpc_python_plugin if (gRPC_INSTALL) install(TARGETS grpc_python_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10556,9 +10556,9 @@ target_link_libraries(grpc_ruby_plugin if (gRPC_INSTALL) install(TARGETS grpc_ruby_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -14190,7 +14190,7 @@ endif (gRPC_BUILD_TESTS) if (gRPC_INSTALL) install(EXPORT gRPCTargets - DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + DESTINATION ${gRPC_INSTALL_CMAKEDIR} NAMESPACE gRPC:: ) endif() @@ -14199,6 +14199,6 @@ foreach(_config gRPCConfig gRPCConfigVersion) configure_file(tools/cmake/${_config}.cmake.in ${_config}.cmake @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_config}.cmake - DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + DESTINATION ${gRPC_INSTALL_CMAKEDIR} ) endforeach() -- cgit v1.2.3 From 5dc774199b18b94642eae61c865d7f64d7d6ad8f Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Fri, 23 Jun 2017 09:13:16 -0700 Subject: Fix Windows compiler problem. --- test/core/end2end/tests/compressed_payload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index e5e0a5ead4..429717a7be 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -279,7 +279,7 @@ static void request_with_payload_template( grpc_call *c; grpc_call *s; grpc_slice request_payload_slice; - grpc_byte_buffer *request_payload; + grpc_byte_buffer *request_payload = NULL; grpc_channel_args *client_args; grpc_channel_args *server_args; grpc_end2end_test_fixture f; -- cgit v1.2.3 From a1fe5e5ae3b2021045d18281e3424312cfbe3679 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 30 May 2017 08:31:36 -0700 Subject: Remove remaining thrift content from main repo --- tools/grift/Dockerfile | 52 - tools/grift/README.md | 24 - tools/grift/grpc_plugins_generator.patch | 2505 ------------------------------ 3 files changed, 2581 deletions(-) delete mode 100644 tools/grift/Dockerfile delete mode 100644 tools/grift/README.md delete mode 100644 tools/grift/grpc_plugins_generator.patch diff --git a/tools/grift/Dockerfile b/tools/grift/Dockerfile deleted file mode 100644 index 4d2fc3146b..0000000000 --- a/tools/grift/Dockerfile +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2016 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. - -FROM ubuntu:14.04 - -RUN apt-get update && \ - apt-get install -y \ - git build-essential \ - pkg-config flex \ - bison \ - libkrb5-dev \ - libsasl2-dev \ - libnuma-dev \ - pkg-config \ - libssl-dev \ - autoconf libtool \ - cmake \ - libiberty-dev \ - g++ unzip \ - curl make automake libtool libboost-dev - -# Configure git -RUN git config --global user.name "Jenkins" && \ - git config --global user.email "jenkins@grpc" - -# Clone gRPC -RUN git clone https://github.com/grpc/grpc - -# Update Submodules -RUN cd grpc && git submodule update --init - -# Install protobuf -RUN cd grpc/third_party/protobuf && ./autogen.sh && ./configure && \ - make -j && make check -j && make install && ldconfig - -# Install gRPC -RUN cd grpc && make -j && make install - -# Install thrift -RUN cd grpc/third_party/thrift && git am --signoff < ../../tools/grift/grpc_plugins_generator.patch && \ - ./bootstrap.sh && ./configure && make -j && make install \ No newline at end of file diff --git a/tools/grift/README.md b/tools/grift/README.md deleted file mode 100644 index 2b5fa5ae14..0000000000 --- a/tools/grift/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# Documentation - -grift is integration of [Apache Thrift](https://github.com/apache/thrift.git) Serializer with gRPC. - -This integration allows you to use grpc to send thrift messages in C++ and java. - -grift uses Compact Protocol to serialize thrift messages. - -## generating grpc plugins for thrift services - -### C++ -```sh - $ thrift --gen cpp -``` - -### Java -```sh - $ thrift --gen java -``` - -# Installation - -Before Installing thrift make sure to apply this [patch](grpc_plugins_generator.patch) to third_party/thrift. -Go to third_party/thrift and follow the [INSTALLATION](https://github.com/apache/thrift.git) instructions to install thrift with commit id bcad91771b7f0bff28a1cac1981d7ef2b9bcef3c. \ No newline at end of file diff --git a/tools/grift/grpc_plugins_generator.patch b/tools/grift/grpc_plugins_generator.patch deleted file mode 100644 index de82a01f62..0000000000 --- a/tools/grift/grpc_plugins_generator.patch +++ /dev/null @@ -1,2505 +0,0 @@ -From 0894590b5020c38106d4ebb2291994668c64f9dd Mon Sep 17 00:00:00 2001 -From: chedeti -Date: Sun, 31 Jul 2016 15:47:47 -0700 -Subject: [PATCH 1/3] don't build tests - ---- - Makefile.am | 7 ++----- - lib/cpp/Makefile.am | 7 ++----- - 2 files changed, 4 insertions(+), 10 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 10fe49a..d49caac 100755 ---- a/Makefile.am -+++ b/Makefile.am -@@ -21,10 +21,6 @@ ACLOCAL_AMFLAGS = -I ./aclocal - - SUBDIRS = compiler/cpp lib - --if WITH_TESTS --SUBDIRS += test --endif -- - if WITH_TUTORIAL - SUBDIRS += tutorial - endif -@@ -117,4 +113,5 @@ EXTRA_DIST = \ - CHANGES \ - NOTICE \ - README.md \ -- Thrift.podspec -+ Thrift.podspec \ -+ test -diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am -index 6fd15d2..7de1fad 100755 ---- a/lib/cpp/Makefile.am -+++ b/lib/cpp/Makefile.am -@@ -27,10 +27,6 @@ moc__%.cpp: %.h - - SUBDIRS = . - --if WITH_TESTS --SUBDIRS += test --endif -- - pkgconfigdir = $(libdir)/pkgconfig - - lib_LTLIBRARIES = libthrift.la -@@ -277,7 +273,8 @@ EXTRA_DIST = \ - thrift-qt.pc.in \ - thrift-qt5.pc.in \ - src/thrift/qt/CMakeLists.txt \ -- $(WINDOWS_DIST) -+ $(WINDOWS_DIST) \ -+ test - - style-local: - $(CPPSTYLE_CMD) --- -2.8.0.rc3.226.g39d4020 - - -From 387e4300bc9d98176a92a7c010621443a538e7f2 Mon Sep 17 00:00:00 2001 -From: chedeti -Date: Sun, 31 Jul 2016 16:16:40 -0700 -Subject: [PATCH 2/3] grpc cpp plugins generator with example - ---- - compiler/cpp/src/generate/t_cpp_generator.cc | 489 +++++++++++++++++++++++---- - tutorial/cpp/CMakeLists.txt | 53 --- - tutorial/cpp/CppClient.cpp | 80 ----- - tutorial/cpp/CppServer.cpp | 181 ---------- - tutorial/cpp/GriftClient.cpp | 93 +++++ - tutorial/cpp/GriftServer.cpp | 93 +++++ - tutorial/cpp/Makefile.am | 66 ++-- - tutorial/cpp/test.thrift | 13 + - 8 files changed, 652 insertions(+), 416 deletions(-) - delete mode 100644 tutorial/cpp/CMakeLists.txt - delete mode 100644 tutorial/cpp/CppClient.cpp - delete mode 100644 tutorial/cpp/CppServer.cpp - create mode 100644 tutorial/cpp/GriftClient.cpp - create mode 100644 tutorial/cpp/GriftServer.cpp - create mode 100644 tutorial/cpp/test.thrift - -diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc -index 6c04899..1557241 100644 ---- a/compiler/cpp/src/generate/t_cpp_generator.cc -+++ b/compiler/cpp/src/generate/t_cpp_generator.cc -@@ -162,6 +162,8 @@ public: - bool specialized = false); - void generate_function_helpers(t_service* tservice, t_function* tfunction); - void generate_service_async_skeleton(t_service* tservice); -+ void generate_service_stub_interface(t_service* tservice); -+ void generate_service_stub(t_service* tservice); - - /** - * Serialization constructs -@@ -883,10 +885,10 @@ void t_cpp_generator::generate_struct_declaration(ofstream& out, - bool is_user_struct) { - string extends = ""; - if (is_exception) { -- extends = " : public ::apache::thrift::TException"; -+ extends = " : public apache::thrift::TException"; - } else { -- if (is_user_struct && !gen_templates_) { -- extends = " : public virtual ::apache::thrift::TBase"; -+ if (!gen_templates_) { -+ extends = " : public virtual apache::thrift::TBase"; - } - } - -@@ -1130,9 +1132,15 @@ void t_cpp_generator::generate_struct_definition(ofstream& out, - vector::const_iterator m_iter; - const vector& members = tstruct->get_members(); - -+ string method_prefix = ""; -+ if (service_name_ != "") { -+ method_prefix = service_name_ + "::"; -+ } -+ - // Destructor - if (tstruct->annotations_.find("final") == tstruct->annotations_.end()) { -- force_cpp_out << endl << indent() << tstruct->get_name() << "::~" << tstruct->get_name() -+ force_cpp_out << endl << indent() << method_prefix << -+ tstruct->get_name() << "::~" << tstruct->get_name() - << "() throw() {" << endl; - indent_up(); - -@@ -1145,12 +1153,14 @@ void t_cpp_generator::generate_struct_definition(ofstream& out, - for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { - if (is_reference((*m_iter))) { - std::string type = type_name((*m_iter)->get_type()); -- out << endl << indent() << "void " << tstruct->get_name() << "::__set_" -+ out << endl << indent() << "void " << method_prefix -+ << tstruct->get_name() << "::__set_" - << (*m_iter)->get_name() << "(boost::shared_ptr<" - << type_name((*m_iter)->get_type(), false, false) << ">"; - out << " val) {" << endl; - } else { -- out << endl << indent() << "void " << tstruct->get_name() << "::__set_" -+ out << endl << indent() << "void " << method_prefix -+ << tstruct->get_name() << "::__set_" - << (*m_iter)->get_name() << "(" << type_name((*m_iter)->get_type(), false, true); - out << " val) {" << endl; - } -@@ -1177,11 +1187,16 @@ void t_cpp_generator::generate_struct_definition(ofstream& out, - * @param tstruct The struct - */ - void t_cpp_generator::generate_struct_reader(ofstream& out, t_struct* tstruct, bool pointers) { -+ string method_prefix = ""; -+ if (service_name_ != "") { -+ method_prefix = service_name_ + "::"; -+ } -+ - if (gen_templates_) { - out << indent() << "template " << endl << indent() << "uint32_t " -- << tstruct->get_name() << "::read(Protocol_* iprot) {" << endl; -+ << method_prefix << tstruct->get_name() << "::read(Protocol_* iprot) {" << endl; - } else { -- indent(out) << "uint32_t " << tstruct->get_name() -+ indent(out) << "uint32_t " << method_prefix << tstruct->get_name() - << "::read(::apache::thrift::protocol::TProtocol* iprot) {" << endl; - } - indent_up(); -@@ -1301,14 +1316,18 @@ void t_cpp_generator::generate_struct_reader(ofstream& out, t_struct* tstruct, b - */ - void t_cpp_generator::generate_struct_writer(ofstream& out, t_struct* tstruct, bool pointers) { - string name = tstruct->get_name(); -+ string method_prefix = ""; -+ if (service_name_ != "") { -+ method_prefix = service_name_ + "::"; -+ } - const vector& fields = tstruct->get_sorted_members(); - vector::const_iterator f_iter; - - if (gen_templates_) { - out << indent() << "template " << endl << indent() << "uint32_t " -- << tstruct->get_name() << "::write(Protocol_* oprot) const {" << endl; -+ << method_prefix << tstruct->get_name() << "::write(Protocol_* oprot) const {" << endl; - } else { -- indent(out) << "uint32_t " << tstruct->get_name() -+ indent(out) << "uint32_t " << method_prefix << tstruct->get_name() - << "::write(::apache::thrift::protocol::TProtocol* oprot) const {" << endl; - } - indent_up(); -@@ -1369,14 +1388,18 @@ void t_cpp_generator::generate_struct_result_writer(ofstream& out, - t_struct* tstruct, - bool pointers) { - string name = tstruct->get_name(); -+ string method_prefix = ""; -+ if (service_name_ != "") { -+ method_prefix = service_name_ + "::"; -+ } - const vector& fields = tstruct->get_sorted_members(); - vector::const_iterator f_iter; - - if (gen_templates_) { - out << indent() << "template " << endl << indent() << "uint32_t " -- << tstruct->get_name() << "::write(Protocol_* oprot) const {" << endl; -+ << method_prefix << tstruct->get_name() << "::write(Protocol_* oprot) const {" << endl; - } else { -- indent(out) << "uint32_t " << tstruct->get_name() -+ indent(out) << "uint32_t " << method_prefix << tstruct->get_name() - << "::write(::apache::thrift::protocol::TProtocol* oprot) const {" << endl; - } - indent_up(); -@@ -1385,18 +1408,7 @@ void t_cpp_generator::generate_struct_result_writer(ofstream& out, - - indent(out) << "xfer += oprot->writeStructBegin(\"" << name << "\");" << endl; - -- bool first = true; - for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { -- if (first) { -- first = false; -- out << endl << indent() << "if "; -- } else { -- out << " else if "; -- } -- -- out << "(this->__isset." << (*f_iter)->get_name() << ") {" << endl; -- -- indent_up(); - - // Write field header - out << indent() << "xfer += oprot->writeFieldBegin(" -@@ -1410,9 +1422,6 @@ void t_cpp_generator::generate_struct_result_writer(ofstream& out, - } - // Write field closer - indent(out) << "xfer += oprot->writeFieldEnd();" << endl; -- -- indent_down(); -- indent(out) << "}"; - } - - // Write the struct map -@@ -1478,9 +1487,13 @@ void t_cpp_generator::generate_struct_ostream_operator(std::ofstream& out, t_str - } - - void t_cpp_generator::generate_struct_print_method_decl(std::ofstream& out, t_struct* tstruct) { -+ string method_prefix = ""; -+ if (service_name_ != "") { -+ method_prefix = service_name_ + "::"; -+ } - out << "void "; - if (tstruct) { -- out << tstruct->get_name() << "::"; -+ out << method_prefix << tstruct->get_name() << "::"; - } - out << "printTo(std::ostream& out) const"; - } -@@ -1601,11 +1614,13 @@ void t_cpp_generator::generate_exception_what_method(std::ofstream& out, t_struc - */ - void t_cpp_generator::generate_service(t_service* tservice) { - string svcname = tservice->get_name(); -+ string ns = tservice->get_program()->get_namespace("cpp"); - - // Make output files -- string f_header_name = get_out_dir() + svcname + ".h"; -+ string f_header_name = get_out_dir() + svcname + ".grpc.thrift.h"; - f_header_.open(f_header_name.c_str()); - -+ - // Print header file includes - f_header_ << autogen_comment(); - f_header_ << "#ifndef " << svcname << "_H" << endl << "#define " << svcname << "_H" << endl -@@ -1621,15 +1636,38 @@ void t_cpp_generator::generate_service(t_service* tservice) { - f_header_ << "#include " << endl; - } - f_header_ << "#include " << endl; -+ - f_header_ << "#include \"" << get_include_prefix(*get_program()) << program_name_ << "_types.h\"" - << endl; - - t_service* extends_service = tservice->get_extends(); -- if (extends_service != NULL) { -+ if (extends_service) { - f_header_ << "#include \"" << get_include_prefix(*(extends_service->get_program())) -- << extends_service->get_name() << ".h\"" << endl; -+ << extends_service->get_name() << ".grpc.thrift.h\"" << endl; - } - -+ -+ f_header_ << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl; -+ -+ -+ f_header_ << -+ endl << -+ "namespace grpc {" << endl << -+ "class CompletionQueue;" << endl << -+ "class Channel;" << endl << -+ "class RpcService;" << endl << -+ "class ServerCompletionQueue;" << endl << -+ "class ServerContext;" << endl << -+ "}" << endl; -+ - f_header_ << endl << ns_open_ << endl << endl; - - f_header_ << "#ifdef _WIN32\n" -@@ -1638,10 +1676,13 @@ void t_cpp_generator::generate_service(t_service* tservice) { - "#endif\n\n"; - - // Service implementation file includes -- string f_service_name = get_out_dir() + svcname + ".cpp"; -+ string f_service_name = get_out_dir() + svcname + ".grpc.thrift.cpp"; - f_service_.open(f_service_name.c_str()); - f_service_ << autogen_comment(); -- f_service_ << "#include \"" << get_include_prefix(*get_program()) << svcname << ".h\"" << endl; -+ -+ f_service_ << "#include \"" << -+ get_include_prefix(*get_program()) << svcname << ".grpc.thrift.h\"" << endl; -+ - if (gen_cob_style_) { - f_service_ << "#include \"thrift/async/TAsyncChannel.h\"" << endl; - } -@@ -1652,7 +1693,7 @@ void t_cpp_generator::generate_service(t_service* tservice) { - string f_service_tcc_name = get_out_dir() + svcname + ".tcc"; - f_service_tcc_.open(f_service_tcc_name.c_str()); - f_service_tcc_ << autogen_comment(); -- f_service_tcc_ << "#include \"" << get_include_prefix(*get_program()) << svcname << ".h\"" -+ f_service_tcc_ << "#include \"" << get_include_prefix(*get_program()) << svcname << ".grpc.thrift.h\"" - << endl; - - f_service_tcc_ << "#ifndef " << svcname << "_TCC" << endl << "#define " << svcname << "_TCC" -@@ -1663,19 +1704,69 @@ void t_cpp_generator::generate_service(t_service* tservice) { - } - } - -+ f_service_ << -+ endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ endl; -+ - f_service_ << endl << ns_open_ << endl << endl; - f_service_tcc_ << endl << ns_open_ << endl << endl; - -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ -+ f_service_ << -+ "static const char* " << service_name_ << "_method_names[] = {" << endl; -+ -+ -+ indent_up(); -+ -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "\"/" << ns << "." << service_name_ << "/" << (*f_iter)->get_name() << "\"," << endl; -+ } -+ -+ -+ t_service* service_iter = extends_service; -+ while (service_iter) { -+ vector functions = service_iter->get_functions(); -+ vector::iterator f_iter; -+ -+ for ( f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "\"/" << service_iter->get_program()->get_namespace("cpp") << -+ "." << service_iter->get_name() << "/" << (*f_iter)->get_name() << "\"," << endl; -+ } -+ service_iter = service_iter->get_extends(); -+ } -+ -+ indent_down(); -+ f_service_ << -+ "};" << endl; -+ -+ // Generate service class -+ if ( extends_service) { -+ f_header_ << "class " << service_name_ << " : public " << -+ type_name(extends_service) << " {" << endl << -+ "public:" << endl; -+ } -+ else { -+ f_header_ << "class " << service_name_ << "{" << endl << -+ "public:" << endl; -+ } -+ - // Generate all the components -- generate_service_interface(tservice, ""); -- generate_service_interface_factory(tservice, ""); -- generate_service_null(tservice, ""); - generate_service_helpers(tservice); -- generate_service_client(tservice, ""); -- generate_service_processor(tservice, ""); -- generate_service_multiface(tservice); -- generate_service_skeleton(tservice); -- generate_service_client(tservice, "Concurrent"); -+ generate_service_interface(tservice, ""); -+ generate_service_stub_interface(tservice); -+ generate_service_stub(tservice); - - // Generate all the cob components - if (gen_cob_style_) { -@@ -1688,10 +1779,14 @@ void t_cpp_generator::generate_service(t_service* tservice) { - generate_service_async_skeleton(tservice); - } - -+ // Close service class -+ f_header_ << "};" << endl; -+ - f_header_ << "#ifdef _WIN32\n" - " #pragma warning( pop )\n" - "#endif\n\n"; - -+ - // Close the namespace - f_service_ << ns_close_ << endl << endl; - f_service_tcc_ << ns_close_ << endl << endl; -@@ -1729,15 +1824,11 @@ void t_cpp_generator::generate_service_helpers(t_service* tservice) { - string name_orig = ts->get_name(); - - // TODO(dreiss): Why is this stuff not in generate_function_helpers? -- ts->set_name(tservice->get_name() + "_" + (*f_iter)->get_name() + "_args"); -+ ts->set_name((*f_iter)->get_name() + "Req"); - generate_struct_declaration(f_header_, ts, false); -- generate_struct_definition(out, f_service_, ts, false); -+ generate_struct_definition(out, f_service_, ts, true); - generate_struct_reader(out, ts); - generate_struct_writer(out, ts); -- ts->set_name(tservice->get_name() + "_" + (*f_iter)->get_name() + "_pargs"); -- generate_struct_declaration(f_header_, ts, false, true, false, true); -- generate_struct_definition(out, f_service_, ts, false); -- generate_struct_writer(out, ts, true); - ts->set_name(name_orig); - - generate_function_helpers(tservice, *f_iter); -@@ -1745,13 +1836,218 @@ void t_cpp_generator::generate_service_helpers(t_service* tservice) { - } - - /** -+ * Generates a service Stub Interface -+ * -+ * @param tservice The service to generate a stub for. -+ * -+ */ -+void t_cpp_generator::generate_service_stub_interface(t_service* tservice) { -+ -+ string extends = ""; -+ if (tservice->get_extends()) { -+ extends = " : virtual public " + type_name(tservice->get_extends()) + "::StubInterface"; -+ } -+ -+ f_header_ << -+ endl << -+ "class StubInterface " << extends << " {" << endl; -+ indent_up(); -+ f_header_ << -+ " public:" << endl << -+ indent() << "virtual ~StubInterface() {}" << endl; -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ string function_name = (*f_iter)->get_name(); -+ f_header_ << -+ indent() << "virtual ::grpc::Status " << function_name << -+ "(::grpc::ClientContext* context, const " << function_name << -+ "Req& request, " << function_name << "Resp* response) = 0;" << endl; -+ } -+ indent_down(); -+ f_header_ << -+ "};" << endl << endl; -+ -+} -+void t_cpp_generator::generate_service_stub(t_service* tservice) { -+ f_header_ << -+ endl << -+ "class Stub : public StubInterface {" << -+ endl; -+ -+ indent_up(); -+ f_header_ << -+ " public:" << endl << -+ indent() << "Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);" << -+ endl; -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ string function_name = (*f_iter)->get_name(); -+ f_header_ << -+ indent() << "::grpc::Status " << function_name << -+ "(::grpc::ClientContext* context, const " << function_name << -+ "Req& request, " << function_name << "Resp* response) override;" << endl; -+ } -+ -+ t_service* extends_service = tservice->get_extends(); -+ t_service* service_iter = extends_service; -+ while (service_iter) { -+ // generate inherited methods -+ vector functions = service_iter->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ string function_name = (*f_iter)->get_name(); -+ f_header_ << -+ indent() << "::grpc::Status " << function_name << -+ "(::grpc::ClientContext* context, const " << function_name << -+ "Req& request, " << function_name << "Resp* response) override;" << endl; -+ } -+ service_iter = service_iter->get_extends(); -+ } -+ -+ f_header_ << -+ endl << -+ " private:" << endl << -+ indent() << "std::shared_ptr< ::grpc::ChannelInterface> channel_;" << -+ endl; -+ -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_header_ << -+ indent() << "const ::grpc::RpcMethod rpcmethod_" << (*f_iter)->get_name() << "_;" << endl; -+ } -+ -+ service_iter = extends_service; -+ while (service_iter) { -+ // generate inherited methods -+ vector functions = service_iter->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_header_ << -+ indent() << "const ::grpc::RpcMethod rpcmethod_" << (*f_iter)->get_name() << "_;" << endl; -+ } -+ service_iter = service_iter->get_extends(); -+ } -+ -+ indent_down(); -+ f_header_ << -+ "};" << endl << endl; -+ -+ // generate the implementaion of Stub -+ f_service_ << -+ endl << -+ service_name_ << "::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)" << endl; -+ -+ indent_up(); -+ f_service_ << -+ indent() << ": channel_(channel)" << endl; -+ int i=0; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter , ++i) { -+ f_service_ << -+ indent() << -+ ", rpcmethod_" << (*f_iter)->get_name() << "_(" << -+ service_name_ << "_method_names[" << i << "], ::grpc::RpcMethod::NORMAL_RPC, channel)" << endl; -+ } -+ -+ service_iter = extends_service; -+ while (service_iter) { -+ // generate inherited methods -+ vector functions = service_iter->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter, ++i) { -+ f_service_ << -+ indent() << -+ ", rpcmethod_" << (*f_iter)->get_name() << "_(" << -+ service_name_ << "_method_names[" << i << "], ::grpc::RpcMethod::NORMAL_RPC, channel)" << endl; -+ } -+ service_iter = service_iter->get_extends(); -+ } -+ f_service_ << -+ indent() << "{}" << endl; -+ indent_down(); -+ -+ // generate NewStub -+ f_header_ << -+ endl << -+ "static std::unique_ptr NewStub(const std::shared_ptr\ -+ < ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());" << -+ endl; -+ -+ // generate NewStub Implementation -+ f_service_ << -+ endl << -+ "std::unique_ptr< " << service_name_ << "::Stub> " << service_name_ << "::NewStub(const std::shared_ptr\ -+ < ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {" << endl; -+ -+ indent_up(); -+ f_service_ << -+ indent() << "std::unique_ptr< " << service_name_ << "::Stub> stub(new " << service_name_ << -+ "::Stub(channel));" << endl << -+ indent() << "return stub;" << endl; -+ indent_down(); -+ f_service_ << -+ "}" << endl; -+ -+ // generate stub methods -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ string function_name = (*f_iter)->get_name(); -+ f_service_ << -+ endl << -+ "::grpc::Status " << service_name_ << "::Stub::" << function_name << -+ "(::grpc::ClientContext* context, const " << service_name_ << "::" << -+ function_name << "Req& request, " << service_name_ << "::" << -+ function_name << "Resp* response) {" << endl; -+ -+ indent_up(); -+ f_service_ << -+ indent() << "return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_" << -+ function_name << "_, context, request, response);" << endl; -+ indent_down(); -+ -+ f_service_ << -+ "}" << endl; -+ -+ } -+ -+ service_iter = extends_service; -+ while (service_iter) { -+ vector functions = service_iter->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ string function_name = (*f_iter)->get_name(); -+ f_service_ << -+ endl << -+ "::grpc::Status " << service_name_ << "::Stub::" << function_name << -+ "(::grpc::ClientContext* context, const " << service_name_ << "::" << -+ function_name << "Req& request, " << service_name_ << "::" << -+ function_name << "Resp* response) {" << endl; -+ -+ indent_up(); -+ f_service_ << -+ indent() << "return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_" << -+ function_name << "_, context, request, response);" << endl; -+ indent_down(); -+ -+ f_service_ << -+ "}" << endl; -+ -+ } -+ service_iter = service_iter->get_extends(); -+ } -+ -+} -+ -+ -+/** - * Generates a service interface definition. - * - * @param tservice The service to generate a header definition for - */ - void t_cpp_generator::generate_service_interface(t_service* tservice, string style) { - -- string service_if_name = service_name_ + style + "If"; -+ string service_if_name = "Service"; - if (style == "CobCl") { - // Forward declare the client. - string client_name = service_name_ + "CobClient"; -@@ -1764,13 +2060,15 @@ void t_cpp_generator::generate_service_interface(t_service* tservice, string sty - } - - string extends = ""; -- if (tservice->get_extends() != NULL) { -- extends = " : virtual public " + type_name(tservice->get_extends()) + style + "If"; -+ if (tservice->get_extends()) { -+ extends = " : virtual public " + type_name(tservice->get_extends()) + style + "::Service"; - if (style == "CobCl" && gen_templates_) { - // TODO(simpkins): If gen_templates_ is enabled, we currently assume all - // parent services were also generated with templates enabled. - extends += "T"; - } -+ } else { -+ extends = " : public ::grpc::Service"; - } - - if (style == "CobCl" && gen_templates_) { -@@ -1778,7 +2076,9 @@ void t_cpp_generator::generate_service_interface(t_service* tservice, string sty - } - f_header_ << "class " << service_if_name << extends << " {" << endl << " public:" << endl; - indent_up(); -- f_header_ << indent() << "virtual ~" << service_if_name << "() {}" << endl; -+ -+ f_header_ << indent() << "Service();" << endl; -+ f_header_ << indent() << "virtual ~Service();" << endl; - - vector functions = tservice->get_functions(); - vector::iterator f_iter; -@@ -1786,7 +2086,12 @@ void t_cpp_generator::generate_service_interface(t_service* tservice, string sty - if ((*f_iter)->has_doc()) - f_header_ << endl; - generate_java_doc(f_header_, *f_iter); -- f_header_ << indent() << "virtual " << function_signature(*f_iter, style) << " = 0;" << endl; -+ -+ string function_name = (*f_iter)->get_name(); -+ f_header_ << -+ indent() << "virtual ::grpc::Status " << function_name << -+ "(::grpc::ServerContext* context, const "<< function_name << -+ "Req* request, "<< function_name << "Resp* response);" << endl; - } - indent_down(); - f_header_ << "};" << endl << endl; -@@ -1797,6 +2102,66 @@ void t_cpp_generator::generate_service_interface(t_service* tservice, string sty - f_header_ << "typedef " << service_if_name << "< ::apache::thrift::protocol::TProtocol> " - << service_name_ << style << "If;" << endl << endl; - } -+ -+ // generate the service interface implementations -+ -+ f_service_ << -+ endl << -+ service_name_ << "::Service::Service() {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "(void)" << service_name_ << "_method_names;" << endl; -+ uint32_t i=0; -+ for(i=0;iget_name(); -+ f_service_ << -+ endl << -+ indent() << "AddMethod(new ::grpc::RpcServiceMethod(" << endl; -+ indent_up(); -+ -+ f_service_ << -+ indent() << service_name_ << "_method_names[" << i << "]," << endl << -+ indent() << "::grpc::RpcMethod::NORMAL_RPC," << endl << -+ indent() << "new ::grpc::RpcMethodHandler< " << service_name_ << "::Service, " << -+ service_name_ << "::" << function_name << "Req, " << service_name_ << "::" << -+ function_name << "Resp>(" << endl; -+ -+ indent_up(); -+ f_service_ << -+ indent() << "std::mem_fn(&" << service_name_ << "::Service::" << function_name << "), this)));" << endl; -+ -+ indent_down(); -+ indent_down(); -+ } -+ -+ indent_down(); -+ f_service_ << -+ "}" << endl; -+ -+ f_service_ << -+ endl << -+ service_name_ << "::Service::~Service() {" << endl << -+ "}" << endl; -+ -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ string function_name = (*f_iter)->get_name(); -+ f_service_ << -+ endl << -+ "::grpc::Status " << service_name_ << "::Service::" << function_name << -+ "(::grpc::ServerContext* context, const " << service_name_ << "::" << function_name << -+ "Req* request, " << service_name_ << "::" << function_name << "Resp* response) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "(void) context;" << endl << -+ indent() << "(void) request;" << endl << -+ indent() << "(void) response;" << endl << -+ indent() << "return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED,\"\");" << endl; -+ indent_down(); -+ -+ f_service_ << -+ "}" << endl; -+ } -+ - } - - /** -@@ -3095,7 +3460,7 @@ void t_cpp_generator::generate_function_helpers(t_service* tservice, t_function* - - std::ofstream& out = (gen_templates_ ? f_service_tcc_ : f_service_); - -- t_struct result(program_, tservice->get_name() + "_" + tfunction->get_name() + "_result"); -+ t_struct result(program_, tfunction->get_name() + "Resp"); - t_field success(tfunction->get_returntype(), "success", 0); - if (!tfunction->get_returntype()->is_void()) { - result.append(&success); -@@ -3109,17 +3474,9 @@ void t_cpp_generator::generate_function_helpers(t_service* tservice, t_function* - } - - generate_struct_declaration(f_header_, &result, false); -- generate_struct_definition(out, f_service_, &result, false); -+ generate_struct_definition(out, f_service_, &result, true); - generate_struct_reader(out, &result); - generate_struct_result_writer(out, &result); -- -- result.set_name(tservice->get_name() + "_" + tfunction->get_name() + "_presult"); -- generate_struct_declaration(f_header_, &result, false, true, true, gen_cob_style_); -- generate_struct_definition(out, f_service_, &result, false); -- generate_struct_reader(out, &result, true); -- if (gen_cob_style_) { -- generate_struct_writer(out, &result, true); -- } - } - - /** -@@ -3162,8 +3519,8 @@ void t_cpp_generator::generate_process_function(t_service* tservice, - << endl; - scope_up(out); - -- string argsname = tservice->get_name() + "_" + tfunction->get_name() + "_args"; -- string resultname = tservice->get_name() + "_" + tfunction->get_name() + "_result"; -+ string argsname = tfunction->get_name() + "Req"; -+ string resultname = tfunction->get_name() + "Resp"; - - if (tfunction->is_oneway() && !unnamed_oprot_seqid) { - out << indent() << "(void) seqid;" << endl << indent() << "(void) oprot;" << endl; -@@ -3320,7 +3677,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice, - out << indent() << "(void) seqid;" << endl << indent() << "(void) oprot;" << endl; - } - -- out << indent() << tservice->get_name() + "_" + tfunction->get_name() << "_args args;" << endl -+ out << indent() << tfunction->get_name() << "Req args;" << endl - << indent() << "void* ctx = NULL;" << endl << indent() - << "if (this->eventHandler_.get() != NULL) {" << endl << indent() - << " ctx = this->eventHandler_->getContext(" << service_func_name << ", NULL);" << endl -@@ -3487,7 +3844,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice, - << "this->eventHandler_.get(), ctx, " << service_func_name << ");" << endl << endl; - - // Throw the TDelayedException, and catch the result -- out << indent() << tservice->get_name() << "_" << tfunction->get_name() << "_result result;" -+ out << indent() << tfunction->get_name() << "Resp result;" - << endl << endl << indent() << "try {" << endl; - indent_up(); - out << indent() << "_throw->throw_it();" << endl << indent() << "return cob(false);" -diff --git a/tutorial/cpp/CMakeLists.txt b/tutorial/cpp/CMakeLists.txt -deleted file mode 100644 -index 8a3d085..0000000 ---- a/tutorial/cpp/CMakeLists.txt -+++ /dev/null -@@ -1,53 +0,0 @@ --# --# Licensed to the Apache Software Foundation (ASF) under one --# or more contributor license agreements. See the NOTICE file --# distributed with this work for additional information --# regarding copyright ownership. The ASF licenses this file --# to you 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. --# -- --find_package(Boost 1.53.0 REQUIRED) --include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") -- --#Make sure gen-cpp files can be included --include_directories("${CMAKE_CURRENT_BINARY_DIR}") --include_directories("${CMAKE_CURRENT_BINARY_DIR}/gen-cpp") --include_directories("${PROJECT_SOURCE_DIR}/lib/cpp/src") -- --include(ThriftMacros) -- --set(tutorialgencpp_SOURCES -- gen-cpp/Calculator.cpp -- gen-cpp/SharedService.cpp -- gen-cpp/shared_constants.cpp -- gen-cpp/shared_types.cpp -- gen-cpp/tutorial_constants.cpp -- gen-cpp/tutorial_types.cpp --) --add_library(tutorialgencpp STATIC ${tutorialgencpp_SOURCES}) --LINK_AGAINST_THRIFT_LIBRARY(tutorialgencpp thrift) -- --add_custom_command(OUTPUT gen-cpp/Calculator.cpp gen-cpp/SharedService.cpp gen-cpp/shared_constants.cpp gen-cpp/shared_types.cpp gen-cpp/tutorial_constants.cpp gen-cpp/tutorial_types.cpp -- COMMAND ${THRIFT_COMPILER} --gen cpp -r ${PROJECT_SOURCE_DIR}/tutorial/tutorial.thrift --) -- --add_executable(TutorialServer CppServer.cpp) --target_link_libraries(TutorialServer tutorialgencpp) --LINK_AGAINST_THRIFT_LIBRARY(TutorialServer thrift) --target_link_libraries(TutorialServer ${ZLIB_LIBRARIES}) -- --add_executable(TutorialClient CppClient.cpp) --target_link_libraries(TutorialClient tutorialgencpp) --LINK_AGAINST_THRIFT_LIBRARY(TutorialClient thrift) --target_link_libraries(TutorialClient ${ZLIB_LIBRARIES}) -diff --git a/tutorial/cpp/CppClient.cpp b/tutorial/cpp/CppClient.cpp -deleted file mode 100644 -index 2763fee..0000000 ---- a/tutorial/cpp/CppClient.cpp -+++ /dev/null -@@ -1,80 +0,0 @@ --/* -- * Licensed to the Apache Software Foundation (ASF) under one -- * or more contributor license agreements. See the NOTICE file -- * distributed with this work for additional information -- * regarding copyright ownership. The ASF licenses this file -- * to you 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 -- --#include --#include --#include -- --#include "../gen-cpp/Calculator.h" -- --using namespace std; --using namespace apache::thrift; --using namespace apache::thrift::protocol; --using namespace apache::thrift::transport; -- --using namespace tutorial; --using namespace shared; -- --int main() { -- boost::shared_ptr socket(new TSocket("localhost", 9090)); -- boost::shared_ptr transport(new TBufferedTransport(socket)); -- boost::shared_ptr protocol(new TBinaryProtocol(transport)); -- CalculatorClient client(protocol); -- -- try { -- transport->open(); -- -- client.ping(); -- cout << "ping()" << endl; -- -- cout << "1 + 1 = " << client.add(1, 1) << endl; -- -- Work work; -- work.op = Operation::DIVIDE; -- work.num1 = 1; -- work.num2 = 0; -- -- try { -- client.calculate(1, work); -- cout << "Whoa? We can divide by zero!" << endl; -- } catch (InvalidOperation& io) { -- cout << "InvalidOperation: " << io.why << endl; -- // or using generated operator<<: cout << io << endl; -- // or by using std::exception native method what(): cout << io.what() << endl; -- } -- -- work.op = Operation::SUBTRACT; -- work.num1 = 15; -- work.num2 = 10; -- int32_t diff = client.calculate(1, work); -- cout << "15 - 10 = " << diff << endl; -- -- // Note that C++ uses return by reference for complex types to avoid -- // costly copy construction -- SharedStruct ss; -- client.getStruct(ss, 1); -- cout << "Received log: " << ss << endl; -- -- transport->close(); -- } catch (TException& tx) { -- cout << "ERROR: " << tx.what() << endl; -- } --} -diff --git a/tutorial/cpp/CppServer.cpp b/tutorial/cpp/CppServer.cpp -deleted file mode 100644 -index eafffa9..0000000 ---- a/tutorial/cpp/CppServer.cpp -+++ /dev/null -@@ -1,181 +0,0 @@ --/* -- * Licensed to the Apache Software Foundation (ASF) under one -- * or more contributor license agreements. See the NOTICE file -- * distributed with this work for additional information -- * regarding copyright ownership. The ASF licenses this file -- * to you 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 --#include --#include --#include --#include --#include --#include --#include --#include --#include -- --#include -- --#include --#include --#include -- --#include "../gen-cpp/Calculator.h" -- --using namespace std; --using namespace apache::thrift; --using namespace apache::thrift::concurrency; --using namespace apache::thrift::protocol; --using namespace apache::thrift::transport; --using namespace apache::thrift::server; -- --using namespace tutorial; --using namespace shared; -- --class CalculatorHandler : public CalculatorIf { --public: -- CalculatorHandler() {} -- -- void ping() { cout << "ping()" << endl; } -- -- int32_t add(const int32_t n1, const int32_t n2) { -- cout << "add(" << n1 << ", " << n2 << ")" << endl; -- return n1 + n2; -- } -- -- int32_t calculate(const int32_t logid, const Work& work) { -- cout << "calculate(" << logid << ", " << work << ")" << endl; -- int32_t val; -- -- switch (work.op) { -- case Operation::ADD: -- val = work.num1 + work.num2; -- break; -- case Operation::SUBTRACT: -- val = work.num1 - work.num2; -- break; -- case Operation::MULTIPLY: -- val = work.num1 * work.num2; -- break; -- case Operation::DIVIDE: -- if (work.num2 == 0) { -- InvalidOperation io; -- io.whatOp = work.op; -- io.why = "Cannot divide by 0"; -- throw io; -- } -- val = work.num1 / work.num2; -- break; -- default: -- InvalidOperation io; -- io.whatOp = work.op; -- io.why = "Invalid Operation"; -- throw io; -- } -- -- SharedStruct ss; -- ss.key = logid; -- ss.value = to_string(val); -- -- log[logid] = ss; -- -- return val; -- } -- -- void getStruct(SharedStruct& ret, const int32_t logid) { -- cout << "getStruct(" << logid << ")" << endl; -- ret = log[logid]; -- } -- -- void zip() { cout << "zip()" << endl; } -- --protected: -- map log; --}; -- --/* -- CalculatorIfFactory is code generated. -- CalculatorCloneFactory is useful for getting access to the server side of the -- transport. It is also useful for making per-connection state. Without this -- CloneFactory, all connections will end up sharing the same handler instance. --*/ --class CalculatorCloneFactory : virtual public CalculatorIfFactory { -- public: -- virtual ~CalculatorCloneFactory() {} -- virtual CalculatorIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) -- { -- boost::shared_ptr sock = boost::dynamic_pointer_cast(connInfo.transport); -- cout << "Incoming connection\n"; -- cout << "\tSocketInfo: " << sock->getSocketInfo() << "\n"; -- cout << "\tPeerHost: " << sock->getPeerHost() << "\n"; -- cout << "\tPeerAddress: " << sock->getPeerAddress() << "\n"; -- cout << "\tPeerPort: " << sock->getPeerPort() << "\n"; -- return new CalculatorHandler; -- } -- virtual void releaseHandler( ::shared::SharedServiceIf* handler) { -- delete handler; -- } --}; -- --int main() { -- TThreadedServer server( -- boost::make_shared(boost::make_shared()), -- boost::make_shared(9090), //port -- boost::make_shared(), -- boost::make_shared()); -- -- /* -- // if you don't need per-connection state, do the following instead -- TThreadedServer server( -- boost::make_shared(boost::make_shared()), -- boost::make_shared(9090), //port -- boost::make_shared(), -- boost::make_shared()); -- */ -- -- /** -- * Here are some alternate server types... -- -- // This server only allows one connection at a time, but spawns no threads -- TSimpleServer server( -- boost::make_shared(boost::make_shared()), -- boost::make_shared(9090), -- boost::make_shared(), -- boost::make_shared()); -- -- const int workerCount = 4; -- -- boost::shared_ptr threadManager = -- ThreadManager::newSimpleThreadManager(workerCount); -- threadManager->threadFactory( -- boost::make_shared()); -- threadManager->start(); -- -- // This server allows "workerCount" connection at a time, and reuses threads -- TThreadPoolServer server( -- boost::make_shared(boost::make_shared()), -- boost::make_shared(9090), -- boost::make_shared(), -- boost::make_shared(), -- threadManager); -- */ -- -- cout << "Starting the server..." << endl; -- server.serve(); -- cout << "Done." << endl; -- return 0; --} -diff --git a/tutorial/cpp/GriftClient.cpp b/tutorial/cpp/GriftClient.cpp -new file mode 100644 -index 0000000..647a683 ---- /dev/null -+++ b/tutorial/cpp/GriftClient.cpp -@@ -0,0 +1,93 @@ -+/* -+ * -+ * Copyright 2016, Google Inc. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are -+ * met: -+ * -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * * Redistributions in binary form must reproduce the above -+ * copyright notice, this list of conditions and the following disclaimer -+ * in the documentation and/or other materials provided with the -+ * distribution. -+ * * Neither the name of Google Inc. nor the names of its -+ * contributors may be used to endorse or promote products derived from -+ * this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ */ -+ -+#include -+#include -+#include -+ -+#include -+ -+#include "gen-cpp/Greeter.grpc.thrift.h" -+ -+using grpc::Channel; -+using grpc::ClientContext; -+using grpc::Status; -+using test::Greeter; -+ -+class GreeterClient { -+ public: -+ GreeterClient(std::shared_ptr 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. -+ Greeter::SayHelloReq req; -+ req.request.name = user; -+ -+ // Container for the data we expect from the server. -+ Greeter::SayHelloResp 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. -+ Status status = stub_->SayHello(&context, req, &reply); -+ -+ // Act upon its status. -+ if (status.ok()) { -+ return reply.success.message; -+ } else { -+ return "RPC failed"; -+ } -+ } -+ -+ private: -+ std::unique_ptr stub_; -+}; -+ -+int main() { -+ // Instantiate the client. It requires a channel, out of which the actual RPCs -+ // are created. This channel models a connection to an endpoint (in this case, -+ // localhost at port 50051). We indicate that the channel isn't authenticated -+ // (use of InsecureChannelCredentials()). -+ GreeterClient greeter(grpc::CreateChannel( -+ "localhost:50051", grpc::InsecureChannelCredentials())); -+ std::string user("world"); -+ std::string reply = greeter.SayHello(user); -+ std::cout << "Greeter received: " << reply << std::endl; -+ -+ return 0; -+} -diff --git a/tutorial/cpp/GriftServer.cpp b/tutorial/cpp/GriftServer.cpp -new file mode 100644 -index 0000000..7c01606 ---- /dev/null -+++ b/tutorial/cpp/GriftServer.cpp -@@ -0,0 +1,93 @@ -+/* -+ * -+ * Copyright 2016, Google Inc. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are -+ * met: -+ * -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * * Redistributions in binary form must reproduce the above -+ * copyright notice, this list of conditions and the following disclaimer -+ * in the documentation and/or other materials provided with the -+ * distribution. -+ * * Neither the name of Google Inc. nor the names of its -+ * contributors may be used to endorse or promote products derived from -+ * this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ */ -+ -+#include -+#include -+#include -+ -+#include -+ -+#include "gen-cpp/Greeter.grpc.thrift.h" -+#include -+ -+using grpc::Server; -+using grpc::ServerBuilder; -+using grpc::ServerContext; -+using grpc::Status; -+using test::Greeter; -+ -+// Logic and data behind the server's behavior. -+class GreeterServiceImpl final : public Greeter::Service { -+ public: -+ ~GreeterServiceImpl() { -+ // shutdown server -+ server->Shutdown(); -+ } -+ -+ Status SayHello(ServerContext* context,const Greeter::SayHelloReq* request, -+ Greeter::SayHelloResp* reply) override { -+ std::string prefix("Hello "); -+ -+ reply->success.message = prefix + request->request.name; -+ -+ return Status::OK; -+ } -+ -+ void RunServer() { -+ std::string server_address("0.0.0.0:50051"); -+ -+ ServerBuilder builder; -+ // Listen on the given address without any authentication mechanism. -+ builder.AddListeningPort(server_address, grpc::InsecureServerCredentials()); -+ // Register "service" as the instance through which we'll communicate with -+ // clients. In this case it corresponds to an *synchronous* service. -+ builder.RegisterService(this); -+ // Finally assemble the 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(); -+ } -+ -+ private: -+ std::unique_ptr server; -+}; -+ -+int main() { -+ GreeterServiceImpl service; -+ service.RunServer(); -+ -+ return 0; -+} -diff --git a/tutorial/cpp/Makefile.am b/tutorial/cpp/Makefile.am -index 184a69d..6f91e28 100755 ---- a/tutorial/cpp/Makefile.am -+++ b/tutorial/cpp/Makefile.am -@@ -18,44 +18,38 @@ - # - AUTOMAKE_OPTIONS = subdir-objects serial-tests - --BUILT_SOURCES = gen-cpp/shared_types.cpp \ -- gen-cpp/tutorial_types.cpp -+BUILT_SOURCES = gen-cpp/test_types.cpp - --noinst_LTLIBRARIES = libtutorialgencpp.la --nodist_libtutorialgencpp_la_SOURCES = \ -- gen-cpp/Calculator.cpp \ -- gen-cpp/Calculator.h \ -- gen-cpp/SharedService.cpp \ -- gen-cpp/SharedService.h \ -- gen-cpp/shared_constants.cpp \ -- gen-cpp/shared_constants.h \ -- gen-cpp/shared_types.cpp \ -- gen-cpp/shared_types.h \ -- gen-cpp/tutorial_constants.cpp \ -- gen-cpp/tutorial_constants.h \ -- gen-cpp/tutorial_types.cpp \ -- gen-cpp/tutorial_types.h -+#noinst_LTLIBRARIES = libtutorialgencpp.la -+noinst_LTLIBRARIES = libtestgencpp.la -+nodist_libtestgencpp_la_SOURCES = \ -+ gen-cpp/Greeter.grpc.thrift.cpp \ -+ gen-cpp/Greeter.grpc.thrift.h \ -+ gen-cpp/test_constants.cpp \ -+ gen-cpp/test_constants.h \ -+ gen-cpp/test_types.cpp \ -+ gen-cpp/test_types.h - - - --libtutorialgencpp_la_LIBADD = $(top_builddir)/lib/cpp/libthrift.la -+libtestgencpp_la_LIBADD = $(top_builddir)/lib/cpp/libthrift.la - - noinst_PROGRAMS = \ -- TutorialServer \ -- TutorialClient -+ TestServer \ -+ TestClient - --TutorialServer_SOURCES = \ -- CppServer.cpp -+TestServer_SOURCES = \ -+ GriftServer.cpp - --TutorialServer_LDADD = \ -- libtutorialgencpp.la \ -+TestServer_LDADD = \ -+ libtestgencpp.la \ - $(top_builddir)/lib/cpp/libthrift.la - --TutorialClient_SOURCES = \ -- CppClient.cpp -+TestClient_SOURCES = \ -+ GriftClient.cpp - --TutorialClient_LDADD = \ -- libtutorialgencpp.la \ -+TestClient_LDADD = \ -+ libtestgencpp.la \ - $(top_builddir)/lib/cpp/libthrift.la - - # -@@ -63,26 +57,26 @@ TutorialClient_LDADD = \ - # - THRIFT = $(top_builddir)/compiler/cpp/thrift - --gen-cpp/Calculator.cpp gen-cpp/SharedService.cpp gen-cpp/shared_constants.cpp gen-cpp/shared_types.cpp gen-cpp/tutorial_constants.cpp gen-cpp/tutorial_types.cpp: $(top_srcdir)/tutorial/tutorial.thrift -+gen-cpp/Greeter.grpc.thrift.cpp gen-cpp/test_constants.cpp gen-cpp/test_types.cpp: $(top_srcdir)/tutorial/cpp/test.thrift - $(THRIFT) --gen cpp -r $< - - AM_CPPFLAGS = $(BOOST_CPPFLAGS) $(LIBEVENT_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src -Igen-cpp - AM_CXXFLAGS = -Wall -Wextra -pedantic --AM_LDFLAGS = $(BOOST_LDFLAGS) $(LIBEVENT_LDFLAGS) -+AM_LDFLAGS = $(BOOST_LDFLAGS) $(LIBEVENT_LDFLAGS) `pkg-config --libs grpc++ grpc` -lpthread -ldl -lgrpc - - clean-local: -- $(RM) gen-cpp/* -+ $(RM) -r gen-cpp - --tutorialserver: all -- ./TutorialServer -+testserver: all -+ ./TestServer - --tutorialclient: all -- ./TutorialClient -+testclient: all -+ ./TestClient - - style-local: - $(CPPSTYLE_CMD) - - EXTRA_DIST = \ - CMakeLists.txt \ -- CppClient.cpp \ -- CppServer.cpp -+ GriftClient.cpp \ -+ GriftServer.cpp -diff --git a/tutorial/cpp/test.thrift b/tutorial/cpp/test.thrift -new file mode 100644 -index 0000000..de3c9a4 ---- /dev/null -+++ b/tutorial/cpp/test.thrift -@@ -0,0 +1,13 @@ -+namespace cpp test -+ -+struct HelloRequest { -+ 1:string name -+} -+ -+struct HelloResponse { -+ 1:string message -+} -+ -+service Greeter { -+ HelloResponse SayHello(1:HelloRequest request); -+} -\ No newline at end of file --- -2.8.0.rc3.226.g39d4020 - - -From 3e4d75a2e2c474ee7700e7c9acaf89fdb768bedc Mon Sep 17 00:00:00 2001 -From: chedeti -Date: Sun, 31 Jul 2016 16:23:53 -0700 -Subject: [PATCH 3/3] grpc java plugins generator - -for examples refer to https://github.com/grpc/grpc-java/tree/master/examples/thrift ---- - compiler/cpp/src/generate/t_java_generator.cc | 906 +++++++++++++++++++++++++- - tutorial/Makefile.am | 8 +- - 2 files changed, 887 insertions(+), 27 deletions(-) - -diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc -index 2db8cb8..8b28fe2 100644 ---- a/compiler/cpp/src/generate/t_java_generator.cc -+++ b/compiler/cpp/src/generate/t_java_generator.cc -@@ -97,10 +97,10 @@ public: - } else if(iter->second.compare("suppress") == 0) { - suppress_generated_annotations_ = true; - } else { -- throw "unknown option java:" + iter->first + "=" + iter->second; -+ throw "unknown option java:" + iter->first + "=" + iter->second; - } - } else { -- throw "unknown option java:" + iter->first; -+ throw "unknown option java:" + iter->first; - } - } - -@@ -195,6 +195,17 @@ public: - void generate_service_async_server(t_service* tservice); - void generate_process_function(t_service* tservice, t_function* tfunction); - void generate_process_async_function(t_service* tservice, t_function* tfunction); -+ void generate_service_impl_base(t_service* tservice); -+ void generate_method_descriptors(t_service* tservice); -+ void generate_stub(t_service* tservice); -+ void generate_blocking_stub(t_service* tservice); -+ void generate_future_stub(t_service* tservice); -+ void generate_method_ids(t_service* tservice); -+ void generate_method_handlers(t_service* tservice); -+ void generate_service_descriptors(t_service* tservice); -+ void generate_service_builder(t_service* tservice); -+ void generate_arg_ids(t_service* tservice); -+ void generate_message_factory(t_service* tservice); - - void generate_java_union(t_struct* tstruct); - void generate_union_constructor(ofstream& out, t_struct* tstruct); -@@ -307,6 +318,8 @@ public: - std::string java_package(); - std::string java_type_imports(); - std::string java_suppressions(); -+ std::string grpc_imports(); -+ std::string import_extended_service(t_service* tservice); - std::string type_name(t_type* ttype, - bool in_container = false, - bool in_init = false, -@@ -368,7 +381,7 @@ private: - bool use_option_type_; - bool undated_generated_annotations_; - bool suppress_generated_annotations_; -- -+ - }; - - /** -@@ -456,6 +469,35 @@ string t_java_generator::java_suppressions() { - return "@SuppressWarnings({\"cast\", \"rawtypes\", \"serial\", \"unchecked\", \"unused\"})\n"; - } - -+string t_java_generator::grpc_imports() { -+ return -+ string() + -+ "import static io.grpc.stub.ClientCalls.asyncUnaryCall;\n" + -+ "import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;\n" + -+ "import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;\n" + -+ "import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;\n" + -+ "import static io.grpc.stub.ClientCalls.blockingUnaryCall;\n" + -+ "import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;\n" + -+ "import static io.grpc.stub.ClientCalls.futureUnaryCall;\n" + -+ "import static io.grpc.MethodDescriptor.generateFullMethodName;\n" + -+ "import static io.grpc.stub.ServerCalls.asyncUnaryCall;\n" + -+ "import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;\n" + -+ "import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;\n" + -+ "import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;\n" + -+ "import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;\n" + -+ "import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;\n" + -+ "import io.grpc.thrift.ThriftUtils;\n\n"; -+} -+ -+string t_java_generator::import_extended_service(t_service* tservice) { -+ if (!tservice) { -+ return string() + "\n"; -+ } -+ string ns = tservice->get_program()->get_namespace("java"); -+ string extend_service_name = tservice->get_name() + "Grpc"; -+ return string() + "import " + ns + "." + extend_service_name + ";\n\n"; -+} -+ - /** - * Nothing in Java - */ -@@ -2772,25 +2814,51 @@ void t_java_generator::generate_field_value_meta_data(std::ofstream& out, t_type - */ - void t_java_generator::generate_service(t_service* tservice) { - // Make output file -- string f_service_name = package_dir_ + "/" + make_valid_java_filename(service_name_) + ".java"; -+ string f_service_name = package_dir_ + "/" + make_valid_java_filename(service_name_) + "Grpc.java"; - f_service_.open(f_service_name.c_str()); - -- f_service_ << autogen_comment() << java_package() << java_type_imports() << java_suppressions(); -+ f_service_ << -+ autogen_comment() << -+ java_package() << -+ java_type_imports() << -+ grpc_imports() << -+ import_extended_service(tservice->get_extends()); -+ java_suppressions(); -+ -+ f_service_ << -+ "public class " << service_name_ << "Grpc {" << endl << -+ endl; - -- if (!suppress_generated_annotations_) { -- generate_javax_generated_annotation(f_service_); -- } -- f_service_ << "public class " << service_name_ << " {" << endl << endl; - indent_up(); - -+ // generate constructor -+ f_service_ << -+ indent() << "private " << service_name_ << -+ "Grpc() {}" << endl << endl; -+ -+ f_service_ << -+ indent() << "public static final String SERVICE_NAME = " << -+ "\"" << package_name_ << "." << service_name_ << "\";" << endl << endl; -+ - // Generate the three main parts of the service - generate_service_interface(tservice); -- generate_service_async_interface(tservice); -- generate_service_client(tservice); -- generate_service_async_client(tservice); -- generate_service_server(tservice); -- generate_service_async_server(tservice); -+ generate_arg_ids(tservice); -+ generate_message_factory(tservice); -+ generate_service_impl_base(tservice); -+ //generate_service_async_interface(tservice); -+ //generate_service_client(tservice); -+ //generate_service_async_client(tservice); -+ //generate_service_server(tservice); -+ //generate_service_async_server(tservice); - generate_service_helpers(tservice); -+ generate_method_descriptors(tservice); -+ generate_stub(tservice); -+ generate_blocking_stub(tservice); -+ generate_future_stub(tservice); -+ generate_method_ids(tservice); -+ generate_method_handlers(tservice); -+ generate_service_descriptors(tservice); -+ generate_service_builder(tservice); - - indent_down(); - f_service_ << "}" << endl; -@@ -2805,24 +2873,820 @@ void t_java_generator::generate_service(t_service* tservice) { - void t_java_generator::generate_service_interface(t_service* tservice) { - string extends = ""; - string extends_iface = ""; -- if (tservice->get_extends() != NULL) { -- extends = type_name(tservice->get_extends()); -- extends_iface = " extends " + extends + ".Iface"; -- } - - generate_java_doc(f_service_, tservice); -- f_service_ << indent() << "public interface Iface" << extends_iface << " {" << endl << endl; -+ f_service_ << indent() << -+ "@java.lang.Deprecated public static interface " << service_name_; -+ -+ if (tservice->get_extends()) { -+ f_service_ << " extends " << tservice->get_extends()->get_name() + "Grpc." << -+ tservice->get_extends()->get_name() << endl; -+ } -+ f_service_ << " {" << endl; -+ -+ indent_up(); -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ //generate_java_doc(f_service_, *f_iter); -+ f_service_ << -+ indent() << "public void " << (*f_iter)->get_name() << "(" << (*f_iter)->get_name() << -+ "_args request," << endl << -+ indent() << " io.grpc.stub.StreamObserver<" << (*f_iter)->get_name() << -+ "_result> responseObserver);" << endl << endl; -+ } -+ indent_down(); -+ f_service_ << indent() << "}" << endl << endl; -+} -+ -+void t_java_generator::generate_arg_ids(t_service* tservice) { -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ int i=0; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << indent() << -+ "private static final int ARG_IN_METHOD_" << -+ (*f_iter)->get_name() << " = " << ++i << ";" << endl; -+ f_service_ << indent() << -+ "private static final int ARG_OUT_METHOD_" << -+ (*f_iter)->get_name() << " = " << ++i << ";" << endl; -+ } -+ f_service_ << endl; -+ -+ if (tservice->get_extends()) { -+ f_service_ << indent() << "// ARG IDs for extended service" << endl; -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << indent() << -+ "private static final int ARG_IN_METHOD_" << -+ (*f_iter)->get_name() << " = " << ++i << ";" << endl; -+ f_service_ << indent() << -+ "private static final int ARG_OUT_METHOD_" << -+ (*f_iter)->get_name() << " = " << ++i << ";" << endl; -+ } -+ f_service_ << endl; -+ } -+} -+ -+void t_java_generator::generate_message_factory(t_service* tservice) { -+ f_service_ << indent() << -+ "private static final class ThriftMessageFactory>" << endl << indent() << -+ " implements io.grpc.thrift.MessageFactory {" << endl; -+ indent_up(); -+ f_service_ << indent() << -+ "private final int id;" << endl << endl; -+ f_service_ << endl; -+ -+ f_service_ << indent() << -+ "ThriftMessageFactory(int id) {" << endl << -+ indent() << " this.id = id;" << endl << -+ indent() << "}" << endl; -+ -+ f_service_ << indent() << -+ "@java.lang.Override" << endl << -+ indent() << "public T newInstance() {" << endl; -+ indent_up(); -+ -+ f_service_ << indent() << -+ "Object o;" << endl << -+ indent() << "switch (id) {" << endl; -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << indent() << -+ "case ARG_IN_METHOD_" << (*f_iter)->get_name() << ":" << endl << -+ indent() << " o = new " << (*f_iter)->get_name() << "_args();" << -+ endl << indent() << " break;" << endl; -+ f_service_ << indent() << -+ "case ARG_OUT_METHOD_" << (*f_iter)->get_name() << ":" << endl << -+ indent() << " o = new " << (*f_iter)->get_name() << "_result();" << -+ endl << indent() << " break;" << endl; -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for (f_iter = functions.begin(); f_iter!= functions.end(); ++f_iter) { -+ f_service_ << indent() << -+ "case ARG_IN_METHOD_" << (*f_iter)->get_name() << ":" << endl << -+ indent() << " o = new " << extend_service_name << "." << (*f_iter)->get_name() << "_args();" << -+ endl << indent() << " break;" << endl; -+ f_service_ << indent() << -+ "case ARG_OUT_METHOD_" << (*f_iter)->get_name() << ":" << endl << -+ indent() << " o = new " << extend_service_name << "." << (*f_iter)->get_name() << "_result();" << -+ endl << indent() << " break;" << endl; -+ } -+ } -+ -+ f_service_ << indent() << -+ "default:" << endl << indent() << -+ " throw new AssertionError();" << endl << indent() << -+ "}" << endl; -+ -+ f_service_ << indent() << -+ "@java.lang.SuppressWarnings(\"unchecked\")" << endl << -+ indent() << "T t = (T) o;" << endl << indent() << -+ "return t;" << endl; -+ -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl; -+ -+ indent_down(); -+ f_service_ << indent() << "}" << endl; -+} -+ -+void t_java_generator::generate_service_impl_base(t_service* tservice) { -+ f_service_ << -+ indent() << "public static abstract class " << service_name_ << -+ "ImplBase implements " << service_name_ << ", io.grpc.BindableService {" << endl; -+ indent_up(); -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public void " << (*f_iter)->get_name() << "(" << (*f_iter)->get_name() << -+ "_args request, " << endl << -+ indent() << " io.grpc.stub.StreamObserver<" << (*f_iter)->get_name() << -+ "_result> responseObserver) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "asyncUnimplementedUnaryCall(METHOD_" << (*f_iter)->get_name() << -+ ", responseObserver);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc" ; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public void " << (*f_iter)->get_name() << "(" << -+ extend_service_name << "." << (*f_iter)->get_name() << -+ "_args request, " << endl << -+ indent() << " io.grpc.stub.StreamObserver<" << extend_service_name -+ << "." << (*f_iter)->get_name() << "_result> responseObserver) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "asyncUnimplementedUnaryCall(METHOD_" << (*f_iter)->get_name() << -+ ", responseObserver);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ } -+ -+ f_service_ << -+ indent() << "@java.lang.Override" << -+ " public io.grpc.ServerServiceDefinition bindService() {" << endl; - indent_up(); -+ f_service_ << -+ indent() << "return " << service_name_ << "Grpc.bindService(this);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // generate Abstract Service -+ f_service_ << -+ indent() << "@java.lang.Deprecated public static abstract class Abstract" << service_name_ << -+ " extends " << service_name_ << "ImplBase {}" << endl << endl; -+} -+ -+void t_java_generator::generate_method_descriptors(t_service* tservice) { -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for( f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "public static final io.grpc.MethodDescriptor<" << -+ (*f_iter)->get_name() << "_args," << endl << -+ indent() << " " << (*f_iter)->get_name() << "_result> METHOD_" << (*f_iter)->get_name() << -+ " = " << endl << indent() << " io.grpc.MethodDescriptor.create(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " io.grpc.MethodDescriptor.MethodType.UNARY," << endl << -+ indent() << " generateFullMethodName(" << "\"" << package_name_ << "." << -+ service_name_ << "\" , \"" << (*f_iter)->get_name() << "\")," << endl << -+ indent() << " io.grpc.thrift.ThriftUtils.marshaller(" << endl << -+ indent() << " new ThriftMessageFactory<" << (*f_iter)->get_name() << -+ "_args>( ARG_IN_METHOD_" << (*f_iter)->get_name() << "))," << endl << -+ indent() << " io.grpc.thrift.ThriftUtils.marshaller(" << endl << -+ indent() << " new ThriftMessageFactory<" << (*f_iter)->get_name() << -+ "_result>( ARG_OUT_METHOD_" << (*f_iter)->get_name() << ")));" << endl << endl; -+ indent_down(); -+ } -+ -+ if(tservice->get_extends()) { -+ t_service* extends_service = tservice->get_extends(); -+ functions = extends_service->get_functions(); -+ string extend_service_name = extends_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "public static final io.grpc.MethodDescriptor<" << extend_service_name << "." << -+ (*f_iter)->get_name() << "_args," << endl << -+ indent() << " " << extend_service_name << "." << (*f_iter)->get_name() << "_result> METHOD_" -+ << (*f_iter)->get_name() << " = " << endl << indent() << -+ " io.grpc.MethodDescriptor.create(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " io.grpc.MethodDescriptor.MethodType.UNARY," << endl << -+ indent() << " generateFullMethodName(" << "\"" << package_name_ << "." << -+ service_name_ << "\" , \"" << (*f_iter)->get_name() << "\")," << endl << -+ indent() << " io.grpc.thrift.ThriftUtils.marshaller(" << endl << -+ indent() << " new ThriftMessageFactory<" << extend_service_name << "." << -+ (*f_iter)->get_name() << "_args>( ARG_IN_METHOD_" << (*f_iter)->get_name() << "))," << endl << -+ indent() << " io.grpc.thrift.ThriftUtils.marshaller(" << endl << -+ indent() << " new ThriftMessageFactory<" << extend_service_name << "." << (*f_iter)->get_name() << -+ "_result>( ARG_OUT_METHOD_" << (*f_iter)->get_name() << ")));" << endl << endl; -+ indent_down(); -+ } -+ } -+} -+ -+void t_java_generator::generate_stub(t_service* tservice) { -+ f_service_ << -+ indent() << -+ "public static " << service_name_ << -+ "Stub newStub(io.grpc.Channel channel) {" << -+ endl; -+ -+ indent_up(); -+ f_service_ << -+ indent() << -+ "return new " << service_name_ << "Stub(channel);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // generate Stub impl -+ -+ f_service_ << -+ indent() << "public static class " << -+ service_name_ << "Stub extends io.grpc.stub.AbstractStub<" << -+ service_name_ << "Stub>" << endl << -+ indent() << " implements " << service_name_ << "{" << endl; -+ indent_up(); -+ -+ f_service_ << -+ indent() << "private " << service_name_ << "Stub(io.grpc.Channel channel) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "super(channel);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ f_service_ << -+ indent() << "private " << service_name_ << "Stub(io.grpc.Channel channel, " << endl << -+ indent() << " io.grpc.CallOptions callOptions) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "super(channel, callOptions);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "protected " << service_name_ << "Stub build(io.grpc.Channel channel, " << -+ endl << indent() << " io.grpc.CallOptions callOptions) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return new " << service_name_ << "Stub(channel, callOptions);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public void " << (*f_iter)->get_name() << "(" << -+ (*f_iter)->get_name() << "_args request," << endl << indent() << -+ " io.grpc.stub.StreamObserver<" << (*f_iter)->get_name() << -+ "_result> responseObserver) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "asyncUnaryCall(" << endl << -+ indent() << " getChannel().newCall(METHOD_" << (*f_iter)->get_name() << -+ ", getCallOptions()), request, responseObserver);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public void " << (*f_iter)->get_name() << "(" << -+ extend_service_name << "." << (*f_iter)->get_name() << "_args request," -+ << endl << indent() << " io.grpc.stub.StreamObserver<" << -+ extend_service_name << "." << (*f_iter)->get_name() << -+ "_result> responseObserver) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "asyncUnaryCall(" << endl << -+ indent() << " getChannel().newCall(METHOD_" << (*f_iter)->get_name() << -+ ", getCallOptions()), request, responseObserver);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ } -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+} -+ -+void t_java_generator::generate_blocking_stub(t_service* tservice) { -+ f_service_ << -+ indent() << "public static " << service_name_ << -+ "BlockingStub newBlockingStub(" << endl << -+ indent() << " io.grpc.Channel channel) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return new " << service_name_ << "BlockingStub(channel);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // generate Blocking Client -+ f_service_ << -+ indent() << "@java.lang.Deprecated public static interface " << service_name_ << -+ "BlockingClient " ; -+ -+ if (tservice->get_extends()) { -+ string extend_service_name = tservice->get_extends()->get_name(); -+ f_service_ << endl << indent() << " extends " << extend_service_name << "Grpc." << -+ extend_service_name << "BlockingClient " ; -+ } -+ -+ f_service_ << "{" << endl; -+ -+ indent_up(); -+ - vector functions = tservice->get_functions(); - vector::iterator f_iter; - for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -- generate_java_doc(f_service_, *f_iter); -- indent(f_service_) << "public " << function_signature(*f_iter) << ";" << endl << endl; -+ f_service_ << -+ indent() << "public " << (*f_iter)->get_name() << "_result " << -+ (*f_iter)->get_name() << "(" << (*f_iter)->get_name() << "_args request);" << endl << endl; -+ } -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // generate Blocking Stub impl -+ -+ f_service_ << -+ indent() << "public static class " << -+ service_name_ << "BlockingStub extends io.grpc.stub.AbstractStub<" << -+ service_name_ << "BlockingStub>" << endl << -+ indent() << " implements " << service_name_ << "BlockingClient {"; -+ -+ indent_up(); -+ -+ f_service_ << -+ indent() << "private " << service_name_ << "BlockingStub(io.grpc.Channel channel) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "super(channel);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ f_service_ << -+ indent() << "private " << service_name_ << "BlockingStub(io.grpc.Channel channel, " << endl << -+ indent() << " io.grpc.CallOptions callOptions) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "super(channel, callOptions);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "protected " << service_name_ << "BlockingStub build(io.grpc.Channel channel, " << -+ endl << indent() << " io.grpc.CallOptions callOptions) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return new " << service_name_ << "BlockingStub(channel, callOptions);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public " << (*f_iter)->get_name() << "_result " << (*f_iter)->get_name() << "(" << -+ (*f_iter)->get_name() << "_args request) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return blockingUnaryCall(" << endl << -+ indent() << " getChannel(), METHOD_" << (*f_iter)->get_name() << -+ ", getCallOptions(), request);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public " << extend_service_name << "." << (*f_iter)->get_name() << -+ "_result " << (*f_iter)->get_name() << "(" << extend_service_name << "." << -+ (*f_iter)->get_name() << "_args request) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return blockingUnaryCall(" << endl << -+ indent() << " getChannel(), METHOD_" << (*f_iter)->get_name() << -+ ", getCallOptions(), request);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ } -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+} -+ -+void t_java_generator::generate_future_stub(t_service* tservice) { -+ f_service_ << -+ indent() << "public static " << service_name_ << -+ "FutureStub newFutureStub(" << endl << -+ indent() << " io.grpc.Channel channel) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return new " << service_name_ << "FutureStub(channel);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // generate Future Client -+ f_service_ << -+ indent() << "@java.lang.Deprecated public static interface " << service_name_ << -+ "FutureClient " ; -+ -+ if (tservice->get_extends()) { -+ string extend_service_name = tservice->get_extends()->get_name(); -+ f_service_ << endl << indent() << " extends " << extend_service_name << "Grpc." << -+ extend_service_name << "FutureClient " ; -+ } -+ f_service_ << "{" << endl; -+ -+ indent_up(); -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "public com.google.common.util.concurrent.ListenableFuture<" << -+ (*f_iter)->get_name() << "_result> " << (*f_iter)->get_name() << "(" << endl << -+ indent() << " " << (*f_iter)->get_name() << "_args request);" << endl << endl; -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "public com.google.common.util.concurrent.ListenableFuture<" << -+ extend_service_name << "." << (*f_iter)->get_name() << "_result> " << -+ (*f_iter)->get_name() << "(" << endl << -+ indent() << " " << extend_service_name << "." << (*f_iter)->get_name() << -+ "_args request);" << endl << endl; -+ } -+ } -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // generate Stub impl -+ -+ f_service_ << -+ indent() << "public static class " << -+ service_name_ << "FutureStub extends io.grpc.stub.AbstractStub<" << -+ service_name_ << "FutureStub>" << endl << -+ indent() << " implements " << service_name_ << "FutureClient {" << endl; -+ indent_up(); -+ -+ f_service_ << -+ indent() << "private " << service_name_ << "FutureStub(io.grpc.Channel channel) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "super(channel);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ f_service_ << -+ indent() << "private " << service_name_ << "FutureStub(io.grpc.Channel channel, " << endl << -+ indent() << " io.grpc.CallOptions callOptions) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "super(channel, callOptions);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "protected " << service_name_ << "FutureStub build(io.grpc.Channel channel, " << -+ endl << indent() << " io.grpc.CallOptions callOptions) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return new " << service_name_ << "FutureStub(channel, callOptions);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ functions = tservice->get_functions(); -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public com.google.common.util.concurrent.ListenableFuture<" << -+ (*f_iter)->get_name() << "_result> " << (*f_iter)->get_name() << "(" << -+ endl << indent() << " " << (*f_iter)->get_name() << "_args request) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return futureUnaryCall(" << endl << -+ indent() << " getChannel().newCall(METHOD_" << (*f_iter)->get_name() << -+ ", getCallOptions()), request);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public com.google.common.util.concurrent.ListenableFuture<" << -+ extend_service_name << "." << (*f_iter)->get_name() << "_result> " << -+ (*f_iter)->get_name() << "(" << endl << indent() << " " << -+ extend_service_name << "." << (*f_iter)->get_name() << "_args request) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return futureUnaryCall(" << endl << -+ indent() << " getChannel().newCall(METHOD_" << (*f_iter)->get_name() << -+ ", getCallOptions()), request);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ } -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+} -+ -+void t_java_generator::generate_method_ids(t_service* tservice) { -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ int i=0; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter, ++i) { -+ f_service_ << -+ indent() << "private static final int METHODID_" << -+ (*f_iter)->get_name() << " = " << i << ";" << endl; -+ } -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter, ++i) { -+ f_service_ << -+ indent() << "private static final int METHODID_" << -+ (*f_iter)->get_name() << " = " << i << ";" << endl; -+ } -+ } -+ f_service_ << endl; -+} -+ -+void t_java_generator::generate_method_handlers(t_service* tservice) { -+ f_service_ << -+ indent() << "private static class MethodHandlers implements" << -+ endl << indent() << " io.grpc.stub.ServerCalls.UnaryMethod," << -+ endl << indent() << " io.grpc.stub.ServerCalls.ServerStreamingMethod," << -+ endl << indent() << " io.grpc.stub.ServerCalls.ClientStreamingMethod," << -+ endl << indent() << " io.grpc.stub.ServerCalls.BidiStreamingMethod {" << -+ endl; -+ indent_up(); -+ f_service_ << -+ indent() << "private final " << service_name_ << " serviceImpl;" << endl << -+ indent() << "private final int methodId;" << endl << endl; -+ -+ f_service_ << -+ indent() << "public MethodHandlers(" << service_name_ << " serviceImpl, int " << -+ "methodId) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "this.serviceImpl = serviceImpl;" << endl << -+ indent() << "this.methodId = methodId;" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // invoke -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "@java.lang.SuppressWarnings(\"unchecked\")" << endl << -+ indent() << "public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) {" << -+ endl; -+ indent_up(); -+ f_service_ << -+ indent() << "switch (methodId) {" << endl; -+ indent_up(); -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "case METHODID_" << (*f_iter)->get_name() << ":" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "serviceImpl." << (*f_iter)->get_name() << "((" << (*f_iter)->get_name() << -+ "_args) request," << endl << -+ indent() << " (io.grpc.stub.StreamObserver<" << (*f_iter)->get_name() << "_result>)" << -+ " responseObserver);" << endl << -+ indent() << "break;" << endl << endl; -+ indent_down(); -+ } -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "case METHODID_" << (*f_iter)->get_name() << ":" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "serviceImpl." << (*f_iter)->get_name() << "((" << extend_service_name << -+ "." << (*f_iter)->get_name() << "_args) request," << endl << -+ indent() << " (io.grpc.stub.StreamObserver<" << extend_service_name << "." << -+ (*f_iter)->get_name() << "_result>)" << " responseObserver);" << endl << -+ indent() << "break;" << endl << endl; -+ indent_down(); -+ } - } -+ f_service_ << -+ indent() << "default:" << endl << -+ indent() << " throw new AssertionError();" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // invoke -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "@java.lang.SuppressWarnings(\"unchecked\")" << endl << -+ indent() << "public io.grpc.stub.StreamObserver invoke(" << endl << -+ indent() << " io.grpc.stub.StreamObserver responseObserver) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "switch (methodId) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "default:" << endl; -+ f_service_ << -+ indent() << " throw new AssertionError();" << endl; -+ indent_down(); -+ f_service_ << indent() << "}" << endl; - indent_down(); - f_service_ << indent() << "}" << endl << endl; -+ indent_down(); -+ f_service_ << indent() << "}" << endl << endl; -+ - } - -+void t_java_generator::generate_service_descriptors(t_service* tservice) { -+ // generate service descriptor -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ f_service_ << -+ indent() << "public static io.grpc.ServiceDescriptor getServiceDescriptor() {" << -+ endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return new io.grpc.ServiceDescriptor(SERVICE_NAME"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "," << endl << -+ indent() << " METHOD_" << (*f_iter)->get_name(); -+ } -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "," << endl << -+ indent() << " METHOD_" << (*f_iter)->get_name(); -+ } -+ } -+ f_service_ << ");" << endl; -+ indent_down(); -+ f_service_ << indent() << "}" << endl << endl; -+} -+ -+void t_java_generator::generate_service_builder(t_service* tservice) { -+ // bind Service -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ f_service_ << -+ indent() << "@java.lang.Deprecated public static io.grpc.ServerServiceDefinition" << -+ " bindService(" << endl << -+ indent() << " final " << service_name_ << " serviceImpl) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())" << -+ endl; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << " .addMethod(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " METHOD_" << (*f_iter)->get_name() << "," << endl << -+ indent() << " asyncUnaryCall(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " new MethodHandlers<" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " " << (*f_iter)->get_name() << "_args," << endl << -+ indent() << " " << (*f_iter)->get_name() << "_result>(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " serviceImpl, METHODID_" << (*f_iter)->get_name() << ")))" << endl; -+ indent_down(); -+ indent_down(); -+ indent_down(); -+ indent_down(); -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << " .addMethod(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " METHOD_" << (*f_iter)->get_name() << "," << endl << -+ indent() << " asyncUnaryCall(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " new MethodHandlers<" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " " << extend_service_name << "." << (*f_iter)->get_name() << "_args," << endl << -+ indent() << " " << extend_service_name << "." << (*f_iter)->get_name() << "_result>(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " serviceImpl, METHODID_" << (*f_iter)->get_name() << ")))" << endl; -+ indent_down(); -+ indent_down(); -+ indent_down(); -+ indent_down(); -+ } -+ } -+ f_service_ << -+ indent() << " .build();" << endl; -+ indent_down(); -+ f_service_ << indent() << "}" << endl << endl; -+} -+ -+ - void t_java_generator::generate_service_async_interface(t_service* tservice) { - string extends = ""; - string extends_iface = ""; -diff --git a/tutorial/Makefile.am b/tutorial/Makefile.am -index 5865c54..1cffbe6 100755 ---- a/tutorial/Makefile.am -+++ b/tutorial/Makefile.am -@@ -35,11 +35,6 @@ if WITH_D - SUBDIRS += d - endif - --if WITH_JAVA --SUBDIRS += java --SUBDIRS += js --endif -- - if WITH_PYTHON - SUBDIRS += py - SUBDIRS += py.twisted -@@ -95,4 +90,5 @@ EXTRA_DIST = \ - php \ - shared.thrift \ - tutorial.thrift \ -- README.md -+ README.md \ -+ java --- -2.8.0.rc3.226.g39d4020 - -- cgit v1.2.3 From a1d79d9763ea5500ad4f50e02b2f72659f3fb0ba Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 22 Jun 2017 18:24:12 -0700 Subject: Handle cancel correctly --- .../transport/cronet/transport/cronet_transport.c | 47 +++++++++++++++++----- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index ce72fc3d08..c178c71e7b 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -766,20 +766,47 @@ static bool op_can_be_run(grpc_transport_stream_op_batch *curr_op, bool is_canceled_or_failed = stream_state->state_op_done[OP_CANCEL_ERROR] || stream_state->state_callback_received[OP_FAILED]; if (is_canceled_or_failed) { - if (op_id == OP_SEND_INITIAL_METADATA) result = false; - if (op_id == OP_SEND_MESSAGE) result = false; - if (op_id == OP_SEND_TRAILING_METADATA) result = false; - if (op_id == OP_CANCEL_ERROR) result = false; + if (op_id == OP_SEND_INITIAL_METADATA) { + CRONET_LOG(GPR_DEBUG, "Because"); + result = false; + } + if (op_id == OP_SEND_MESSAGE) { + CRONET_LOG(GPR_DEBUG, "Because"); + result = false; + } + if (op_id == OP_SEND_TRAILING_METADATA) { + CRONET_LOG(GPR_DEBUG, "Because"); + result = false; + } + if (op_id == OP_CANCEL_ERROR) { + CRONET_LOG(GPR_DEBUG, "Because"); + result = false; + } /* already executed */ if (op_id == OP_RECV_INITIAL_METADATA && - stream_state->state_op_done[OP_RECV_INITIAL_METADATA]) + stream_state->state_op_done[OP_RECV_INITIAL_METADATA]) { + CRONET_LOG(GPR_DEBUG, "Because"); result = false; + } if (op_id == OP_RECV_MESSAGE && - stream_state->state_op_done[OP_RECV_MESSAGE]) + stream_state->state_op_done[OP_RECV_MESSAGE]) { + CRONET_LOG(GPR_DEBUG, "Because"); result = false; + } if (op_id == OP_RECV_TRAILING_METADATA && - stream_state->state_op_done[OP_RECV_TRAILING_METADATA]) + stream_state->state_op_done[OP_RECV_TRAILING_METADATA]) { + CRONET_LOG(GPR_DEBUG, "Because"); result = false; + } + /* If cancelled, we need to wait for the cancel callback (if call is already + * started) */ + if (op_id == OP_ON_COMPLETE && + !(stream_state->state_callback_received[OP_FAILED] || + stream_state->state_callback_received[OP_CANCELED] || + !stream_state->state_op_done[OP_SEND_INITIAL_METADATA])) { + CRONET_LOG(GPR_DEBUG, "Because"); + result = false; + } } else if (op_id == OP_SEND_INITIAL_METADATA) { /* already executed */ if (stream_state->state_op_done[OP_SEND_INITIAL_METADATA]) result = false; @@ -868,7 +895,7 @@ static bool op_can_be_run(grpc_transport_stream_op_batch *curr_op, CRONET_LOG(GPR_DEBUG, "Because"); result = false; } else if (curr_op->recv_message && - !stream_state->state_op_done[OP_RECV_MESSAGE]) { + !op_state->state_op_done[OP_RECV_MESSAGE]) { CRONET_LOG(GPR_DEBUG, "Because"); result = false; } else if (curr_op->cancel_stream && @@ -1067,6 +1094,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_op->payload->recv_message.recv_message_ready, GRPC_ERROR_NONE); stream_state->state_op_done[OP_RECV_MESSAGE] = true; + oas->state.state_op_done[OP_RECV_MESSAGE] = true; result = ACTION_TAKEN_NO_CALLBACK; } else if (stream_state->state_callback_received[OP_FAILED]) { CRONET_LOG(GPR_DEBUG, "Stream failed."); @@ -1074,6 +1102,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_op->payload->recv_message.recv_message_ready, GRPC_ERROR_NONE); stream_state->state_op_done[OP_RECV_MESSAGE] = true; + oas->state.state_op_done[OP_RECV_MESSAGE] = true; result = ACTION_TAKEN_NO_CALLBACK; } else if (stream_state->rs.read_stream_closed == true) { /* No more data will be received */ @@ -1214,8 +1243,8 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, } else if (stream_op->cancel_stream && op_can_be_run(stream_op, s, &oas->state, OP_CANCEL_ERROR)) { CRONET_LOG(GPR_DEBUG, "running: %p OP_CANCEL_ERROR", oas); - CRONET_LOG(GPR_DEBUG, "W: bidirectional_stream_cancel(%p)", s->cbs); if (s->cbs) { + CRONET_LOG(GPR_DEBUG, "W: bidirectional_stream_cancel(%p)", s->cbs); bidirectional_stream_cancel(s->cbs); result = ACTION_TAKEN_WITH_CALLBACK; } else { -- cgit v1.2.3 From 275e392449ad4c366e65911a4d3b803f5bd840e5 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 23 Jun 2017 16:26:33 -0700 Subject: Another bug fix in the same series --- src/core/ext/transport/cronet/transport/cronet_transport.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index c178c71e7b..380146fece 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -47,7 +47,7 @@ } while (0) /* TODO (makdharma): Hook up into the wider tracing mechanism */ -int grpc_cronet_trace = 0; +int grpc_cronet_trace = 1; enum e_op_result { ACTION_TAKEN_WITH_CALLBACK, @@ -788,8 +788,7 @@ static bool op_can_be_run(grpc_transport_stream_op_batch *curr_op, CRONET_LOG(GPR_DEBUG, "Because"); result = false; } - if (op_id == OP_RECV_MESSAGE && - stream_state->state_op_done[OP_RECV_MESSAGE]) { + if (op_id == OP_RECV_MESSAGE && op_state->state_op_done[OP_RECV_MESSAGE]) { CRONET_LOG(GPR_DEBUG, "Because"); result = false; } -- cgit v1.2.3 From 32e41b452abf0842080530d7f01a748767197e10 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 23 Jun 2017 16:34:34 -0700 Subject: Fix bad_ping --- test/core/end2end/tests/bad_ping.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/core/end2end/tests/bad_ping.c b/test/core/end2end/tests/bad_ping.c index 78032a6b5f..12aceda688 100644 --- a/test/core/end2end/tests/bad_ping.c +++ b/test/core/end2end/tests/bad_ping.c @@ -81,7 +81,10 @@ static void test_bad_ping(grpc_end2end_test_config config) { .value.integer = 300000 /* 5 minutes */}, {.type = GRPC_ARG_INTEGER, .key = GRPC_ARG_HTTP2_MAX_PING_STRIKES, - .value.integer = MAX_PING_STRIKES}}; + .value.integer = MAX_PING_STRIKES}, + {.type = GRPC_ARG_INTEGER, + .key = GRPC_ARG_HTTP2_BDP_PROBE, + .value.integer = 0}}; grpc_channel_args client_args = {.num_args = GPR_ARRAY_SIZE(client_a), .args = client_a}; grpc_channel_args server_args = {.num_args = GPR_ARRAY_SIZE(server_a), -- cgit v1.2.3 From c7208282aeb2140655f8d4b80335f6945a256a42 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 23 Jun 2017 17:05:54 -0700 Subject: Add comment to explain the added lines and disable debugging log --- src/core/ext/transport/cronet/transport/cronet_transport.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 380146fece..498b444001 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -47,7 +47,7 @@ } while (0) /* TODO (makdharma): Hook up into the wider tracing mechanism */ -int grpc_cronet_trace = 1; +int grpc_cronet_trace = 0; enum e_op_result { ACTION_TAKEN_WITH_CALLBACK, @@ -797,8 +797,10 @@ static bool op_can_be_run(grpc_transport_stream_op_batch *curr_op, CRONET_LOG(GPR_DEBUG, "Because"); result = false; } - /* If cancelled, we need to wait for the cancel callback (if call is already - * started) */ + /* ON_COMPLETE can be processed if one of the following conditions is met: + * 1. the stream failed + * 2. the stream is cancelled, and the callback is received, or + * 3. the stream is cancelled, and the stream is never started */ if (op_id == OP_ON_COMPLETE && !(stream_state->state_callback_received[OP_FAILED] || stream_state->state_callback_received[OP_CANCELED] || -- cgit v1.2.3 From 2b8b7482abf5e98e091f910da979d552a3312fd2 Mon Sep 17 00:00:00 2001 From: yang-g Date: Fri, 23 Jun 2017 17:07:54 -0700 Subject: Destroy byte buffer to avoid leak in zombied calls --- src/core/lib/surface/server.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 8a2616b027..84ddf74ab9 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -475,6 +475,7 @@ static void publish_call(grpc_exec_ctx *exec_ctx, grpc_server *server, *rc->data.registered.deadline = calld->deadline; if (rc->data.registered.optional_payload) { *rc->data.registered.optional_payload = calld->payload; + calld->payload = NULL; } break; default: @@ -878,6 +879,7 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_slice_unref_internal(exec_ctx, calld->path); } grpc_metadata_array_destroy(&calld->initial_metadata); + grpc_byte_buffer_destroy(calld->payload); gpr_mu_destroy(&calld->mu_state); -- cgit v1.2.3 From d19c112db066c35b461ad3e5c992d9b7727545d6 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 23 Jun 2017 17:00:20 -0700 Subject: Add test --- CMakeLists.txt | 2 + Makefile | 2 + .../CoreCronetEnd2EndTests.m | 4 + test/core/end2end/end2end_nosec_tests.c | 8 + test/core/end2end/end2end_tests.c | 8 + test/core/end2end/gen_build_yaml.py | 1 + test/core/end2end/generate_tests.bzl | 1 + test/core/end2end/tests/cancel_after_round_trip.c | 293 +++++++ tools/run_tests/generated/sources_and_headers.json | 2 + tools/run_tests/generated/tests.json | 950 +++++++++++++++++++-- .../end2end_nosec_tests.vcxproj | 2 + .../end2end_nosec_tests.vcxproj.filters | 3 + .../tests/end2end_tests/end2end_tests.vcxproj | 2 + .../end2end_tests/end2end_tests.vcxproj.filters | 3 + 14 files changed, 1189 insertions(+), 92 deletions(-) create mode 100644 test/core/end2end/tests/cancel_after_round_trip.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 852eb2bf6c..6c7584d136 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4289,6 +4289,7 @@ add_library(end2end_tests test/core/end2end/tests/cancel_after_accept.c test/core/end2end/tests/cancel_after_client_done.c test/core/end2end/tests/cancel_after_invoke.c + test/core/end2end/tests/cancel_after_round_trip.c test/core/end2end/tests/cancel_before_invoke.c test/core/end2end/tests/cancel_in_a_vacuum.c test/core/end2end/tests/cancel_with_status.c @@ -4387,6 +4388,7 @@ add_library(end2end_nosec_tests test/core/end2end/tests/cancel_after_accept.c test/core/end2end/tests/cancel_after_client_done.c test/core/end2end/tests/cancel_after_invoke.c + test/core/end2end/tests/cancel_after_round_trip.c test/core/end2end/tests/cancel_before_invoke.c test/core/end2end/tests/cancel_in_a_vacuum.c test/core/end2end/tests/cancel_with_status.c diff --git a/Makefile b/Makefile index 0ca788592c..b0b29c8d79 100644 --- a/Makefile +++ b/Makefile @@ -7892,6 +7892,7 @@ LIBEND2END_TESTS_SRC = \ test/core/end2end/tests/cancel_after_accept.c \ test/core/end2end/tests/cancel_after_client_done.c \ test/core/end2end/tests/cancel_after_invoke.c \ + test/core/end2end/tests/cancel_after_round_trip.c \ test/core/end2end/tests/cancel_before_invoke.c \ test/core/end2end/tests/cancel_in_a_vacuum.c \ test/core/end2end/tests/cancel_with_status.c \ @@ -7985,6 +7986,7 @@ LIBEND2END_NOSEC_TESTS_SRC = \ test/core/end2end/tests/cancel_after_accept.c \ test/core/end2end/tests/cancel_after_client_done.c \ test/core/end2end/tests/cancel_after_invoke.c \ + test/core/end2end/tests/cancel_after_round_trip.c \ test/core/end2end/tests/cancel_before_invoke.c \ test/core/end2end/tests/cancel_in_a_vacuum.c \ test/core/end2end/tests/cancel_with_status.c \ diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m index aa52239f8f..453b0752c3 100644 --- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m +++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m @@ -246,6 +246,10 @@ static char *roots_filename; [self testIndividualCase:"cancel_after_invoke"]; } +- (void)testCancelAfterRoundTrip { + [self testIndividualCase:"cancel_after_round_trip"]; +} + - (void)testCancelBeforeInvoke { [self testIndividualCase:"cancel_before_invoke"]; } diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index 9e75397502..ae1db54f1a 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -44,6 +44,8 @@ extern void cancel_after_client_done(grpc_end2end_test_config config); extern void cancel_after_client_done_pre_init(void); extern void cancel_after_invoke(grpc_end2end_test_config config); extern void cancel_after_invoke_pre_init(void); +extern void cancel_after_round_trip(grpc_end2end_test_config config); +extern void cancel_after_round_trip_pre_init(void); extern void cancel_before_invoke(grpc_end2end_test_config config); extern void cancel_before_invoke_pre_init(void); extern void cancel_in_a_vacuum(grpc_end2end_test_config config); @@ -148,6 +150,7 @@ void grpc_end2end_tests_pre_init(void) { cancel_after_accept_pre_init(); cancel_after_client_done_pre_init(); cancel_after_invoke_pre_init(); + cancel_after_round_trip_pre_init(); cancel_before_invoke_pre_init(); cancel_in_a_vacuum_pre_init(); cancel_with_status_pre_init(); @@ -210,6 +213,7 @@ void grpc_end2end_tests(int argc, char **argv, cancel_after_accept(config); cancel_after_client_done(config); cancel_after_invoke(config); + cancel_after_round_trip(config); cancel_before_invoke(config); cancel_in_a_vacuum(config); cancel_with_status(config); @@ -288,6 +292,10 @@ void grpc_end2end_tests(int argc, char **argv, cancel_after_invoke(config); continue; } + if (0 == strcmp("cancel_after_round_trip", argv[i])) { + cancel_after_round_trip(config); + continue; + } if (0 == strcmp("cancel_before_invoke", argv[i])) { cancel_before_invoke(config); continue; diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index a0e6ac7f93..d18dd9c7b6 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -46,6 +46,8 @@ extern void cancel_after_client_done(grpc_end2end_test_config config); extern void cancel_after_client_done_pre_init(void); extern void cancel_after_invoke(grpc_end2end_test_config config); extern void cancel_after_invoke_pre_init(void); +extern void cancel_after_round_trip(grpc_end2end_test_config config); +extern void cancel_after_round_trip_pre_init(void); extern void cancel_before_invoke(grpc_end2end_test_config config); extern void cancel_before_invoke_pre_init(void); extern void cancel_in_a_vacuum(grpc_end2end_test_config config); @@ -151,6 +153,7 @@ void grpc_end2end_tests_pre_init(void) { cancel_after_accept_pre_init(); cancel_after_client_done_pre_init(); cancel_after_invoke_pre_init(); + cancel_after_round_trip_pre_init(); cancel_before_invoke_pre_init(); cancel_in_a_vacuum_pre_init(); cancel_with_status_pre_init(); @@ -214,6 +217,7 @@ void grpc_end2end_tests(int argc, char **argv, cancel_after_accept(config); cancel_after_client_done(config); cancel_after_invoke(config); + cancel_after_round_trip(config); cancel_before_invoke(config); cancel_in_a_vacuum(config); cancel_with_status(config); @@ -296,6 +300,10 @@ void grpc_end2end_tests(int argc, char **argv, cancel_after_invoke(config); continue; } + if (0 == strcmp("cancel_after_round_trip", argv[i])) { + cancel_after_round_trip(config); + continue; + } if (0 == strcmp("cancel_before_invoke", argv[i])) { cancel_before_invoke(config); continue; diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index de1eccec15..6dffacf9d7 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -87,6 +87,7 @@ END2END_TESTS = { 'cancel_after_accept': default_test_options._replace(cpu_cost=LOWCPU), 'cancel_after_client_done': default_test_options._replace(cpu_cost=LOWCPU), 'cancel_after_invoke': default_test_options._replace(cpu_cost=LOWCPU), + 'cancel_after_round_trip': default_test_options._replace(cpu_cost=LOWCPU), 'cancel_before_invoke': default_test_options._replace(cpu_cost=LOWCPU), 'cancel_in_a_vacuum': default_test_options._replace(cpu_cost=LOWCPU), 'cancel_with_status': default_test_options._replace(cpu_cost=LOWCPU), diff --git a/test/core/end2end/generate_tests.bzl b/test/core/end2end/generate_tests.bzl index 185ca606b8..3312f4e596 100755 --- a/test/core/end2end/generate_tests.bzl +++ b/test/core/end2end/generate_tests.bzl @@ -79,6 +79,7 @@ END2END_TESTS = { 'cancel_after_accept': test_options(), 'cancel_after_client_done': test_options(), 'cancel_after_invoke': test_options(), + 'cancel_after_round_trip': test_options(), 'cancel_before_invoke': test_options(), 'cancel_in_a_vacuum': test_options(), 'cancel_with_status': test_options(), diff --git a/test/core/end2end/tests/cancel_after_round_trip.c b/test/core/end2end/tests/cancel_after_round_trip.c new file mode 100644 index 0000000000..032f74aa91 --- /dev/null +++ b/test/core/end2end/tests/cancel_after_round_trip.c @@ -0,0 +1,293 @@ +/* + * + * Copyright 2015 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 "test/core/end2end/end2end_tests.h" + +#include +#include + +#include +#include +#include +#include +#include + +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/slice/slice_internal.h" +#include "src/core/lib/transport/metadata.h" +#include "src/core/lib/transport/service_config.h" + +#include "test/core/end2end/cq_verifier.h" +#include "test/core/end2end/tests/cancel_test_helpers.h" + +static void *tag(intptr_t t) { return (void *)t; } + +static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, + const char *test_name, + grpc_channel_args *client_args, + grpc_channel_args *server_args) { + grpc_end2end_test_fixture f; + gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name); + f = config.create_fixture(client_args, server_args); + config.init_server(&f, server_args); + config.init_client(&f, client_args); + return f; +} + +static gpr_timespec n_seconds_from_now(int n) { + return grpc_timeout_seconds_to_deadline(n); +} + +static gpr_timespec five_seconds_from_now(void) { + return n_seconds_from_now(5); +} + +static void drain_cq(grpc_completion_queue *cq) { + grpc_event ev; + do { + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); +} + +static void shutdown_server(grpc_end2end_test_fixture *f) { + if (!f->server) return; + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) + .type == GRPC_OP_COMPLETE); + grpc_server_destroy(f->server); + f->server = NULL; +} + +static void shutdown_client(grpc_end2end_test_fixture *f) { + if (!f->client) return; + grpc_channel_destroy(f->client); + f->client = NULL; +} + +static void end_test(grpc_end2end_test_fixture *f) { + shutdown_server(f); + shutdown_client(f); + + grpc_completion_queue_shutdown(f->cq); + drain_cq(f->cq); + grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); +} + +/* Cancel after accept, no payload */ +static void test_cancel_after_round_trip(grpc_end2end_test_config config, + cancellation_mode mode, + bool use_service_config) { + grpc_op ops[6]; + grpc_op *op; + grpc_call *c; + grpc_call *s; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + grpc_slice details; + grpc_byte_buffer *request_payload_recv = NULL; + grpc_byte_buffer *response_payload_recv = NULL; + grpc_slice request_payload_slice = + grpc_slice_from_copied_string("hello world"); + grpc_slice response_payload_slice = + grpc_slice_from_copied_string("hello you"); + grpc_byte_buffer *request_payload = + grpc_raw_byte_buffer_create(&request_payload_slice, 1); + grpc_byte_buffer *response_payload = + grpc_raw_byte_buffer_create(&response_payload_slice, 1); + int was_cancelled = 2; + + grpc_channel_args *args = NULL; + if (use_service_config) { + grpc_arg arg; + arg.type = GRPC_ARG_STRING; + arg.key = GRPC_ARG_SERVICE_CONFIG; + arg.value.string = + "{\n" + " \"methodConfig\": [ {\n" + " \"name\": [\n" + " { \"service\": \"service\", \"method\": \"method\" }\n" + " ],\n" + " \"timeout\": \"5s\"\n" + " } ]\n" + "}"; + args = grpc_channel_args_copy_and_add(args, &arg, 1); + } + + grpc_end2end_test_fixture f = + begin_test(config, "cancel_after_round_trip", args, NULL); + cq_verifier *cqv = cq_verifier_create(f.cq); + + gpr_timespec deadline = use_service_config + ? gpr_inf_future(GPR_CLOCK_MONOTONIC) + : five_seconds_from_now(); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + get_host_override_slice("foo.test.google.fr:1234", config), deadline, + NULL); + GPR_ASSERT(c); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &response_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + error = + grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(101), 1); + cq_verify(cqv); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &request_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = response_payload; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(102), 1); + CQ_EXPECT_COMPLETION(cqv, tag(1), 1); + cq_verify(cqv); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &response_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = response_payload; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(2), 1); + CQ_EXPECT_COMPLETION(cqv, tag(103), 1); + cq_verify(cqv); + + GPR_ASSERT(status == mode.expect_status || status == GRPC_STATUS_INTERNAL); + GPR_ASSERT(was_cancelled == 1); + + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_byte_buffer_destroy(request_payload); + grpc_byte_buffer_destroy(response_payload); + grpc_byte_buffer_destroy(request_payload_recv); + grpc_byte_buffer_destroy(response_payload_recv); + grpc_slice_unref(details); + + grpc_call_unref(c); + grpc_call_unref(s); + + if (args != NULL) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_channel_args_destroy(&exec_ctx, args); + grpc_exec_ctx_finish(&exec_ctx); + } + + cq_verifier_destroy(cqv); + end_test(&f); + config.tear_down_data(&f); +} + +void cancel_after_round_trip(grpc_end2end_test_config config) { + unsigned i; + + for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { + test_cancel_after_round_trip(config, cancellation_modes[i], + false /* use_service_config */); + if (config.feature_mask & FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL && + cancellation_modes[i].expect_status == GRPC_STATUS_DEADLINE_EXCEEDED) { + test_cancel_after_round_trip(config, cancellation_modes[i], + true /* use_service_config */); + } + } +} + +void cancel_after_round_trip_pre_init(void) {} diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 0c4e1fae1d..65a99bf7d6 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7209,6 +7209,7 @@ "test/core/end2end/tests/cancel_after_accept.c", "test/core/end2end/tests/cancel_after_client_done.c", "test/core/end2end/tests/cancel_after_invoke.c", + "test/core/end2end/tests/cancel_after_round_trip.c", "test/core/end2end/tests/cancel_before_invoke.c", "test/core/end2end/tests/cancel_in_a_vacuum.c", "test/core/end2end/tests/cancel_test_helpers.h", @@ -7285,6 +7286,7 @@ "test/core/end2end/tests/cancel_after_accept.c", "test/core/end2end/tests/cancel_after_client_done.c", "test/core/end2end/tests/cancel_after_invoke.c", + "test/core/end2end/tests/cancel_after_round_trip.c", "test/core/end2end/tests/cancel_before_invoke.c", "test/core/end2end/tests/cancel_in_a_vacuum.c", "test/core/end2end/tests/cancel_test_helpers.h", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 8cca6d3daf..b66a84285a 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -5892,6 +5892,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_census_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -7138,6 +7161,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -8353,6 +8399,28 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_fakesec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -9530,6 +9598,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_fd_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -10634,6 +10725,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -11848,6 +11962,25 @@ "linux" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, { "args": [ "cancel_before_invoke" @@ -12906,6 +13039,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -14106,6 +14262,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+workarounds_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -15360,6 +15539,30 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_http_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -16648,6 +16851,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_load_reporting_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -17904,7 +18130,7 @@ }, { "args": [ - "cancel_before_invoke" + "cancel_after_round_trip" ], "ci_platforms": [ "windows", @@ -17928,7 +18154,7 @@ }, { "args": [ - "cancel_in_a_vacuum" + "cancel_before_invoke" ], "ci_platforms": [ "windows", @@ -17952,7 +18178,7 @@ }, { "args": [ - "cancel_with_status" + "cancel_in_a_vacuum" ], "ci_platforms": [ "windows", @@ -17976,14 +18202,14 @@ }, { "args": [ - "compressed_payload" + "cancel_with_status" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18000,14 +18226,14 @@ }, { "args": [ - "connectivity" + "compressed_payload" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18024,14 +18250,14 @@ }, { "args": [ - "default_host" + "connectivity" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18048,7 +18274,7 @@ }, { "args": [ - "disappearing_server" + "default_host" ], "ci_platforms": [ "windows", @@ -18060,7 +18286,7 @@ "exclude_iomgrs": [ "uv" ], - "flaky": true, + "flaky": false, "language": "c", "name": "h2_oauth2_test", "platforms": [ @@ -18072,19 +18298,19 @@ }, { "args": [ - "empty_batch" + "disappearing_server" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" ], - "flaky": false, + "flaky": true, "language": "c", "name": "h2_oauth2_test", "platforms": [ @@ -18096,14 +18322,14 @@ }, { "args": [ - "filter_call_init_fails" + "empty_batch" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18120,14 +18346,14 @@ }, { "args": [ - "filter_causes_close" + "filter_call_init_fails" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18144,7 +18370,7 @@ }, { "args": [ - "filter_latency" + "filter_causes_close" ], "ci_platforms": [ "windows", @@ -18168,7 +18394,7 @@ }, { "args": [ - "graceful_server_shutdown" + "filter_latency" ], "ci_platforms": [ "windows", @@ -18192,7 +18418,31 @@ }, { "args": [ - "high_initial_seqno" + "graceful_server_shutdown" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_oauth2_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "high_initial_seqno" ], "ci_platforms": [ "windows", @@ -19174,6 +19424,30 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -20230,6 +20504,30 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -21358,6 +21656,30 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -22428,6 +22750,32 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [ + "msan" + ], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_1byte_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -23626,6 +23974,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -24872,6 +25243,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_cert_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -26102,6 +26496,30 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_ssl_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -27176,53 +27594,7 @@ }, { "args": [ - "cancel_before_invoke" - ], - "ci_platforms": [ - "linux", - "mac", - "posix" - ], - "cpu_cost": 0.1, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_uds_test", - "platforms": [ - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "cancel_in_a_vacuum" - ], - "ci_platforms": [ - "linux", - "mac", - "posix" - ], - "cpu_cost": 0.1, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_uds_test", - "platforms": [ - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "cancel_with_status" + "cancel_after_round_trip" ], "ci_platforms": [ "linux", @@ -27245,30 +27617,99 @@ }, { "args": [ - "compressed_payload" - ], - "ci_platforms": [ - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_uds_test", - "platforms": [ - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "connectivity" + "cancel_before_invoke" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_uds_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "cancel_in_a_vacuum" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_uds_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "cancel_with_status" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_uds_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "compressed_payload" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_uds_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "connectivity" ], "ci_platforms": [ "linux", @@ -28370,6 +28811,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_census_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -29593,6 +30057,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -30770,6 +31257,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_fd_nosec_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -31851,6 +32361,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -33046,6 +33579,25 @@ "linux" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_nosec_test", + "platforms": [ + "linux" + ] + }, { "args": [ "cancel_before_invoke" @@ -34081,6 +34633,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -35258,6 +35833,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+workarounds_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -36488,6 +37086,30 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_http_proxy_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -37753,6 +38375,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_load_reporting_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -38959,6 +39604,30 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_proxy_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -39991,6 +40660,30 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -41095,6 +41788,30 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair+trace_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -42139,6 +42856,32 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [ + "msan" + ], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_1byte_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" @@ -43314,6 +44057,29 @@ "posix" ] }, + { + "args": [ + "cancel_after_round_trip" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_uds_nosec_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj index 8581f0cb37..4d02c88082 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj @@ -169,6 +169,8 @@ + + diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters index ae2937b1b9..89316bc535 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters @@ -28,6 +28,9 @@ test\core\end2end\tests + + test\core\end2end\tests + test\core\end2end\tests diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj index 1bd09989e8..9573111452 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj @@ -171,6 +171,8 @@ + + diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters index 217c60ee05..7d02fc3fa0 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters @@ -31,6 +31,9 @@ test\core\end2end\tests + + test\core\end2end\tests + test\core\end2end\tests -- cgit v1.2.3 From 366270eee58df0c59dd3c7453e5ffd0d3d9eebc5 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 23 Jun 2017 18:08:27 -0700 Subject: Fix test --- src/core/ext/transport/cronet/transport/cronet_transport.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 498b444001..29dfa885de 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -799,11 +799,13 @@ static bool op_can_be_run(grpc_transport_stream_op_batch *curr_op, } /* ON_COMPLETE can be processed if one of the following conditions is met: * 1. the stream failed - * 2. the stream is cancelled, and the callback is received, or - * 3. the stream is cancelled, and the stream is never started */ + * 2. the stream is cancelled, and the callback is received + * 3. the stream succeeded before cancel is effective + * 4. the stream is cancelled, and the stream is never started */ if (op_id == OP_ON_COMPLETE && !(stream_state->state_callback_received[OP_FAILED] || stream_state->state_callback_received[OP_CANCELED] || + stream_state->state_callback_received[OP_SUCCEEDED] || !stream_state->state_op_done[OP_SEND_INITIAL_METADATA])) { CRONET_LOG(GPR_DEBUG, "Because"); result = false; -- cgit v1.2.3 From 38ba4661cec913c72b81beb15f34e263c694858b Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 23 Jun 2017 18:24:01 -0700 Subject: Fix segfault in rr trace --- .../ext/filters/client_channel/lb_policy/round_robin/round_robin.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c index 3c8520cc1c..e7d38f751d 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c @@ -571,11 +571,13 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, GPR_ASSERT(sd->subchannel_list == p->latest_pending_subchannel_list); GPR_ASSERT(!sd->subchannel_list->shutting_down); if (GRPC_TRACER_ON(grpc_lb_round_robin_trace)) { + const unsigned long num_subchannels = + p->subchannel_list != NULL ? p->subchannel_list->num_subchannels + : 0; gpr_log(GPR_DEBUG, "[RR %p] phasing out subchannel list %p (size %lu) in favor " "of %p (size %lu)", - (void *)p, (void *)p->subchannel_list, - (unsigned long)p->subchannel_list->num_subchannels, + (void *)p, (void *)p->subchannel_list, num_subchannels, (void *)sd->subchannel_list, (unsigned long)sd->subchannel_list->num_subchannels); } -- cgit v1.2.3 From 936f8d5eaaf63a72792226eda0209becb60b0ec8 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Wed, 8 Mar 2017 21:34:41 +0000 Subject: Enable next-method-called lint --- .pylintrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.pylintrc b/.pylintrc index 4102747906..e7b4eb0109 100644 --- a/.pylintrc +++ b/.pylintrc @@ -32,9 +32,8 @@ notes=FIXME,XXX #TODO: Enable too-many-instance-attributes #TODO: Enable too-many-lines #TODO: Enable redefined-variable-type -#TODO: Enable next-method-called #TODO: Enable import-error #TODO: Enable useless-else-on-loop #TODO: Enable too-many-nested-blocks -disable=missing-docstring,too-few-public-methods,no-init,duplicate-code,invalid-name,locally-disabled,protected-access,no-name-in-module,wrong-import-order,cyclic-import,too-many-instance-attributes,too-many-lines,redefined-variable-type,next-method-called,import-error,useless-else-on-loop,too-many-nested-blocks +disable=missing-docstring,too-few-public-methods,no-init,duplicate-code,invalid-name,locally-disabled,protected-access,no-name-in-module,wrong-import-order,cyclic-import,too-many-instance-attributes,too-many-lines,redefined-variable-type,import-error,useless-else-on-loop,too-many-nested-blocks -- cgit v1.2.3 From a7182f7f5a7253bbcd33eabff1b3ec4fb686edb0 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Sat, 24 Jun 2017 20:57:00 +0000 Subject: Always use an upgraded pip when running pylint --- tools/distrib/pylint_code.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/distrib/pylint_code.sh b/tools/distrib/pylint_code.sh index f5c958473f..3a1825535d 100755 --- a/tools/distrib/pylint_code.sh +++ b/tools/distrib/pylint_code.sh @@ -19,15 +19,16 @@ set -ex cd "$(dirname "$0")/../.." DIRS=( - 'src/python/grpcio/grpc' - 'src/python/grpcio_reflection/grpc_reflection' - 'src/python/grpcio_health_checking/grpc_health' + 'src/python/grpcio/grpc' + 'src/python/grpcio_health_checking/grpc_health' + 'src/python/grpcio_reflection/grpc_reflection' ) VIRTUALENV=python_pylint_venv virtualenv $VIRTUALENV PYTHON=$(realpath $VIRTUALENV/bin/python) +$PYTHON -m pip install --upgrade pip $PYTHON -m pip install pylint==1.6.5 for dir in "${DIRS[@]}"; do -- cgit v1.2.3 From 37c83ffbed4e01f02d4fdee3e8e9156e877d4608 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Sat, 24 Jun 2017 21:03:21 +0000 Subject: Enable redefined-variable-type lint --- .pylintrc | 3 +-- src/python/grpcio/grpc/_channel.py | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index e7b4eb0109..15062dca9c 100644 --- a/.pylintrc +++ b/.pylintrc @@ -31,9 +31,8 @@ notes=FIXME,XXX # disable=cyclic-import suppressions. #TODO: Enable too-many-instance-attributes #TODO: Enable too-many-lines -#TODO: Enable redefined-variable-type #TODO: Enable import-error #TODO: Enable useless-else-on-loop #TODO: Enable too-many-nested-blocks -disable=missing-docstring,too-few-public-methods,no-init,duplicate-code,invalid-name,locally-disabled,protected-access,no-name-in-module,wrong-import-order,cyclic-import,too-many-instance-attributes,too-many-lines,redefined-variable-type,import-error,useless-else-on-loop,too-many-nested-blocks +disable=missing-docstring,too-few-public-methods,no-init,duplicate-code,invalid-name,locally-disabled,protected-access,no-name-in-module,wrong-import-order,cyclic-import,too-many-instance-attributes,too-many-lines,import-error,useless-else-on-loop,too-many-nested-blocks diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index 1562c3e24d..cf4ce0941b 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -849,7 +849,10 @@ def _poll_connectivity(state, channel, initial_try_to_connect): _common.CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY[ connectivity]) if not state.delivering: - callbacks = _deliveries(state) + # NOTE(nathaniel): The field is only ever used as a + # sequence so it's fine that both lists and tuples are + # assigned to it. + callbacks = _deliveries(state) # pylint: disable=redefined-variable-type if callbacks: _spawn_delivery(state, callbacks) -- cgit v1.2.3 From 6613f601660e7cf58db2a5dd1e11556378955910 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Sat, 24 Jun 2017 21:13:24 +0000 Subject: Enable wrong-import-order lint --- .pylintrc | 3 +-- src/python/grpcio/grpc/_server.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index 15062dca9c..188b7d7058 100644 --- a/.pylintrc +++ b/.pylintrc @@ -25,7 +25,6 @@ notes=FIXME,XXX #TODO: Enable locally-disabled #TODO: Enable protected-access #TODO: Enable no-name-in-module -#TODO: Enable wrong-import-order # TODO(https://github.com/PyCQA/pylint/issues/59#issuecomment-283774279): # enable cyclic-import after a 1.7-or-later pylint release that recognizes our # disable=cyclic-import suppressions. @@ -35,4 +34,4 @@ notes=FIXME,XXX #TODO: Enable useless-else-on-loop #TODO: Enable too-many-nested-blocks -disable=missing-docstring,too-few-public-methods,no-init,duplicate-code,invalid-name,locally-disabled,protected-access,no-name-in-module,wrong-import-order,cyclic-import,too-many-instance-attributes,too-many-lines,import-error,useless-else-on-loop,too-many-nested-blocks +disable=missing-docstring,too-few-public-methods,no-init,duplicate-code,invalid-name,locally-disabled,protected-access,no-name-in-module,cyclic-import,too-many-instance-attributes,too-many-lines,import-error,useless-else-on-loop,too-many-nested-blocks diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index 9e2d40b67d..cd59b07c04 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -16,10 +16,11 @@ import collections import enum import logging -import six import threading import time +import six + import grpc from grpc import _common from grpc._cython import cygrpc -- cgit v1.2.3 From 9104884a1903606831b15476b01ef9f87a89b29b Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Sat, 24 Jun 2017 21:16:53 +0000 Subject: Clean up and opinionate .pylintrc --- .pylintrc | 68 ++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/.pylintrc b/.pylintrc index 188b7d7058..8447821b4e 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,15 +1,18 @@ [VARIABLES] + # TODO(https://github.com/PyCQA/pylint/issues/1345): How does the inspection # not include "unused_" and "ignored_" by default? dummy-variables-rgx=^ignored_|^unused_ [DESIGN] + # NOTE(nathaniel): Not particularly attached to this value; it just seems to # be what works for us at the moment (excepting the dead-code-walking Beta # API). max-args=6 [MISCELLANEOUS] + # NOTE(nathaniel): We are big fans of "TODO(): " and # "NOTE(): ". We do not allow "TODO:", # "TODO():", "FIXME:", or anything else. @@ -17,21 +20,50 @@ notes=FIXME,XXX [MESSAGES CONTROL] -#TODO: Enable missing-docstring -#TODO: Enable too-few-public-methods -#TODO: Enable no-init -#TODO: Enable duplicate-code -#TODO: Enable invalid-name -#TODO: Enable locally-disabled -#TODO: Enable protected-access -#TODO: Enable no-name-in-module -# TODO(https://github.com/PyCQA/pylint/issues/59#issuecomment-283774279): -# enable cyclic-import after a 1.7-or-later pylint release that recognizes our -# disable=cyclic-import suppressions. -#TODO: Enable too-many-instance-attributes -#TODO: Enable too-many-lines -#TODO: Enable import-error -#TODO: Enable useless-else-on-loop -#TODO: Enable too-many-nested-blocks - -disable=missing-docstring,too-few-public-methods,no-init,duplicate-code,invalid-name,locally-disabled,protected-access,no-name-in-module,cyclic-import,too-many-instance-attributes,too-many-lines,import-error,useless-else-on-loop,too-many-nested-blocks +disable= + # TODO(https://github.com/PyCQA/pylint/issues/59#issuecomment-283774279): + # Enable cyclic-import after a 1.7-or-later pylint release that + # recognizes our disable=cyclic-import suppressions. + cyclic-import, + # TODO(https://github.com/grpc/grpc/issues/8622): Enable this after the + # Beta API is removed. + duplicate-code, + # TODO(https://github.com/grpc/grpc/issues/261): Doesn't seem to + # understand enum and concurrent.futures; look into this later with the + # latest pylint version. + import-error, + # TODO(https://github.com/grpc/grpc/issues/261): Enable this one. + # Should take a little configuration but not much. + invalid-name, + # TODO(https://github.com/grpc/grpc/issues/261): This doesn't seem to + # work for now? Try with a later pylint? + locally-disabled, + # NOTE(nathaniel): We don't write doc strings for most private code + # elements. + missing-docstring, + # NOTE(nathaniel): Our completely abstract interface classes don't have + # constructors. + no-init, + # TODO(https://github.com/grpc/grpc/issues/261): Doesn't yet play + # nicely with some of our code being implemented in Cython. Maybe in a + # later version? + no-name-in-module, + # TODO(https://github.com/grpc/grpc/issues/261): Suppress these where + # the odd shape of the authentication portion of the API forces them on + # us and enable everywhere else. + protected-access, + # NOTE(nathaniel): Pylint and I will probably never agree on this. + too-few-public-methods, + # NOTE(nathaniel): Pylint and I wil probably never agree on this for + # private classes. For public classes maybe? + too-many-instance-attributes, + # NOTE(nathaniel): Some of our modules have a lot of lines... of + # specification and documentation. Maybe if this were + # lines-of-code-based we would use it. + too-many-lines, + # TODO(https://github.com/grpc/grpc/issues/261): Maybe we could have + # this one if we extracted just a few more helper functions... + too-many-nested-blocks, + # NOTE(nathaniel): I have disputed the premise of this inspection from + # the beginning and will continue to do so until it goes away for good. + useless-else-on-loop, -- cgit v1.2.3 From 1f0fc53e9719755302d5f160959728b4c30077c3 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 26 Jun 2017 11:05:33 -0700 Subject: Have the fake resolver "re-resolve" upon seeing error --- .../filters/client_channel/resolver/fake/fake_resolver.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c index a311334d13..56ed4371a9 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c @@ -56,6 +56,10 @@ typedef struct { // grpc_resolver_next_locked()'s closure. grpc_channel_args* next_results; + // Results to use for the pretended re-resolution in + // fake_resolver_channel_saw_error_locked(). + grpc_channel_args* results_upon_error; + // pending next completion, or NULL grpc_closure* next_completion; // target result address for next completion @@ -65,6 +69,7 @@ typedef struct { static void fake_resolver_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* gr) { fake_resolver* r = (fake_resolver*)gr; grpc_channel_args_destroy(exec_ctx, r->next_results); + grpc_channel_args_destroy(exec_ctx, r->results_upon_error); grpc_channel_args_destroy(exec_ctx, r->channel_args); gpr_free(r); } @@ -87,15 +92,19 @@ static void fake_resolver_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx, *r->target_result = grpc_channel_args_union(r->next_results, r->channel_args); grpc_channel_args_destroy(exec_ctx, r->next_results); + r->next_results = NULL; GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE); r->next_completion = NULL; - r->next_results = NULL; } } static void fake_resolver_channel_saw_error_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver) { fake_resolver* r = (fake_resolver*)resolver; + if (r->next_results == NULL && r->results_upon_error != NULL) { + // Pretend we re-resolved. + r->next_results = grpc_channel_args_copy(r->results_upon_error); + } fake_resolver_maybe_finish_next_locked(exec_ctx, r); } @@ -151,6 +160,10 @@ static void set_response_cb(grpc_exec_ctx* exec_ctx, void* arg, grpc_channel_args_destroy(exec_ctx, r->next_results); } r->next_results = generator->next_response; + if (r->results_upon_error != NULL) { + grpc_channel_args_destroy(exec_ctx, r->results_upon_error); + } + r->results_upon_error = grpc_channel_args_copy(generator->next_response); fake_resolver_maybe_finish_next_locked(exec_ctx, r); } -- cgit v1.2.3 From 9d1a5de94e438c89dc0e359ce0038fc138cdaf9f Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 26 Jun 2017 11:06:00 -0700 Subject: Fix RR policy connectivity state upon subchannels shutdown --- .../lb_policy/round_robin/round_robin.c | 41 ++++++++++++++-------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c index e7d38f751d..c41f22ea9a 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c @@ -126,6 +126,8 @@ struct rr_subchannel_list { size_t num_ready; /** how many subchannels are in state TRANSIENT_FAILURE */ size_t num_transient_failures; + /** how many subchannels are in state SHUTDOWN */ + size_t num_shutdown; /** how many subchannels are in state IDLE */ size_t num_idle; @@ -425,14 +427,20 @@ static void update_state_counters_locked(subchannel_data *sd) { } else if (sd->prev_connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) { GPR_ASSERT(subchannel_list->num_transient_failures > 0); --subchannel_list->num_transient_failures; + } else if (sd->prev_connectivity_state == GRPC_CHANNEL_SHUTDOWN) { + GPR_ASSERT(subchannel_list->num_shutdown > 0); + --subchannel_list->num_shutdown; } else if (sd->prev_connectivity_state == GRPC_CHANNEL_IDLE) { GPR_ASSERT(subchannel_list->num_idle > 0); --subchannel_list->num_idle; } + if (sd->curr_connectivity_state == GRPC_CHANNEL_READY) { ++subchannel_list->num_ready; } else if (sd->curr_connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) { ++subchannel_list->num_transient_failures; + } else if (sd->curr_connectivity_state == GRPC_CHANNEL_SHUTDOWN) { + ++subchannel_list->num_shutdown; } else if (sd->curr_connectivity_state == GRPC_CHANNEL_IDLE) { ++subchannel_list->num_idle; } @@ -455,7 +463,8 @@ static grpc_connectivity_state update_lb_connectivity_status_locked( * CHECK: sd->curr_connectivity_state == CONNECTING. * * 3) RULE: ALL subchannels are SHUTDOWN => policy is SHUTDOWN. - * CHECK: p->subchannel_list->num_subchannels = 0. + * CHECK: p->subchannel_list->num_shutdown == + * p->subchannel_list->num_subchannels. * * 4) RULE: ALL subchannels are TRANSIENT_FAILURE => policy is * TRANSIENT_FAILURE. @@ -464,37 +473,38 @@ static grpc_connectivity_state update_lb_connectivity_status_locked( * 5) RULE: ALL subchannels are IDLE => policy is IDLE. * CHECK: p->num_idle == p->subchannel_list->num_subchannels. */ + grpc_connectivity_state new_state = sd->curr_connectivity_state; rr_subchannel_list *subchannel_list = sd->subchannel_list; round_robin_lb_policy *p = subchannel_list->policy; if (subchannel_list->num_ready > 0) { /* 1) READY */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_READY, GRPC_ERROR_NONE, "rr_ready"); - return GRPC_CHANNEL_READY; + new_state = GRPC_CHANNEL_READY; } else if (sd->curr_connectivity_state == GRPC_CHANNEL_CONNECTING) { /* 2) CONNECTING */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_CONNECTING, GRPC_ERROR_NONE, "rr_connecting"); - return GRPC_CHANNEL_CONNECTING; - } else if (p->subchannel_list->num_subchannels == 0) { /* 3) SHUTDOWN */ + new_state = GRPC_CHANNEL_CONNECTING; + } else if (p->subchannel_list->num_shutdown == + p->subchannel_list->num_subchannels) { /* 3) SHUTDOWN */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, - GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error), - "rr_shutdown"); - return GRPC_CHANNEL_SHUTDOWN; + GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error), "rr_shutdown"); + new_state = GRPC_CHANNEL_SHUTDOWN; } else if (subchannel_list->num_transient_failures == p->subchannel_list->num_subchannels) { /* 4) TRANSIENT_FAILURE */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, - GRPC_CHANNEL_TRANSIENT_FAILURE, - GRPC_ERROR_REF(error), "rr_transient_failure"); - return GRPC_CHANNEL_TRANSIENT_FAILURE; + GRPC_CHANNEL_TRANSIENT_FAILURE, GRPC_ERROR_REF(error), + "rr_transient_failure"); + new_state = GRPC_CHANNEL_TRANSIENT_FAILURE; } else if (subchannel_list->num_idle == p->subchannel_list->num_subchannels) { /* 5) IDLE */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_IDLE, GRPC_ERROR_NONE, "rr_idle"); - return GRPC_CHANNEL_IDLE; + new_state = GRPC_CHANNEL_IDLE; } - /* no change */ - return sd->curr_connectivity_state; + GRPC_ERROR_UNREF(error); + return new_state; } static void rr_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, @@ -657,8 +667,9 @@ static void rr_ping_one_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, grpc_connected_subchannel_ping(exec_ctx, target, closure); GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, target, "rr_picked"); } else { - GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_CREATE_FROM_STATIC_STRING( - "Round Robin not connected")); + GRPC_CLOSURE_SCHED( + exec_ctx, closure, + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Round Robin not connected")); } } -- cgit v1.2.3 From 05e15745d3a562c4fc43180ab4153766ac2a9851 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 26 Jun 2017 11:06:17 -0700 Subject: added test for RR connectivity state upon subchannels shutdown --- test/cpp/end2end/client_lb_end2end_test.cc | 60 +++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index 776d94d3b6..f71e557450 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -97,9 +97,12 @@ class ClientLbEnd2endTest : public ::testing::Test { } } - void StartServers(int num_servers) { - for (int i = 0; i < num_servers; ++i) { - servers_.emplace_back(new ServerData(server_host_)); + void StartServers(size_t num_servers, + std::vector ports = std::vector()) { + for (size_t i = 0; i < num_servers; ++i) { + int port = 0; + if (ports.size() == num_servers) port = ports[i]; + servers_.emplace_back(new ServerData(server_host_, port)); } } @@ -146,14 +149,18 @@ class ClientLbEnd2endTest : public ::testing::Test { stub_ = grpc::testing::EchoTestService::NewStub(channel_); } - void SendRpc() { + void SendRpc(bool expect_ok = true) { EchoRequest request; EchoResponse response; request.set_message("Live long and prosper."); ClientContext context; Status status = stub_->Echo(&context, request, &response); - EXPECT_TRUE(status.ok()); - EXPECT_EQ(response.message(), request.message()); + if (expect_ok) { + EXPECT_TRUE(status.ok()); + EXPECT_EQ(response.message(), request.message()); + } else { + EXPECT_FALSE(status.ok()); + } } struct ServerData { @@ -162,8 +169,8 @@ class ClientLbEnd2endTest : public ::testing::Test { MyTestServiceImpl service_; std::unique_ptr thread_; - explicit ServerData(const grpc::string& server_host) { - port_ = grpc_pick_unused_port_or_die(); + explicit ServerData(const grpc::string& server_host, int port = 0) { + port_ = port > 0 ? port : grpc_pick_unused_port_or_die(); gpr_log(GPR_INFO, "starting server on port %d", port_); std::mutex mu; std::condition_variable cond; @@ -187,9 +194,9 @@ class ClientLbEnd2endTest : public ::testing::Test { cond->notify_one(); } - void Shutdown() { + void Shutdown(bool join = true) { server_->Shutdown(); - thread_->join(); + if (join) thread_->join(); } }; @@ -456,6 +463,39 @@ TEST_F(ClientLbEnd2endTest, RoundRobinManyUpdates) { EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName()); } +TEST_F(ClientLbEnd2endTest, RoundRobinReconnect) { + // Start servers and send one RPC per server. + const int kNumServers = 1; + std::vector ports; + ports.push_back(grpc_pick_unused_port_or_die()); + StartServers(kNumServers, ports); + ResetStub("round_robin"); + SetNextResolution(ports); + // Send one RPC per backend and make sure they are used in order. + // Note: This relies on the fact that the subchannels are reported in + // state READY in the order in which the addresses are specified, + // which is only true because the backends are all local. + for (size_t i = 0; i < servers_.size(); ++i) { + SendRpc(); + EXPECT_EQ(1, servers_[i]->service_.request_count()) << "for backend #" << i; + } + // Check LB policy name for the channel. + EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName()); + + // Kill all servers + for (size_t i = 0; i < servers_.size(); ++i) { + servers_[i]->Shutdown(false); + } + // Client request should fail. + SendRpc(false); + + // Bring servers back up on the same port (we aren't recreating the channel). + StartServers(kNumServers, ports); + + // Client request should succeed. + SendRpc(); +} + } // namespace } // namespace testing } // namespace grpc -- cgit v1.2.3 From a139bfdc4c8c785e05dc6e8ac8ccbd50a92b2f89 Mon Sep 17 00:00:00 2001 From: thassss Date: Mon, 26 Jun 2017 13:34:40 -0700 Subject: Expose :authority pseudo-header to Obj-C API. --- src/objective-c/GRPCClient/GRPCCall.h | 5 +++++ src/objective-c/GRPCClient/GRPCCall.m | 2 +- src/objective-c/GRPCClient/private/GRPCChannel.h | 1 + src/objective-c/GRPCClient/private/GRPCChannel.m | 5 ++++- src/objective-c/GRPCClient/private/GRPCHost.h | 1 + src/objective-c/GRPCClient/private/GRPCHost.m | 4 +++- src/objective-c/GRPCClient/private/GRPCWrappedCall.h | 1 + src/objective-c/GRPCClient/private/GRPCWrappedCall.m | 5 +++-- 8 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 8c5bcf1c8b..2495aface6 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -163,6 +163,11 @@ extern id const kGRPCTrailersKey; /** Represents a single gRPC remote call. */ @interface GRPCCall : GRXWriter +/** + * The server name for the RPC. If nil, the host name of the service object will be used instead. + */ +@property (atomic, readwrite) NSString *serverName; + /** * The container of the request headers of an RPC conforms to this protocol, which is a subset of * NSMutableDictionary's interface. It will become a NSMutableDictionary later on. diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 6ba401def4..872362419e 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -425,7 +425,7 @@ static NSMutableDictionary *callFlags; _responseWriteable = [[GRXConcurrentWriteable alloc] initWithWriteable:writeable dispatchQueue:_responseQueue]; - _wrappedCall = [[GRPCWrappedCall alloc] initWithHost:_host path:_path]; + _wrappedCall = [[GRPCWrappedCall alloc] initWithHost:_host serverName:_serverName path:_path]; NSAssert(_wrappedCall, @"Error allocating RPC objects. Low memory?"); [self sendHeaders:_requestHeaders]; diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCChannel.h index e4dfbca38d..e2aa5bd036 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.h +++ b/src/objective-c/GRPCClient/private/GRPCChannel.h @@ -62,5 +62,6 @@ struct grpc_channel_credentials; channelArgs:(nullable NSDictionary *)channelArgs; - (nullable grpc_call *)unmanagedCallWithPath:(nonnull NSString *)path + serverName:(nonnull NSString *)serverName completionQueue:(nonnull GRPCCompletionQueue *)queue; @end diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index ca494d5ff2..690fad2596 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -181,14 +181,17 @@ static grpc_channel_args *BuildChannelArgs(NSDictionary *dictionary) { } - (grpc_call *)unmanagedCallWithPath:(NSString *)path + serverName:(NSString *)serverName completionQueue:(GRPCCompletionQueue *)queue { + grpc_slice host_slice = grpc_slice_from_copied_string(serverName.UTF8String); grpc_slice path_slice = grpc_slice_from_copied_string(path.UTF8String); grpc_call *call = grpc_channel_create_call(_unmanagedChannel, NULL, GRPC_PROPAGATE_DEFAULTS, queue.unmanagedQueue, path_slice, - NULL, // Passing NULL for host + &host_slice, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + grpc_slice_unref(host_slice); grpc_slice_unref(path_slice); return call; } diff --git a/src/objective-c/GRPCClient/private/GRPCHost.h b/src/objective-c/GRPCClient/private/GRPCHost.h index 4b1f780dd2..bb68fa3ec4 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.h +++ b/src/objective-c/GRPCClient/private/GRPCHost.h @@ -54,6 +54,7 @@ struct grpc_channel_credentials; /** Create a grpc_call object to the provided path on this host. */ - (nullable struct grpc_call *)unmanagedCallWithPath:(NSString *)path + serverName:(nullable NSString *)serverName completionQueue:(GRPCCompletionQueue *)queue; // TODO: There's a race when a new RPC is coming through just as an existing one is getting diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m index 5b4d647a1a..5658150b33 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCHost.m @@ -120,6 +120,7 @@ static GRPCConnectivityMonitor *connectivityMonitor = nil; } - (nullable grpc_call *)unmanagedCallWithPath:(NSString *)path + serverName:(nullable NSString *)serverName completionQueue:(GRPCCompletionQueue *)queue { GRPCChannel *channel; // This is racing -[GRPCHost disconnect]. @@ -129,7 +130,8 @@ static GRPCConnectivityMonitor *connectivityMonitor = nil; } channel = _channel; } - return [channel unmanagedCallWithPath:path completionQueue:queue]; + NSString *name = serverName ? serverName : _address; + return [channel unmanagedCallWithPath:path serverName:name completionQueue:queue]; } - (BOOL)setTLSPEMRootCerts:(nullable NSString *)pemRootCerts diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.h b/src/objective-c/GRPCClient/private/GRPCWrappedCall.h index ed245ff7ed..e24d246912 100644 --- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.h +++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.h @@ -75,6 +75,7 @@ @interface GRPCWrappedCall : NSObject - (instancetype)initWithHost:(NSString *)host + serverName:(nullable NSString *)serverName path:(NSString *)path NS_DESIGNATED_INITIALIZER; - (void)startBatchWithOperations:(NSArray *)ops errorHandler:(void(^)())errorHandler; diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m index 8c8b0b2570..2d98f70899 100644 --- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m +++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m @@ -232,10 +232,11 @@ } - (instancetype)init { - return [self initWithHost:nil path:nil]; + return [self initWithHost:nil serverName:nil path:nil]; } - (instancetype)initWithHost:(NSString *)host + serverName:(nullable NSString *)serverName path:(NSString *)path { if (!path || !host) { [NSException raise:NSInvalidArgumentException @@ -248,7 +249,7 @@ // queue. Currently we use a singleton queue. _queue = [GRPCCompletionQueue completionQueue]; - _call = [[GRPCHost hostWithAddress:host] unmanagedCallWithPath:path completionQueue:_queue]; + _call = [[GRPCHost hostWithAddress:host] unmanagedCallWithPath:path serverName:serverName completionQueue:_queue]; if (_call == NULL) { return nil; } -- cgit v1.2.3 From b8be14309df478973990d1908430763b399b7027 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 26 Jun 2017 13:38:42 -0700 Subject: formatting changes --- src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c index c41f22ea9a..b648bba3fb 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c @@ -434,7 +434,6 @@ static void update_state_counters_locked(subchannel_data *sd) { GPR_ASSERT(subchannel_list->num_idle > 0); --subchannel_list->num_idle; } - if (sd->curr_connectivity_state == GRPC_CHANNEL_READY) { ++subchannel_list->num_ready; } else if (sd->curr_connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) { -- cgit v1.2.3 From 3598ac81b0ad9666f98c13414c492243366fc635 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 27 Jun 2017 12:49:40 +0200 Subject: update scenario result schema --- .../performance/scenario_result_schema.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/run_tests/performance/scenario_result_schema.json b/tools/run_tests/performance/scenario_result_schema.json index 8ec41c377c..245861f8c2 100644 --- a/tools/run_tests/performance/scenario_result_schema.json +++ b/tools/run_tests/performance/scenario_result_schema.json @@ -107,6 +107,11 @@ "name": "timeSystem", "type": "FLOAT", "mode": "NULLABLE" + }, + { + "name": "cqPollCount", + "type": "INTEGER", + "mode": "NULLABLE" } ] }, @@ -129,6 +134,11 @@ "name": "timeSystem", "type": "FLOAT", "mode": "NULLABLE" + }, + { + "name": "cqPollCount", + "type": "INTEGER", + "mode": "NULLABLE" } ] }, @@ -196,6 +206,16 @@ "name": "latency999", "type": "FLOAT", "mode": "NULLABLE" + }, + { + "name": "clientPollsPerRequest", + "type": "FLOAT", + "mode": "NULLABLE" + }, + { + "name": "serverPollsPerRequest", + "type": "FLOAT", + "mode": "NULLABLE" } ] }, -- cgit v1.2.3 From 58ca8beb165b1a741072ed6ff826c2b87066bc00 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 27 Jun 2017 13:45:46 +0200 Subject: add script for patching perf benchmark schema --- tools/gcp/utils/big_query_utils.py | 27 +++++++++++ .../performance/patch_scenario_results_schema.py | 55 ++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100755 tools/run_tests/performance/patch_scenario_results_schema.py diff --git a/tools/gcp/utils/big_query_utils.py b/tools/gcp/utils/big_query_utils.py index 76c86645b7..77a5f5691e 100755 --- a/tools/gcp/utils/big_query_utils.py +++ b/tools/gcp/utils/big_query_utils.py @@ -116,6 +116,33 @@ def create_table2(big_query, project_id, dataset_id, table_id, fields_schema, return is_success +def patch_table(big_query, project_id, dataset_id, table_id, fields_schema): + is_success = True + + body = { + 'schema': { + 'fields': fields_schema + }, + 'tableReference': { + 'datasetId': dataset_id, + 'projectId': project_id, + 'tableId': table_id + } + } + + try: + table_req = big_query.tables().patch(projectId=project_id, + datasetId=dataset_id, + tableId=table_id, + body=body) + res = table_req.execute(num_retries=NUM_RETRIES) + print 'Successfully patched %s "%s"' % (res['kind'], res['id']) + except HttpError as http_error: + print 'Error in creating table: %s. Err: %s' % (table_id, http_error) + is_success = False + return is_success + + def insert_rows(big_query, project_id, dataset_id, table_id, rows_list): is_success = True body = {'rows': rows_list} diff --git a/tools/run_tests/performance/patch_scenario_results_schema.py b/tools/run_tests/performance/patch_scenario_results_schema.py new file mode 100755 index 0000000000..81ba5381b3 --- /dev/null +++ b/tools/run_tests/performance/patch_scenario_results_schema.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# Copyright 2016 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. + +# Use to patch schema of existing scenario results tables (after adding fields). + +from __future__ import print_function + +import argparse +import calendar +import json +import os +import sys +import time +import uuid + + +gcp_utils_dir = os.path.abspath(os.path.join( + os.path.dirname(__file__), '../../gcp/utils')) +sys.path.append(gcp_utils_dir) +import big_query_utils + + +_PROJECT_ID='grpc-testing' + +def _patch_results_table(dataset_id, table_id): + bq = big_query_utils.create_big_query() + with open(os.path.dirname(__file__) + '/scenario_result_schema.json', 'r') as f: + table_schema = json.loads(f.read()) + desc = 'Results of performance benchmarks.' + return big_query_utils.patch_table(bq, _PROJECT_ID, dataset_id, + table_id, table_schema) + + +argp = argparse.ArgumentParser(description='Patch schema of scenario results table.') +argp.add_argument('--bq_result_table', required=True, default=None, type=str, + help='Bigquery "dataset.table" to patch.') + +args = argp.parse_args() + +dataset_id, table_id = args.bq_result_table.split('.', 2) + +_patch_results_table(dataset_id, table_id) +print('Successfully patched schema of %s.\n' % args.bq_result_table) -- cgit v1.2.3 From be3c7e2a4266979f3ba355aaaa00a1fb4185cc71 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 27 Jun 2017 11:52:52 -0700 Subject: Fix the memory leak in metadata --- src/objective-c/GRPCClient/private/GRPCWrappedCall.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m index 8c8b0b2570..bebfc39af1 100644 --- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m +++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m @@ -75,6 +75,10 @@ } - (void)dealloc { + for (int i = 0; i < _op.data.send_initial_metadata.count; i++) { + grpc_slice_unref(_op.data.send_initial_metadata.metadata[i].key); + grpc_slice_unref(_op.data.send_initial_metadata.metadata[i].value); + } gpr_free(_op.data.send_initial_metadata.metadata); } -- cgit v1.2.3 From 0c8cb1d6524fa2f072d45df359f7b8c8b8ec7265 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 27 Jun 2017 14:00:53 -0700 Subject: Resolve asan failure --- test/core/end2end/tests/cancel_after_round_trip.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/core/end2end/tests/cancel_after_round_trip.c b/test/core/end2end/tests/cancel_after_round_trip.c index 032f74aa91..ce98075ae6 100644 --- a/test/core/end2end/tests/cancel_after_round_trip.c +++ b/test/core/end2end/tests/cancel_after_round_trip.c @@ -210,6 +210,9 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); + grpc_byte_buffer_destroy(request_payload_recv); + grpc_byte_buffer_destroy(response_payload_recv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; -- cgit v1.2.3 From d46239a8c2fc44ca17be3747b57387d358bcacb9 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 27 Jun 2017 16:30:46 -0700 Subject: Correct copyright year --- test/core/end2end/tests/cancel_after_round_trip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core/end2end/tests/cancel_after_round_trip.c b/test/core/end2end/tests/cancel_after_round_trip.c index ce98075ae6..eb7bd36228 100644 --- a/test/core/end2end/tests/cancel_after_round_trip.c +++ b/test/core/end2end/tests/cancel_after_round_trip.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015 gRPC authors. + * Copyright 2017 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. -- cgit v1.2.3 From ff17b050e6ab499eeaf292e316d6a481b2095b3f Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 27 Jun 2017 11:05:29 -0700 Subject: Document error unref contract for iomgr cb's and transport/stream errors --- src/core/lib/iomgr/closure.h | 4 +++- src/core/lib/transport/transport.c | 5 +++++ src/core/lib/transport/transport.h | 10 ++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index 2ec6f77e76..2560bf4527 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -42,7 +42,9 @@ typedef struct grpc_closure_list { * * \param arg Arbitrary input. * \param error GRPC_ERROR_NONE if no error occurred, otherwise some grpc_error - * describing what went wrong */ + * describing what went wrong. + * Error contract: it is not the cb's job to unref this error; + * the closure scheduler will do that after the cb returns */ typedef void (*grpc_iomgr_cb_func)(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error); diff --git a/src/core/lib/transport/transport.c b/src/core/lib/transport/transport.c index 52725846e6..6a9eba110d 100644 --- a/src/core/lib/transport/transport.c +++ b/src/core/lib/transport/transport.c @@ -206,6 +206,11 @@ grpc_endpoint *grpc_transport_get_endpoint(grpc_exec_ctx *exec_ctx, return transport->vtable->get_endpoint(exec_ctx, transport); } +// grpc_transport_stream_op_batch_finish_with_failure +// is a function that must always unref cancel_error +// though it lives in lib, it handles transport stream ops sure +// it's grpc_transport_stream_op_batch_finish_with_failure + void grpc_transport_stream_op_batch_finish_with_failure( grpc_exec_ctx *exec_ctx, grpc_transport_stream_op_batch *op, grpc_error *error) { diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index 2a1a24db20..84e53e683a 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -198,6 +198,8 @@ struct grpc_transport_stream_op_batch_payload { grpc_chttp2_grpc_status_to_http2_error. Send a RST_STREAM with this error. */ struct { + // Error contract: the transport that gets this op must cause cancel_error + // to be unref'ed after processing it grpc_error *cancel_error; } cancel_stream; @@ -212,9 +214,13 @@ typedef struct grpc_transport_op { /** connectivity monitoring - set connectivity_state to NULL to unsubscribe */ grpc_closure *on_connectivity_state_change; grpc_connectivity_state *connectivity_state; - /** should the transport be disconnected */ + /** should the transport be disconnected + * Error contract: the transport that gets this op must cause + * disconnect_with_error to be unref'ed after processing it */ grpc_error *disconnect_with_error; - /** what should the goaway contain? */ + /** what should the goaway contain? + * Error contract: the transport that gets this op must cause + * goaway_error to be unref'ed after processing it */ grpc_error *goaway_error; /** set the callback for accepting new streams; this is a permanent callback, unlike the other one-shot closures. -- cgit v1.2.3 From e282dfe9e9af3a28f3d80225214388cbc2ceb7c3 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 28 Jun 2017 19:40:35 +0200 Subject: update macos kokoro rc script --- .../helper_scripts/prepare_build_macos_rc | 52 ++++++---------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index 3851e565a4..1dabeeb3de 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -15,53 +15,29 @@ # Source this rc script to prepare the environment for macos builds -# TODO(jtattermusch): remove all deps once installed on MacOS workers +# required to build protobuf +brew install gflags -# brew and C++ deps -yes | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -brew install autoconf automake libtool ccache cmake gflags gpg wget - -# TODO(jtattermusch): hkp://keys.gnupg.net fails with "No route to host" -gpg --keyserver hkp://193.164.133.100 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 -curl -sSL https://get.rvm.io | sudo bash -s stable - -# add ourselves to rvm group to prevent later "access denied" errors. -sudo dseditgroup -o edit -a `whoami` -t user rvm - -set +ex -source /etc/profile.d/rvm.sh +set +ex # rvm script is very verbose and exits with errorcode +source $HOME/.rvm/scripts/rvm +set -e # rvm commands are very verbose rvm install ruby-2.3 -gem install bundler - rvm osx-ssl-certs status all rvm osx-ssl-certs update all set -ex +gem install bundler + # cocoapods -gem install cocoapods --version 1.0.0 +export LANG=en_US.UTF-8 +gem install cocoapods +pod repo update # needed by python # python -wget -q https://bootstrap.pypa.io/get-pip.py -sudo python get-pip.py +brew install coreutils # we need grealpath +#wget -q https://bootstrap.pypa.io/get-pip.py +#sudo python get-pip.py sudo pip install virtualenv - -# TODO(jtattermusch): install python3 - -# mono -wget -q https://download.mono-project.com/archive/5.0.1/macos-10-universal/MonoFramework-MDK-5.0.1.1.macos10.xamarin.universal.pkg -sudo installer -pkg MonoFramework-MDK-5.0.1.1.macos10.xamarin.universal.pkg -target / -ln -s /Library/Frameworks/Mono.framework/Versions/Current/bin/mono /usr/local/bin/mono - -# dotnet SDK -brew install openssl -wget -q https://go.microsoft.com/fwlink/?linkid=843444 -O dotnet-dev-osx-x64.1.0.1.pkg -sudo installer -pkg dotnet-dev-osx-x64.1.0.1.pkg -target / -ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/dotnet -dotnet --version # bootstrap dotnet SDK - -# nvm -wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash - -# TODO(jtattermusch): install node if needed +sudo pip install -U six tox setuptools git submodule update --init -- cgit v1.2.3 From 6ba7d53b63532c3a1ed41cac54460a912c930539 Mon Sep 17 00:00:00 2001 From: Kamil Skalski Date: Wed, 28 Jun 2017 19:42:26 +0100 Subject: Make CMake find_package work for preinstalled libprotobuf on Raspbian. --- CMakeLists.txt | 21 +++++++++++++++------ templates/CMakeLists.txt.template | 21 +++++++++++++++------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 852eb2bf6c..384e275d53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,9 @@ set_property(CACHE gRPC_SSL_PROVIDER PROPERTY STRINGS "module" "package") set(gRPC_PROTOBUF_PROVIDER "module" CACHE STRING "Provider of protobuf library") set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package") +set(gRPC_PROTOBUF_PACKAGE_TYPE "" CACHE STRING "Algorithm for searching protobuf package") +set_property(CACHE gRPC_PROTOBUF_PACKAGE_TYPE PROPERTY STRINGS "CONFIG" "MODULE") + set(gRPC_GFLAGS_PROVIDER "module" CACHE STRING "Provider of gflags library") set_property(CACHE gRPC_GFLAGS_PROVIDER PROPERTY STRINGS "module" "package") @@ -183,21 +186,27 @@ if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module") set(gRPC_INSTALL FALSE) endif() elseif("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "package") - find_package(protobuf CONFIG) - if(protobuf_FOUND) + find_package(Protobuf ${gRPC_PROTOBUF_PACKAGE_TYPE}) + if(Protobuf_FOUND OR PROTOBUF_FOUND) if(TARGET protobuf::${_gRPC_PROTOBUF_LIBRARY_NAME}) set(_gRPC_PROTOBUF_LIBRARIES protobuf::${_gRPC_PROTOBUF_LIBRARY_NAME}) + else() + set(_gRPC_PROTOBUF_LIBRARIES ${PROTOBUF_LIBRARIES}) endif() if(TARGET protobuf::libprotoc) set(_gRPC_PROTOBUF_PROTOC_LIBRARIES protobuf::libprotoc) + else() + set(_gRPC_PROTOBUF_PROTOC_LIBRARIES ${PROTOBUF_PROTOC_LIBRARIES}) endif() if(TARGET protobuf::protoc) set(_gRPC_PROTOBUF_PROTOC protobuf::protoc) + else() + set(_gRPC_PROTOBUF_PROTOC ${PROTOBUF_PROTOC_EXECUTABLE}) endif() - set(_gRPC_FIND_PROTOBUF "if(NOT protobuf_FOUND)\n find_package(protobuf CONFIG)\nendif()") - else() - find_package(Protobuf MODULE) - set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND)\n find_package(Protobuf)\nendif()") + set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND)\n find_package(Protobuf ${gRPC_PROTOBUF_PACKAGE_TYPE})\nendif()") + endif() + if(PROTOBUF_FOUND) + include_directories(${PROTOBUF_INCLUDE_DIRS}) endif() set(PROTOBUF_WELLKNOWN_IMPORT_DIR /usr/local/include) endif() diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index ef0faccb2e..8c38954c91 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -97,6 +97,9 @@ set(gRPC_PROTOBUF_PROVIDER "module" CACHE STRING "Provider of protobuf library") set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package") + set(gRPC_PROTOBUF_PACKAGE_TYPE "" CACHE STRING "Algorithm for searching protobuf package") + set_property(CACHE gRPC_PROTOBUF_PACKAGE_TYPE PROPERTY STRINGS "CONFIG" "MODULE") + set(gRPC_GFLAGS_PROVIDER "module" CACHE STRING "Provider of gflags library") set_property(CACHE gRPC_GFLAGS_PROVIDER PROPERTY STRINGS "module" "package") @@ -228,21 +231,27 @@ set(gRPC_INSTALL FALSE) endif() elseif("<%text>${gRPC_PROTOBUF_PROVIDER}" STREQUAL "package") - find_package(protobuf CONFIG) - if(protobuf_FOUND) + find_package(Protobuf <%text>${gRPC_PROTOBUF_PACKAGE_TYPE}) + if(Protobuf_FOUND OR PROTOBUF_FOUND) if(TARGET protobuf::<%text>${_gRPC_PROTOBUF_LIBRARY_NAME}) set(_gRPC_PROTOBUF_LIBRARIES protobuf::<%text>${_gRPC_PROTOBUF_LIBRARY_NAME}) + else() + set(_gRPC_PROTOBUF_LIBRARIES <%text>${PROTOBUF_LIBRARIES}) endif() if(TARGET protobuf::libprotoc) set(_gRPC_PROTOBUF_PROTOC_LIBRARIES protobuf::libprotoc) + else() + set(_gRPC_PROTOBUF_PROTOC_LIBRARIES <%text>${PROTOBUF_PROTOC_LIBRARIES}) endif() if(TARGET protobuf::protoc) set(_gRPC_PROTOBUF_PROTOC protobuf::protoc) + else() + set(_gRPC_PROTOBUF_PROTOC <%text>${PROTOBUF_PROTOC_EXECUTABLE}) endif() - set(_gRPC_FIND_PROTOBUF "if(NOT protobuf_FOUND)\n find_package(protobuf CONFIG)\nendif()") - else() - find_package(Protobuf MODULE) - set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND)\n find_package(Protobuf)\nendif()") + set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND)\n find_package(Protobuf <%text>${gRPC_PROTOBUF_PACKAGE_TYPE})\nendif()") + endif() + if(PROTOBUF_FOUND) + include_directories(<%text>${PROTOBUF_INCLUDE_DIRS}) endif() set(PROTOBUF_WELLKNOWN_IMPORT_DIR /usr/local/include) endif() -- cgit v1.2.3 From b9078c8ee86664fd204b7b0f205e6bb0897a9e42 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Wed, 28 Jun 2017 12:37:23 -0700 Subject: Properly use uint64_t not unsigned int64_t --- src/core/lib/support/time_precise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/support/time_precise.c b/src/core/lib/support/time_precise.c index 22971ef6c3..6ce19e53cc 100644 --- a/src/core/lib/support/time_precise.c +++ b/src/core/lib/support/time_precise.c @@ -31,7 +31,7 @@ static void gpr_get_cycle_counter(int64_t int *clk) { // ---------------------------------------------------------------- #elif defined(__x86_64__) || defined(__amd64__) static void gpr_get_cycle_counter(int64_t *clk) { - unsigned int64_t low, high; + uint64_t low, high; __asm__ volatile("rdtsc" : "=a"(low), "=d"(high)); *clk = (int64_t)(high << 32) | (int64_t)low; } -- cgit v1.2.3 From ab1ff6b0415a3582b7aee26e19e738928c75e0d3 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 28 Jun 2017 14:14:24 -0700 Subject: Split move test --- test/cpp/common/alarm_cpp_test.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/test/cpp/common/alarm_cpp_test.cc b/test/cpp/common/alarm_cpp_test.cc index 760dd7b956..ce4168843c 100644 --- a/test/cpp/common/alarm_cpp_test.cc +++ b/test/cpp/common/alarm_cpp_test.cc @@ -40,13 +40,25 @@ TEST(AlarmTest, RegularExpiry) { EXPECT_EQ(junk, output_tag); } -TEST(AlarmTest, Move) { +TEST(AlarmTest, MoveConstructor) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + Alarm first(&cq, grpc_timeout_seconds_to_deadline(1), junk); + Alarm second(std::move(first)); + void* output_tag; + bool ok; + const CompletionQueue::NextStatus status = cq.AsyncNext( + (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_TRUE(ok); + EXPECT_EQ(junk, output_tag); +} + +TEST(AlarmTest, MoveAssignment) { CompletionQueue cq; void* junk = reinterpret_cast(1618033); Alarm first(&cq, grpc_timeout_seconds_to_deadline(1), junk); - // Move constructor. Alarm second(std::move(first)); - // Moving assignment. first = std::move(second); void* output_tag; -- cgit v1.2.3 From b8e6e2f2999c71f50c8442d76c73870b841dafc3 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 28 Jun 2017 17:59:52 -0700 Subject: Fix test failures --- test/core/end2end/tests/cancel_after_round_trip.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/core/end2end/tests/cancel_after_round_trip.c b/test/core/end2end/tests/cancel_after_round_trip.c index eb7bd36228..0fc8b95ef7 100644 --- a/test/core/end2end/tests/cancel_after_round_trip.c +++ b/test/core/end2end/tests/cancel_after_round_trip.c @@ -212,6 +212,8 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, grpc_byte_buffer_destroy(request_payload_recv); grpc_byte_buffer_destroy(response_payload_recv); + request_payload_recv = NULL; + response_payload_recv = NULL; memset(ops, 0, sizeof(ops)); op = ops; -- cgit v1.2.3 From af084dc37c2d31f199cfa0516473fbe308ed9ba4 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 27 Jun 2017 13:42:54 -0700 Subject: Fixes to pick first --- .../lb_policy/pick_first/pick_first.c | 45 +++++++++++++++++++--- .../lb_policy/round_robin/round_robin.c | 30 +++++++-------- .../client_channel/resolver/fake/fake_resolver.c | 3 ++ 3 files changed, 57 insertions(+), 21 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c index 307e3bad67..d0acd7a901 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c @@ -95,6 +95,9 @@ static void pf_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { gpr_free(p->subchannels); gpr_free(p->new_subchannels); gpr_free(p); + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log(GPR_DEBUG, "Pick First %p destroyed.", (void *)p); + } } static void pf_shutdown_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { @@ -268,11 +271,20 @@ static void stop_connectivity_watchers(grpc_exec_ctx *exec_ctx, pick_first_lb_policy *p) { if (p->num_subchannels > 0) { GPR_ASSERT(p->selected == NULL); + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log(GPR_DEBUG, "Pick First %p unsubscribing from subchannel %p", + (void *)p, (void *)p->subchannels[p->checking_subchannel]); + } grpc_subchannel_notify_on_state_change( exec_ctx, p->subchannels[p->checking_subchannel], NULL, NULL, &p->connectivity_changed); p->updating_subchannels = true; } else if (p->selected != NULL) { + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log(GPR_DEBUG, + "Pick First %p unsubscribing from selected subchannel %p", + (void *)p, (void *)p->selected); + } grpc_connected_subchannel_notify_on_state_change( exec_ctx, p->selected, NULL, NULL, &p->connectivity_changed); p->updating_selected = true; @@ -451,12 +463,25 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_subchannel *selected_subchannel; pending_pick *pp; + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log( + GPR_DEBUG, + "Pick First %p connectivity changed. Updating selected: %d; Updating " + "subchannels: %d; Checking %lu index (%lu total); State: %d; ", + (void *)p, p->updating_selected, p->updating_subchannels, + (unsigned long)p->checking_subchannel, + (unsigned long)p->num_subchannels, p->checking_connectivity); + } bool restart = false; - if (p->updating_selected && error == GRPC_ERROR_CANCELLED) { + if (p->updating_selected && error != GRPC_ERROR_NONE) { /* Captured the unsubscription for p->selected */ GPR_ASSERT(p->selected != NULL); GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, p->selected, "pf_update_connectivity"); + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log(GPR_DEBUG, "Pick First %p unreffing selected subchannel %p", + (void *)p, (void *)p->selected); + } p->updating_selected = false; if (p->num_new_subchannels == 0) { p->selected = NULL; @@ -464,12 +489,16 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, } restart = true; } - if (p->updating_subchannels && error == GRPC_ERROR_CANCELLED) { + if (p->updating_subchannels && error != GRPC_ERROR_NONE) { /* Captured the unsubscription for the checking subchannel */ GPR_ASSERT(p->selected == NULL); for (size_t i = 0; i < p->num_subchannels; i++) { GRPC_SUBCHANNEL_UNREF(exec_ctx, p->subchannels[i], "pf_update_connectivity"); + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log(GPR_DEBUG, "Pick First %p unreffing subchannel %p", (void *)p, + (void *)p->subchannels[i]); + } } gpr_free(p->subchannels); p->subchannels = NULL; @@ -481,14 +510,12 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, if (restart) { p->selected = NULL; p->selected_key = NULL; - GPR_ASSERT(p->new_subchannels != NULL); GPR_ASSERT(p->num_new_subchannels > 0); p->num_subchannels = p->num_new_subchannels; p->subchannels = p->new_subchannels; p->num_new_subchannels = 0; p->new_subchannels = NULL; - if (p->started_picking) { /* If we were picking, continue to do so over the new subchannels, * starting from the 0th index. */ @@ -542,7 +569,9 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, "picked_first"); if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { - gpr_log(GPR_INFO, "Selected subchannel %p", (void *)p->selected); + gpr_log(GPR_INFO, + "Pick First %p selected subchannel %p (connected %p)", + (void *)p, (void *)selected_subchannel, (void *)p->selected); } p->selected_key = grpc_subchannel_get_key(selected_subchannel); /* drop the pick list: we are connected now */ @@ -568,7 +597,8 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, p->checking_subchannel = (p->checking_subchannel + 1) % p->num_subchannels; if (p->checking_subchannel == 0) { - /* only trigger transient failure when we've tried all alternatives */ + /* only trigger transient failure when we've tried all alternatives + */ grpc_connectivity_state_set( exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE, GRPC_ERROR_REF(error), "connecting_transient_failure"); @@ -652,6 +682,9 @@ static grpc_lb_policy *create_pick_first(grpc_exec_ctx *exec_ctx, grpc_lb_policy_args *args) { GPR_ASSERT(args->client_channel_factory != NULL); pick_first_lb_policy *p = gpr_zalloc(sizeof(*p)); + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log(GPR_DEBUG, "Pick First %p created.", (void *)p); + } pf_update_locked(exec_ctx, &p->base, args); grpc_lb_policy_init(&p->base, &pick_first_lb_policy_vtable, args->combiner); GRPC_CLOSURE_INIT(&p->connectivity_changed, pf_connectivity_changed_locked, p, diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c index b648bba3fb..8e9d6b0f47 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c @@ -478,29 +478,30 @@ static grpc_connectivity_state update_lb_connectivity_status_locked( if (subchannel_list->num_ready > 0) { /* 1) READY */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_READY, GRPC_ERROR_NONE, "rr_ready"); - new_state = GRPC_CHANNEL_READY; + new_state = GRPC_CHANNEL_READY; } else if (sd->curr_connectivity_state == GRPC_CHANNEL_CONNECTING) { /* 2) CONNECTING */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_CONNECTING, GRPC_ERROR_NONE, "rr_connecting"); - new_state = GRPC_CHANNEL_CONNECTING; + new_state = GRPC_CHANNEL_CONNECTING; } else if (p->subchannel_list->num_shutdown == p->subchannel_list->num_subchannels) { /* 3) SHUTDOWN */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, - GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error), "rr_shutdown"); - new_state = GRPC_CHANNEL_SHUTDOWN; + GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error), + "rr_shutdown"); + new_state = GRPC_CHANNEL_SHUTDOWN; } else if (subchannel_list->num_transient_failures == p->subchannel_list->num_subchannels) { /* 4) TRANSIENT_FAILURE */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, - GRPC_CHANNEL_TRANSIENT_FAILURE, GRPC_ERROR_REF(error), - "rr_transient_failure"); - new_state = GRPC_CHANNEL_TRANSIENT_FAILURE; + GRPC_CHANNEL_TRANSIENT_FAILURE, + GRPC_ERROR_REF(error), "rr_transient_failure"); + new_state = GRPC_CHANNEL_TRANSIENT_FAILURE; } else if (subchannel_list->num_idle == p->subchannel_list->num_subchannels) { /* 5) IDLE */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_IDLE, GRPC_ERROR_NONE, "rr_idle"); - new_state = GRPC_CHANNEL_IDLE; + new_state = GRPC_CHANNEL_IDLE; } GRPC_ERROR_UNREF(error); return new_state; @@ -581,14 +582,14 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, GPR_ASSERT(!sd->subchannel_list->shutting_down); if (GRPC_TRACER_ON(grpc_lb_round_robin_trace)) { const unsigned long num_subchannels = - p->subchannel_list != NULL ? p->subchannel_list->num_subchannels - : 0; + p->subchannel_list != NULL + ? (unsigned long)p->subchannel_list->num_subchannels + : 0; gpr_log(GPR_DEBUG, "[RR %p] phasing out subchannel list %p (size %lu) in favor " "of %p (size %lu)", (void *)p, (void *)p->subchannel_list, num_subchannels, - (void *)sd->subchannel_list, - (unsigned long)sd->subchannel_list->num_subchannels); + (void *)sd->subchannel_list, num_subchannels); } if (p->subchannel_list != NULL) { // dispose of the current subchannel_list @@ -666,9 +667,8 @@ static void rr_ping_one_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, grpc_connected_subchannel_ping(exec_ctx, target, closure); GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, target, "rr_picked"); } else { - GRPC_CLOSURE_SCHED( - exec_ctx, closure, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Round Robin not connected")); + GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "Round Robin not connected")); } } diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c index 56ed4371a9..479ba393a2 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c @@ -101,6 +101,9 @@ static void fake_resolver_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx, static void fake_resolver_channel_saw_error_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver) { fake_resolver* r = (fake_resolver*)resolver; + gpr_log( + GPR_INFO, + "FOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); if (r->next_results == NULL && r->results_upon_error != NULL) { // Pretend we re-resolved. r->next_results = grpc_channel_args_copy(r->results_upon_error); -- cgit v1.2.3 From 1e0aae6304b93f0fbd2ca10d683adf92b5c5d330 Mon Sep 17 00:00:00 2001 From: Noah Eisen Date: Thu, 29 Jun 2017 03:00:18 -0700 Subject: Fix musl --- src/core/lib/iomgr/ev_epollsig_linux.c | 5 ----- src/core/lib/iomgr/ev_poll_posix.c | 5 ----- 2 files changed, 10 deletions(-) diff --git a/src/core/lib/iomgr/ev_epollsig_linux.c b/src/core/lib/iomgr/ev_epollsig_linux.c index 17fef01e6e..255e07010b 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.c +++ b/src/core/lib/iomgr/ev_epollsig_linux.c @@ -840,11 +840,6 @@ static grpc_fd *fd_create(int fd, const char *name) { char *fd_name; gpr_asprintf(&fd_name, "%s fd=%d", name, fd); grpc_iomgr_register_object(&new_fd->iomgr_object, fd_name); -#ifndef NDEBUG - if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { - gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, new_fd, fd_name); - } -#endif gpr_free(fd_name); return new_fd; } diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index 1f66159c4a..1f8d7eef26 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -323,11 +323,6 @@ static grpc_fd *fd_create(int fd, const char *name) { gpr_asprintf(&name2, "%s fd=%d", name, fd); grpc_iomgr_register_object(&r->iomgr_object, name2); gpr_free(name2); -#ifndef NDEBUG - if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { - gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, r, name); - } -#endif return r; } -- cgit v1.2.3 From f53eb370560b797463ff571b384c66ef787d67dc Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 29 Jun 2017 14:18:38 +0200 Subject: improvements to kokoro macos build --- tools/internal_ci/helper_scripts/prepare_build_macos_rc | 12 ++++++++++-- tools/internal_ci/macos/grpc_master.sh | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index 1dabeeb3de..6d9db5db47 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -15,6 +15,12 @@ # Source this rc script to prepare the environment for macos builds +ulimit -n 1000 + +# show current limits +ulimit -a + + # required to build protobuf brew install gflags @@ -35,9 +41,11 @@ pod repo update # needed by python # python brew install coreutils # we need grealpath -#wget -q https://bootstrap.pypa.io/get-pip.py -#sudo python get-pip.py sudo pip install virtualenv sudo pip install -U six tox setuptools +# python 3.4 +wget https://www.python.org/ftp/python/3.4.4/python-3.4.4-macosx10.6.pkg +sudo installer -pkg python-3.4.4-macosx10.6.pkg -target / + git submodule update --init diff --git a/tools/internal_ci/macos/grpc_master.sh b/tools/internal_ci/macos/grpc_master.sh index 786859be3f..c64666b2de 100755 --- a/tools/internal_ci/macos/grpc_master.sh +++ b/tools/internal_ci/macos/grpc_master.sh @@ -20,7 +20,7 @@ cd $(dirname $0)/../../.. source tools/internal_ci/helper_scripts/prepare_build_macos_rc -tools/run_tests/run_tests_matrix.py -f basictests macos --internal_ci || FAILED="true" +tools/run_tests/run_tests_matrix.py -f basictests macos --internal_ci -j 2 --inner_jobs 4 || FAILED="true" # kill port_server.py to prevent the build from hanging ps aux | grep port_server\\.py | awk '{print $2}' | xargs kill -9 -- cgit v1.2.3 From cc4ef5919f81dc0c1be14172785da0f4d24d1e21 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 29 Jun 2017 08:11:57 -0700 Subject: Improvements to C++ filter API: - Make sure all C-core parameters are passed into C++ methods. - Add Destroy() methods for ChannelData and CallData. - Use C++-style casts. - Add 'extern "C"' to iomgr/closure.h, which is used in C++ filters. --- src/core/lib/iomgr/closure.h | 8 +++++ src/cpp/common/channel_filter.h | 54 ++++++++++++++++++++-------------- test/cpp/common/channel_filter_test.cc | 4 +-- 3 files changed, 42 insertions(+), 24 deletions(-) diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index 2560bf4527..cd32a4ba38 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -26,6 +26,10 @@ #include "src/core/lib/iomgr/error.h" #include "src/core/lib/support/mpscq.h" +#ifdef __cplusplus +extern "C" { +#endif + struct grpc_closure; typedef struct grpc_closure grpc_closure; @@ -197,4 +201,8 @@ void grpc_closure_list_sched(grpc_exec_ctx *exec_ctx, grpc_closure_list_sched(exec_ctx, closure_list) #endif +#ifdef __cplusplus +} +#endif + #endif /* GRPC_CORE_LIB_IOMGR_CLOSURE_H */ diff --git a/src/cpp/common/channel_filter.h b/src/cpp/common/channel_filter.h index 1b6ace6b13..5d629f7c14 100644 --- a/src/cpp/common/channel_filter.h +++ b/src/cpp/common/channel_filter.h @@ -208,38 +208,45 @@ class TransportStreamOpBatch { /// Represents channel data. class ChannelData { public: + ChannelData() {} virtual ~ChannelData() {} - /// Initializes the call data. - virtual grpc_error *Init(grpc_exec_ctx *exec_ctx, + // TODO(roth): Come up with a more C++-like API for the channel element. + + /// Initializes the channel data. + virtual grpc_error *Init(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_channel_element_args *args) { return GRPC_ERROR_NONE; } - // TODO(roth): Find a way to avoid passing elem into these methods. + // Called before destruction. + virtual void Destroy(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {} virtual void StartTransportOp(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, TransportOp *op); virtual void GetInfo(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, const grpc_channel_info *channel_info); - - protected: - ChannelData() {} }; /// Represents call data. class CallData { public: + CallData() {} virtual ~CallData() {} + // TODO(roth): Come up with a more C++-like API for the call element. + /// Initializes the call data. - virtual grpc_error *Init(grpc_exec_ctx *exec_ctx, ChannelData *channel_data, + virtual grpc_error *Init(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_element_args *args) { return GRPC_ERROR_NONE; } - // TODO(roth): Find a way to avoid passing elem into these methods. + // Called before destruction. + virtual void Destroy(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, + const grpc_call_final_info *final_info, + grpc_closure *then_call_closure) {} /// Starts a new stream operation. virtual void StartTransportStreamOpBatch(grpc_exec_ctx *exec_ctx, @@ -253,9 +260,6 @@ class CallData { /// Gets the peer name. virtual char *GetPeer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem); - - protected: - CallData() {} }; namespace internal { @@ -271,19 +275,24 @@ class ChannelFilter final { static grpc_error *InitChannelElement(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_channel_element_args *args) { + // Construct the object in the already-allocated memory. ChannelDataType *channel_data = new (elem->channel_data) ChannelDataType(); - return channel_data->Init(exec_ctx, args); + return channel_data->Init(exec_ctx, elem, args); } static void DestroyChannelElement(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) { - reinterpret_cast(elem->channel_data)->~ChannelDataType(); + ChannelDataType *channel_data = + reinterpret_cast(elem->channel_data); + channel_data->Destroy(exec_ctx, elem); + channel_data->~ChannelDataType(); } static void StartTransportOp(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_transport_op *op) { - ChannelDataType *channel_data = (ChannelDataType *)elem->channel_data; + ChannelDataType *channel_data = + reinterpret_cast(elem->channel_data); TransportOp op_wrapper(op); channel_data->StartTransportOp(exec_ctx, elem, &op_wrapper); } @@ -291,7 +300,8 @@ class ChannelFilter final { static void GetChannelInfo(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, const grpc_channel_info *channel_info) { - ChannelDataType *channel_data = (ChannelDataType *)elem->channel_data; + ChannelDataType *channel_data = + reinterpret_cast(elem->channel_data); channel_data->GetInfo(exec_ctx, elem, channel_info); } @@ -300,24 +310,24 @@ class ChannelFilter final { static grpc_error *InitCallElement(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_element_args *args) { - ChannelDataType *channel_data = (ChannelDataType *)elem->channel_data; // Construct the object in the already-allocated memory. CallDataType *call_data = new (elem->call_data) CallDataType(); - return call_data->Init(exec_ctx, channel_data, args); + return call_data->Init(exec_ctx, elem, args); } static void DestroyCallElement(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_final_info *final_info, grpc_closure *then_call_closure) { - GPR_ASSERT(then_call_closure == NULL); - reinterpret_cast(elem->call_data)->~CallDataType(); + CallDataType *call_data = reinterpret_cast(elem->call_data); + call_data->Destroy(exec_ctx, elem, final_info, then_call_closure); + call_data->~CallDataType(); } static void StartTransportStreamOpBatch(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op_batch *op) { - CallDataType *call_data = (CallDataType *)elem->call_data; + CallDataType *call_data = reinterpret_cast(elem->call_data); TransportStreamOpBatch op_wrapper(op); call_data->StartTransportStreamOpBatch(exec_ctx, elem, &op_wrapper); } @@ -325,12 +335,12 @@ class ChannelFilter final { static void SetPollsetOrPollsetSet(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_polling_entity *pollent) { - CallDataType *call_data = (CallDataType *)elem->call_data; + CallDataType *call_data = reinterpret_cast(elem->call_data); call_data->SetPollsetOrPollsetSet(exec_ctx, elem, pollent); } static char *GetPeer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { - CallDataType *call_data = (CallDataType *)elem->call_data; + CallDataType *call_data = reinterpret_cast(elem->call_data); return call_data->GetPeer(exec_ctx, elem); } }; diff --git a/test/cpp/common/channel_filter_test.cc b/test/cpp/common/channel_filter_test.cc index e747e633a0..638518107b 100644 --- a/test/cpp/common/channel_filter_test.cc +++ b/test/cpp/common/channel_filter_test.cc @@ -28,7 +28,7 @@ class MyChannelData : public ChannelData { public: MyChannelData() {} - grpc_error* Init(grpc_exec_ctx* exec_ctx, + grpc_error* Init(grpc_exec_ctx* exec_ctx, grpc_channel_element* elem, grpc_channel_element_args* args) override { (void)args->channel_args; // Make sure field is available. return GRPC_ERROR_NONE; @@ -39,7 +39,7 @@ class MyCallData : public CallData { public: MyCallData() {} - grpc_error* Init(grpc_exec_ctx* exec_ctx, ChannelData* channel_data, + grpc_error* Init(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, const grpc_call_element_args* args) override { (void)args->path; // Make sure field is available. return GRPC_ERROR_NONE; -- cgit v1.2.3 From c250b048a0abde515bad066f14dcaf5c33e4e730 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 29 Jun 2017 15:06:09 +0200 Subject: add mac deps to build artifacts on kokoro --- .../helper_scripts/prepare_build_macos_rc | 2 +- tools/internal_ci/macos/grpc_build_artifacts.sh | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index 6d9db5db47..6b942d22b8 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -45,7 +45,7 @@ sudo pip install virtualenv sudo pip install -U six tox setuptools # python 3.4 -wget https://www.python.org/ftp/python/3.4.4/python-3.4.4-macosx10.6.pkg +wget -q https://www.python.org/ftp/python/3.4.4/python-3.4.4-macosx10.6.pkg sudo installer -pkg python-3.4.4-macosx10.6.pkg -target / git submodule update --init diff --git a/tools/internal_ci/macos/grpc_build_artifacts.sh b/tools/internal_ci/macos/grpc_build_artifacts.sh index aad99b068d..3884a4f2e5 100755 --- a/tools/internal_ci/macos/grpc_build_artifacts.sh +++ b/tools/internal_ci/macos/grpc_build_artifacts.sh @@ -18,6 +18,24 @@ set -ex # change to grpc repo root cd $(dirname $0)/../../.. -git submodule update --init +source tools/internal_ci/helper_scripts/prepare_build_macos_rc + +# python 3.5 +wget -q https://www.python.org/ftp/python/3.5.2/python-3.5.2-macosx10.6.pkg +sudo installer -pkg python-3.5.2-macosx10.6.pkg -target / + +# install cython for all python versions +python2.7 -m pip install cython setuptools wheel +python3.4 -m pip install cython setuptools wheel +python3.5 -m pip install cython setuptools wheel +python3.6 -m pip install cython setuptools wheel + +# node-gyp (needed for node artifacts) +npm install -g node-gyp + +# php dependencies: pecl +curl -O http://pear.php.net/go-pear.phar +sudo php -d detect_unicode=0 go-pear.phar + tools/run_tests/task_runner.py -f artifact macos -- cgit v1.2.3 From b2b54fe60fd0f9353ba536f8217fa8119a5bbb77 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 27 Jun 2017 14:37:01 +0200 Subject: add C# test demoing custom error details --- .../CustomErrorDetailsTest.cs | 112 +++++++++++++++++++++ src/csharp/generate_proto_csharp.sh | 2 +- src/csharp/tests.json | 1 + 3 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs diff --git a/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs b/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs new file mode 100644 index 0000000000..be996f91e0 --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs @@ -0,0 +1,112 @@ +#region Copyright notice and license + +// Copyright 2015-2016 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. + +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Google.Protobuf; +using Grpc.Core; +using Grpc.Core.Utils; +using Grpc.Testing; +using NUnit.Framework; + +namespace Grpc.IntegrationTesting +{ + /// + /// Shows how to attach custom error details as a binary trailer. + /// + public class CustomErrorDetailsTest + { + const string DebugInfoTrailerName = "debug-info-bin"; + const string ExceptionDetail = "Exception thrown on purpose."; + const string Host = "localhost"; + Server server; + Channel channel; + TestService.TestServiceClient client; + + [TestFixtureSetUp] + public void Init() + { + // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755 + server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) }) + { + Services = { TestService.BindService(new CustomErrorDetailsTestServiceImpl()) }, + Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } } + }; + server.Start(); + + channel = new Channel(Host, server.Ports.Single().BoundPort, ChannelCredentials.Insecure); + client = new TestService.TestServiceClient(channel); + } + + [TestFixtureTearDown] + public void Cleanup() + { + channel.ShutdownAsync().Wait(); + server.ShutdownAsync().Wait(); + } + + [Test] + public async Task UnaryCall() + { + var call = client.UnaryCallAsync(new SimpleRequest { ResponseSize = 10 }); + + try + { + await call.ResponseAsync; + Assert.Fail(); + } + catch (RpcException e) + { + Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode); + var debugInfo = GetDebugInfo(call.GetTrailers()); + Assert.AreEqual(debugInfo.Detail, ExceptionDetail); + Assert.IsNotEmpty(debugInfo.StackEntries); + } + } + + private DebugInfo GetDebugInfo(Metadata trailers) + { + var entry = trailers.First((e) => e.Key == DebugInfoTrailerName); + return DebugInfo.Parser.ParseFrom(entry.ValueBytes); + } + + private class CustomErrorDetailsTestServiceImpl : TestService.TestServiceBase + { + public override async Task UnaryCall(SimpleRequest request, ServerCallContext context) + { + try + { + throw new ArgumentException(ExceptionDetail); + } + catch (Exception e) + { + // Fill debug info with some structured details about the failure. + var debugInfo = new DebugInfo(); + debugInfo.Detail = e.Message; + debugInfo.StackEntries.AddRange(e.StackTrace.Split(new[] { Environment.NewLine }, StringSplitOptions.None)); + context.ResponseTrailers.Add(DebugInfoTrailerName, debugInfo.ToByteArray()); + throw new RpcException(new Status(StatusCode.Unknown, "The handler threw exception.")); + } + } + } + } +} diff --git a/src/csharp/generate_proto_csharp.sh b/src/csharp/generate_proto_csharp.sh index 8caaaabe0f..1a1adbbae5 100755 --- a/src/csharp/generate_proto_csharp.sh +++ b/src/csharp/generate_proto_csharp.sh @@ -37,4 +37,4 @@ $PROTOC --plugin=$PLUGIN --csharp_out=$REFLECTION_DIR --grpc_out=$REFLECTION_DIR # don't match the package names. Setting -I to the correct value src/proto # breaks the code generation. $PROTOC --plugin=$PLUGIN --csharp_out=$TESTING_DIR --grpc_out=$TESTING_DIR \ - -I . src/proto/grpc/testing/{control,empty,messages,metrics,payloads,services,stats,test}.proto + -I . src/proto/grpc/testing/{control,echo_messages,empty,messages,metrics,payloads,services,stats,test}.proto diff --git a/src/csharp/tests.json b/src/csharp/tests.json index 707d140f62..bc6adbbfe8 100644 --- a/src/csharp/tests.json +++ b/src/csharp/tests.json @@ -42,6 +42,7 @@ "Grpc.HealthCheck.Tests.HealthServiceImplTest" ], "Grpc.IntegrationTesting": [ + "Grpc.IntegrationTesting.CustomErrorDetailsTest", "Grpc.IntegrationTesting.GeneratedClientTest", "Grpc.IntegrationTesting.GeneratedServiceBaseTest", "Grpc.IntegrationTesting.HistogramTest", -- cgit v1.2.3 From eb0219ba76c1f3beaa598457c85cf73b2d09342c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 27 Jun 2017 17:04:04 +0200 Subject: regenerate C# protos --- src/csharp/Grpc.IntegrationTesting/Control.cs | 260 +++- src/csharp/Grpc.IntegrationTesting/EchoMessages.cs | 1354 ++++++++++++++++++++ src/csharp/Grpc.IntegrationTesting/Services.cs | 34 +- src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs | 266 +++- src/csharp/Grpc.IntegrationTesting/Stats.cs | 93 +- 5 files changed, 1922 insertions(+), 85 deletions(-) create mode 100644 src/csharp/Grpc.IntegrationTesting/EchoMessages.cs diff --git a/src/csharp/Grpc.IntegrationTesting/Control.cs b/src/csharp/Grpc.IntegrationTesting/Control.cs index 6c0176fb43..d62b5a1c5b 100644 --- a/src/csharp/Grpc.IntegrationTesting/Control.cs +++ b/src/csharp/Grpc.IntegrationTesting/Control.cs @@ -32,7 +32,7 @@ namespace Grpc.Testing { "U2VjdXJpdHlQYXJhbXMSEwoLdXNlX3Rlc3RfY2EYASABKAgSHAoUc2VydmVy", "X2hvc3Rfb3ZlcnJpZGUYAiABKAkiTQoKQ2hhbm5lbEFyZxIMCgRuYW1lGAEg", "ASgJEhMKCXN0cl92YWx1ZRgCIAEoCUgAEhMKCWludF92YWx1ZRgDIAEoBUgA", - "QgcKBXZhbHVlIqAECgxDbGllbnRDb25maWcSFgoOc2VydmVyX3RhcmdldHMY", + "QgcKBXZhbHVlItUECgxDbGllbnRDb25maWcSFgoOc2VydmVyX3RhcmdldHMY", "ASADKAkSLQoLY2xpZW50X3R5cGUYAiABKA4yGC5ncnBjLnRlc3RpbmcuQ2xp", "ZW50VHlwZRI1Cg9zZWN1cml0eV9wYXJhbXMYAyABKAsyHC5ncnBjLnRlc3Rp", "bmcuU2VjdXJpdHlQYXJhbXMSJAocb3V0c3RhbmRpbmdfcnBjc19wZXJfY2hh", @@ -44,52 +44,57 @@ namespace Grpc.Testing { "cxgMIAEoCzIdLmdycGMudGVzdGluZy5IaXN0b2dyYW1QYXJhbXMSEQoJY29y", "ZV9saXN0GA0gAygFEhIKCmNvcmVfbGltaXQYDiABKAUSGAoQb3RoZXJfY2xp", "ZW50X2FwaRgPIAEoCRIuCgxjaGFubmVsX2FyZ3MYECADKAsyGC5ncnBjLnRl", - "c3RpbmcuQ2hhbm5lbEFyZyI4CgxDbGllbnRTdGF0dXMSKAoFc3RhdHMYASAB", - "KAsyGS5ncnBjLnRlc3RpbmcuQ2xpZW50U3RhdHMiFQoETWFyaxINCgVyZXNl", - "dBgBIAEoCCJoCgpDbGllbnRBcmdzEisKBXNldHVwGAEgASgLMhouZ3JwYy50", - "ZXN0aW5nLkNsaWVudENvbmZpZ0gAEiIKBG1hcmsYAiABKAsyEi5ncnBjLnRl", - "c3RpbmcuTWFya0gAQgkKB2FyZ3R5cGUitAIKDFNlcnZlckNvbmZpZxItCgtz", - "ZXJ2ZXJfdHlwZRgBIAEoDjIYLmdycGMudGVzdGluZy5TZXJ2ZXJUeXBlEjUK", - "D3NlY3VyaXR5X3BhcmFtcxgCIAEoCzIcLmdycGMudGVzdGluZy5TZWN1cml0", - "eVBhcmFtcxIMCgRwb3J0GAQgASgFEhwKFGFzeW5jX3NlcnZlcl90aHJlYWRz", - "GAcgASgFEhIKCmNvcmVfbGltaXQYCCABKAUSMwoOcGF5bG9hZF9jb25maWcY", - "CSABKAsyGy5ncnBjLnRlc3RpbmcuUGF5bG9hZENvbmZpZxIRCgljb3JlX2xp", - "c3QYCiADKAUSGAoQb3RoZXJfc2VydmVyX2FwaRgLIAEoCRIcChNyZXNvdXJj", - "ZV9xdW90YV9zaXplGOkHIAEoBSJoCgpTZXJ2ZXJBcmdzEisKBXNldHVwGAEg", - "ASgLMhouZ3JwYy50ZXN0aW5nLlNlcnZlckNvbmZpZ0gAEiIKBG1hcmsYAiAB", - "KAsyEi5ncnBjLnRlc3RpbmcuTWFya0gAQgkKB2FyZ3R5cGUiVQoMU2VydmVy", - "U3RhdHVzEigKBXN0YXRzGAEgASgLMhkuZ3JwYy50ZXN0aW5nLlNlcnZlclN0", - "YXRzEgwKBHBvcnQYAiABKAUSDQoFY29yZXMYAyABKAUiDQoLQ29yZVJlcXVl", - "c3QiHQoMQ29yZVJlc3BvbnNlEg0KBWNvcmVzGAEgASgFIgYKBFZvaWQi/QEK", - "CFNjZW5hcmlvEgwKBG5hbWUYASABKAkSMQoNY2xpZW50X2NvbmZpZxgCIAEo", - "CzIaLmdycGMudGVzdGluZy5DbGllbnRDb25maWcSEwoLbnVtX2NsaWVudHMY", - "AyABKAUSMQoNc2VydmVyX2NvbmZpZxgEIAEoCzIaLmdycGMudGVzdGluZy5T", - "ZXJ2ZXJDb25maWcSEwoLbnVtX3NlcnZlcnMYBSABKAUSFgoOd2FybXVwX3Nl", - "Y29uZHMYBiABKAUSGQoRYmVuY2htYXJrX3NlY29uZHMYByABKAUSIAoYc3Bh", - "d25fbG9jYWxfd29ya2VyX2NvdW50GAggASgFIjYKCVNjZW5hcmlvcxIpCglz", - "Y2VuYXJpb3MYASADKAsyFi5ncnBjLnRlc3RpbmcuU2NlbmFyaW8i+AIKFVNj", - "ZW5hcmlvUmVzdWx0U3VtbWFyeRILCgNxcHMYASABKAESGwoTcXBzX3Blcl9z", - "ZXJ2ZXJfY29yZRgCIAEoARIaChJzZXJ2ZXJfc3lzdGVtX3RpbWUYAyABKAES", - "GAoQc2VydmVyX3VzZXJfdGltZRgEIAEoARIaChJjbGllbnRfc3lzdGVtX3Rp", - "bWUYBSABKAESGAoQY2xpZW50X3VzZXJfdGltZRgGIAEoARISCgpsYXRlbmN5", - "XzUwGAcgASgBEhIKCmxhdGVuY3lfOTAYCCABKAESEgoKbGF0ZW5jeV85NRgJ", - "IAEoARISCgpsYXRlbmN5Xzk5GAogASgBEhMKC2xhdGVuY3lfOTk5GAsgASgB", - "EhgKEHNlcnZlcl9jcHVfdXNhZ2UYDCABKAESJgoec3VjY2Vzc2Z1bF9yZXF1", - "ZXN0c19wZXJfc2Vjb25kGA0gASgBEiIKGmZhaWxlZF9yZXF1ZXN0c19wZXJf", - "c2Vjb25kGA4gASgBIoMDCg5TY2VuYXJpb1Jlc3VsdBIoCghzY2VuYXJpbxgB", - "IAEoCzIWLmdycGMudGVzdGluZy5TY2VuYXJpbxIuCglsYXRlbmNpZXMYAiAB", - "KAsyGy5ncnBjLnRlc3RpbmcuSGlzdG9ncmFtRGF0YRIvCgxjbGllbnRfc3Rh", - "dHMYAyADKAsyGS5ncnBjLnRlc3RpbmcuQ2xpZW50U3RhdHMSLwoMc2VydmVy", - "X3N0YXRzGAQgAygLMhkuZ3JwYy50ZXN0aW5nLlNlcnZlclN0YXRzEhQKDHNl", - "cnZlcl9jb3JlcxgFIAMoBRI0CgdzdW1tYXJ5GAYgASgLMiMuZ3JwYy50ZXN0", - "aW5nLlNjZW5hcmlvUmVzdWx0U3VtbWFyeRIWCg5jbGllbnRfc3VjY2VzcxgH", - "IAMoCBIWCg5zZXJ2ZXJfc3VjY2VzcxgIIAMoCBI5Cg9yZXF1ZXN0X3Jlc3Vs", - "dHMYCSADKAsyIC5ncnBjLnRlc3RpbmcuUmVxdWVzdFJlc3VsdENvdW50KkEK", - "CkNsaWVudFR5cGUSDwoLU1lOQ19DTElFTlQQABIQCgxBU1lOQ19DTElFTlQQ", - "ARIQCgxPVEhFUl9DTElFTlQQAipbCgpTZXJ2ZXJUeXBlEg8KC1NZTkNfU0VS", - "VkVSEAASEAoMQVNZTkNfU0VSVkVSEAESGAoUQVNZTkNfR0VORVJJQ19TRVJW", - "RVIQAhIQCgxPVEhFUl9TRVJWRVIQAyojCgdScGNUeXBlEgkKBVVOQVJZEAAS", - "DQoJU1RSRUFNSU5HEAFiBnByb3RvMw==")); + "c3RpbmcuQ2hhbm5lbEFyZxIWCg50aHJlYWRzX3Blcl9jcRgRIAEoBRIbChNt", + "ZXNzYWdlc19wZXJfc3RyZWFtGBIgASgFIjgKDENsaWVudFN0YXR1cxIoCgVz", + "dGF0cxgBIAEoCzIZLmdycGMudGVzdGluZy5DbGllbnRTdGF0cyIVCgRNYXJr", + "Eg0KBXJlc2V0GAEgASgIImgKCkNsaWVudEFyZ3MSKwoFc2V0dXAYASABKAsy", + "Gi5ncnBjLnRlc3RpbmcuQ2xpZW50Q29uZmlnSAASIgoEbWFyaxgCIAEoCzIS", + "LmdycGMudGVzdGluZy5NYXJrSABCCQoHYXJndHlwZSLMAgoMU2VydmVyQ29u", + "ZmlnEi0KC3NlcnZlcl90eXBlGAEgASgOMhguZ3JwYy50ZXN0aW5nLlNlcnZl", + "clR5cGUSNQoPc2VjdXJpdHlfcGFyYW1zGAIgASgLMhwuZ3JwYy50ZXN0aW5n", + "LlNlY3VyaXR5UGFyYW1zEgwKBHBvcnQYBCABKAUSHAoUYXN5bmNfc2VydmVy", + "X3RocmVhZHMYByABKAUSEgoKY29yZV9saW1pdBgIIAEoBRIzCg5wYXlsb2Fk", + "X2NvbmZpZxgJIAEoCzIbLmdycGMudGVzdGluZy5QYXlsb2FkQ29uZmlnEhEK", + "CWNvcmVfbGlzdBgKIAMoBRIYChBvdGhlcl9zZXJ2ZXJfYXBpGAsgASgJEhYK", + "DnRocmVhZHNfcGVyX2NxGAwgASgFEhwKE3Jlc291cmNlX3F1b3RhX3NpemUY", + "6QcgASgFImgKClNlcnZlckFyZ3MSKwoFc2V0dXAYASABKAsyGi5ncnBjLnRl", + "c3RpbmcuU2VydmVyQ29uZmlnSAASIgoEbWFyaxgCIAEoCzISLmdycGMudGVz", + "dGluZy5NYXJrSABCCQoHYXJndHlwZSJVCgxTZXJ2ZXJTdGF0dXMSKAoFc3Rh", + "dHMYASABKAsyGS5ncnBjLnRlc3RpbmcuU2VydmVyU3RhdHMSDAoEcG9ydBgC", + "IAEoBRINCgVjb3JlcxgDIAEoBSINCgtDb3JlUmVxdWVzdCIdCgxDb3JlUmVz", + "cG9uc2USDQoFY29yZXMYASABKAUiBgoEVm9pZCL9AQoIU2NlbmFyaW8SDAoE", + "bmFtZRgBIAEoCRIxCg1jbGllbnRfY29uZmlnGAIgASgLMhouZ3JwYy50ZXN0", + "aW5nLkNsaWVudENvbmZpZxITCgtudW1fY2xpZW50cxgDIAEoBRIxCg1zZXJ2", + "ZXJfY29uZmlnGAQgASgLMhouZ3JwYy50ZXN0aW5nLlNlcnZlckNvbmZpZxIT", + "CgtudW1fc2VydmVycxgFIAEoBRIWCg53YXJtdXBfc2Vjb25kcxgGIAEoBRIZ", + "ChFiZW5jaG1hcmtfc2Vjb25kcxgHIAEoBRIgChhzcGF3bl9sb2NhbF93b3Jr", + "ZXJfY291bnQYCCABKAUiNgoJU2NlbmFyaW9zEikKCXNjZW5hcmlvcxgBIAMo", + "CzIWLmdycGMudGVzdGluZy5TY2VuYXJpbyK8AwoVU2NlbmFyaW9SZXN1bHRT", + "dW1tYXJ5EgsKA3FwcxgBIAEoARIbChNxcHNfcGVyX3NlcnZlcl9jb3JlGAIg", + "ASgBEhoKEnNlcnZlcl9zeXN0ZW1fdGltZRgDIAEoARIYChBzZXJ2ZXJfdXNl", + "cl90aW1lGAQgASgBEhoKEmNsaWVudF9zeXN0ZW1fdGltZRgFIAEoARIYChBj", + "bGllbnRfdXNlcl90aW1lGAYgASgBEhIKCmxhdGVuY3lfNTAYByABKAESEgoK", + "bGF0ZW5jeV85MBgIIAEoARISCgpsYXRlbmN5Xzk1GAkgASgBEhIKCmxhdGVu", + "Y3lfOTkYCiABKAESEwoLbGF0ZW5jeV85OTkYCyABKAESGAoQc2VydmVyX2Nw", + "dV91c2FnZRgMIAEoARImCh5zdWNjZXNzZnVsX3JlcXVlc3RzX3Blcl9zZWNv", + "bmQYDSABKAESIgoaZmFpbGVkX3JlcXVlc3RzX3Blcl9zZWNvbmQYDiABKAES", + "IAoYY2xpZW50X3BvbGxzX3Blcl9yZXF1ZXN0GA8gASgBEiAKGHNlcnZlcl9w", + "b2xsc19wZXJfcmVxdWVzdBgQIAEoASKDAwoOU2NlbmFyaW9SZXN1bHQSKAoI", + "c2NlbmFyaW8YASABKAsyFi5ncnBjLnRlc3RpbmcuU2NlbmFyaW8SLgoJbGF0", + "ZW5jaWVzGAIgASgLMhsuZ3JwYy50ZXN0aW5nLkhpc3RvZ3JhbURhdGESLwoM", + "Y2xpZW50X3N0YXRzGAMgAygLMhkuZ3JwYy50ZXN0aW5nLkNsaWVudFN0YXRz", + "Ei8KDHNlcnZlcl9zdGF0cxgEIAMoCzIZLmdycGMudGVzdGluZy5TZXJ2ZXJT", + "dGF0cxIUCgxzZXJ2ZXJfY29yZXMYBSADKAUSNAoHc3VtbWFyeRgGIAEoCzIj", + "LmdycGMudGVzdGluZy5TY2VuYXJpb1Jlc3VsdFN1bW1hcnkSFgoOY2xpZW50", + "X3N1Y2Nlc3MYByADKAgSFgoOc2VydmVyX3N1Y2Nlc3MYCCADKAgSOQoPcmVx", + "dWVzdF9yZXN1bHRzGAkgAygLMiAuZ3JwYy50ZXN0aW5nLlJlcXVlc3RSZXN1", + "bHRDb3VudCpBCgpDbGllbnRUeXBlEg8KC1NZTkNfQ0xJRU5UEAASEAoMQVNZ", + "TkNfQ0xJRU5UEAESEAoMT1RIRVJfQ0xJRU5UEAIqWwoKU2VydmVyVHlwZRIP", + "CgtTWU5DX1NFUlZFUhAAEhAKDEFTWU5DX1NFUlZFUhABEhgKFEFTWU5DX0dF", + "TkVSSUNfU0VSVkVSEAISEAoMT1RIRVJfU0VSVkVSEAMqcgoHUnBjVHlwZRIJ", + "CgVVTkFSWRAAEg0KCVNUUkVBTUlORxABEhkKFVNUUkVBTUlOR19GUk9NX0NM", + "SUVOVBACEhkKFVNUUkVBTUlOR19GUk9NX1NFUlZFUhADEhcKE1NUUkVBTUlO", + "R19CT1RIX1dBWVMQBGIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Grpc.Testing.PayloadsReflection.Descriptor, global::Grpc.Testing.StatsReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Grpc.Testing.ClientType), typeof(global::Grpc.Testing.ServerType), typeof(global::Grpc.Testing.RpcType), }, new pbr::GeneratedClrTypeInfo[] { @@ -98,11 +103,11 @@ namespace Grpc.Testing { new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.LoadParams), global::Grpc.Testing.LoadParams.Parser, new[]{ "ClosedLoop", "Poisson" }, new[]{ "Load" }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SecurityParams), global::Grpc.Testing.SecurityParams.Parser, new[]{ "UseTestCa", "ServerHostOverride" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ChannelArg), global::Grpc.Testing.ChannelArg.Parser, new[]{ "Name", "StrValue", "IntValue" }, new[]{ "Value" }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit", "OtherClientApi", "ChannelArgs" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit", "OtherClientApi", "ChannelArgs", "ThreadsPerCq", "MessagesPerStream" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientStatus), global::Grpc.Testing.ClientStatus.Parser, new[]{ "Stats" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Mark), global::Grpc.Testing.Mark.Parser, new[]{ "Reset" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientArgs), global::Grpc.Testing.ClientArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerConfig), global::Grpc.Testing.ServerConfig.Parser, new[]{ "ServerType", "SecurityParams", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig", "CoreList", "OtherServerApi", "ResourceQuotaSize" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerConfig), global::Grpc.Testing.ServerConfig.Parser, new[]{ "ServerType", "SecurityParams", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig", "CoreList", "OtherServerApi", "ThreadsPerCq", "ResourceQuotaSize" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerArgs), global::Grpc.Testing.ServerArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerStatus), global::Grpc.Testing.ServerStatus.Parser, new[]{ "Stats", "Port", "Cores" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.CoreRequest), global::Grpc.Testing.CoreRequest.Parser, null, null, null, null), @@ -110,7 +115,7 @@ namespace Grpc.Testing { new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Void), global::Grpc.Testing.Void.Parser, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Scenario), global::Grpc.Testing.Scenario.Parser, new[]{ "Name", "ClientConfig", "NumClients", "ServerConfig", "NumServers", "WarmupSeconds", "BenchmarkSeconds", "SpawnLocalWorkerCount" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Scenarios), global::Grpc.Testing.Scenarios.Parser, new[]{ "Scenarios_" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ScenarioResultSummary), global::Grpc.Testing.ScenarioResultSummary.Parser, new[]{ "Qps", "QpsPerServerCore", "ServerSystemTime", "ServerUserTime", "ClientSystemTime", "ClientUserTime", "Latency50", "Latency90", "Latency95", "Latency99", "Latency999", "ServerCpuUsage", "SuccessfulRequestsPerSecond", "FailedRequestsPerSecond" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ScenarioResultSummary), global::Grpc.Testing.ScenarioResultSummary.Parser, new[]{ "Qps", "QpsPerServerCore", "ServerSystemTime", "ServerUserTime", "ClientSystemTime", "ClientUserTime", "Latency50", "Latency90", "Latency95", "Latency99", "Latency999", "ServerCpuUsage", "SuccessfulRequestsPerSecond", "FailedRequestsPerSecond", "ClientPollsPerRequest", "ServerPollsPerRequest" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ScenarioResult), global::Grpc.Testing.ScenarioResult.Parser, new[]{ "Scenario", "Latencies", "ClientStats", "ServerStats", "ServerCores", "Summary", "ClientSuccess", "ServerSuccess", "RequestResults" }, null, null, null) })); } @@ -144,6 +149,9 @@ namespace Grpc.Testing { public enum RpcType { [pbr::OriginalName("UNARY")] Unary = 0, [pbr::OriginalName("STREAMING")] Streaming = 1, + [pbr::OriginalName("STREAMING_FROM_CLIENT")] StreamingFromClient = 2, + [pbr::OriginalName("STREAMING_FROM_SERVER")] StreamingFromServer = 3, + [pbr::OriginalName("STREAMING_BOTH_WAYS")] StreamingBothWays = 4, } #endregion @@ -942,6 +950,8 @@ namespace Grpc.Testing { coreLimit_ = other.coreLimit_; otherClientApi_ = other.otherClientApi_; channelArgs_ = other.channelArgs_.Clone(); + threadsPerCq_ = other.threadsPerCq_; + messagesPerStream_ = other.messagesPerStream_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1123,6 +1133,34 @@ namespace Grpc.Testing { get { return channelArgs_; } } + /// Field number for the "threads_per_cq" field. + public const int ThreadsPerCqFieldNumber = 17; + private int threadsPerCq_; + /// + /// Number of threads that share each completion queue + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ThreadsPerCq { + get { return threadsPerCq_; } + set { + threadsPerCq_ = value; + } + } + + /// Field number for the "messages_per_stream" field. + public const int MessagesPerStreamFieldNumber = 18; + private int messagesPerStream_; + /// + /// Number of messages on a stream before it gets finished/restarted + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int MessagesPerStream { + get { return messagesPerStream_; } + set { + messagesPerStream_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ClientConfig); @@ -1150,6 +1188,8 @@ namespace Grpc.Testing { if (CoreLimit != other.CoreLimit) return false; if (OtherClientApi != other.OtherClientApi) return false; if(!channelArgs_.Equals(other.channelArgs_)) return false; + if (ThreadsPerCq != other.ThreadsPerCq) return false; + if (MessagesPerStream != other.MessagesPerStream) return false; return true; } @@ -1170,6 +1210,8 @@ namespace Grpc.Testing { if (CoreLimit != 0) hash ^= CoreLimit.GetHashCode(); if (OtherClientApi.Length != 0) hash ^= OtherClientApi.GetHashCode(); hash ^= channelArgs_.GetHashCode(); + if (ThreadsPerCq != 0) hash ^= ThreadsPerCq.GetHashCode(); + if (MessagesPerStream != 0) hash ^= MessagesPerStream.GetHashCode(); return hash; } @@ -1227,6 +1269,14 @@ namespace Grpc.Testing { output.WriteString(OtherClientApi); } channelArgs_.WriteTo(output, _repeated_channelArgs_codec); + if (ThreadsPerCq != 0) { + output.WriteRawTag(136, 1); + output.WriteInt32(ThreadsPerCq); + } + if (MessagesPerStream != 0) { + output.WriteRawTag(144, 1); + output.WriteInt32(MessagesPerStream); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1268,6 +1318,12 @@ namespace Grpc.Testing { size += 1 + pb::CodedOutputStream.ComputeStringSize(OtherClientApi); } size += channelArgs_.CalculateSize(_repeated_channelArgs_codec); + if (ThreadsPerCq != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(ThreadsPerCq); + } + if (MessagesPerStream != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(MessagesPerStream); + } return size; } @@ -1324,6 +1380,12 @@ namespace Grpc.Testing { OtherClientApi = other.OtherClientApi; } channelArgs_.Add(other.channelArgs_); + if (other.ThreadsPerCq != 0) { + ThreadsPerCq = other.ThreadsPerCq; + } + if (other.MessagesPerStream != 0) { + MessagesPerStream = other.MessagesPerStream; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1403,6 +1465,14 @@ namespace Grpc.Testing { channelArgs_.AddEntriesFrom(input, _repeated_channelArgs_codec); break; } + case 136: { + ThreadsPerCq = input.ReadInt32(); + break; + } + case 144: { + MessagesPerStream = input.ReadInt32(); + break; + } } } } @@ -1873,6 +1943,7 @@ namespace Grpc.Testing { PayloadConfig = other.payloadConfig_ != null ? other.PayloadConfig.Clone() : null; coreList_ = other.coreList_.Clone(); otherServerApi_ = other.otherServerApi_; + threadsPerCq_ = other.threadsPerCq_; resourceQuotaSize_ = other.resourceQuotaSize_; } @@ -1989,6 +2060,20 @@ namespace Grpc.Testing { } } + /// Field number for the "threads_per_cq" field. + public const int ThreadsPerCqFieldNumber = 12; + private int threadsPerCq_; + /// + /// Number of threads that share each completion queue + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ThreadsPerCq { + get { return threadsPerCq_; } + set { + threadsPerCq_ = value; + } + } + /// Field number for the "resource_quota_size" field. public const int ResourceQuotaSizeFieldNumber = 1001; private int resourceQuotaSize_; @@ -2024,6 +2109,7 @@ namespace Grpc.Testing { if (!object.Equals(PayloadConfig, other.PayloadConfig)) return false; if(!coreList_.Equals(other.coreList_)) return false; if (OtherServerApi != other.OtherServerApi) return false; + if (ThreadsPerCq != other.ThreadsPerCq) return false; if (ResourceQuotaSize != other.ResourceQuotaSize) return false; return true; } @@ -2039,6 +2125,7 @@ namespace Grpc.Testing { if (payloadConfig_ != null) hash ^= PayloadConfig.GetHashCode(); hash ^= coreList_.GetHashCode(); if (OtherServerApi.Length != 0) hash ^= OtherServerApi.GetHashCode(); + if (ThreadsPerCq != 0) hash ^= ThreadsPerCq.GetHashCode(); if (ResourceQuotaSize != 0) hash ^= ResourceQuotaSize.GetHashCode(); return hash; } @@ -2079,6 +2166,10 @@ namespace Grpc.Testing { output.WriteRawTag(90); output.WriteString(OtherServerApi); } + if (ThreadsPerCq != 0) { + output.WriteRawTag(96); + output.WriteInt32(ThreadsPerCq); + } if (ResourceQuotaSize != 0) { output.WriteRawTag(200, 62); output.WriteInt32(ResourceQuotaSize); @@ -2110,6 +2201,9 @@ namespace Grpc.Testing { if (OtherServerApi.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(OtherServerApi); } + if (ThreadsPerCq != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ThreadsPerCq); + } if (ResourceQuotaSize != 0) { size += 2 + pb::CodedOutputStream.ComputeInt32Size(ResourceQuotaSize); } @@ -2149,6 +2243,9 @@ namespace Grpc.Testing { if (other.OtherServerApi.Length != 0) { OtherServerApi = other.OtherServerApi; } + if (other.ThreadsPerCq != 0) { + ThreadsPerCq = other.ThreadsPerCq; + } if (other.ResourceQuotaSize != 0) { ResourceQuotaSize = other.ResourceQuotaSize; } @@ -2201,6 +2298,10 @@ namespace Grpc.Testing { OtherServerApi = input.ReadString(); break; } + case 96: { + ThreadsPerCq = input.ReadInt32(); + break; + } case 8008: { ResourceQuotaSize = input.ReadInt32(); break; @@ -3386,6 +3487,8 @@ namespace Grpc.Testing { serverCpuUsage_ = other.serverCpuUsage_; successfulRequestsPerSecond_ = other.successfulRequestsPerSecond_; failedRequestsPerSecond_ = other.failedRequestsPerSecond_; + clientPollsPerRequest_ = other.clientPollsPerRequest_; + serverPollsPerRequest_ = other.serverPollsPerRequest_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3574,6 +3677,31 @@ namespace Grpc.Testing { } } + /// Field number for the "client_polls_per_request" field. + public const int ClientPollsPerRequestFieldNumber = 15; + private double clientPollsPerRequest_; + /// + /// Number of polls called inside completion queue per request + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double ClientPollsPerRequest { + get { return clientPollsPerRequest_; } + set { + clientPollsPerRequest_ = value; + } + } + + /// Field number for the "server_polls_per_request" field. + public const int ServerPollsPerRequestFieldNumber = 16; + private double serverPollsPerRequest_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double ServerPollsPerRequest { + get { return serverPollsPerRequest_; } + set { + serverPollsPerRequest_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ScenarioResultSummary); @@ -3601,6 +3729,8 @@ namespace Grpc.Testing { if (ServerCpuUsage != other.ServerCpuUsage) return false; if (SuccessfulRequestsPerSecond != other.SuccessfulRequestsPerSecond) return false; if (FailedRequestsPerSecond != other.FailedRequestsPerSecond) return false; + if (ClientPollsPerRequest != other.ClientPollsPerRequest) return false; + if (ServerPollsPerRequest != other.ServerPollsPerRequest) return false; return true; } @@ -3621,6 +3751,8 @@ namespace Grpc.Testing { if (ServerCpuUsage != 0D) hash ^= ServerCpuUsage.GetHashCode(); if (SuccessfulRequestsPerSecond != 0D) hash ^= SuccessfulRequestsPerSecond.GetHashCode(); if (FailedRequestsPerSecond != 0D) hash ^= FailedRequestsPerSecond.GetHashCode(); + if (ClientPollsPerRequest != 0D) hash ^= ClientPollsPerRequest.GetHashCode(); + if (ServerPollsPerRequest != 0D) hash ^= ServerPollsPerRequest.GetHashCode(); return hash; } @@ -3687,6 +3819,14 @@ namespace Grpc.Testing { output.WriteRawTag(113); output.WriteDouble(FailedRequestsPerSecond); } + if (ClientPollsPerRequest != 0D) { + output.WriteRawTag(121); + output.WriteDouble(ClientPollsPerRequest); + } + if (ServerPollsPerRequest != 0D) { + output.WriteRawTag(129, 1); + output.WriteDouble(ServerPollsPerRequest); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3734,6 +3874,12 @@ namespace Grpc.Testing { if (FailedRequestsPerSecond != 0D) { size += 1 + 8; } + if (ClientPollsPerRequest != 0D) { + size += 1 + 8; + } + if (ServerPollsPerRequest != 0D) { + size += 2 + 8; + } return size; } @@ -3784,6 +3930,12 @@ namespace Grpc.Testing { if (other.FailedRequestsPerSecond != 0D) { FailedRequestsPerSecond = other.FailedRequestsPerSecond; } + if (other.ClientPollsPerRequest != 0D) { + ClientPollsPerRequest = other.ClientPollsPerRequest; + } + if (other.ServerPollsPerRequest != 0D) { + ServerPollsPerRequest = other.ServerPollsPerRequest; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3850,6 +4002,14 @@ namespace Grpc.Testing { FailedRequestsPerSecond = input.ReadDouble(); break; } + case 121: { + ClientPollsPerRequest = input.ReadDouble(); + break; + } + case 129: { + ServerPollsPerRequest = input.ReadDouble(); + break; + } } } } diff --git a/src/csharp/Grpc.IntegrationTesting/EchoMessages.cs b/src/csharp/Grpc.IntegrationTesting/EchoMessages.cs new file mode 100644 index 0000000000..b2fe73acdf --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting/EchoMessages.cs @@ -0,0 +1,1354 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: src/proto/grpc/testing/echo_messages.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Grpc.Testing { + + /// Holder for reflection information generated from src/proto/grpc/testing/echo_messages.proto + public static partial class EchoMessagesReflection { + + #region Descriptor + /// File descriptor for src/proto/grpc/testing/echo_messages.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static EchoMessagesReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CipzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL2VjaG9fbWVzc2FnZXMucHJvdG8S", + "DGdycGMudGVzdGluZyIyCglEZWJ1Z0luZm8SFQoNc3RhY2tfZW50cmllcxgB", + "IAMoCRIOCgZkZXRhaWwYAiABKAkiUAoLRXJyb3JTdGF0dXMSDAoEY29kZRgB", + "IAEoBRIVCg1lcnJvcl9tZXNzYWdlGAIgASgJEhwKFGJpbmFyeV9lcnJvcl9k", + "ZXRhaWxzGAMgASgJIskDCg1SZXF1ZXN0UGFyYW1zEhUKDWVjaG9fZGVhZGxp", + "bmUYASABKAgSHgoWY2xpZW50X2NhbmNlbF9hZnRlcl91cxgCIAEoBRIeChZz", + "ZXJ2ZXJfY2FuY2VsX2FmdGVyX3VzGAMgASgFEhUKDWVjaG9fbWV0YWRhdGEY", + "BCABKAgSGgoSY2hlY2tfYXV0aF9jb250ZXh0GAUgASgIEh8KF3Jlc3BvbnNl", + "X21lc3NhZ2VfbGVuZ3RoGAYgASgFEhEKCWVjaG9fcGVlchgHIAEoCBIgChhl", + "eHBlY3RlZF9jbGllbnRfaWRlbnRpdHkYCCABKAkSHAoUc2tpcF9jYW5jZWxs", + "ZWRfY2hlY2sYCSABKAgSKAogZXhwZWN0ZWRfdHJhbnNwb3J0X3NlY3VyaXR5", + "X3R5cGUYCiABKAkSKwoKZGVidWdfaW5mbxgLIAEoCzIXLmdycGMudGVzdGlu", + "Zy5EZWJ1Z0luZm8SEgoKc2VydmVyX2RpZRgMIAEoCBIcChRiaW5hcnlfZXJy", + "b3JfZGV0YWlscxgNIAEoCRIxCg5leHBlY3RlZF9lcnJvchgOIAEoCzIZLmdy", + "cGMudGVzdGluZy5FcnJvclN0YXR1cyJKCgtFY2hvUmVxdWVzdBIPCgdtZXNz", + "YWdlGAEgASgJEioKBXBhcmFtGAIgASgLMhsuZ3JwYy50ZXN0aW5nLlJlcXVl", + "c3RQYXJhbXMiRgoOUmVzcG9uc2VQYXJhbXMSGAoQcmVxdWVzdF9kZWFkbGlu", + "ZRgBIAEoAxIMCgRob3N0GAIgASgJEgwKBHBlZXIYAyABKAkiTAoMRWNob1Jl", + "c3BvbnNlEg8KB21lc3NhZ2UYASABKAkSKwoFcGFyYW0YAiABKAsyHC5ncnBj", + "LnRlc3RpbmcuUmVzcG9uc2VQYXJhbXNiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.DebugInfo), global::Grpc.Testing.DebugInfo.Parser, new[]{ "StackEntries", "Detail" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ErrorStatus), global::Grpc.Testing.ErrorStatus.Parser, new[]{ "Code", "ErrorMessage", "BinaryErrorDetails" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.RequestParams), global::Grpc.Testing.RequestParams.Parser, new[]{ "EchoDeadline", "ClientCancelAfterUs", "ServerCancelAfterUs", "EchoMetadata", "CheckAuthContext", "ResponseMessageLength", "EchoPeer", "ExpectedClientIdentity", "SkipCancelledCheck", "ExpectedTransportSecurityType", "DebugInfo", "ServerDie", "BinaryErrorDetails", "ExpectedError" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.EchoRequest), global::Grpc.Testing.EchoRequest.Parser, new[]{ "Message", "Param" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ResponseParams), global::Grpc.Testing.ResponseParams.Parser, new[]{ "RequestDeadline", "Host", "Peer" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.EchoResponse), global::Grpc.Testing.EchoResponse.Parser, new[]{ "Message", "Param" }, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// Message to be echoed back serialized in trailer. + /// + public sealed partial class DebugInfo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DebugInfo()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.EchoMessagesReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DebugInfo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DebugInfo(DebugInfo other) : this() { + stackEntries_ = other.stackEntries_.Clone(); + detail_ = other.detail_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DebugInfo Clone() { + return new DebugInfo(this); + } + + /// Field number for the "stack_entries" field. + public const int StackEntriesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_stackEntries_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField stackEntries_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField StackEntries { + get { return stackEntries_; } + } + + /// Field number for the "detail" field. + public const int DetailFieldNumber = 2; + private string detail_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Detail { + get { return detail_; } + set { + detail_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DebugInfo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DebugInfo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!stackEntries_.Equals(other.stackEntries_)) return false; + if (Detail != other.Detail) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= stackEntries_.GetHashCode(); + if (Detail.Length != 0) hash ^= Detail.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + stackEntries_.WriteTo(output, _repeated_stackEntries_codec); + if (Detail.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Detail); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += stackEntries_.CalculateSize(_repeated_stackEntries_codec); + if (Detail.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Detail); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DebugInfo other) { + if (other == null) { + return; + } + stackEntries_.Add(other.stackEntries_); + if (other.Detail.Length != 0) { + Detail = other.Detail; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + stackEntries_.AddEntriesFrom(input, _repeated_stackEntries_codec); + break; + } + case 18: { + Detail = input.ReadString(); + break; + } + } + } + } + + } + + /// + /// Error status client expects to see. + /// + public sealed partial class ErrorStatus : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ErrorStatus()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.EchoMessagesReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ErrorStatus() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ErrorStatus(ErrorStatus other) : this() { + code_ = other.code_; + errorMessage_ = other.errorMessage_; + binaryErrorDetails_ = other.binaryErrorDetails_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ErrorStatus Clone() { + return new ErrorStatus(this); + } + + /// Field number for the "code" field. + public const int CodeFieldNumber = 1; + private int code_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Code { + get { return code_; } + set { + code_ = value; + } + } + + /// Field number for the "error_message" field. + public const int ErrorMessageFieldNumber = 2; + private string errorMessage_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ErrorMessage { + get { return errorMessage_; } + set { + errorMessage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "binary_error_details" field. + public const int BinaryErrorDetailsFieldNumber = 3; + private string binaryErrorDetails_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BinaryErrorDetails { + get { return binaryErrorDetails_; } + set { + binaryErrorDetails_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ErrorStatus); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ErrorStatus other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Code != other.Code) return false; + if (ErrorMessage != other.ErrorMessage) return false; + if (BinaryErrorDetails != other.BinaryErrorDetails) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Code != 0) hash ^= Code.GetHashCode(); + if (ErrorMessage.Length != 0) hash ^= ErrorMessage.GetHashCode(); + if (BinaryErrorDetails.Length != 0) hash ^= BinaryErrorDetails.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Code != 0) { + output.WriteRawTag(8); + output.WriteInt32(Code); + } + if (ErrorMessage.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ErrorMessage); + } + if (BinaryErrorDetails.Length != 0) { + output.WriteRawTag(26); + output.WriteString(BinaryErrorDetails); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Code != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + } + if (ErrorMessage.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ErrorMessage); + } + if (BinaryErrorDetails.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BinaryErrorDetails); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ErrorStatus other) { + if (other == null) { + return; + } + if (other.Code != 0) { + Code = other.Code; + } + if (other.ErrorMessage.Length != 0) { + ErrorMessage = other.ErrorMessage; + } + if (other.BinaryErrorDetails.Length != 0) { + BinaryErrorDetails = other.BinaryErrorDetails; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + Code = input.ReadInt32(); + break; + } + case 18: { + ErrorMessage = input.ReadString(); + break; + } + case 26: { + BinaryErrorDetails = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class RequestParams : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RequestParams()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.EchoMessagesReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RequestParams() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RequestParams(RequestParams other) : this() { + echoDeadline_ = other.echoDeadline_; + clientCancelAfterUs_ = other.clientCancelAfterUs_; + serverCancelAfterUs_ = other.serverCancelAfterUs_; + echoMetadata_ = other.echoMetadata_; + checkAuthContext_ = other.checkAuthContext_; + responseMessageLength_ = other.responseMessageLength_; + echoPeer_ = other.echoPeer_; + expectedClientIdentity_ = other.expectedClientIdentity_; + skipCancelledCheck_ = other.skipCancelledCheck_; + expectedTransportSecurityType_ = other.expectedTransportSecurityType_; + DebugInfo = other.debugInfo_ != null ? other.DebugInfo.Clone() : null; + serverDie_ = other.serverDie_; + binaryErrorDetails_ = other.binaryErrorDetails_; + ExpectedError = other.expectedError_ != null ? other.ExpectedError.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RequestParams Clone() { + return new RequestParams(this); + } + + /// Field number for the "echo_deadline" field. + public const int EchoDeadlineFieldNumber = 1; + private bool echoDeadline_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool EchoDeadline { + get { return echoDeadline_; } + set { + echoDeadline_ = value; + } + } + + /// Field number for the "client_cancel_after_us" field. + public const int ClientCancelAfterUsFieldNumber = 2; + private int clientCancelAfterUs_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ClientCancelAfterUs { + get { return clientCancelAfterUs_; } + set { + clientCancelAfterUs_ = value; + } + } + + /// Field number for the "server_cancel_after_us" field. + public const int ServerCancelAfterUsFieldNumber = 3; + private int serverCancelAfterUs_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ServerCancelAfterUs { + get { return serverCancelAfterUs_; } + set { + serverCancelAfterUs_ = value; + } + } + + /// Field number for the "echo_metadata" field. + public const int EchoMetadataFieldNumber = 4; + private bool echoMetadata_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool EchoMetadata { + get { return echoMetadata_; } + set { + echoMetadata_ = value; + } + } + + /// Field number for the "check_auth_context" field. + public const int CheckAuthContextFieldNumber = 5; + private bool checkAuthContext_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool CheckAuthContext { + get { return checkAuthContext_; } + set { + checkAuthContext_ = value; + } + } + + /// Field number for the "response_message_length" field. + public const int ResponseMessageLengthFieldNumber = 6; + private int responseMessageLength_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ResponseMessageLength { + get { return responseMessageLength_; } + set { + responseMessageLength_ = value; + } + } + + /// Field number for the "echo_peer" field. + public const int EchoPeerFieldNumber = 7; + private bool echoPeer_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool EchoPeer { + get { return echoPeer_; } + set { + echoPeer_ = value; + } + } + + /// Field number for the "expected_client_identity" field. + public const int ExpectedClientIdentityFieldNumber = 8; + private string expectedClientIdentity_ = ""; + /// + /// will force check_auth_context. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ExpectedClientIdentity { + get { return expectedClientIdentity_; } + set { + expectedClientIdentity_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "skip_cancelled_check" field. + public const int SkipCancelledCheckFieldNumber = 9; + private bool skipCancelledCheck_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool SkipCancelledCheck { + get { return skipCancelledCheck_; } + set { + skipCancelledCheck_ = value; + } + } + + /// Field number for the "expected_transport_security_type" field. + public const int ExpectedTransportSecurityTypeFieldNumber = 10; + private string expectedTransportSecurityType_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ExpectedTransportSecurityType { + get { return expectedTransportSecurityType_; } + set { + expectedTransportSecurityType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "debug_info" field. + public const int DebugInfoFieldNumber = 11; + private global::Grpc.Testing.DebugInfo debugInfo_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Grpc.Testing.DebugInfo DebugInfo { + get { return debugInfo_; } + set { + debugInfo_ = value; + } + } + + /// Field number for the "server_die" field. + public const int ServerDieFieldNumber = 12; + private bool serverDie_; + /// + /// Server should not see a request with this set. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool ServerDie { + get { return serverDie_; } + set { + serverDie_ = value; + } + } + + /// Field number for the "binary_error_details" field. + public const int BinaryErrorDetailsFieldNumber = 13; + private string binaryErrorDetails_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BinaryErrorDetails { + get { return binaryErrorDetails_; } + set { + binaryErrorDetails_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "expected_error" field. + public const int ExpectedErrorFieldNumber = 14; + private global::Grpc.Testing.ErrorStatus expectedError_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Grpc.Testing.ErrorStatus ExpectedError { + get { return expectedError_; } + set { + expectedError_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RequestParams); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RequestParams other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (EchoDeadline != other.EchoDeadline) return false; + if (ClientCancelAfterUs != other.ClientCancelAfterUs) return false; + if (ServerCancelAfterUs != other.ServerCancelAfterUs) return false; + if (EchoMetadata != other.EchoMetadata) return false; + if (CheckAuthContext != other.CheckAuthContext) return false; + if (ResponseMessageLength != other.ResponseMessageLength) return false; + if (EchoPeer != other.EchoPeer) return false; + if (ExpectedClientIdentity != other.ExpectedClientIdentity) return false; + if (SkipCancelledCheck != other.SkipCancelledCheck) return false; + if (ExpectedTransportSecurityType != other.ExpectedTransportSecurityType) return false; + if (!object.Equals(DebugInfo, other.DebugInfo)) return false; + if (ServerDie != other.ServerDie) return false; + if (BinaryErrorDetails != other.BinaryErrorDetails) return false; + if (!object.Equals(ExpectedError, other.ExpectedError)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (EchoDeadline != false) hash ^= EchoDeadline.GetHashCode(); + if (ClientCancelAfterUs != 0) hash ^= ClientCancelAfterUs.GetHashCode(); + if (ServerCancelAfterUs != 0) hash ^= ServerCancelAfterUs.GetHashCode(); + if (EchoMetadata != false) hash ^= EchoMetadata.GetHashCode(); + if (CheckAuthContext != false) hash ^= CheckAuthContext.GetHashCode(); + if (ResponseMessageLength != 0) hash ^= ResponseMessageLength.GetHashCode(); + if (EchoPeer != false) hash ^= EchoPeer.GetHashCode(); + if (ExpectedClientIdentity.Length != 0) hash ^= ExpectedClientIdentity.GetHashCode(); + if (SkipCancelledCheck != false) hash ^= SkipCancelledCheck.GetHashCode(); + if (ExpectedTransportSecurityType.Length != 0) hash ^= ExpectedTransportSecurityType.GetHashCode(); + if (debugInfo_ != null) hash ^= DebugInfo.GetHashCode(); + if (ServerDie != false) hash ^= ServerDie.GetHashCode(); + if (BinaryErrorDetails.Length != 0) hash ^= BinaryErrorDetails.GetHashCode(); + if (expectedError_ != null) hash ^= ExpectedError.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (EchoDeadline != false) { + output.WriteRawTag(8); + output.WriteBool(EchoDeadline); + } + if (ClientCancelAfterUs != 0) { + output.WriteRawTag(16); + output.WriteInt32(ClientCancelAfterUs); + } + if (ServerCancelAfterUs != 0) { + output.WriteRawTag(24); + output.WriteInt32(ServerCancelAfterUs); + } + if (EchoMetadata != false) { + output.WriteRawTag(32); + output.WriteBool(EchoMetadata); + } + if (CheckAuthContext != false) { + output.WriteRawTag(40); + output.WriteBool(CheckAuthContext); + } + if (ResponseMessageLength != 0) { + output.WriteRawTag(48); + output.WriteInt32(ResponseMessageLength); + } + if (EchoPeer != false) { + output.WriteRawTag(56); + output.WriteBool(EchoPeer); + } + if (ExpectedClientIdentity.Length != 0) { + output.WriteRawTag(66); + output.WriteString(ExpectedClientIdentity); + } + if (SkipCancelledCheck != false) { + output.WriteRawTag(72); + output.WriteBool(SkipCancelledCheck); + } + if (ExpectedTransportSecurityType.Length != 0) { + output.WriteRawTag(82); + output.WriteString(ExpectedTransportSecurityType); + } + if (debugInfo_ != null) { + output.WriteRawTag(90); + output.WriteMessage(DebugInfo); + } + if (ServerDie != false) { + output.WriteRawTag(96); + output.WriteBool(ServerDie); + } + if (BinaryErrorDetails.Length != 0) { + output.WriteRawTag(106); + output.WriteString(BinaryErrorDetails); + } + if (expectedError_ != null) { + output.WriteRawTag(114); + output.WriteMessage(ExpectedError); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (EchoDeadline != false) { + size += 1 + 1; + } + if (ClientCancelAfterUs != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ClientCancelAfterUs); + } + if (ServerCancelAfterUs != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ServerCancelAfterUs); + } + if (EchoMetadata != false) { + size += 1 + 1; + } + if (CheckAuthContext != false) { + size += 1 + 1; + } + if (ResponseMessageLength != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ResponseMessageLength); + } + if (EchoPeer != false) { + size += 1 + 1; + } + if (ExpectedClientIdentity.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ExpectedClientIdentity); + } + if (SkipCancelledCheck != false) { + size += 1 + 1; + } + if (ExpectedTransportSecurityType.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ExpectedTransportSecurityType); + } + if (debugInfo_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DebugInfo); + } + if (ServerDie != false) { + size += 1 + 1; + } + if (BinaryErrorDetails.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BinaryErrorDetails); + } + if (expectedError_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExpectedError); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RequestParams other) { + if (other == null) { + return; + } + if (other.EchoDeadline != false) { + EchoDeadline = other.EchoDeadline; + } + if (other.ClientCancelAfterUs != 0) { + ClientCancelAfterUs = other.ClientCancelAfterUs; + } + if (other.ServerCancelAfterUs != 0) { + ServerCancelAfterUs = other.ServerCancelAfterUs; + } + if (other.EchoMetadata != false) { + EchoMetadata = other.EchoMetadata; + } + if (other.CheckAuthContext != false) { + CheckAuthContext = other.CheckAuthContext; + } + if (other.ResponseMessageLength != 0) { + ResponseMessageLength = other.ResponseMessageLength; + } + if (other.EchoPeer != false) { + EchoPeer = other.EchoPeer; + } + if (other.ExpectedClientIdentity.Length != 0) { + ExpectedClientIdentity = other.ExpectedClientIdentity; + } + if (other.SkipCancelledCheck != false) { + SkipCancelledCheck = other.SkipCancelledCheck; + } + if (other.ExpectedTransportSecurityType.Length != 0) { + ExpectedTransportSecurityType = other.ExpectedTransportSecurityType; + } + if (other.debugInfo_ != null) { + if (debugInfo_ == null) { + debugInfo_ = new global::Grpc.Testing.DebugInfo(); + } + DebugInfo.MergeFrom(other.DebugInfo); + } + if (other.ServerDie != false) { + ServerDie = other.ServerDie; + } + if (other.BinaryErrorDetails.Length != 0) { + BinaryErrorDetails = other.BinaryErrorDetails; + } + if (other.expectedError_ != null) { + if (expectedError_ == null) { + expectedError_ = new global::Grpc.Testing.ErrorStatus(); + } + ExpectedError.MergeFrom(other.ExpectedError); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + EchoDeadline = input.ReadBool(); + break; + } + case 16: { + ClientCancelAfterUs = input.ReadInt32(); + break; + } + case 24: { + ServerCancelAfterUs = input.ReadInt32(); + break; + } + case 32: { + EchoMetadata = input.ReadBool(); + break; + } + case 40: { + CheckAuthContext = input.ReadBool(); + break; + } + case 48: { + ResponseMessageLength = input.ReadInt32(); + break; + } + case 56: { + EchoPeer = input.ReadBool(); + break; + } + case 66: { + ExpectedClientIdentity = input.ReadString(); + break; + } + case 72: { + SkipCancelledCheck = input.ReadBool(); + break; + } + case 82: { + ExpectedTransportSecurityType = input.ReadString(); + break; + } + case 90: { + if (debugInfo_ == null) { + debugInfo_ = new global::Grpc.Testing.DebugInfo(); + } + input.ReadMessage(debugInfo_); + break; + } + case 96: { + ServerDie = input.ReadBool(); + break; + } + case 106: { + BinaryErrorDetails = input.ReadString(); + break; + } + case 114: { + if (expectedError_ == null) { + expectedError_ = new global::Grpc.Testing.ErrorStatus(); + } + input.ReadMessage(expectedError_); + break; + } + } + } + } + + } + + public sealed partial class EchoRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EchoRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.EchoMessagesReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EchoRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EchoRequest(EchoRequest other) : this() { + message_ = other.message_; + Param = other.param_ != null ? other.Param.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EchoRequest Clone() { + return new EchoRequest(this); + } + + /// Field number for the "message" field. + public const int MessageFieldNumber = 1; + private string message_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Message { + get { return message_; } + set { + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "param" field. + public const int ParamFieldNumber = 2; + private global::Grpc.Testing.RequestParams param_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Grpc.Testing.RequestParams Param { + get { return param_; } + set { + param_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as EchoRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(EchoRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Message != other.Message) return false; + if (!object.Equals(Param, other.Param)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Message.Length != 0) hash ^= Message.GetHashCode(); + if (param_ != null) hash ^= Param.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Message.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Message); + } + if (param_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Param); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + if (param_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Param); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(EchoRequest other) { + if (other == null) { + return; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + if (other.param_ != null) { + if (param_ == null) { + param_ = new global::Grpc.Testing.RequestParams(); + } + Param.MergeFrom(other.Param); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Message = input.ReadString(); + break; + } + case 18: { + if (param_ == null) { + param_ = new global::Grpc.Testing.RequestParams(); + } + input.ReadMessage(param_); + break; + } + } + } + } + + } + + public sealed partial class ResponseParams : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResponseParams()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.EchoMessagesReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResponseParams() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResponseParams(ResponseParams other) : this() { + requestDeadline_ = other.requestDeadline_; + host_ = other.host_; + peer_ = other.peer_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResponseParams Clone() { + return new ResponseParams(this); + } + + /// Field number for the "request_deadline" field. + public const int RequestDeadlineFieldNumber = 1; + private long requestDeadline_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long RequestDeadline { + get { return requestDeadline_; } + set { + requestDeadline_ = value; + } + } + + /// Field number for the "host" field. + public const int HostFieldNumber = 2; + private string host_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Host { + get { return host_; } + set { + host_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "peer" field. + public const int PeerFieldNumber = 3; + private string peer_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Peer { + get { return peer_; } + set { + peer_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ResponseParams); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ResponseParams other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (RequestDeadline != other.RequestDeadline) return false; + if (Host != other.Host) return false; + if (Peer != other.Peer) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (RequestDeadline != 0L) hash ^= RequestDeadline.GetHashCode(); + if (Host.Length != 0) hash ^= Host.GetHashCode(); + if (Peer.Length != 0) hash ^= Peer.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (RequestDeadline != 0L) { + output.WriteRawTag(8); + output.WriteInt64(RequestDeadline); + } + if (Host.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Host); + } + if (Peer.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Peer); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (RequestDeadline != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(RequestDeadline); + } + if (Host.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Host); + } + if (Peer.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Peer); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ResponseParams other) { + if (other == null) { + return; + } + if (other.RequestDeadline != 0L) { + RequestDeadline = other.RequestDeadline; + } + if (other.Host.Length != 0) { + Host = other.Host; + } + if (other.Peer.Length != 0) { + Peer = other.Peer; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + RequestDeadline = input.ReadInt64(); + break; + } + case 18: { + Host = input.ReadString(); + break; + } + case 26: { + Peer = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class EchoResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EchoResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.EchoMessagesReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EchoResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EchoResponse(EchoResponse other) : this() { + message_ = other.message_; + Param = other.param_ != null ? other.Param.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EchoResponse Clone() { + return new EchoResponse(this); + } + + /// Field number for the "message" field. + public const int MessageFieldNumber = 1; + private string message_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Message { + get { return message_; } + set { + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "param" field. + public const int ParamFieldNumber = 2; + private global::Grpc.Testing.ResponseParams param_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Grpc.Testing.ResponseParams Param { + get { return param_; } + set { + param_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as EchoResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(EchoResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Message != other.Message) return false; + if (!object.Equals(Param, other.Param)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Message.Length != 0) hash ^= Message.GetHashCode(); + if (param_ != null) hash ^= Param.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Message.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Message); + } + if (param_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Param); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + if (param_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Param); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(EchoResponse other) { + if (other == null) { + return; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + if (other.param_ != null) { + if (param_ == null) { + param_ = new global::Grpc.Testing.ResponseParams(); + } + Param.MergeFrom(other.Param); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Message = input.ReadString(); + break; + } + case 18: { + if (param_ == null) { + param_ = new global::Grpc.Testing.ResponseParams(); + } + input.ReadMessage(param_); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/csharp/Grpc.IntegrationTesting/Services.cs b/src/csharp/Grpc.IntegrationTesting/Services.cs index bf36a0253b..7a0845dffb 100644 --- a/src/csharp/Grpc.IntegrationTesting/Services.cs +++ b/src/csharp/Grpc.IntegrationTesting/Services.cs @@ -24,20 +24,28 @@ namespace Grpc.Testing { string.Concat( "CiVzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL3NlcnZpY2VzLnByb3RvEgxncnBj", "LnRlc3RpbmcaJXNyYy9wcm90by9ncnBjL3Rlc3RpbmcvbWVzc2FnZXMucHJv", - "dG8aJHNyYy9wcm90by9ncnBjL3Rlc3RpbmcvY29udHJvbC5wcm90bzKqAQoQ", - "QmVuY2htYXJrU2VydmljZRJGCglVbmFyeUNhbGwSGy5ncnBjLnRlc3Rpbmcu", - "U2ltcGxlUmVxdWVzdBocLmdycGMudGVzdGluZy5TaW1wbGVSZXNwb25zZRJO", - "Cg1TdHJlYW1pbmdDYWxsEhsuZ3JwYy50ZXN0aW5nLlNpbXBsZVJlcXVlc3Qa", - "HC5ncnBjLnRlc3RpbmcuU2ltcGxlUmVzcG9uc2UoATABMpcCCg1Xb3JrZXJT", - "ZXJ2aWNlEkUKCVJ1blNlcnZlchIYLmdycGMudGVzdGluZy5TZXJ2ZXJBcmdz", - "GhouZ3JwYy50ZXN0aW5nLlNlcnZlclN0YXR1cygBMAESRQoJUnVuQ2xpZW50", - "EhguZ3JwYy50ZXN0aW5nLkNsaWVudEFyZ3MaGi5ncnBjLnRlc3RpbmcuQ2xp", - "ZW50U3RhdHVzKAEwARJCCglDb3JlQ291bnQSGS5ncnBjLnRlc3RpbmcuQ29y", - "ZVJlcXVlc3QaGi5ncnBjLnRlc3RpbmcuQ29yZVJlc3BvbnNlEjQKClF1aXRX", - "b3JrZXISEi5ncnBjLnRlc3RpbmcuVm9pZBoSLmdycGMudGVzdGluZy5Wb2lk", - "YgZwcm90bzM=")); + "dG8aJHNyYy9wcm90by9ncnBjL3Rlc3RpbmcvY29udHJvbC5wcm90bxoic3Jj", + "L3Byb3RvL2dycGMvdGVzdGluZy9zdGF0cy5wcm90bzKmAwoQQmVuY2htYXJr", + "U2VydmljZRJGCglVbmFyeUNhbGwSGy5ncnBjLnRlc3RpbmcuU2ltcGxlUmVx", + "dWVzdBocLmdycGMudGVzdGluZy5TaW1wbGVSZXNwb25zZRJOCg1TdHJlYW1p", + "bmdDYWxsEhsuZ3JwYy50ZXN0aW5nLlNpbXBsZVJlcXVlc3QaHC5ncnBjLnRl", + "c3RpbmcuU2ltcGxlUmVzcG9uc2UoATABElIKE1N0cmVhbWluZ0Zyb21DbGll", + "bnQSGy5ncnBjLnRlc3RpbmcuU2ltcGxlUmVxdWVzdBocLmdycGMudGVzdGlu", + "Zy5TaW1wbGVSZXNwb25zZSgBElIKE1N0cmVhbWluZ0Zyb21TZXJ2ZXISGy5n", + "cnBjLnRlc3RpbmcuU2ltcGxlUmVxdWVzdBocLmdycGMudGVzdGluZy5TaW1w", + "bGVSZXNwb25zZTABElIKEVN0cmVhbWluZ0JvdGhXYXlzEhsuZ3JwYy50ZXN0", + "aW5nLlNpbXBsZVJlcXVlc3QaHC5ncnBjLnRlc3RpbmcuU2ltcGxlUmVzcG9u", + "c2UoATABMpcCCg1Xb3JrZXJTZXJ2aWNlEkUKCVJ1blNlcnZlchIYLmdycGMu", + "dGVzdGluZy5TZXJ2ZXJBcmdzGhouZ3JwYy50ZXN0aW5nLlNlcnZlclN0YXR1", + "cygBMAESRQoJUnVuQ2xpZW50EhguZ3JwYy50ZXN0aW5nLkNsaWVudEFyZ3Ma", + "Gi5ncnBjLnRlc3RpbmcuQ2xpZW50U3RhdHVzKAEwARJCCglDb3JlQ291bnQS", + "GS5ncnBjLnRlc3RpbmcuQ29yZVJlcXVlc3QaGi5ncnBjLnRlc3RpbmcuQ29y", + "ZVJlc3BvbnNlEjQKClF1aXRXb3JrZXISEi5ncnBjLnRlc3RpbmcuVm9pZBoS", + "LmdycGMudGVzdGluZy5Wb2lkMl4KGFJlcG9ydFFwc1NjZW5hcmlvU2Vydmlj", + "ZRJCCg5SZXBvcnRTY2VuYXJpbxIcLmdycGMudGVzdGluZy5TY2VuYXJpb1Jl", + "c3VsdBoSLmdycGMudGVzdGluZy5Wb2lkYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Grpc.Testing.MessagesReflection.Descriptor, global::Grpc.Testing.ControlReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Grpc.Testing.MessagesReflection.Descriptor, global::Grpc.Testing.ControlReflection.Descriptor, global::Grpc.Testing.StatsReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null)); } #endregion diff --git a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs index 143c9ac9fc..bd5971e296 100644 --- a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs @@ -46,6 +46,27 @@ namespace Grpc.Testing { __Marshaller_SimpleRequest, __Marshaller_SimpleResponse); + static readonly grpc::Method __Method_StreamingFromClient = new grpc::Method( + grpc::MethodType.ClientStreaming, + __ServiceName, + "StreamingFromClient", + __Marshaller_SimpleRequest, + __Marshaller_SimpleResponse); + + static readonly grpc::Method __Method_StreamingFromServer = new grpc::Method( + grpc::MethodType.ServerStreaming, + __ServiceName, + "StreamingFromServer", + __Marshaller_SimpleRequest, + __Marshaller_SimpleResponse); + + static readonly grpc::Method __Method_StreamingBothWays = new grpc::Method( + grpc::MethodType.DuplexStreaming, + __ServiceName, + "StreamingBothWays", + __Marshaller_SimpleRequest, + __Marshaller_SimpleResponse); + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { @@ -68,8 +89,9 @@ namespace Grpc.Testing { } /// - /// One request followed by one response. - /// The server returns the client payload as-is. + /// Repeated sequence of one request followed by one response. + /// Should be called streaming ping-pong + /// The server returns the client payload as-is on each response /// /// Used for reading requests from the client. /// Used for sending responses back to the client. @@ -80,6 +102,44 @@ namespace Grpc.Testing { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } + /// + /// Single-sided unbounded streaming from client to server + /// The server returns the client payload as-is once the client does WritesDone + /// + /// Used for reading requests from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task StreamingFromClient(grpc::IAsyncStreamReader requestStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Single-sided unbounded streaming from server to client + /// The server repeatedly returns the client payload as-is + /// + /// The request received from the client. + /// Used for sending responses back to the client. + /// The context of the server-side call handler being invoked. + /// A task indicating completion of the handler. + public virtual global::System.Threading.Tasks.Task StreamingFromServer(global::Grpc.Testing.SimpleRequest request, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Two-sided unbounded streaming between server to client + /// Both sides send the content of their own choice to the other + /// + /// Used for reading requests from the client. + /// Used for sending responses back to the client. + /// The context of the server-side call handler being invoked. + /// A task indicating completion of the handler. + public virtual global::System.Threading.Tasks.Task StreamingBothWays(grpc::IAsyncStreamReader requestStream, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + } /// Client for BenchmarkService @@ -154,8 +214,9 @@ namespace Grpc.Testing { return CallInvoker.AsyncUnaryCall(__Method_UnaryCall, null, options, request); } /// - /// One request followed by one response. - /// The server returns the client payload as-is. + /// Repeated sequence of one request followed by one response. + /// Should be called streaming ping-pong + /// The server returns the client payload as-is on each response /// /// The initial metadata to send with the call. This parameter is optional. /// An optional deadline for the call. The call will be cancelled if deadline is hit. @@ -166,8 +227,9 @@ namespace Grpc.Testing { return StreamingCall(new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// One request followed by one response. - /// The server returns the client payload as-is. + /// Repeated sequence of one request followed by one response. + /// Should be called streaming ping-pong + /// The server returns the client payload as-is on each response /// /// The options for the call. /// The call object. @@ -175,6 +237,74 @@ namespace Grpc.Testing { { return CallInvoker.AsyncDuplexStreamingCall(__Method_StreamingCall, null, options); } + /// + /// Single-sided unbounded streaming from client to server + /// The server returns the client payload as-is once the client does WritesDone + /// + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncClientStreamingCall StreamingFromClient(grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return StreamingFromClient(new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Single-sided unbounded streaming from client to server + /// The server returns the client payload as-is once the client does WritesDone + /// + /// The options for the call. + /// The call object. + public virtual grpc::AsyncClientStreamingCall StreamingFromClient(grpc::CallOptions options) + { + return CallInvoker.AsyncClientStreamingCall(__Method_StreamingFromClient, null, options); + } + /// + /// Single-sided unbounded streaming from server to client + /// The server repeatedly returns the client payload as-is + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncServerStreamingCall StreamingFromServer(global::Grpc.Testing.SimpleRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return StreamingFromServer(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Single-sided unbounded streaming from server to client + /// The server repeatedly returns the client payload as-is + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncServerStreamingCall StreamingFromServer(global::Grpc.Testing.SimpleRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncServerStreamingCall(__Method_StreamingFromServer, null, options, request); + } + /// + /// Two-sided unbounded streaming between server to client + /// Both sides send the content of their own choice to the other + /// + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncDuplexStreamingCall StreamingBothWays(grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return StreamingBothWays(new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Two-sided unbounded streaming between server to client + /// Both sides send the content of their own choice to the other + /// + /// The options for the call. + /// The call object. + public virtual grpc::AsyncDuplexStreamingCall StreamingBothWays(grpc::CallOptions options) + { + return CallInvoker.AsyncDuplexStreamingCall(__Method_StreamingBothWays, null, options); + } /// Creates a new instance of client from given ClientBaseConfiguration. protected override BenchmarkServiceClient NewInstance(ClientBaseConfiguration configuration) { @@ -188,7 +318,10 @@ namespace Grpc.Testing { { return grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) - .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build(); + .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall) + .AddMethod(__Method_StreamingFromClient, serviceImpl.StreamingFromClient) + .AddMethod(__Method_StreamingFromServer, serviceImpl.StreamingFromServer) + .AddMethod(__Method_StreamingBothWays, serviceImpl.StreamingBothWays).Build(); } } @@ -489,5 +622,124 @@ namespace Grpc.Testing { } } + public static partial class ReportQpsScenarioService + { + static readonly string __ServiceName = "grpc.testing.ReportQpsScenarioService"; + + static readonly grpc::Marshaller __Marshaller_ScenarioResult = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ScenarioResult.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Void = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.Void.Parser.ParseFrom); + + static readonly grpc::Method __Method_ReportScenario = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "ReportScenario", + __Marshaller_ScenarioResult, + __Marshaller_Void); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[2]; } + } + + /// Base class for server-side implementations of ReportQpsScenarioService + public abstract partial class ReportQpsScenarioServiceBase + { + /// + /// Report results of a QPS test benchmark scenario. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task ReportScenario(global::Grpc.Testing.ScenarioResult request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for ReportQpsScenarioService + public partial class ReportQpsScenarioServiceClient : grpc::ClientBase + { + /// Creates a new client for ReportQpsScenarioService + /// The channel to use to make remote calls. + public ReportQpsScenarioServiceClient(grpc::Channel channel) : base(channel) + { + } + /// Creates a new client for ReportQpsScenarioService that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public ReportQpsScenarioServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected ReportQpsScenarioServiceClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected ReportQpsScenarioServiceClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Report results of a QPS test benchmark scenario. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Grpc.Testing.Void ReportScenario(global::Grpc.Testing.ScenarioResult request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return ReportScenario(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Report results of a QPS test benchmark scenario. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Grpc.Testing.Void ReportScenario(global::Grpc.Testing.ScenarioResult request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_ReportScenario, null, options, request); + } + /// + /// Report results of a QPS test benchmark scenario. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall ReportScenarioAsync(global::Grpc.Testing.ScenarioResult request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return ReportScenarioAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Report results of a QPS test benchmark scenario. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall ReportScenarioAsync(global::Grpc.Testing.ScenarioResult request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_ReportScenario, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override ReportQpsScenarioServiceClient NewInstance(ClientBaseConfiguration configuration) + { + return new ReportQpsScenarioServiceClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(ReportQpsScenarioServiceBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_ReportScenario, serviceImpl.ReportScenario).Build(); + } + + } } #endregion diff --git a/src/csharp/Grpc.IntegrationTesting/Stats.cs b/src/csharp/Grpc.IntegrationTesting/Stats.cs index 79ff220436..23b56df6bd 100644 --- a/src/csharp/Grpc.IntegrationTesting/Stats.cs +++ b/src/csharp/Grpc.IntegrationTesting/Stats.cs @@ -23,27 +23,28 @@ namespace Grpc.Testing { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiJzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL3N0YXRzLnByb3RvEgxncnBjLnRl", - "c3RpbmciegoLU2VydmVyU3RhdHMSFAoMdGltZV9lbGFwc2VkGAEgASgBEhEK", - "CXRpbWVfdXNlchgCIAEoARITCgt0aW1lX3N5c3RlbRgDIAEoARIWCg50b3Rh", - "bF9jcHVfdGltZRgEIAEoBBIVCg1pZGxlX2NwdV90aW1lGAUgASgEIjsKD0hp", - "c3RvZ3JhbVBhcmFtcxISCgpyZXNvbHV0aW9uGAEgASgBEhQKDG1heF9wb3Nz", - "aWJsZRgCIAEoASJ3Cg1IaXN0b2dyYW1EYXRhEg4KBmJ1Y2tldBgBIAMoDRIQ", - "CghtaW5fc2VlbhgCIAEoARIQCghtYXhfc2VlbhgDIAEoARILCgNzdW0YBCAB", - "KAESFgoOc3VtX29mX3NxdWFyZXMYBSABKAESDQoFY291bnQYBiABKAEiOAoS", - "UmVxdWVzdFJlc3VsdENvdW50EhMKC3N0YXR1c19jb2RlGAEgASgFEg0KBWNv", - "dW50GAIgASgDIrYBCgtDbGllbnRTdGF0cxIuCglsYXRlbmNpZXMYASABKAsy", - "Gy5ncnBjLnRlc3RpbmcuSGlzdG9ncmFtRGF0YRIUCgx0aW1lX2VsYXBzZWQY", - "AiABKAESEQoJdGltZV91c2VyGAMgASgBEhMKC3RpbWVfc3lzdGVtGAQgASgB", - "EjkKD3JlcXVlc3RfcmVzdWx0cxgFIAMoCzIgLmdycGMudGVzdGluZy5SZXF1", - "ZXN0UmVzdWx0Q291bnRiBnByb3RvMw==")); + "c3RpbmcikQEKC1NlcnZlclN0YXRzEhQKDHRpbWVfZWxhcHNlZBgBIAEoARIR", + "Cgl0aW1lX3VzZXIYAiABKAESEwoLdGltZV9zeXN0ZW0YAyABKAESFgoOdG90", + "YWxfY3B1X3RpbWUYBCABKAQSFQoNaWRsZV9jcHVfdGltZRgFIAEoBBIVCg1j", + "cV9wb2xsX2NvdW50GAYgASgEIjsKD0hpc3RvZ3JhbVBhcmFtcxISCgpyZXNv", + "bHV0aW9uGAEgASgBEhQKDG1heF9wb3NzaWJsZRgCIAEoASJ3Cg1IaXN0b2dy", + "YW1EYXRhEg4KBmJ1Y2tldBgBIAMoDRIQCghtaW5fc2VlbhgCIAEoARIQCght", + "YXhfc2VlbhgDIAEoARILCgNzdW0YBCABKAESFgoOc3VtX29mX3NxdWFyZXMY", + "BSABKAESDQoFY291bnQYBiABKAEiOAoSUmVxdWVzdFJlc3VsdENvdW50EhMK", + "C3N0YXR1c19jb2RlGAEgASgFEg0KBWNvdW50GAIgASgDIs0BCgtDbGllbnRT", + "dGF0cxIuCglsYXRlbmNpZXMYASABKAsyGy5ncnBjLnRlc3RpbmcuSGlzdG9n", + "cmFtRGF0YRIUCgx0aW1lX2VsYXBzZWQYAiABKAESEQoJdGltZV91c2VyGAMg", + "ASgBEhMKC3RpbWVfc3lzdGVtGAQgASgBEjkKD3JlcXVlc3RfcmVzdWx0cxgF", + "IAMoCzIgLmdycGMudGVzdGluZy5SZXF1ZXN0UmVzdWx0Q291bnQSFQoNY3Ff", + "cG9sbF9jb3VudBgGIAEoBGIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerStats), global::Grpc.Testing.ServerStats.Parser, new[]{ "TimeElapsed", "TimeUser", "TimeSystem", "TotalCpuTime", "IdleCpuTime" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerStats), global::Grpc.Testing.ServerStats.Parser, new[]{ "TimeElapsed", "TimeUser", "TimeSystem", "TotalCpuTime", "IdleCpuTime", "CqPollCount" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.HistogramParams), global::Grpc.Testing.HistogramParams.Parser, new[]{ "Resolution", "MaxPossible" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.HistogramData), global::Grpc.Testing.HistogramData.Parser, new[]{ "Bucket", "MinSeen", "MaxSeen", "Sum", "SumOfSquares", "Count" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.RequestResultCount), global::Grpc.Testing.RequestResultCount.Parser, new[]{ "StatusCode", "Count" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientStats), global::Grpc.Testing.ClientStats.Parser, new[]{ "Latencies", "TimeElapsed", "TimeUser", "TimeSystem", "RequestResults" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientStats), global::Grpc.Testing.ClientStats.Parser, new[]{ "Latencies", "TimeElapsed", "TimeUser", "TimeSystem", "RequestResults", "CqPollCount" }, null, null, null) })); } #endregion @@ -79,6 +80,7 @@ namespace Grpc.Testing { timeSystem_ = other.timeSystem_; totalCpuTime_ = other.totalCpuTime_; idleCpuTime_ = other.idleCpuTime_; + cqPollCount_ = other.cqPollCount_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -157,6 +159,20 @@ namespace Grpc.Testing { } } + /// Field number for the "cq_poll_count" field. + public const int CqPollCountFieldNumber = 6; + private ulong cqPollCount_; + /// + /// Number of polls called inside completion queue + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong CqPollCount { + get { return cqPollCount_; } + set { + cqPollCount_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ServerStats); @@ -175,6 +191,7 @@ namespace Grpc.Testing { if (TimeSystem != other.TimeSystem) return false; if (TotalCpuTime != other.TotalCpuTime) return false; if (IdleCpuTime != other.IdleCpuTime) return false; + if (CqPollCount != other.CqPollCount) return false; return true; } @@ -186,6 +203,7 @@ namespace Grpc.Testing { if (TimeSystem != 0D) hash ^= TimeSystem.GetHashCode(); if (TotalCpuTime != 0UL) hash ^= TotalCpuTime.GetHashCode(); if (IdleCpuTime != 0UL) hash ^= IdleCpuTime.GetHashCode(); + if (CqPollCount != 0UL) hash ^= CqPollCount.GetHashCode(); return hash; } @@ -216,6 +234,10 @@ namespace Grpc.Testing { output.WriteRawTag(40); output.WriteUInt64(IdleCpuTime); } + if (CqPollCount != 0UL) { + output.WriteRawTag(48); + output.WriteUInt64(CqPollCount); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -236,6 +258,9 @@ namespace Grpc.Testing { if (IdleCpuTime != 0UL) { size += 1 + pb::CodedOutputStream.ComputeUInt64Size(IdleCpuTime); } + if (CqPollCount != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(CqPollCount); + } return size; } @@ -259,6 +284,9 @@ namespace Grpc.Testing { if (other.IdleCpuTime != 0UL) { IdleCpuTime = other.IdleCpuTime; } + if (other.CqPollCount != 0UL) { + CqPollCount = other.CqPollCount; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -289,6 +317,10 @@ namespace Grpc.Testing { IdleCpuTime = input.ReadUInt64(); break; } + case 48: { + CqPollCount = input.ReadUInt64(); + break; + } } } } @@ -876,6 +908,7 @@ namespace Grpc.Testing { timeUser_ = other.timeUser_; timeSystem_ = other.timeSystem_; requestResults_ = other.requestResults_.Clone(); + cqPollCount_ = other.cqPollCount_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -946,6 +979,20 @@ namespace Grpc.Testing { get { return requestResults_; } } + /// Field number for the "cq_poll_count" field. + public const int CqPollCountFieldNumber = 6; + private ulong cqPollCount_; + /// + /// Number of polls called inside completion queue + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong CqPollCount { + get { return cqPollCount_; } + set { + cqPollCount_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ClientStats); @@ -964,6 +1011,7 @@ namespace Grpc.Testing { if (TimeUser != other.TimeUser) return false; if (TimeSystem != other.TimeSystem) return false; if(!requestResults_.Equals(other.requestResults_)) return false; + if (CqPollCount != other.CqPollCount) return false; return true; } @@ -975,6 +1023,7 @@ namespace Grpc.Testing { if (TimeUser != 0D) hash ^= TimeUser.GetHashCode(); if (TimeSystem != 0D) hash ^= TimeSystem.GetHashCode(); hash ^= requestResults_.GetHashCode(); + if (CqPollCount != 0UL) hash ^= CqPollCount.GetHashCode(); return hash; } @@ -1002,6 +1051,10 @@ namespace Grpc.Testing { output.WriteDouble(TimeSystem); } requestResults_.WriteTo(output, _repeated_requestResults_codec); + if (CqPollCount != 0UL) { + output.WriteRawTag(48); + output.WriteUInt64(CqPollCount); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1020,6 +1073,9 @@ namespace Grpc.Testing { size += 1 + 8; } size += requestResults_.CalculateSize(_repeated_requestResults_codec); + if (CqPollCount != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(CqPollCount); + } return size; } @@ -1044,6 +1100,9 @@ namespace Grpc.Testing { TimeSystem = other.TimeSystem; } requestResults_.Add(other.requestResults_); + if (other.CqPollCount != 0UL) { + CqPollCount = other.CqPollCount; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1077,6 +1136,10 @@ namespace Grpc.Testing { requestResults_.AddEntriesFrom(input, _repeated_requestResults_codec); break; } + case 48: { + CqPollCount = input.ReadUInt64(); + break; + } } } } -- cgit v1.2.3 From e78a0b79fa5b8c7d0154ba91b2fcca4d55bb2e08 Mon Sep 17 00:00:00 2001 From: thassss Date: Thu, 29 Jun 2017 09:23:23 -0700 Subject: Warn against using serverName property with Cronet --- src/objective-c/GRPCClient/GRPCCall.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 2495aface6..496242a1b6 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -165,6 +165,7 @@ extern id const kGRPCTrailersKey; /** * The server name for the RPC. If nil, the host name of the service object will be used instead. + * This property must be nil when Cronet transport is enabled. */ @property (atomic, readwrite) NSString *serverName; -- cgit v1.2.3 From 260ddd175977c4c19d2b06287c1db416b2a4fbf4 Mon Sep 17 00:00:00 2001 From: thassss Date: Thu, 29 Jun 2017 09:24:16 -0700 Subject: Remove nullability specifiers --- src/objective-c/GRPCClient/private/GRPCHost.h | 2 +- src/objective-c/GRPCClient/private/GRPCHost.m | 2 +- src/objective-c/GRPCClient/private/GRPCWrappedCall.h | 2 +- src/objective-c/GRPCClient/private/GRPCWrappedCall.m | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/objective-c/GRPCClient/private/GRPCHost.h b/src/objective-c/GRPCClient/private/GRPCHost.h index bb68fa3ec4..0c1d715240 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.h +++ b/src/objective-c/GRPCClient/private/GRPCHost.h @@ -54,7 +54,7 @@ struct grpc_channel_credentials; /** Create a grpc_call object to the provided path on this host. */ - (nullable struct grpc_call *)unmanagedCallWithPath:(NSString *)path - serverName:(nullable NSString *)serverName + serverName:(NSString *)serverName completionQueue:(GRPCCompletionQueue *)queue; // TODO: There's a race when a new RPC is coming through just as an existing one is getting diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m index 5658150b33..800c548077 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCHost.m @@ -120,7 +120,7 @@ static GRPCConnectivityMonitor *connectivityMonitor = nil; } - (nullable grpc_call *)unmanagedCallWithPath:(NSString *)path - serverName:(nullable NSString *)serverName + serverName:(NSString *)serverName completionQueue:(GRPCCompletionQueue *)queue { GRPCChannel *channel; // This is racing -[GRPCHost disconnect]. diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.h b/src/objective-c/GRPCClient/private/GRPCWrappedCall.h index e24d246912..64075591a3 100644 --- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.h +++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.h @@ -75,7 +75,7 @@ @interface GRPCWrappedCall : NSObject - (instancetype)initWithHost:(NSString *)host - serverName:(nullable NSString *)serverName + serverName:(NSString *)serverName path:(NSString *)path NS_DESIGNATED_INITIALIZER; - (void)startBatchWithOperations:(NSArray *)ops errorHandler:(void(^)())errorHandler; diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m index 2d98f70899..7593a8ab0d 100644 --- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m +++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m @@ -236,7 +236,7 @@ } - (instancetype)initWithHost:(NSString *)host - serverName:(nullable NSString *)serverName + serverName:(NSString *)serverName path:(NSString *)path { if (!path || !host) { [NSException raise:NSInvalidArgumentException -- cgit v1.2.3 From a5082db9dabb3aae114fa773d1f6edf1f8d54363 Mon Sep 17 00:00:00 2001 From: thassss Date: Thu, 29 Jun 2017 09:26:20 -0700 Subject: Pass NULL to grpc_channel_create_call for nil serverName --- src/objective-c/GRPCClient/private/GRPCChannel.m | 11 ++++++++--- src/objective-c/GRPCClient/private/GRPCHost.m | 3 +-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index 690fad2596..52dbc70b99 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -183,15 +183,20 @@ static grpc_channel_args *BuildChannelArgs(NSDictionary *dictionary) { - (grpc_call *)unmanagedCallWithPath:(NSString *)path serverName:(NSString *)serverName completionQueue:(GRPCCompletionQueue *)queue { - grpc_slice host_slice = grpc_slice_from_copied_string(serverName.UTF8String); + grpc_slice host_slice; + if (serverName) { + host_slice = grpc_slice_from_copied_string(serverName.UTF8String); + } grpc_slice path_slice = grpc_slice_from_copied_string(path.UTF8String); grpc_call *call = grpc_channel_create_call(_unmanagedChannel, NULL, GRPC_PROPAGATE_DEFAULTS, queue.unmanagedQueue, path_slice, - &host_slice, + serverName ? &host_slice : NULL, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); - grpc_slice_unref(host_slice); + if (serverName) { + grpc_slice_unref(host_slice); + } grpc_slice_unref(path_slice); return call; } diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m index 800c548077..23794c1fed 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCHost.m @@ -130,8 +130,7 @@ static GRPCConnectivityMonitor *connectivityMonitor = nil; } channel = _channel; } - NSString *name = serverName ? serverName : _address; - return [channel unmanagedCallWithPath:path serverName:name completionQueue:queue]; + return [channel unmanagedCallWithPath:path serverName:serverName completionQueue:queue]; } - (BOOL)setTLSPEMRootCerts:(nullable NSString *)pemRootCerts -- cgit v1.2.3 From be928be48acf7cafdf82b99a5bc5ba7e620a1f06 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 29 Jun 2017 10:43:00 -0700 Subject: Allow HTTP CONNECT handshaker to be used in http1 client. --- src/core/lib/http/httpcli_security_connector.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/lib/http/httpcli_security_connector.c b/src/core/lib/http/httpcli_security_connector.c index 34a77c3bf4..97c2886525 100644 --- a/src/core/lib/http/httpcli_security_connector.c +++ b/src/core/lib/http/httpcli_security_connector.c @@ -25,6 +25,7 @@ #include #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/channel/handshaker_registry.h" #include "src/core/lib/security/transport/security_handshaker.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/support/string.h" @@ -157,7 +158,6 @@ static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg, gpr_timespec deadline, void (*on_done)(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *endpoint)) { - grpc_channel_security_connector *sc = NULL; on_done_closure *c = gpr_malloc(sizeof(*c)); const char *pem_root_certs = grpc_get_default_ssl_roots(); if (pem_root_certs == NULL) { @@ -168,11 +168,13 @@ static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg, } c->func = on_done; c->arg = arg; - c->handshake_mgr = grpc_handshake_manager_create(); + grpc_channel_security_connector *sc = NULL; GPR_ASSERT(httpcli_ssl_channel_security_connector_create( exec_ctx, pem_root_certs, host, &sc) == GRPC_SECURITY_OK); - grpc_channel_security_connector_add_handshakers(exec_ctx, sc, - c->handshake_mgr); + grpc_arg channel_arg = grpc_security_connector_to_arg(&sc->base); + grpc_channel_args args = {1, &channel_arg}; + c->handshake_mgr = grpc_handshake_manager_create(); + grpc_handshakers_add(exec_ctx, HANDSHAKER_CLIENT, &args, c->handshake_mgr); grpc_handshake_manager_do_handshake( exec_ctx, c->handshake_mgr, tcp, NULL /* channel_args */, deadline, NULL /* acceptor */, on_handshake_done, c /* user_data */); -- cgit v1.2.3 From 5c8f27bf1833dcfc0ae49b0d05546586db4d404f Mon Sep 17 00:00:00 2001 From: thassss Date: Thu, 29 Jun 2017 16:23:08 -0700 Subject: Update serverName comment to be more accurate --- src/objective-c/GRPCClient/GRPCCall.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 496242a1b6..178a446c8b 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -164,8 +164,8 @@ extern id const kGRPCTrailersKey; @interface GRPCCall : GRXWriter /** - * The server name for the RPC. If nil, the host name of the service object will be used instead. - * This property must be nil when Cronet transport is enabled. + * The authority for the RPC. If nil, the default authority will be used. This property must be nil + * when Cronet transport is enabled. */ @property (atomic, readwrite) NSString *serverName; -- cgit v1.2.3 From 36a481e647dd671d3c9975cf55d99bd272831915 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 29 Jun 2017 17:07:33 -0700 Subject: Removed leftover debugging msg --- src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c index 479ba393a2..56ed4371a9 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c @@ -101,9 +101,6 @@ static void fake_resolver_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx, static void fake_resolver_channel_saw_error_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver) { fake_resolver* r = (fake_resolver*)resolver; - gpr_log( - GPR_INFO, - "FOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); if (r->next_results == NULL && r->results_upon_error != NULL) { // Pretend we re-resolved. r->next_results = grpc_channel_args_copy(r->results_upon_error); -- cgit v1.2.3 From 2faddbd639c594fd7c6acc64660042a3b6a7e4ae Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Fri, 30 Jun 2017 07:10:10 -0700 Subject: Fix filter_end2end_test. --- test/cpp/end2end/filter_end2end_test.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/cpp/end2end/filter_end2end_test.cc b/test/cpp/end2end/filter_end2end_test.cc index bf5a9c227a..f260ea0016 100644 --- a/test/cpp/end2end/filter_end2end_test.cc +++ b/test/cpp/end2end/filter_end2end_test.cc @@ -100,7 +100,8 @@ int GetCallCounterValue() { class ChannelDataImpl : public ChannelData { public: - grpc_error* Init(grpc_exec_ctx* exec_ctx, grpc_channel_element_args* args) { + grpc_error* Init(grpc_exec_ctx* exec_ctx, grpc_channel_element* elem, + grpc_channel_element_args* args) { IncrementConnectionCounter(); return GRPC_ERROR_NONE; } -- cgit v1.2.3 From 0c435fe6cbb0113f108f10805dbc6cb49bf8335f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 30 Jun 2017 12:42:30 +0200 Subject: add more ruby artifact deps --- tools/internal_ci/helper_scripts/prepare_build_macos_rc | 2 +- tools/internal_ci/macos/grpc_build_artifacts.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index 6b942d22b8..22e80d2afa 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -27,7 +27,7 @@ brew install gflags set +ex # rvm script is very verbose and exits with errorcode source $HOME/.rvm/scripts/rvm set -e # rvm commands are very verbose -rvm install ruby-2.3 +rvm install ruby-2.4 rvm osx-ssl-certs status all rvm osx-ssl-certs update all set -ex diff --git a/tools/internal_ci/macos/grpc_build_artifacts.sh b/tools/internal_ci/macos/grpc_build_artifacts.sh index 3884a4f2e5..603c15f210 100755 --- a/tools/internal_ci/macos/grpc_build_artifacts.sh +++ b/tools/internal_ci/macos/grpc_build_artifacts.sh @@ -37,5 +37,12 @@ npm install -g node-gyp curl -O http://pear.php.net/go-pear.phar sudo php -d detect_unicode=0 go-pear.phar +# needed to build ruby artifacts +gem install rake-compiler +wget https://raw.githubusercontent.com/grpc/grpc/master/tools/distrib/build_ruby_environment_macos.sh +bash build_ruby_environment_macos.sh + +gem install rubygems-update +update_rubygems tools/run_tests/task_runner.py -f artifact macos -- cgit v1.2.3 From e5de5e5ffa2c664ca1d6ac09c3761a03a1500cb0 Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Thu, 29 Jun 2017 15:23:43 -0700 Subject: Run Android interops on Firebase --- .../grpc_interop_android_java/Dockerfile.template | 78 ++++++++++++++++++++++ .../grpc_interop_android_java/Dockerfile | 76 +++++++++++++++++++++ .../interop/android/android_interop_helper.sh | 36 ++++++++++ .../android/run_android_tests_on_firebase.sh | 30 +++++++++ 4 files changed, 220 insertions(+) create mode 100644 templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template create mode 100644 tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile create mode 100755 tools/run_tests/interop/android/android_interop_helper.sh create mode 100755 tools/run_tests/interop/android/run_android_tests_on_firebase.sh diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template new file mode 100644 index 0000000000..3f5b6cf6ce --- /dev/null +++ b/templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template @@ -0,0 +1,78 @@ +%YAML 1.2 +--- | + # Copyright 2017 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. + + FROM debian:jessie + + # Install JDK 8 and Git + RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && ${'\\'} + echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list && ${'\\'} + echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list && ${'\\'} + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 + RUN apt-get update && apt-get -y install ${'\\'} + git ${'\\'} + libapr1 ${'\\'} + oracle-java8-installer ${'\\'} + && ${'\\'} + apt-get clean && rm -r /var/cache/oracle-jdk8-installer/ + ENV JAVA_HOME /usr/lib/jvm/java-8-oracle + ENV PATH $PATH:$JAVA_HOME/bin + + # Install protobuf + RUN apt-get update && apt-get install -y ${'\\'} + autoconf ${'\\'} + build-essential ${'\\'} + curl ${'\\'} + gcc ${'\\'} + libtool ${'\\'} + unzip ${'\\'} + && ${'\\'} + apt-get clean + WORKDIR / + RUN git clone https://github.com/google/protobuf.git + WORKDIR /protobuf + RUN git checkout v3.3.1 && ${'\\'} + ./autogen.sh && ${'\\'} + ./configure && ${'\\'} + make && ${'\\'} + make check && ${'\\'} + make install + + # Install gcloud command line tools + ENV CLOUD_SDK_REPO "cloud-sdk-jessie" + RUN echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && ${'\\'} + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && ${'\\'} + apt-get update && apt-get install -y google-cloud-sdk && apt-get clean && ${'\\'} + gcloud config set component_manager/disable_update_check true + + # Download and install grpc-java + WORKDIR / + RUN git clone https://github.com/grpc/grpc-java.git + WORKDIR /grpc-java + RUN ./gradlew install + + # Setup the Android SDK licenses + ENV ANDROID_HOME "/grpc-java/android-interop-testing/.android" + RUN mkdir -p "<%text>${ANDROID_HOME}/licenses" + RUN echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "<%text>${ANDROID_HOME}/licenses/android-sdk-license" + RUN echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "<%text>${ANDROID_HOME}/licenses/android-sdk-preview-license" + + # Build the Android interop apks + WORKDIR /grpc-java/android-interop-testing + RUN ../gradlew assembleDebug + RUN ../gradlew assembleDebugAndroidTest + + # Define the default command. + CMD ["bash"] diff --git a/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile new file mode 100644 index 0000000000..35998a3cb2 --- /dev/null +++ b/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile @@ -0,0 +1,76 @@ +# Copyright 2017 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. + +FROM debian:jessie + +# Install JDK 8 and Git +RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \ + echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list && \ + echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list && \ + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 +RUN apt-get update && apt-get -y install \ + git \ + libapr1 \ + oracle-java8-installer \ + && \ + apt-get clean && rm -r /var/cache/oracle-jdk8-installer/ +ENV JAVA_HOME /usr/lib/jvm/java-8-oracle +ENV PATH $PATH:$JAVA_HOME/bin + +# Install protobuf +RUN apt-get update && apt-get install -y \ + autoconf \ + build-essential \ + curl \ + gcc \ + libtool \ + unzip \ + && \ + apt-get clean +WORKDIR / +RUN git clone https://github.com/google/protobuf.git +WORKDIR /protobuf +RUN git checkout v3.3.1 && \ + ./autogen.sh && \ + ./configure && \ + make && \ + make check && \ + make install + +# Install gcloud command line tools +ENV CLOUD_SDK_REPO "cloud-sdk-jessie" +RUN echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \ + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ + apt-get update && apt-get install -y google-cloud-sdk && apt-get clean && \ + gcloud config set component_manager/disable_update_check true + +# Download and install grpc-java +WORKDIR / +RUN git clone https://github.com/grpc/grpc-java.git +WORKDIR /grpc-java +RUN ./gradlew install + +# Setup the Android SDK licenses +ENV ANDROID_HOME "/grpc-java/android-interop-testing/.android" +RUN mkdir -p "${ANDROID_HOME}/licenses" +RUN echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "${ANDROID_HOME}/licenses/android-sdk-license" +RUN echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "${ANDROID_HOME}/licenses/android-sdk-preview-license" + +# Build the Android interop apks +WORKDIR /grpc-java/android-interop-testing +RUN ../gradlew assembleDebug +RUN ../gradlew assembleDebugAndroidTest + +# Define the default command. +CMD ["bash"] diff --git a/tools/run_tests/interop/android/android_interop_helper.sh b/tools/run_tests/interop/android/android_interop_helper.sh new file mode 100755 index 0000000000..9c0d18fba3 --- /dev/null +++ b/tools/run_tests/interop/android/android_interop_helper.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Copyright 2017 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. + +# Helper that runs inside the docker container and builds the APKs and +# invokes Firebase Test Lab via gcloud. + +SERVICE_KEY=$1 + +gcloud auth activate-service-account --key-file=$SERVICE_KEY || exit 1 +gcloud config set project grpc-testing || exit 1 + +rm -rf grpc-java +git clone https://github.com/grpc/grpc-java.git +cd grpc-java +./gradlew install || exit 1 +cd android-interop-testing +../gradlew assembleDebug +../gradlew assembleDebugAndroidTest + +gcloud firebase test android run \ + --type instrumentation \ + --app app/build/outputs/apk/app-debug.apk \ + --test app/build/outputs/apk/app-debug-androidTest.apk \ + --device model=Nexus6,version=21,locale=en,orientation=portrait diff --git a/tools/run_tests/interop/android/run_android_tests_on_firebase.sh b/tools/run_tests/interop/android/run_android_tests_on_firebase.sh new file mode 100755 index 0000000000..0b4811355c --- /dev/null +++ b/tools/run_tests/interop/android/run_android_tests_on_firebase.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Copyright 2017 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. + +# Builds the gRPC Android instrumented interop tests inside a docker container +# and runs them on Firebase Test Lab + +DOCKERFILE=tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile +DOCKER_TAG=android_interop_test +SERVICE_KEY=~/android-interops-service-key.json +HELPER=$(pwd)/tools/run_tests/interop/android/android_interop_helper.sh + +docker build -t $DOCKER_TAG -f $DOCKERFILE . + +docker run --interactive --rm \ + --volume="$SERVICE_KEY":/service-key.json:ro \ + --volume="$HELPER":/android_interop_helper.sh:ro \ + $DOCKER_TAG \ + /bin/bash -c "/android_interop_helper.sh /service-key.json" -- cgit v1.2.3