From 0498124f8ebead73d71fefdfc63e9b29d0da7a8f Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 1 Dec 2016 11:53:08 -0800 Subject: [PATCH 001/126] Add files --- BUILD | 6 ++ CMakeLists.txt | 6 ++ Makefile | 6 ++ build.yaml | 2 + .../ext/health_check_service_interface.h | 52 +++++++++++++++++ ...alth_check_service_server_builder_option.h | 56 +++++++++++++++++++ tools/doxygen/Doxyfile.c++ | 2 + tools/doxygen/Doxyfile.c++.internal | 2 + .../generated/sources_and_headers.json | 4 ++ vsprojects/vcxproj/grpc++/grpc++.vcxproj | 2 + .../vcxproj/grpc++/grpc++.vcxproj.filters | 9 +++ .../grpc++_unsecure/grpc++_unsecure.vcxproj | 2 + .../grpc++_unsecure.vcxproj.filters | 9 +++ 13 files changed, 158 insertions(+) create mode 100644 include/grpc++/ext/health_check_service_interface.h create mode 100644 include/grpc++/ext/health_check_service_server_builder_option.h diff --git a/BUILD b/BUILD index ab0fc237b78..54eda959fc2 100644 --- a/BUILD +++ b/BUILD @@ -1422,6 +1422,8 @@ cc_library( "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", "include/grpc++/create_channel_posix.h", + "include/grpc++/ext/health_check_service_interface.h", + "include/grpc++/ext/health_check_service_server_builder_option.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", @@ -1884,6 +1886,8 @@ cc_library( "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", "include/grpc++/create_channel_posix.h", + "include/grpc++/ext/health_check_service_interface.h", + "include/grpc++/ext/health_check_service_server_builder_option.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", @@ -2060,6 +2064,8 @@ cc_library( "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", "include/grpc++/create_channel_posix.h", + "include/grpc++/ext/health_check_service_interface.h", + "include/grpc++/ext/health_check_service_server_builder_option.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index ff0927504aa..90cf1cdc777 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1128,6 +1128,8 @@ foreach(_hdr include/grpc++/completion_queue.h include/grpc++/create_channel.h include/grpc++/create_channel_posix.h + include/grpc++/ext/health_check_service_interface.h + include/grpc++/ext/health_check_service_server_builder_option.h include/grpc++/generic/async_generic_service.h include/grpc++/generic/generic_stub.h include/grpc++/grpc++.h @@ -1461,6 +1463,8 @@ foreach(_hdr include/grpc++/completion_queue.h include/grpc++/create_channel.h include/grpc++/create_channel_posix.h + include/grpc++/ext/health_check_service_interface.h + include/grpc++/ext/health_check_service_server_builder_option.h include/grpc++/generic/async_generic_service.h include/grpc++/generic/generic_stub.h include/grpc++/grpc++.h @@ -1667,6 +1671,8 @@ foreach(_hdr include/grpc++/completion_queue.h include/grpc++/create_channel.h include/grpc++/create_channel_posix.h + include/grpc++/ext/health_check_service_interface.h + include/grpc++/ext/health_check_service_server_builder_option.h include/grpc++/generic/async_generic_service.h include/grpc++/generic/generic_stub.h include/grpc++/grpc++.h diff --git a/Makefile b/Makefile index 8f7328ae285..85074b5b813 100644 --- a/Makefile +++ b/Makefile @@ -3805,6 +3805,8 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ include/grpc++/create_channel_posix.h \ + include/grpc++/ext/health_check_service_interface.h \ + include/grpc++/ext/health_check_service_server_builder_option.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ @@ -4167,6 +4169,8 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ include/grpc++/create_channel_posix.h \ + include/grpc++/ext/health_check_service_interface.h \ + include/grpc++/ext/health_check_service_server_builder_option.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ @@ -4700,6 +4704,8 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ include/grpc++/create_channel_posix.h \ + include/grpc++/ext/health_check_service_interface.h \ + include/grpc++/ext/health_check_service_server_builder_option.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ diff --git a/build.yaml b/build.yaml index de9d253ef1c..25c4dd7fbf7 100644 --- a/build.yaml +++ b/build.yaml @@ -718,6 +718,8 @@ filegroups: - include/grpc++/completion_queue.h - include/grpc++/create_channel.h - include/grpc++/create_channel_posix.h + - include/grpc++/ext/health_check_service_interface.h + - include/grpc++/ext/health_check_service_server_builder_option.h - include/grpc++/generic/async_generic_service.h - include/grpc++/generic/generic_stub.h - include/grpc++/grpc++.h diff --git a/include/grpc++/ext/health_check_service_interface.h b/include/grpc++/ext/health_check_service_interface.h new file mode 100644 index 00000000000..b9f4ebb87f9 --- /dev/null +++ b/include/grpc++/ext/health_check_service_interface.h @@ -0,0 +1,52 @@ +/* + * + * 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. + * + */ + +#ifndef GRPCXX_EXT_HEALTH_CHECK_SERVICE_INTERFACE_H +#define GRPCXX_EXT_HEALTH_CHECK_SERVICE_INTERFACE_H + +#include + +namespace grpc { + +class HealthCheckServiceInterface { + public: + virtual ~HealthCheckServiceInterface() { } + virtual void SetServingStatus(const grpc::string& service_name, bool serving) = 0; + // Apply to all registered service names. + virtual void SetServingStatus(bool serving) = 0; +}; + + +} // namespace grpc + +#endif // GRPCXX_EXT_HEALTH_CHECK_SERVICE_INTERFACE_H diff --git a/include/grpc++/ext/health_check_service_server_builder_option.h b/include/grpc++/ext/health_check_service_server_builder_option.h new file mode 100644 index 00000000000..9da1d18c985 --- /dev/null +++ b/include/grpc++/ext/health_check_service_server_builder_option.h @@ -0,0 +1,56 @@ +/* + * + * 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. + * + */ + +#ifndef GRPCXX_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H +#define GRPCXX_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H + +#include + +#include + +namespace grpc { + +class HealthCheckServiceInterface; + +class HealthCheckServiceServerBuilderOption : public ServerBuilderOption { + public: + explicit HealthCheckServiceServerBuilderOption( + std::unique_ptr hc); + void UpdateArguments(ChannelArguments* args) override; + private: + std::unique_ptr hc_; +}; + +} // namespace grpc + +#endif // GRPCXX_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index ff3a0e381da..77e9c7fc9ac 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -766,6 +766,8 @@ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ include/grpc++/create_channel_posix.h \ +include/grpc++/ext/health_check_service_interface.h \ +include/grpc++/ext/health_check_service_server_builder_option.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 04e8f4e7f20..f2e871e7bdd 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -766,6 +766,8 @@ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ include/grpc++/create_channel_posix.h \ +include/grpc++/ext/health_check_service_interface.h \ +include/grpc++/ext/health_check_service_server_builder_option.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 6ae269cc20d..4fd90ed24eb 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7618,6 +7618,8 @@ "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", "include/grpc++/create_channel_posix.h", + "include/grpc++/ext/health_check_service_interface.h", + "include/grpc++/ext/health_check_service_server_builder_option.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", @@ -7670,6 +7672,8 @@ "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", "include/grpc++/create_channel_posix.h", + "include/grpc++/ext/health_check_service_interface.h", + "include/grpc++/ext/health_check_service_server_builder_option.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index f281db72b66..b8d4176f8a4 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -264,6 +264,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index f359e4ef31a..b7eae651bd0 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -132,6 +132,12 @@ include\grpc++ + + include\grpc++\ext + + + include\grpc++\ext + include\grpc++\generic @@ -416,6 +422,9 @@ {784a0281-f547-aeb0-9f55-b26b7de9c769} + + {25501d8e-5fae-2fe4-14a6-d69a07acefdd} + {51dae921-3aa2-1976-2ee4-c5615de1af54} diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 1511a2cfe4c..4b6d448f919 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -264,6 +264,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index bed77b25a44..deec6d71052 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -117,6 +117,12 @@ include\grpc++ + + include\grpc++\ext + + + include\grpc++\ext + include\grpc++\generic @@ -389,6 +395,9 @@ {eceb50c0-bb49-3812-b6bd-b0af6df81da7} + + {e6643be2-2b2f-953d-ab14-27d89c835c8a} + {83717d3c-57d9-2bfa-ed9c-2b08f86da12b} From 64868839401b48a68afca187b28bc772043a2e1b Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 1 Dec 2016 12:15:50 -0800 Subject: [PATCH 002/126] Add more files --- BUILD | 3 + CMakeLists.txt | 3 + Makefile | 3 + build.yaml | 1 + ...alth_check_service_server_builder_option.h | 8 ++- ...lth_check_service_server_builder_option.cc | 59 +++++++++++++++++++ tools/doxygen/Doxyfile.c++.internal | 1 + .../generated/sources_and_headers.json | 1 + vsprojects/vcxproj/grpc++/grpc++.vcxproj | 2 + .../vcxproj/grpc++/grpc++.vcxproj.filters | 3 + .../grpc++_unsecure/grpc++_unsecure.vcxproj | 2 + .../grpc++_unsecure.vcxproj.filters | 3 + 12 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 src/cpp/ext/health_check_service_server_builder_option.cc diff --git a/BUILD b/BUILD index 54eda959fc2..fcd2742a8f5 100644 --- a/BUILD +++ b/BUILD @@ -1396,6 +1396,7 @@ cc_library( "src/cpp/common/channel_filter.cc", "src/cpp/common/completion_queue_cc.cc", "src/cpp/common/core_codegen.cc", + "src/cpp/common/health_check_service_server_builder_option.cc", "src/cpp/common/resource_quota_cc.cc", "src/cpp/common/rpc_method.cc", "src/cpp/common/version_cc.cc", @@ -1688,6 +1689,7 @@ cc_library( "src/cpp/common/channel_filter.cc", "src/cpp/common/completion_queue_cc.cc", "src/cpp/common/core_codegen.cc", + "src/cpp/common/health_check_service_server_builder_option.cc", "src/cpp/common/resource_quota_cc.cc", "src/cpp/common/rpc_method.cc", "src/cpp/common/version_cc.cc", @@ -2038,6 +2040,7 @@ cc_library( "src/cpp/common/channel_filter.cc", "src/cpp/common/completion_queue_cc.cc", "src/cpp/common/core_codegen.cc", + "src/cpp/common/health_check_service_server_builder_option.cc", "src/cpp/common/resource_quota_cc.cc", "src/cpp/common/rpc_method.cc", "src/cpp/common/version_cc.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index 90cf1cdc777..e90e8426cc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1085,6 +1085,7 @@ add_library(grpc++ src/cpp/common/channel_filter.cc src/cpp/common/completion_queue_cc.cc src/cpp/common/core_codegen.cc + src/cpp/common/health_check_service_server_builder_option.cc src/cpp/common/resource_quota_cc.cc src/cpp/common/rpc_method.cc src/cpp/common/version_cc.cc @@ -1245,6 +1246,7 @@ add_library(grpc++_cronet src/cpp/common/channel_filter.cc src/cpp/common/completion_queue_cc.cc src/cpp/common/core_codegen.cc + src/cpp/common/health_check_service_server_builder_option.cc src/cpp/common/resource_quota_cc.cc src/cpp/common/rpc_method.cc src/cpp/common/version_cc.cc @@ -1628,6 +1630,7 @@ add_library(grpc++_unsecure src/cpp/common/channel_filter.cc src/cpp/common/completion_queue_cc.cc src/cpp/common/core_codegen.cc + src/cpp/common/health_check_service_server_builder_option.cc src/cpp/common/resource_quota_cc.cc src/cpp/common/rpc_method.cc src/cpp/common/version_cc.cc diff --git a/Makefile b/Makefile index 85074b5b813..45d3cb29632 100644 --- a/Makefile +++ b/Makefile @@ -3779,6 +3779,7 @@ LIBGRPC++_SRC = \ src/cpp/common/channel_filter.cc \ src/cpp/common/completion_queue_cc.cc \ src/cpp/common/core_codegen.cc \ + src/cpp/common/health_check_service_server_builder_option.cc \ src/cpp/common/resource_quota_cc.cc \ src/cpp/common/rpc_method.cc \ src/cpp/common/version_cc.cc \ @@ -3968,6 +3969,7 @@ LIBGRPC++_CRONET_SRC = \ src/cpp/common/channel_filter.cc \ src/cpp/common/completion_queue_cc.cc \ src/cpp/common/core_codegen.cc \ + src/cpp/common/health_check_service_server_builder_option.cc \ src/cpp/common/resource_quota_cc.cc \ src/cpp/common/rpc_method.cc \ src/cpp/common/version_cc.cc \ @@ -4678,6 +4680,7 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/common/channel_filter.cc \ src/cpp/common/completion_queue_cc.cc \ src/cpp/common/core_codegen.cc \ + src/cpp/common/health_check_service_server_builder_option.cc \ src/cpp/common/resource_quota_cc.cc \ src/cpp/common/rpc_method.cc \ src/cpp/common/version_cc.cc \ diff --git a/build.yaml b/build.yaml index 25c4dd7fbf7..25dc9e0fcbe 100644 --- a/build.yaml +++ b/build.yaml @@ -774,6 +774,7 @@ filegroups: - src/cpp/common/channel_filter.cc - src/cpp/common/completion_queue_cc.cc - src/cpp/common/core_codegen.cc + - src/cpp/common/health_check_service_server_builder_option.cc - src/cpp/common/resource_quota_cc.cc - src/cpp/common/rpc_method.cc - src/cpp/common/version_cc.cc diff --git a/include/grpc++/ext/health_check_service_server_builder_option.h b/include/grpc++/ext/health_check_service_server_builder_option.h index 9da1d18c985..fb5263d7426 100644 --- a/include/grpc++/ext/health_check_service_server_builder_option.h +++ b/include/grpc++/ext/health_check_service_server_builder_option.h @@ -36,21 +36,25 @@ #include +#include +#include #include namespace grpc { -class HealthCheckServiceInterface; - class HealthCheckServiceServerBuilderOption : public ServerBuilderOption { public: explicit HealthCheckServiceServerBuilderOption( std::unique_ptr hc); + ~HealthCheckServiceServerBuilderOption() {} void UpdateArguments(ChannelArguments* args) override; + void UpdatePlugins(std::vector>* plugins) override; private: std::unique_ptr hc_; }; +void EnableDefaultHealthCheckService(bool enable); + } // namespace grpc #endif // GRPCXX_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H diff --git a/src/cpp/ext/health_check_service_server_builder_option.cc b/src/cpp/ext/health_check_service_server_builder_option.cc new file mode 100644 index 00000000000..dab5731e895 --- /dev/null +++ b/src/cpp/ext/health_check_service_server_builder_option.cc @@ -0,0 +1,59 @@ +/* + * + * 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 + +namespace grpc { +namespace { +bool g_grpc_default_health_check_service_enabled = false; +const char kDefaultHealthCheckServiceInterfaceArg[] = "grpc.default_health_check_service_interface"; +} // namesapce + +HealthCheckServiceServerBuilderOption::HealthCheckServiceServerBuilderOption( + std::unique_ptr hc) : hc_(std::move(hc)) { } + +HealthCheckServiceServerBuilderOption::UpdateArguments(ChannelArguments* args) override { + args->SetPointer(kDefaultHealthCheckServiceInterfaceArg, hc_.release()); +} + +void HealthCheckServiceServerBuilderOption::UpdatePlugins(std::vector>* plugins) override { + +} + +void EnableDefaultHealthCheckService(bool enable) { + g_grpc_default_health_check_service_enabled = enable; +} + +} // namespace grpc + + diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index f2e871e7bdd..ac20f0fc021 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -877,6 +877,7 @@ src/cpp/common/channel_arguments.cc \ src/cpp/common/channel_filter.cc \ src/cpp/common/completion_queue_cc.cc \ src/cpp/common/core_codegen.cc \ +src/cpp/common/health_check_service_server_builder_option.cc \ src/cpp/common/resource_quota_cc.cc \ src/cpp/common/rpc_method.cc \ src/cpp/common/version_cc.cc \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 4fd90ed24eb..cb92999b268 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7723,6 +7723,7 @@ "src/cpp/common/channel_filter.h", "src/cpp/common/completion_queue_cc.cc", "src/cpp/common/core_codegen.cc", + "src/cpp/common/health_check_service_server_builder_option.cc", "src/cpp/common/resource_quota_cc.cc", "src/cpp/common/rpc_method.cc", "src/cpp/common/version_cc.cc", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index b8d4176f8a4..468accbd239 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -398,6 +398,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index b7eae651bd0..d21b97b8df5 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -58,6 +58,9 @@ src\cpp\common + + src\cpp\common + src\cpp\common diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 4b6d448f919..f0e3f3a23e2 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -384,6 +384,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index deec6d71052..6076dbc693b 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -43,6 +43,9 @@ src\cpp\common + + src\cpp\common + src\cpp\common From 8d668d8324c3aa24353b3774a8f6ce35edbf20b7 Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 1 Dec 2016 15:09:28 -0800 Subject: [PATCH 003/126] default service --- BUILD | 9 +++ CMakeLists.txt | 6 ++ Makefile | 6 ++ build.yaml | 3 + ...alth_check_service_server_builder_option.h | 5 +- .../grpc++/health_check_service_interface.h | 63 +++++++++++++++++ include/grpc++/server.h | 9 +++ ...lth_check_service_server_builder_option.cc | 12 +--- .../server/default_health_check_service.cc | 67 +++++++++++++++++++ src/cpp/server/default_health_check_service.h | 59 ++++++++++++++++ .../cpp/server/health_check_service.cc | 23 +++---- src/cpp/server/server_cc.cc | 33 ++++++++- tools/doxygen/Doxyfile.c++.internal | 3 + .../generated/sources_and_headers.json | 4 ++ vsprojects/vcxproj/grpc++/grpc++.vcxproj | 5 ++ .../vcxproj/grpc++/grpc++.vcxproj.filters | 9 +++ .../grpc++_unsecure/grpc++_unsecure.vcxproj | 5 ++ .../grpc++_unsecure.vcxproj.filters | 9 +++ 18 files changed, 302 insertions(+), 28 deletions(-) create mode 100644 include/grpc++/health_check_service_interface.h create mode 100644 src/cpp/server/default_health_check_service.cc create mode 100644 src/cpp/server/default_health_check_service.h rename include/grpc++/ext/health_check_service_interface.h => src/cpp/server/health_check_service.cc (77%) diff --git a/BUILD b/BUILD index fcd2742a8f5..be1e23007b9 100644 --- a/BUILD +++ b/BUILD @@ -1374,6 +1374,7 @@ cc_library( "src/cpp/server/secure_server_credentials.h", "src/cpp/client/create_channel_internal.h", "src/cpp/common/channel_filter.h", + "src/cpp/server/default_health_check_service.h", "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/thread_pool_interface.h", "src/cpp/thread_manager/thread_manager.h", @@ -1402,7 +1403,9 @@ cc_library( "src/cpp/common/version_cc.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", + "src/cpp/server/default_health_check_service.cc", "src/cpp/server/dynamic_thread_pool.cc", + "src/cpp/server/health_check_service.cc", "src/cpp/server/server_builder.cc", "src/cpp/server/server_cc.cc", "src/cpp/server/server_context.cc", @@ -1525,6 +1528,7 @@ cc_library( srcs = [ "src/cpp/client/create_channel_internal.h", "src/cpp/common/channel_filter.h", + "src/cpp/server/default_health_check_service.h", "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/thread_pool_interface.h", "src/cpp/thread_manager/thread_manager.h", @@ -1695,7 +1699,9 @@ cc_library( "src/cpp/common/version_cc.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", + "src/cpp/server/default_health_check_service.cc", "src/cpp/server/dynamic_thread_pool.cc", + "src/cpp/server/health_check_service.cc", "src/cpp/server/server_builder.cc", "src/cpp/server/server_cc.cc", "src/cpp/server/server_context.cc", @@ -2023,6 +2029,7 @@ cc_library( srcs = [ "src/cpp/client/create_channel_internal.h", "src/cpp/common/channel_filter.h", + "src/cpp/server/default_health_check_service.h", "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/thread_pool_interface.h", "src/cpp/thread_manager/thread_manager.h", @@ -2046,7 +2053,9 @@ cc_library( "src/cpp/common/version_cc.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", + "src/cpp/server/default_health_check_service.cc", "src/cpp/server/dynamic_thread_pool.cc", + "src/cpp/server/health_check_service.cc", "src/cpp/server/server_builder.cc", "src/cpp/server/server_cc.cc", "src/cpp/server/server_context.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index e90e8426cc7..049f7fdaca0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1091,7 +1091,9 @@ add_library(grpc++ src/cpp/common/version_cc.cc src/cpp/server/async_generic_service.cc src/cpp/server/create_default_thread_pool.cc + src/cpp/server/default_health_check_service.cc src/cpp/server/dynamic_thread_pool.cc + src/cpp/server/health_check_service.cc src/cpp/server/server_builder.cc src/cpp/server/server_cc.cc src/cpp/server/server_context.cc @@ -1252,7 +1254,9 @@ add_library(grpc++_cronet src/cpp/common/version_cc.cc src/cpp/server/async_generic_service.cc src/cpp/server/create_default_thread_pool.cc + src/cpp/server/default_health_check_service.cc src/cpp/server/dynamic_thread_pool.cc + src/cpp/server/health_check_service.cc src/cpp/server/server_builder.cc src/cpp/server/server_cc.cc src/cpp/server/server_context.cc @@ -1636,7 +1640,9 @@ add_library(grpc++_unsecure src/cpp/common/version_cc.cc src/cpp/server/async_generic_service.cc src/cpp/server/create_default_thread_pool.cc + src/cpp/server/default_health_check_service.cc src/cpp/server/dynamic_thread_pool.cc + src/cpp/server/health_check_service.cc src/cpp/server/server_builder.cc src/cpp/server/server_cc.cc src/cpp/server/server_context.cc diff --git a/Makefile b/Makefile index 45d3cb29632..63f5d2ad314 100644 --- a/Makefile +++ b/Makefile @@ -3785,7 +3785,9 @@ LIBGRPC++_SRC = \ src/cpp/common/version_cc.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ + src/cpp/server/default_health_check_service.cc \ src/cpp/server/dynamic_thread_pool.cc \ + src/cpp/server/health_check_service.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_cc.cc \ src/cpp/server/server_context.cc \ @@ -3975,7 +3977,9 @@ LIBGRPC++_CRONET_SRC = \ src/cpp/common/version_cc.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ + src/cpp/server/default_health_check_service.cc \ src/cpp/server/dynamic_thread_pool.cc \ + src/cpp/server/health_check_service.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_cc.cc \ src/cpp/server/server_context.cc \ @@ -4686,7 +4690,9 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/common/version_cc.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ + src/cpp/server/default_health_check_service.cc \ src/cpp/server/dynamic_thread_pool.cc \ + src/cpp/server/health_check_service.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_cc.cc \ src/cpp/server/server_context.cc \ diff --git a/build.yaml b/build.yaml index 25dc9e0fcbe..925c73b729d 100644 --- a/build.yaml +++ b/build.yaml @@ -759,6 +759,7 @@ filegroups: headers: - src/cpp/client/create_channel_internal.h - src/cpp/common/channel_filter.h + - src/cpp/server/default_health_check_service.h - src/cpp/server/dynamic_thread_pool.h - src/cpp/server/thread_pool_interface.h - src/cpp/thread_manager/thread_manager.h @@ -780,7 +781,9 @@ filegroups: - src/cpp/common/version_cc.cc - src/cpp/server/async_generic_service.cc - src/cpp/server/create_default_thread_pool.cc + - src/cpp/server/default_health_check_service.cc - src/cpp/server/dynamic_thread_pool.cc + - src/cpp/server/health_check_service.cc - src/cpp/server/server_builder.cc - src/cpp/server/server_cc.cc - src/cpp/server/server_context.cc diff --git a/include/grpc++/ext/health_check_service_server_builder_option.h b/include/grpc++/ext/health_check_service_server_builder_option.h index fb5263d7426..e00c4c3dd59 100644 --- a/include/grpc++/ext/health_check_service_server_builder_option.h +++ b/include/grpc++/ext/health_check_service_server_builder_option.h @@ -36,7 +36,7 @@ #include -#include +#include #include #include @@ -44,6 +44,7 @@ namespace grpc { class HealthCheckServiceServerBuilderOption : public ServerBuilderOption { public: + // Use nullptr to disable default service. explicit HealthCheckServiceServerBuilderOption( std::unique_ptr hc); ~HealthCheckServiceServerBuilderOption() {} @@ -53,8 +54,6 @@ class HealthCheckServiceServerBuilderOption : public ServerBuilderOption { std::unique_ptr hc_; }; -void EnableDefaultHealthCheckService(bool enable); - } // namespace grpc #endif // GRPCXX_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H diff --git a/include/grpc++/health_check_service_interface.h b/include/grpc++/health_check_service_interface.h new file mode 100644 index 00000000000..70153d65cbb --- /dev/null +++ b/include/grpc++/health_check_service_interface.h @@ -0,0 +1,63 @@ +/* + * + * 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. + * + */ + +#ifndef GRPCXX_HEALTH_CHECK_SERVICE_INTERFACE_H +#define GRPCXX_HEALTH_CHECK_SERVICE_INTERFACE_H + +#include + +namespace grpc { + +const char kDefaultHealthCheckServiceInterfaceArg[] = + "grpc.default_health_check_service_interface"; + +class HealthCheckServiceInterface { + public: + virtual ~HealthCheckServiceInterface() {} + virtual void SetServingStatus(const grpc::string& service_name, + bool serving) = 0; + // Apply to all registered service names. + virtual void SetServingStatus(bool serving) = 0; +}; + +bool DefaultHealthCheckServiceEnabled(); + +// Enable/disable the default health checking service. This applies to all C++ +// servers created afterwards. For each server, user can override the default +// with a HealthCheckServiceServerBuilderOption. +// NOT thread safe. +void EnableDefaultHealthCheckService(bool enable); + +} // namespace grpc + +#endif // GRPCXX_HEALTH_CHECK_SERVICE_INTERFACE_H diff --git a/include/grpc++/server.h b/include/grpc++/server.h index fba9952e6e7..511dc35564a 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -97,6 +97,11 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen { // Returns a \em raw pointer to the underlying grpc_server instance. grpc_server* c_server(); + /// Returns the health check service. + HealthCheckServiceInterface* GetHealthCheckService() const { + return hc_.get(); + } + private: friend class AsyncGenericService; friend class ServerBuilder; @@ -214,6 +219,10 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen { grpc_server* server_; std::unique_ptr server_initializer_; + + std::unique_ptr health_check_service_; + // User explicitly disabled health check service. + bool health_check_service_disabled_; }; } // namespace grpc diff --git a/src/cpp/ext/health_check_service_server_builder_option.cc b/src/cpp/ext/health_check_service_server_builder_option.cc index dab5731e895..4afc82dc144 100644 --- a/src/cpp/ext/health_check_service_server_builder_option.cc +++ b/src/cpp/ext/health_check_service_server_builder_option.cc @@ -34,26 +34,16 @@ #include namespace grpc { -namespace { -bool g_grpc_default_health_check_service_enabled = false; -const char kDefaultHealthCheckServiceInterfaceArg[] = "grpc.default_health_check_service_interface"; -} // namesapce HealthCheckServiceServerBuilderOption::HealthCheckServiceServerBuilderOption( std::unique_ptr hc) : hc_(std::move(hc)) { } HealthCheckServiceServerBuilderOption::UpdateArguments(ChannelArguments* args) override { - args->SetPointer(kDefaultHealthCheckServiceInterfaceArg, hc_.release()); + args->SetPointer(DefaultHealthCheckServiceInterfaceArg(), hc_.release()); } void HealthCheckServiceServerBuilderOption::UpdatePlugins(std::vector>* plugins) override { - -} - -void EnableDefaultHealthCheckService(bool enable) { - g_grpc_default_health_check_service_enabled = enable; } } // namespace grpc - diff --git a/src/cpp/server/default_health_check_service.cc b/src/cpp/server/default_health_check_service.cc new file mode 100644 index 00000000000..eec7e2cd585 --- /dev/null +++ b/src/cpp/server/default_health_check_service.cc @@ -0,0 +1,67 @@ +/* + * + * 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 "src/cpp/server/default_health_check_service.h" + +namespace grpc { + +DefaultHealthCheckService::DefaultHealthCheckService() { + services_map_.insert("", true); +} + +void DefaultHealthCheckService::SetServingStatus( + const grpc::string& service_name, bool serving) override { + std::lock_guard lock(mu_); + services_map_[service_name] = serving; +} + +void SetServingStatus(bool serving) override { + std::lock_guard lock(mu_); + for (auto& iter = services_map_.begin(); iter != services_map_.end(); + ++iter) { + iter->second = serving; + } +} + +ServingStatus GetServingStatus(const grpc::string& service_name) const { + std::lock_guard lock(mu_); + const auto& iter = services_map_.find(service_name); + if (iter == services_map_.end()) { + return NOT_FOUND; + } + return iter->second ? SERVING : NOT_SERVING; +} + +} // namespace grpc + +#endif // GRPC_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_H diff --git a/src/cpp/server/default_health_check_service.h b/src/cpp/server/default_health_check_service.h new file mode 100644 index 00000000000..51afa6491e6 --- /dev/null +++ b/src/cpp/server/default_health_check_service.h @@ -0,0 +1,59 @@ +/* + * + * 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. + * + */ + +#ifndef GRPC_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_H +#define GRPC_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_H + +#include + +#include + +namespace grpc { + +class DefaultHealthCheckService : public HealthCheckServiceInterface { + public: + DefaultHealthCheckService(); + void SetServingStatus(const grpc::string& service_name, + bool serving) override; + void SetServingStatus(bool serving) override; + enum ServingStatus { NOT_FOUND, SERVING, NOT_SERVING }; + ServingStatus GetServingStatus(const grpc::string& service_name) const; + + private: + std::mutex mu_; + std::map services_map_; +}; + +} // namespace grpc + +#endif // GRPC_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_H diff --git a/include/grpc++/ext/health_check_service_interface.h b/src/cpp/server/health_check_service.cc similarity index 77% rename from include/grpc++/ext/health_check_service_interface.h rename to src/cpp/server/health_check_service.cc index b9f4ebb87f9..cca68c55490 100644 --- a/include/grpc++/ext/health_check_service_interface.h +++ b/src/cpp/server/health_check_service.cc @@ -31,22 +31,19 @@ * */ -#ifndef GRPCXX_EXT_HEALTH_CHECK_SERVICE_INTERFACE_H -#define GRPCXX_EXT_HEALTH_CHECK_SERVICE_INTERFACE_H - -#include +#include namespace grpc { +namespace { +bool g_grpc_default_health_check_service_enabled = false; +} // namesapce -class HealthCheckServiceInterface { - public: - virtual ~HealthCheckServiceInterface() { } - virtual void SetServingStatus(const grpc::string& service_name, bool serving) = 0; - // Apply to all registered service names. - virtual void SetServingStatus(bool serving) = 0; -}; +bool DefaultHealthCheckServiceEnabled() { + return g_grpc_default_health_check_service_enabled; +} +void EnableDefaultHealthCheckService(bool enable) { + g_grpc_default_health_check_service_enabled = enable; +} } // namespace grpc - -#endif // GRPCXX_EXT_HEALTH_CHECK_SERVICE_INTERFACE_H diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 817d85a81ca..037da2b3015 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -342,6 +343,7 @@ class Server::SyncRequestThreadManager : public ThreadManager { int cq_timeout_msec_; std::vector> sync_requests_; std::unique_ptr unknown_method_; + std::unique_ptr health_check_; std::shared_ptr global_callbacks_; }; @@ -358,7 +360,8 @@ Server::Server( shutdown_notified_(false), has_generic_service_(false), server_(nullptr), - server_initializer_(new ServerInitializer(this)) { + server_initializer_(new ServerInitializer(this)), + health_check_service_disabled_(false) { g_gli_initializer.summon(); gpr_once_init(&g_once_init_callbacks, InitGlobalCallbacks); global_callbacks_ = g_callbacks; @@ -374,6 +377,18 @@ Server::Server( grpc_channel_args channel_args; args->SetChannelArgs(&channel_args); + for (size_t i = 0; i < channel_args.num_args; i++) { + if (0 == strcmp(channel_args.args[i].key, + kDefaultHealthCheckServiceInterfaceArg)) { + if (channel_args.args[i].value == nullptr) { + health_check_service_disabled_ = true; + } else { + health_check_service_.reset(channel_args.args[i].value); + } + break; + } + } + server_ = grpc_server_create(&channel_args, nullptr); } @@ -481,6 +496,22 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { started_ = true; grpc_server_start(server_); + // Only create default health check service when user did not provide an + // explicit one. + if (health_check_service_ == nullptr && !health_check_service_disabled_ && + EnableDefaultHealthCheckService()) { + health_check_service_.reset(CreateDefaultHealthCheckService()); + for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { + (*it)->AddHealthCheckSyncMethod(); + } + + for (size_t i = 0; i < num_cqs; i++) { + if (cqs[i]->IsFrequentlyPolled()) { + // new UnimplementedAsyncRequest(this, cqs[i]); + } + } + } + if (!has_generic_service_) { for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { (*it)->AddUnknownSyncMethod(); diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index ac20f0fc021..aa79aedeb9d 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -855,6 +855,7 @@ src/cpp/common/secure_auth_context.h \ src/cpp/server/secure_server_credentials.h \ src/cpp/client/create_channel_internal.h \ src/cpp/common/channel_filter.h \ +src/cpp/server/default_health_check_service.h \ src/cpp/server/dynamic_thread_pool.h \ src/cpp/server/thread_pool_interface.h \ src/cpp/thread_manager/thread_manager.h \ @@ -883,7 +884,9 @@ src/cpp/common/rpc_method.cc \ src/cpp/common/version_cc.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ +src/cpp/server/default_health_check_service.cc \ src/cpp/server/dynamic_thread_pool.cc \ +src/cpp/server/health_check_service.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_cc.cc \ src/cpp/server/server_context.cc \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index cb92999b268..860a151f48a 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7658,6 +7658,7 @@ "include/grpc++/support/time.h", "src/cpp/client/create_channel_internal.h", "src/cpp/common/channel_filter.h", + "src/cpp/server/default_health_check_service.h", "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/thread_pool_interface.h", "src/cpp/thread_manager/thread_manager.h" @@ -7729,8 +7730,11 @@ "src/cpp/common/version_cc.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", + "src/cpp/server/default_health_check_service.cc", + "src/cpp/server/default_health_check_service.h", "src/cpp/server/dynamic_thread_pool.cc", "src/cpp/server/dynamic_thread_pool.h", + "src/cpp/server/health_check_service.cc", "src/cpp/server/server_builder.cc", "src/cpp/server/server_cc.cc", "src/cpp/server/server_context.cc", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index 468accbd239..a57ed0e2e53 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -355,6 +355,7 @@ + @@ -410,8 +411,12 @@ + + + + diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index d21b97b8df5..e455636abe2 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -76,9 +76,15 @@ src\cpp\server + + src\cpp\server + src\cpp\server + + src\cpp\server + src\cpp\server @@ -404,6 +410,9 @@ src\cpp\common + + src\cpp\server + src\cpp\server diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index f0e3f3a23e2..10c9be33399 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -351,6 +351,7 @@ + @@ -396,8 +397,12 @@ + + + + diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 6076dbc693b..0b65ff3fe81 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -61,9 +61,15 @@ src\cpp\server + + src\cpp\server + src\cpp\server + + src\cpp\server + src\cpp\server @@ -377,6 +383,9 @@ src\cpp\common + + src\cpp\server + src\cpp\server From 08137362d0c27d9908d91333c2825f09b30bad2b Mon Sep 17 00:00:00 2001 From: yang-g Date: Fri, 2 Dec 2016 21:28:43 -0800 Subject: [PATCH 004/126] WIP --- src/cpp/server/server_cc.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 037da2b3015..5d4da92f2bc 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -52,6 +52,7 @@ #include #include "src/core/lib/profiling/timers.h" +#include "src/cpp/server/default_health_check_service.h" #include "src/cpp/thread_manager/thread_manager.h" namespace grpc { @@ -306,6 +307,15 @@ class Server::SyncRequestThreadManager : public ThreadManager { sync_requests_.emplace_back(new SyncRequest(method, tag)); } + void AddHealthCheckSyncMethod() { + if (!sync_requests_.empty()) { + health_check_.reset( + new RpcServiceMethod("???", RpcMethod::NORMAL_RPC, new XXXHandler)); + sync_requests_.emplace_back( + new SyncRequest(health_check_.get(), nullptr)); + } + } + void AddUnknownSyncMethod() { if (!sync_requests_.empty()) { unknown_method_.reset(new RpcServiceMethod( @@ -500,7 +510,7 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { // explicit one. if (health_check_service_ == nullptr && !health_check_service_disabled_ && EnableDefaultHealthCheckService()) { - health_check_service_.reset(CreateDefaultHealthCheckService()); + health_check_service_.reset(new DefaultHealthCheckService); for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { (*it)->AddHealthCheckSyncMethod(); } From c9d2954e556db3f102a858d97e339edb9db0388c Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 6 Dec 2016 14:20:17 -0800 Subject: [PATCH 005/126] more --- BUILD | 6 +-- CMakeLists.txt | 6 +-- Makefile | 6 +-- build.yaml | 2 +- include/grpc++/server.h | 8 +-- .../server/default_health_check_service.cc | 23 +++++++++ src/cpp/server/default_health_check_service.h | 22 ++++++-- ...lth_check_service_server_builder_option.cc | 50 +++++++++++++++++++ src/cpp/server/server_cc.cc | 29 ++++------- tools/doxygen/Doxyfile.c++.internal | 2 +- .../generated/sources_and_headers.json | 2 +- vsprojects/vcxproj/grpc++/grpc++.vcxproj | 4 +- .../vcxproj/grpc++/grpc++.vcxproj.filters | 6 +-- .../grpc++_unsecure/grpc++_unsecure.vcxproj | 4 +- .../grpc++_unsecure.vcxproj.filters | 6 +-- 15 files changed, 127 insertions(+), 49 deletions(-) create mode 100644 src/cpp/server/health_check_service_server_builder_option.cc diff --git a/BUILD b/BUILD index be1e23007b9..6e786607ccc 100644 --- a/BUILD +++ b/BUILD @@ -1397,7 +1397,6 @@ cc_library( "src/cpp/common/channel_filter.cc", "src/cpp/common/completion_queue_cc.cc", "src/cpp/common/core_codegen.cc", - "src/cpp/common/health_check_service_server_builder_option.cc", "src/cpp/common/resource_quota_cc.cc", "src/cpp/common/rpc_method.cc", "src/cpp/common/version_cc.cc", @@ -1406,6 +1405,7 @@ cc_library( "src/cpp/server/default_health_check_service.cc", "src/cpp/server/dynamic_thread_pool.cc", "src/cpp/server/health_check_service.cc", + "src/cpp/server/health_check_service_server_builder_option.cc", "src/cpp/server/server_builder.cc", "src/cpp/server/server_cc.cc", "src/cpp/server/server_context.cc", @@ -1693,7 +1693,6 @@ cc_library( "src/cpp/common/channel_filter.cc", "src/cpp/common/completion_queue_cc.cc", "src/cpp/common/core_codegen.cc", - "src/cpp/common/health_check_service_server_builder_option.cc", "src/cpp/common/resource_quota_cc.cc", "src/cpp/common/rpc_method.cc", "src/cpp/common/version_cc.cc", @@ -1702,6 +1701,7 @@ cc_library( "src/cpp/server/default_health_check_service.cc", "src/cpp/server/dynamic_thread_pool.cc", "src/cpp/server/health_check_service.cc", + "src/cpp/server/health_check_service_server_builder_option.cc", "src/cpp/server/server_builder.cc", "src/cpp/server/server_cc.cc", "src/cpp/server/server_context.cc", @@ -2047,7 +2047,6 @@ cc_library( "src/cpp/common/channel_filter.cc", "src/cpp/common/completion_queue_cc.cc", "src/cpp/common/core_codegen.cc", - "src/cpp/common/health_check_service_server_builder_option.cc", "src/cpp/common/resource_quota_cc.cc", "src/cpp/common/rpc_method.cc", "src/cpp/common/version_cc.cc", @@ -2056,6 +2055,7 @@ cc_library( "src/cpp/server/default_health_check_service.cc", "src/cpp/server/dynamic_thread_pool.cc", "src/cpp/server/health_check_service.cc", + "src/cpp/server/health_check_service_server_builder_option.cc", "src/cpp/server/server_builder.cc", "src/cpp/server/server_cc.cc", "src/cpp/server/server_context.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index 049f7fdaca0..c32a4aaf960 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1085,7 +1085,6 @@ add_library(grpc++ src/cpp/common/channel_filter.cc src/cpp/common/completion_queue_cc.cc src/cpp/common/core_codegen.cc - src/cpp/common/health_check_service_server_builder_option.cc src/cpp/common/resource_quota_cc.cc src/cpp/common/rpc_method.cc src/cpp/common/version_cc.cc @@ -1094,6 +1093,7 @@ add_library(grpc++ src/cpp/server/default_health_check_service.cc src/cpp/server/dynamic_thread_pool.cc src/cpp/server/health_check_service.cc + src/cpp/server/health_check_service_server_builder_option.cc src/cpp/server/server_builder.cc src/cpp/server/server_cc.cc src/cpp/server/server_context.cc @@ -1248,7 +1248,6 @@ add_library(grpc++_cronet src/cpp/common/channel_filter.cc src/cpp/common/completion_queue_cc.cc src/cpp/common/core_codegen.cc - src/cpp/common/health_check_service_server_builder_option.cc src/cpp/common/resource_quota_cc.cc src/cpp/common/rpc_method.cc src/cpp/common/version_cc.cc @@ -1257,6 +1256,7 @@ add_library(grpc++_cronet src/cpp/server/default_health_check_service.cc src/cpp/server/dynamic_thread_pool.cc src/cpp/server/health_check_service.cc + src/cpp/server/health_check_service_server_builder_option.cc src/cpp/server/server_builder.cc src/cpp/server/server_cc.cc src/cpp/server/server_context.cc @@ -1634,7 +1634,6 @@ add_library(grpc++_unsecure src/cpp/common/channel_filter.cc src/cpp/common/completion_queue_cc.cc src/cpp/common/core_codegen.cc - src/cpp/common/health_check_service_server_builder_option.cc src/cpp/common/resource_quota_cc.cc src/cpp/common/rpc_method.cc src/cpp/common/version_cc.cc @@ -1643,6 +1642,7 @@ add_library(grpc++_unsecure src/cpp/server/default_health_check_service.cc src/cpp/server/dynamic_thread_pool.cc src/cpp/server/health_check_service.cc + src/cpp/server/health_check_service_server_builder_option.cc src/cpp/server/server_builder.cc src/cpp/server/server_cc.cc src/cpp/server/server_context.cc diff --git a/Makefile b/Makefile index 63f5d2ad314..43ef3c4f068 100644 --- a/Makefile +++ b/Makefile @@ -3779,7 +3779,6 @@ LIBGRPC++_SRC = \ src/cpp/common/channel_filter.cc \ src/cpp/common/completion_queue_cc.cc \ src/cpp/common/core_codegen.cc \ - src/cpp/common/health_check_service_server_builder_option.cc \ src/cpp/common/resource_quota_cc.cc \ src/cpp/common/rpc_method.cc \ src/cpp/common/version_cc.cc \ @@ -3788,6 +3787,7 @@ LIBGRPC++_SRC = \ src/cpp/server/default_health_check_service.cc \ src/cpp/server/dynamic_thread_pool.cc \ src/cpp/server/health_check_service.cc \ + src/cpp/server/health_check_service_server_builder_option.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_cc.cc \ src/cpp/server/server_context.cc \ @@ -3971,7 +3971,6 @@ LIBGRPC++_CRONET_SRC = \ src/cpp/common/channel_filter.cc \ src/cpp/common/completion_queue_cc.cc \ src/cpp/common/core_codegen.cc \ - src/cpp/common/health_check_service_server_builder_option.cc \ src/cpp/common/resource_quota_cc.cc \ src/cpp/common/rpc_method.cc \ src/cpp/common/version_cc.cc \ @@ -3980,6 +3979,7 @@ LIBGRPC++_CRONET_SRC = \ src/cpp/server/default_health_check_service.cc \ src/cpp/server/dynamic_thread_pool.cc \ src/cpp/server/health_check_service.cc \ + src/cpp/server/health_check_service_server_builder_option.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_cc.cc \ src/cpp/server/server_context.cc \ @@ -4684,7 +4684,6 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/common/channel_filter.cc \ src/cpp/common/completion_queue_cc.cc \ src/cpp/common/core_codegen.cc \ - src/cpp/common/health_check_service_server_builder_option.cc \ src/cpp/common/resource_quota_cc.cc \ src/cpp/common/rpc_method.cc \ src/cpp/common/version_cc.cc \ @@ -4693,6 +4692,7 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/server/default_health_check_service.cc \ src/cpp/server/dynamic_thread_pool.cc \ src/cpp/server/health_check_service.cc \ + src/cpp/server/health_check_service_server_builder_option.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_cc.cc \ src/cpp/server/server_context.cc \ diff --git a/build.yaml b/build.yaml index 925c73b729d..f02142717d6 100644 --- a/build.yaml +++ b/build.yaml @@ -775,7 +775,6 @@ filegroups: - src/cpp/common/channel_filter.cc - src/cpp/common/completion_queue_cc.cc - src/cpp/common/core_codegen.cc - - src/cpp/common/health_check_service_server_builder_option.cc - src/cpp/common/resource_quota_cc.cc - src/cpp/common/rpc_method.cc - src/cpp/common/version_cc.cc @@ -784,6 +783,7 @@ filegroups: - src/cpp/server/default_health_check_service.cc - src/cpp/server/dynamic_thread_pool.cc - src/cpp/server/health_check_service.cc + - src/cpp/server/health_check_service_server_builder_option.cc - src/cpp/server/server_builder.cc - src/cpp/server/server_cc.cc - src/cpp/server/server_context.cc diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 511dc35564a..dc97a0ec4c7 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -55,12 +55,10 @@ struct grpc_server; namespace grpc { -class GenericServerContext; class AsyncGenericService; -class ServerAsyncStreamingInterface; +class HealthCheckServiceInterface; class ServerContext; class ServerInitializer; -class ThreadPoolInterface; /// Models a gRPC server. /// @@ -99,7 +97,7 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen { /// Returns the health check service. HealthCheckServiceInterface* GetHealthCheckService() const { - return hc_.get(); + return health_check_service_.get(); } private: @@ -221,8 +219,6 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen { std::unique_ptr server_initializer_; std::unique_ptr health_check_service_; - // User explicitly disabled health check service. - bool health_check_service_disabled_; }; } // namespace grpc diff --git a/src/cpp/server/default_health_check_service.cc b/src/cpp/server/default_health_check_service.cc index eec7e2cd585..45f51a97b6f 100644 --- a/src/cpp/server/default_health_check_service.cc +++ b/src/cpp/server/default_health_check_service.cc @@ -34,6 +34,29 @@ #include "src/cpp/server/default_health_check_service.h" namespace grpc { +namespace { + +const char kHealthCheckMethodName[] = "/grpc.health.v1.Health/Check"; + +} // namespace + +SyncHealthCheckServiceImpl::SyncHealthCheckServiceImpl( + DefaultHealthCheckService* service) + : service_(service) { + auto* handler = + new RpcMethodHandler( + std::mem_fn(&SyncHealthCheckServiceImpl::Check), this); + auto* method = new RpcServiceMethod(kHealthCheckMethodName, + RpcMethod::NORMAL_RPC, handler); + AddMethod(mehtod); +} + +Status SyncHealthCheckServiceImpl::Check(ServerContext* context, + const ByteBuffer* request, + ByteBuffer* response) { + // TODO nanopb + return Status::OK; +} DefaultHealthCheckService::DefaultHealthCheckService() { services_map_.insert("", true); diff --git a/src/cpp/server/default_health_check_service.h b/src/cpp/server/default_health_check_service.h index 51afa6491e6..a2545c50e75 100644 --- a/src/cpp/server/default_health_check_service.h +++ b/src/cpp/server/default_health_check_service.h @@ -37,21 +37,37 @@ #include #include +#include namespace grpc { +class SyncHealthCheckServiceImpl : public Service { + public: + explicit SyncHealthCheckServiceImpl(DefaultHealthCheckService* service); + Status Check(ServerContext* context, const ByteBuffer* request, + ByteBuffer* response); + + private: + const DefaultHealthCheckService* service_; +}; + +// Default implementation of HealthCheckServiceInterface. Server will create and +// own it. class DefaultHealthCheckService : public HealthCheckServiceInterface { public: DefaultHealthCheckService(); - void SetServingStatus(const grpc::string& service_name, - bool serving) override; - void SetServingStatus(bool serving) override; + void SetServingStatus(const grpc::string& service_name, bool serving) final; + void SetServingStatus(bool serving) final; enum ServingStatus { NOT_FOUND, SERVING, NOT_SERVING }; ServingStatus GetServingStatus(const grpc::string& service_name) const; + SyncHealthCheckServiceImpl* GetSyncHealthCheckService() const { + return sync_service_.get(); + } private: std::mutex mu_; std::map services_map_; + std::unique_ptr sync_service_; }; } // namespace grpc diff --git a/src/cpp/server/health_check_service_server_builder_option.cc b/src/cpp/server/health_check_service_server_builder_option.cc new file mode 100644 index 00000000000..80004b77fae --- /dev/null +++ b/src/cpp/server/health_check_service_server_builder_option.cc @@ -0,0 +1,50 @@ +/* + * + * 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 + +namespace grpc { + +HealthCheckServiceServerBuilderOption::HealthCheckServiceServerBuilderOption( + std::unique_ptr hc) + : hc_(std::move(hc)) {} +// Hand over hc_ to the server. +void HealthCheckServiceServerBuilderOption::UpdateArguments( + ChannelArguments* args) override { + args->SetPointer(kDefaultHealthCheckServiceInterfaceArg, hc_.release()); +} + +void HealthCheckServiceServerBuilderOption::UpdatePlugins( + std::vector>* plugins) override {} + +} // namespace grpc diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 5d4da92f2bc..03210883bfe 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -370,8 +370,7 @@ Server::Server( shutdown_notified_(false), has_generic_service_(false), server_(nullptr), - server_initializer_(new ServerInitializer(this)), - health_check_service_disabled_(false) { + server_initializer_(new ServerInitializer(this)) { g_gli_initializer.summon(); gpr_once_init(&g_once_init_callbacks, InitGlobalCallbacks); global_callbacks_ = g_callbacks; @@ -387,6 +386,7 @@ Server::Server( grpc_channel_args channel_args; args->SetChannelArgs(&channel_args); + bool health_check_service_disabled = false; for (size_t i = 0; i < channel_args.num_args; i++) { if (0 == strcmp(channel_args.args[i].key, kDefaultHealthCheckServiceInterfaceArg)) { @@ -398,6 +398,15 @@ Server::Server( break; } } + // Only create default health check service when user did not provide an + // explicit one. + if (health_check_service_ == nullptr && !health_check_service_disabled && + EnableDefaultHealthCheckService()) { + health_check_service_.reset(new DefaultHealthCheckService); + if (!sync_server_cqs->empty()) { // Has sync methods. + RegisterService(health_check_service_->GetSyncHealthCheckService()); + } + } server_ = grpc_server_create(&channel_args, nullptr); } @@ -506,22 +515,6 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { started_ = true; grpc_server_start(server_); - // Only create default health check service when user did not provide an - // explicit one. - if (health_check_service_ == nullptr && !health_check_service_disabled_ && - EnableDefaultHealthCheckService()) { - health_check_service_.reset(new DefaultHealthCheckService); - for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { - (*it)->AddHealthCheckSyncMethod(); - } - - for (size_t i = 0; i < num_cqs; i++) { - if (cqs[i]->IsFrequentlyPolled()) { - // new UnimplementedAsyncRequest(this, cqs[i]); - } - } - } - if (!has_generic_service_) { for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { (*it)->AddUnknownSyncMethod(); diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index aa79aedeb9d..5e3f2266032 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -878,7 +878,6 @@ src/cpp/common/channel_arguments.cc \ src/cpp/common/channel_filter.cc \ src/cpp/common/completion_queue_cc.cc \ src/cpp/common/core_codegen.cc \ -src/cpp/common/health_check_service_server_builder_option.cc \ src/cpp/common/resource_quota_cc.cc \ src/cpp/common/rpc_method.cc \ src/cpp/common/version_cc.cc \ @@ -887,6 +886,7 @@ src/cpp/server/create_default_thread_pool.cc \ src/cpp/server/default_health_check_service.cc \ src/cpp/server/dynamic_thread_pool.cc \ src/cpp/server/health_check_service.cc \ +src/cpp/server/health_check_service_server_builder_option.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_cc.cc \ src/cpp/server/server_context.cc \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 860a151f48a..84fc1ad3b18 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7724,7 +7724,6 @@ "src/cpp/common/channel_filter.h", "src/cpp/common/completion_queue_cc.cc", "src/cpp/common/core_codegen.cc", - "src/cpp/common/health_check_service_server_builder_option.cc", "src/cpp/common/resource_quota_cc.cc", "src/cpp/common/rpc_method.cc", "src/cpp/common/version_cc.cc", @@ -7735,6 +7734,7 @@ "src/cpp/server/dynamic_thread_pool.cc", "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/health_check_service.cc", + "src/cpp/server/health_check_service_server_builder_option.cc", "src/cpp/server/server_builder.cc", "src/cpp/server/server_cc.cc", "src/cpp/server/server_context.cc", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index a57ed0e2e53..4af3454e39a 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -399,8 +399,6 @@ - - @@ -417,6 +415,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index e455636abe2..17ea98381a0 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -58,9 +58,6 @@ src\cpp\common - - src\cpp\common - src\cpp\common @@ -85,6 +82,9 @@ src\cpp\server + + src\cpp\server + src\cpp\server diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 10c9be33399..060f2818e32 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -385,8 +385,6 @@ - - @@ -403,6 +401,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 0b65ff3fe81..8aa4a77d400 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -43,9 +43,6 @@ src\cpp\common - - src\cpp\common - src\cpp\common @@ -70,6 +67,9 @@ src\cpp\server + + src\cpp\server + src\cpp\server From 6d0fbfaf7b887ed96defc46f96fd1e7d5b4875b9 Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 6 Dec 2016 16:49:04 -0800 Subject: [PATCH 006/126] WIP --- .../server/default_health_check_service.cc | 29 ++++++++++--------- src/cpp/server/default_health_check_service.h | 25 ++++++++-------- ...lth_check_service_server_builder_option.cc | 4 +-- src/cpp/server/server_cc.cc | 25 ++++++---------- 4 files changed, 39 insertions(+), 44 deletions(-) diff --git a/src/cpp/server/default_health_check_service.cc b/src/cpp/server/default_health_check_service.cc index 45f51a97b6f..704243e8314 100644 --- a/src/cpp/server/default_health_check_service.cc +++ b/src/cpp/server/default_health_check_service.cc @@ -31,6 +31,10 @@ * */ +#include + +#include + #include "src/cpp/server/default_health_check_service.h" namespace grpc { @@ -40,43 +44,42 @@ const char kHealthCheckMethodName[] = "/grpc.health.v1.Health/Check"; } // namespace -SyncHealthCheckServiceImpl::SyncHealthCheckServiceImpl( - DefaultHealthCheckService* service) +DefaultHealthCheckService::SyncHealthCheckServiceImpl:: + SyncHealthCheckServiceImpl(DefaultHealthCheckService* service) : service_(service) { auto* handler = new RpcMethodHandler( std::mem_fn(&SyncHealthCheckServiceImpl::Check), this); auto* method = new RpcServiceMethod(kHealthCheckMethodName, RpcMethod::NORMAL_RPC, handler); - AddMethod(mehtod); + AddMethod(method); } -Status SyncHealthCheckServiceImpl::Check(ServerContext* context, - const ByteBuffer* request, - ByteBuffer* response) { +Status DefaultHealthCheckService::SyncHealthCheckServiceImpl::Check( + ServerContext* context, const ByteBuffer* request, ByteBuffer* response) { // TODO nanopb return Status::OK; } DefaultHealthCheckService::DefaultHealthCheckService() { - services_map_.insert("", true); + services_map_.emplace("", true); } void DefaultHealthCheckService::SetServingStatus( - const grpc::string& service_name, bool serving) override { + const grpc::string& service_name, bool serving) { std::lock_guard lock(mu_); services_map_[service_name] = serving; } -void SetServingStatus(bool serving) override { +void DefaultHealthCheckService::SetServingStatus(bool serving) { std::lock_guard lock(mu_); - for (auto& iter = services_map_.begin(); iter != services_map_.end(); - ++iter) { + for (auto iter = services_map_.begin(); iter != services_map_.end(); ++iter) { iter->second = serving; } } -ServingStatus GetServingStatus(const grpc::string& service_name) const { +DefaultHealthCheckService::ServingStatus +DefaultHealthCheckService::GetServingStatus(const grpc::string& service_name) { std::lock_guard lock(mu_); const auto& iter = services_map_.find(service_name); if (iter == services_map_.end()) { @@ -86,5 +89,3 @@ ServingStatus GetServingStatus(const grpc::string& service_name) const { } } // namespace grpc - -#endif // GRPC_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_H diff --git a/src/cpp/server/default_health_check_service.h b/src/cpp/server/default_health_check_service.h index a2545c50e75..23ee1cb7dc3 100644 --- a/src/cpp/server/default_health_check_service.h +++ b/src/cpp/server/default_health_check_service.h @@ -37,29 +37,30 @@ #include #include -#include +#include +#include namespace grpc { -class SyncHealthCheckServiceImpl : public Service { - public: - explicit SyncHealthCheckServiceImpl(DefaultHealthCheckService* service); - Status Check(ServerContext* context, const ByteBuffer* request, - ByteBuffer* response); - - private: - const DefaultHealthCheckService* service_; -}; - // Default implementation of HealthCheckServiceInterface. Server will create and // own it. class DefaultHealthCheckService : public HealthCheckServiceInterface { public: + class SyncHealthCheckServiceImpl : public Service { + public: + explicit SyncHealthCheckServiceImpl(DefaultHealthCheckService* service); + Status Check(ServerContext* context, const ByteBuffer* request, + ByteBuffer* response); + + private: + const DefaultHealthCheckService* service_; + }; + DefaultHealthCheckService(); void SetServingStatus(const grpc::string& service_name, bool serving) final; void SetServingStatus(bool serving) final; enum ServingStatus { NOT_FOUND, SERVING, NOT_SERVING }; - ServingStatus GetServingStatus(const grpc::string& service_name) const; + ServingStatus GetServingStatus(const grpc::string& service_name); SyncHealthCheckServiceImpl* GetSyncHealthCheckService() const { return sync_service_.get(); } diff --git a/src/cpp/server/health_check_service_server_builder_option.cc b/src/cpp/server/health_check_service_server_builder_option.cc index 80004b77fae..6680bed2e2b 100644 --- a/src/cpp/server/health_check_service_server_builder_option.cc +++ b/src/cpp/server/health_check_service_server_builder_option.cc @@ -40,11 +40,11 @@ HealthCheckServiceServerBuilderOption::HealthCheckServiceServerBuilderOption( : hc_(std::move(hc)) {} // Hand over hc_ to the server. void HealthCheckServiceServerBuilderOption::UpdateArguments( - ChannelArguments* args) override { + ChannelArguments* args) { args->SetPointer(kDefaultHealthCheckServiceInterfaceArg, hc_.release()); } void HealthCheckServiceServerBuilderOption::UpdatePlugins( - std::vector>* plugins) override {} + std::vector>* plugins) {} } // namespace grpc diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 03210883bfe..4eaafeabb89 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -36,7 +36,6 @@ #include #include -#include #include #include #include @@ -307,15 +306,6 @@ class Server::SyncRequestThreadManager : public ThreadManager { sync_requests_.emplace_back(new SyncRequest(method, tag)); } - void AddHealthCheckSyncMethod() { - if (!sync_requests_.empty()) { - health_check_.reset( - new RpcServiceMethod("???", RpcMethod::NORMAL_RPC, new XXXHandler)); - sync_requests_.emplace_back( - new SyncRequest(health_check_.get(), nullptr)); - } - } - void AddUnknownSyncMethod() { if (!sync_requests_.empty()) { unknown_method_.reset(new RpcServiceMethod( @@ -390,10 +380,11 @@ Server::Server( for (size_t i = 0; i < channel_args.num_args; i++) { if (0 == strcmp(channel_args.args[i].key, kDefaultHealthCheckServiceInterfaceArg)) { - if (channel_args.args[i].value == nullptr) { - health_check_service_disabled_ = true; + if (channel_args.args[i].value.pointer.p == nullptr) { + health_check_service_disabled = true; } else { - health_check_service_.reset(channel_args.args[i].value); + health_check_service_.reset(static_cast( + channel_args.args[i].value.pointer.p)); } break; } @@ -401,10 +392,12 @@ Server::Server( // Only create default health check service when user did not provide an // explicit one. if (health_check_service_ == nullptr && !health_check_service_disabled && - EnableDefaultHealthCheckService()) { - health_check_service_.reset(new DefaultHealthCheckService); + DefaultHealthCheckServiceEnabled()) { + auto* default_hc_service = new DefaultHealthCheckService; + health_check_service_.reset(default_hc_service); if (!sync_server_cqs->empty()) { // Has sync methods. - RegisterService(health_check_service_->GetSyncHealthCheckService()); + grpc::string host; + RegisterService(&host, default_hc_service->GetSyncHealthCheckService()); } } From c8a49d29560be146bb81f421b8dd646c7f4a4f46 Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 12 Dec 2016 11:18:49 -0800 Subject: [PATCH 007/126] codegen health proto --- Makefile | 43 ++++--- build.yaml | 1 + .../generated/sources_and_headers.json | 25 +--- .../vcxproj/benchmark/benchmark.vcxproj | 48 +------ .../benchmark/benchmark.vcxproj.filters | 118 ------------------ .../grpc++_test_util/grpc++_test_util.vcxproj | 8 ++ .../grpc++_test_util.vcxproj.filters | 9 ++ 7 files changed, 45 insertions(+), 207 deletions(-) diff --git a/Makefile b/Makefile index 43ef3c4f068..e9d24906d54 100644 --- a/Makefile +++ b/Makefile @@ -2027,6 +2027,21 @@ $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc: $(Q) mkdir -p $(@D) $(Q) echo "$(GRPCXX_UNSECURE_PC_FILE)" | tr , '\n' >$@ +ifeq ($(NO_PROTOC),true) +$(GENDIR)/src/proto/grpc/health/v1/health.pb.cc: protoc_dep_error +$(GENDIR)/src/proto/grpc/health/v1/health.grpc.pb.cc: protoc_dep_error +else +$(GENDIR)/src/proto/grpc/health/v1/health.pb.cc: src/proto/grpc/health/v1/health.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[PROTOC] Generating protobuf CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $< + +$(GENDIR)/src/proto/grpc/health/v1/health.grpc.pb.cc: src/proto/grpc/health/v1/health.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< +endif + ifeq ($(NO_PROTOC),true) $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.pb.cc: protoc_dep_error $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc: protoc_dep_error @@ -4556,6 +4571,7 @@ endif LIBGRPC++_TEST_UTIL_SRC = \ + $(GENDIR)/src/proto/grpc/health/v1/health.pb.cc $(GENDIR)/src/proto/grpc/health/v1/health.grpc.pb.cc \ $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc \ $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc \ $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc \ @@ -4660,13 +4676,13 @@ ifneq ($(NO_DEPS),true) -include $(LIBGRPC++_TEST_UTIL_OBJS:.o=.dep) endif endif -$(OBJDIR)/$(CONFIG)/test/cpp/end2end/test_service_impl.o: $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc -$(OBJDIR)/$(CONFIG)/test/cpp/util/byte_buffer_proto_helper.o: $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc -$(OBJDIR)/$(CONFIG)/test/cpp/util/create_test_channel.o: $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc -$(OBJDIR)/$(CONFIG)/test/cpp/util/string_ref_helper.o: $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc -$(OBJDIR)/$(CONFIG)/test/cpp/util/subprocess.o: $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc -$(OBJDIR)/$(CONFIG)/test/cpp/util/test_credentials_provider.o: $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc -$(OBJDIR)/$(CONFIG)/src/cpp/codegen/codegen_init.o: $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/end2end/test_service_impl.o: $(GENDIR)/src/proto/grpc/health/v1/health.pb.cc $(GENDIR)/src/proto/grpc/health/v1/health.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/util/byte_buffer_proto_helper.o: $(GENDIR)/src/proto/grpc/health/v1/health.pb.cc $(GENDIR)/src/proto/grpc/health/v1/health.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/util/create_test_channel.o: $(GENDIR)/src/proto/grpc/health/v1/health.pb.cc $(GENDIR)/src/proto/grpc/health/v1/health.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/util/string_ref_helper.o: $(GENDIR)/src/proto/grpc/health/v1/health.pb.cc $(GENDIR)/src/proto/grpc/health/v1/health.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/util/subprocess.o: $(GENDIR)/src/proto/grpc/health/v1/health.pb.cc $(GENDIR)/src/proto/grpc/health/v1/health.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/util/test_credentials_provider.o: $(GENDIR)/src/proto/grpc/health/v1/health.pb.cc $(GENDIR)/src/proto/grpc/health/v1/health.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/src/cpp/codegen/codegen_init.o: $(GENDIR)/src/proto/grpc/health/v1/health.pb.cc $(GENDIR)/src/proto/grpc/health/v1/health.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc LIBGRPC++_UNSECURE_SRC = \ @@ -7014,19 +7030,6 @@ endif LIBBENCHMARK_SRC = \ - third_party/benchmark/src/benchmark.cc \ - third_party/benchmark/src/benchmark_register.cc \ - third_party/benchmark/src/colorprint.cc \ - third_party/benchmark/src/commandlineflags.cc \ - third_party/benchmark/src/complexity.cc \ - third_party/benchmark/src/console_reporter.cc \ - third_party/benchmark/src/csv_reporter.cc \ - third_party/benchmark/src/json_reporter.cc \ - third_party/benchmark/src/reporter.cc \ - third_party/benchmark/src/sleep.cc \ - third_party/benchmark/src/string_util.cc \ - third_party/benchmark/src/sysinfo.cc \ - third_party/benchmark/src/timers.cc \ PUBLIC_HEADERS_CXX += \ diff --git a/build.yaml b/build.yaml index f02142717d6..54635fe3695 100644 --- a/build.yaml +++ b/build.yaml @@ -1124,6 +1124,7 @@ libs: - test/cpp/util/subprocess.h - test/cpp/util/test_credentials_provider.h src: + - src/proto/grpc/health/v1/health.proto - src/proto/grpc/testing/echo_messages.proto - src/proto/grpc/testing/echo.proto - src/proto/grpc/testing/duplicate/echo_duplicate.proto diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 84fc1ad3b18..02d03bd6169 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -5246,6 +5246,8 @@ "thrift_util" ], "headers": [ + "src/proto/grpc/health/v1/health.grpc.pb.h", + "src/proto/grpc/health/v1/health.pb.h", "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h", "src/proto/grpc/testing/duplicate/echo_duplicate.pb.h", "src/proto/grpc/testing/echo.grpc.pb.h", @@ -6206,28 +6208,7 @@ }, { "deps": [], - "headers": [ - "third_party/benchmark/include/benchmark/benchmark.h", - "third_party/benchmark/include/benchmark/benchmark_api.h", - "third_party/benchmark/include/benchmark/macros.h", - "third_party/benchmark/include/benchmark/reporter.h", - "third_party/benchmark/src/arraysize.h", - "third_party/benchmark/src/benchmark_api_internal.h", - "third_party/benchmark/src/check.h", - "third_party/benchmark/src/colorprint.h", - "third_party/benchmark/src/commandlineflags.h", - "third_party/benchmark/src/complexity.h", - "third_party/benchmark/src/cycleclock.h", - "third_party/benchmark/src/internal_macros.h", - "third_party/benchmark/src/log.h", - "third_party/benchmark/src/mutex.h", - "third_party/benchmark/src/re.h", - "third_party/benchmark/src/sleep.h", - "third_party/benchmark/src/stat.h", - "third_party/benchmark/src/string_util.h", - "third_party/benchmark/src/sysinfo.h", - "third_party/benchmark/src/timers.h" - ], + "headers": [], "is_filegroup": false, "language": "c++", "name": "benchmark", diff --git a/vsprojects/vcxproj/benchmark/benchmark.vcxproj b/vsprojects/vcxproj/benchmark/benchmark.vcxproj index 9f262b3b00c..811317595f4 100644 --- a/vsprojects/vcxproj/benchmark/benchmark.vcxproj +++ b/vsprojects/vcxproj/benchmark/benchmark.vcxproj @@ -147,53 +147,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/vsprojects/vcxproj/benchmark/benchmark.vcxproj.filters b/vsprojects/vcxproj/benchmark/benchmark.vcxproj.filters index ccc9ca2cae7..00e4276f1d4 100644 --- a/vsprojects/vcxproj/benchmark/benchmark.vcxproj.filters +++ b/vsprojects/vcxproj/benchmark/benchmark.vcxproj.filters @@ -1,125 +1,7 @@ - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - - - third_party\benchmark\include\benchmark - - - third_party\benchmark\include\benchmark - - - third_party\benchmark\include\benchmark - - - third_party\benchmark\include\benchmark - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - third_party\benchmark\src - - - - {7b593518-9fee-107e-6b64-24bdce73f939} - - - {f0d35de1-6b41-778d-0ba0-faad514fb0f4} - - - {cbc02dfa-face-8cc6-0efb-efacc0c3369c} - - - {4f2f03fc-b82d-df33-63ee-bedebeb2c0ee} - - - {f42a8e0a-5a76-0e6f-d708-f0306858f673} - diff --git a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj index d2305b2e255..49333b0951a 100644 --- a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj @@ -206,6 +206,14 @@ + + + + + + + + diff --git a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters index d1aaba70926..9a9c05b99b1 100644 --- a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters @@ -1,6 +1,9 @@ + + src\proto\grpc\health\v1 + src\proto\grpc\testing @@ -242,6 +245,12 @@ {f3daac52-2bfd-362e-9a76-04cd7a90aa34} + + {d2393dd7-6f95-0e70-c36d-cd8ef8e2f17e} + + + {f2f10901-f74f-a55a-abea-082923feb664} + {3df5f11f-e018-1126-8c22-291540035aa8} From ad327642192363808c378b775ddcd34b86294443 Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 12 Dec 2016 14:32:09 -0800 Subject: [PATCH 008/126] sync test pass --- Makefile | 48 ++++ build.yaml | 13 ++ include/grpc++/server.h | 1 + .../server/default_health_check_service.cc | 7 +- src/cpp/server/server_cc.cc | 29 +-- .../end2end/health_service_end2end_test.cc | 158 +++++++++++++ .../generated/sources_and_headers.json | 19 ++ tools/run_tests/generated/tests.json | 22 ++ .../health_service_end2end_test.vcxproj | 207 ++++++++++++++++++ ...ealth_service_end2end_test.vcxproj.filters | 21 ++ 10 files changed, 509 insertions(+), 16 deletions(-) create mode 100644 test/cpp/end2end/health_service_end2end_test.cc create mode 100644 vsprojects/vcxproj/test/health_service_end2end_test/health_service_end2end_test.vcxproj create mode 100644 vsprojects/vcxproj/test/health_service_end2end_test/health_service_end2end_test.vcxproj.filters diff --git a/Makefile b/Makefile index e9d24906d54..6c7a0c15187 100644 --- a/Makefile +++ b/Makefile @@ -1085,6 +1085,7 @@ grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin grpc_tool_test: $(BINDIR)/$(CONFIG)/grpc_tool_test grpclb_api_test: $(BINDIR)/$(CONFIG)/grpclb_api_test grpclb_test: $(BINDIR)/$(CONFIG)/grpclb_test +health_service_end2end_test: $(BINDIR)/$(CONFIG)/health_service_end2end_test hybrid_end2end_test: $(BINDIR)/$(CONFIG)/hybrid_end2end_test interop_client: $(BINDIR)/$(CONFIG)/interop_client interop_server: $(BINDIR)/$(CONFIG)/interop_server @@ -1467,6 +1468,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/grpc_tool_test \ $(BINDIR)/$(CONFIG)/grpclb_api_test \ $(BINDIR)/$(CONFIG)/grpclb_test \ + $(BINDIR)/$(CONFIG)/health_service_end2end_test \ $(BINDIR)/$(CONFIG)/hybrid_end2end_test \ $(BINDIR)/$(CONFIG)/interop_client \ $(BINDIR)/$(CONFIG)/interop_server \ @@ -1560,6 +1562,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/grpc_tool_test \ $(BINDIR)/$(CONFIG)/grpclb_api_test \ $(BINDIR)/$(CONFIG)/grpclb_test \ + $(BINDIR)/$(CONFIG)/health_service_end2end_test \ $(BINDIR)/$(CONFIG)/hybrid_end2end_test \ $(BINDIR)/$(CONFIG)/interop_client \ $(BINDIR)/$(CONFIG)/interop_server \ @@ -1883,6 +1886,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/grpclb_api_test || ( echo test grpclb_api_test failed ; exit 1 ) $(E) "[RUN] Testing grpclb_test" $(Q) $(BINDIR)/$(CONFIG)/grpclb_test || ( echo test grpclb_test failed ; exit 1 ) + $(E) "[RUN] Testing health_service_end2end_test" + $(Q) $(BINDIR)/$(CONFIG)/health_service_end2end_test || ( echo test health_service_end2end_test failed ; exit 1 ) $(E) "[RUN] Testing hybrid_end2end_test" $(Q) $(BINDIR)/$(CONFIG)/hybrid_end2end_test || ( echo test hybrid_end2end_test failed ; exit 1 ) $(E) "[RUN] Testing interop_test" @@ -12906,6 +12911,49 @@ endif $(OBJDIR)/$(CONFIG)/test/cpp/grpclb/grpclb_test.o: $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.pb.cc $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc +HEALTH_SERVICE_END2END_TEST_SRC = \ + test/cpp/end2end/health_service_end2end_test.cc \ + +HEALTH_SERVICE_END2END_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HEALTH_SERVICE_END2END_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/health_service_end2end_test: openssl_dep_error + +else + + + + +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)/health_service_end2end_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/health_service_end2end_test: $(PROTOBUF_DEP) $(HEALTH_SERVICE_END2END_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(HEALTH_SERVICE_END2END_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/health_service_end2end_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/cpp/end2end/health_service_end2end_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_health_service_end2end_test: $(HEALTH_SERVICE_END2END_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(HEALTH_SERVICE_END2END_TEST_OBJS:.o=.dep) +endif +endif + + HYBRID_END2END_TEST_SRC = \ test/cpp/end2end/hybrid_end2end_test.cc \ diff --git a/build.yaml b/build.yaml index 54635fe3695..8be83187b1d 100644 --- a/build.yaml +++ b/build.yaml @@ -3192,6 +3192,19 @@ targets: - grpc++ - grpc++_test_util - grpc_test_util +- name: health_service_end2end_test + gtest: true + build: test + language: c++ + src: + - test/cpp/end2end/health_service_end2end_test.cc + deps: + - grpc++_test_util + - grpc_test_util + - grpc++ + - grpc + - gpr_test_util + - gpr - name: hybrid_end2end_test gtest: true build: test diff --git a/include/grpc++/server.h b/include/grpc++/server.h index dc97a0ec4c7..e3e9174c9c2 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -219,6 +219,7 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen { std::unique_ptr server_initializer_; std::unique_ptr health_check_service_; + bool health_check_service_disabled_; }; } // namespace grpc diff --git a/src/cpp/server/default_health_check_service.cc b/src/cpp/server/default_health_check_service.cc index 704243e8314..ae10ec92c6e 100644 --- a/src/cpp/server/default_health_check_service.cc +++ b/src/cpp/server/default_health_check_service.cc @@ -31,9 +31,11 @@ * */ +#include #include #include +#include #include "src/cpp/server/default_health_check_service.h" @@ -57,11 +59,12 @@ DefaultHealthCheckService::SyncHealthCheckServiceImpl:: Status DefaultHealthCheckService::SyncHealthCheckServiceImpl::Check( ServerContext* context, const ByteBuffer* request, ByteBuffer* response) { - // TODO nanopb + // TODO nanopb part return Status::OK; } -DefaultHealthCheckService::DefaultHealthCheckService() { +DefaultHealthCheckService::DefaultHealthCheckService() + : sync_service_(new SyncHealthCheckServiceImpl(this)) { services_map_.emplace("", true); } diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 4eaafeabb89..b8558cfc3de 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -360,7 +360,8 @@ Server::Server( shutdown_notified_(false), has_generic_service_(false), server_(nullptr), - server_initializer_(new ServerInitializer(this)) { + server_initializer_(new ServerInitializer(this)), + health_check_service_disabled_(false) { g_gli_initializer.summon(); gpr_once_init(&g_once_init_callbacks, InitGlobalCallbacks); global_callbacks_ = g_callbacks; @@ -376,12 +377,11 @@ Server::Server( grpc_channel_args channel_args; args->SetChannelArgs(&channel_args); - bool health_check_service_disabled = false; for (size_t i = 0; i < channel_args.num_args; i++) { if (0 == strcmp(channel_args.args[i].key, kDefaultHealthCheckServiceInterfaceArg)) { if (channel_args.args[i].value.pointer.p == nullptr) { - health_check_service_disabled = true; + health_check_service_disabled_ = true; } else { health_check_service_.reset(static_cast( channel_args.args[i].value.pointer.p)); @@ -389,17 +389,6 @@ Server::Server( break; } } - // Only create default health check service when user did not provide an - // explicit one. - if (health_check_service_ == nullptr && !health_check_service_disabled && - DefaultHealthCheckServiceEnabled()) { - auto* default_hc_service = new DefaultHealthCheckService; - health_check_service_.reset(default_hc_service); - if (!sync_server_cqs->empty()) { // Has sync methods. - grpc::string host; - RegisterService(&host, default_hc_service->GetSyncHealthCheckService()); - } - } server_ = grpc_server_create(&channel_args, nullptr); } @@ -506,6 +495,18 @@ int Server::AddListeningPort(const grpc::string& addr, bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { GPR_ASSERT(!started_); started_ = true; + + // Only create default health check service when user did not provide an + // explicit one. + if (health_check_service_ == nullptr && !health_check_service_disabled_ && + DefaultHealthCheckServiceEnabled()) { + auto* default_hc_service = new DefaultHealthCheckService; + health_check_service_.reset(default_hc_service); + if (!sync_server_cqs_->empty()) { // Has sync methods. + RegisterService(nullptr, default_hc_service->GetSyncHealthCheckService()); + } + } + grpc_server_start(server_); if (!has_generic_service_) { diff --git a/test/cpp/end2end/health_service_end2end_test.cc b/test/cpp/end2end/health_service_end2end_test.cc new file mode 100644 index 00000000000..17e8c4b7615 --- /dev/null +++ b/test/cpp/end2end/health_service_end2end_test.cc @@ -0,0 +1,158 @@ +/* + * + * 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 +#include +#include +#include +#include +#include +#include + +#include "src/proto/grpc/health/v1/health.grpc.pb.h" +#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" +#include "test/cpp/end2end/test_service_impl.h" + +using grpc::health::v1::Health; +using grpc::health::v1::HealthCheckRequest; +using grpc::health::v1::HealthCheckResponse; + +namespace grpc { +namespace testing { +namespace { + +class HealthServiceEnd2endTest : public ::testing::Test { + protected: + HealthServiceEnd2endTest() {} + + void SetUpServer(grpc::Service* explicit_health_service) { + int port = grpc_pick_unused_port_or_die(); + server_address_ << "localhost:" << port; + + // Setup server + ServerBuilder builder; + builder.AddListeningPort(server_address_.str(), + grpc::InsecureServerCredentials()); + // Register a sync service. + builder.RegisterService(&echo_test_service_); + server_ = builder.BuildAndStart(); + } + + void TearDown() override { + if (server_) { + server_->Shutdown(); + } + } + + void ResetStubs() { + std::shared_ptr channel = + CreateChannel(server_address_.str(), InsecureChannelCredentials()); + stub_ = grpc::testing::EchoTestService::NewStub(channel); + hc_stub_ = grpc::health::v1::Health::NewStub(channel); + } + + void SendHealthCheckRpc( + const grpc::string& service_name, const Status& expected_status, + HealthCheckResponse::ServingStatus expected_serving_status) { + HealthCheckRequest request; + request.set_service(service_name); + HealthCheckResponse response; + ClientContext context; + Status s = hc_stub_->Check(&context, request, &response); + EXPECT_EQ(expected_status.error_code(), s.error_code()); + // EXPECT_EQ(expected_status.error_details(), s.error_details()); + if (s.ok()) { + EXPECT_EQ(expected_serving_status, response.status()); + } + } + + TestServiceImpl echo_test_service_; + std::unique_ptr stub_; + std::unique_ptr hc_stub_; + std::unique_ptr server_; + std::ostringstream server_address_; +}; + +TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceDisabled) { + EnableDefaultHealthCheckService(false); + EXPECT_FALSE(DefaultHealthCheckServiceEnabled()); + SetUpServer(nullptr); + HealthCheckServiceInterface* default_service = + server_->GetHealthCheckService(); + EXPECT_TRUE(default_service == nullptr); +} + +TEST_F(HealthServiceEnd2endTest, DefaultHealthService) { + EnableDefaultHealthCheckService(true); + EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); + SetUpServer(nullptr); + HealthCheckServiceInterface* default_service = + server_->GetHealthCheckService(); + EXPECT_TRUE(default_service != nullptr); + const grpc::string kHealthyService("healthy_service"); + const grpc::string kUnhealthyService("unhealthy_service"); + default_service->SetServingStatus(kHealthyService, true); + default_service->SetServingStatus(kUnhealthyService, false); + + ResetStubs(); + + SendHealthCheckRpc("", Status::OK, HealthCheckResponse::SERVING); + SendHealthCheckRpc(kHealthyService, Status::OK, HealthCheckResponse::SERVING); + SendHealthCheckRpc(kUnhealthyService, Status::OK, + HealthCheckResponse::NOT_SERVING); + + default_service->SetServingStatus(false); + SendHealthCheckRpc("", Status::OK, HealthCheckResponse::NOT_SERVING); + SendHealthCheckRpc(kHealthyService, Status::OK, + HealthCheckResponse::NOT_SERVING); + SendHealthCheckRpc(kUnhealthyService, Status::OK, + HealthCheckResponse::NOT_SERVING); +} + +} // namespace +} // namespace testing +} // namespace grpc + +int main(int argc, char** argv) { + grpc_test_init(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 02d03bd6169..9366e3366be 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -2772,6 +2772,25 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "gpr", + "gpr_test_util", + "grpc", + "grpc++", + "grpc++_test_util", + "grpc_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "health_service_end2end_test", + "src": [ + "test/cpp/end2end/health_service_end2end_test.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index b76263b8b98..1cd04ea5dd9 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -2805,6 +2805,28 @@ "windows" ] }, + { + "args": [], + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": true, + "language": "c++", + "name": "health_service_end2end_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, { "args": [], "ci_platforms": [ diff --git a/vsprojects/vcxproj/test/health_service_end2end_test/health_service_end2end_test.vcxproj b/vsprojects/vcxproj/test/health_service_end2end_test/health_service_end2end_test.vcxproj new file mode 100644 index 00000000000..28530d07b53 --- /dev/null +++ b/vsprojects/vcxproj/test/health_service_end2end_test/health_service_end2end_test.vcxproj @@ -0,0 +1,207 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {3EB2B3E9-8BC3-8DF7-82CB-38462FFE5919} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + health_service_end2end_test + static + Debug + static + Debug + + + health_service_end2end_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 + + + + + + + + + + {0BE77741-552A-929B-A497-4EF7ECE17A64} + + + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + + + {C187A093-A0FE-489D-A40A-6E33DE0F9FEB} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + {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/health_service_end2end_test/health_service_end2end_test.vcxproj.filters b/vsprojects/vcxproj/test/health_service_end2end_test/health_service_end2end_test.vcxproj.filters new file mode 100644 index 00000000000..cccf9682869 --- /dev/null +++ b/vsprojects/vcxproj/test/health_service_end2end_test/health_service_end2end_test.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + test\cpp\end2end + + + + + + {00d750b2-db02-2106-d9b7-1d3b2ca58604} + + + {02e29b2f-d68a-4474-8483-621ecfd7fa9d} + + + {b0de697a-d73a-23e1-c9af-fa0edf011d4d} + + + + From fbbb0d707fa8b8cd9b1fe373c6b196dc729c1601 Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 12 Dec 2016 21:24:10 -0800 Subject: [PATCH 009/126] generated nanopb files, need to update build.yaml and maybe move them to a sub-dir --- .../server/default_health_check_service.cc | 4 +- src/cpp/server/health.pb.c | 62 +++++++++++ src/cpp/server/health.pb.h | 104 ++++++++++++++++++ src/proto/grpc/health/v1/health.options | 1 + 4 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 src/cpp/server/health.pb.c create mode 100644 src/cpp/server/health.pb.h create mode 100644 src/proto/grpc/health/v1/health.options diff --git a/src/cpp/server/default_health_check_service.cc b/src/cpp/server/default_health_check_service.cc index ae10ec92c6e..1bd5973e47c 100644 --- a/src/cpp/server/default_health_check_service.cc +++ b/src/cpp/server/default_health_check_service.cc @@ -38,6 +38,8 @@ #include #include "src/cpp/server/default_health_check_service.h" +#include "third_party/nanopb/pb_encode.h" +#include "third_party/nanopb/pb_decode.h" namespace grpc { namespace { @@ -59,7 +61,7 @@ DefaultHealthCheckService::SyncHealthCheckServiceImpl:: Status DefaultHealthCheckService::SyncHealthCheckServiceImpl::Check( ServerContext* context, const ByteBuffer* request, ByteBuffer* response) { - // TODO nanopb part + return Status::OK; } diff --git a/src/cpp/server/health.pb.c b/src/cpp/server/health.pb.c new file mode 100644 index 00000000000..cfd06b496ff --- /dev/null +++ b/src/cpp/server/health.pb.c @@ -0,0 +1,62 @@ +/* + * + * 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. + * + */ +/* Automatically generated nanopb constant definitions */ +/* Generated by nanopb-0.3.7-dev */ + +#include "/usr/local/google/home/yangg/github/grpc/src/cpp/server//health.pb.h" + +/* @@protoc_insertion_point(includes) */ +#if PB_PROTO_HEADER_VERSION != 30 +#error Regenerate this file with the current version of nanopb generator. +#endif + + + +const pb_field_t grpc_health_v1_HealthCheckRequest_fields[2] = { + PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_health_v1_HealthCheckRequest, service, service, 0), + PB_LAST_FIELD +}; + +const pb_field_t grpc_health_v1_HealthCheckResponse_fields[2] = { + PB_FIELD( 1, UENUM , OPTIONAL, STATIC , FIRST, grpc_health_v1_HealthCheckResponse, status, status, 0), + PB_LAST_FIELD +}; + + +/* Check that field information fits in pb_field_t */ +#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT) +#error Field descriptor for grpc_health_v1_HealthCheckRequest.service is too large. Define PB_FIELD_16BIT to fix this. +#endif + + +/* @@protoc_insertion_point(eof) */ diff --git a/src/cpp/server/health.pb.h b/src/cpp/server/health.pb.h new file mode 100644 index 00000000000..5782b9c1984 --- /dev/null +++ b/src/cpp/server/health.pb.h @@ -0,0 +1,104 @@ +/* + * + * 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. + * + */ +/* Automatically generated nanopb header */ +/* Generated by nanopb-0.3.7-dev */ + +#ifndef PB_GRPC_HEALTH_V1_HEALTH_PB_H_INCLUDED +#define PB_GRPC_HEALTH_V1_HEALTH_PB_H_INCLUDED +#include "third_party/nanopb/pb.h" +/* @@protoc_insertion_point(includes) */ +#if PB_PROTO_HEADER_VERSION != 30 +#error Regenerate this file with the current version of nanopb generator. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Enum definitions */ +typedef enum _grpc_health_v1_HealthCheckResponse_ServingStatus { + grpc_health_v1_HealthCheckResponse_ServingStatus_UNKNOWN = 0, + grpc_health_v1_HealthCheckResponse_ServingStatus_SERVING = 1, + grpc_health_v1_HealthCheckResponse_ServingStatus_NOT_SERVING = 2 +} grpc_health_v1_HealthCheckResponse_ServingStatus; +#define _grpc_health_v1_HealthCheckResponse_ServingStatus_MIN grpc_health_v1_HealthCheckResponse_ServingStatus_UNKNOWN +#define _grpc_health_v1_HealthCheckResponse_ServingStatus_MAX grpc_health_v1_HealthCheckResponse_ServingStatus_NOT_SERVING +#define _grpc_health_v1_HealthCheckResponse_ServingStatus_ARRAYSIZE ((grpc_health_v1_HealthCheckResponse_ServingStatus)(grpc_health_v1_HealthCheckResponse_ServingStatus_NOT_SERVING+1)) + +/* Struct definitions */ +typedef struct _grpc_health_v1_HealthCheckRequest { + bool has_service; + char service[2048]; +/* @@protoc_insertion_point(struct:grpc_health_v1_HealthCheckRequest) */ +} grpc_health_v1_HealthCheckRequest; + +typedef struct _grpc_health_v1_HealthCheckResponse { + bool has_status; + grpc_health_v1_HealthCheckResponse_ServingStatus status; +/* @@protoc_insertion_point(struct:grpc_health_v1_HealthCheckResponse) */ +} grpc_health_v1_HealthCheckResponse; + +/* Default values for struct fields */ + +/* Initializer values for message structs */ +#define grpc_health_v1_HealthCheckRequest_init_default {false, ""} +#define grpc_health_v1_HealthCheckResponse_init_default {false, (grpc_health_v1_HealthCheckResponse_ServingStatus)0} +#define grpc_health_v1_HealthCheckRequest_init_zero {false, ""} +#define grpc_health_v1_HealthCheckResponse_init_zero {false, (grpc_health_v1_HealthCheckResponse_ServingStatus)0} + +/* Field tags (for use in manual encoding/decoding) */ +#define grpc_health_v1_HealthCheckRequest_service_tag 1 +#define grpc_health_v1_HealthCheckResponse_status_tag 1 + +/* Struct field encoding specification for nanopb */ +extern const pb_field_t grpc_health_v1_HealthCheckRequest_fields[2]; +extern const pb_field_t grpc_health_v1_HealthCheckResponse_fields[2]; + +/* Maximum encoded size of messages (where known) */ +#define grpc_health_v1_HealthCheckRequest_size 2051 +#define grpc_health_v1_HealthCheckResponse_size 2 + +/* Message IDs (where set with "msgid" option) */ +#ifdef PB_MSGID + +#define HEALTH_MESSAGES \ + + +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif +/* @@protoc_insertion_point(eof) */ + +#endif diff --git a/src/proto/grpc/health/v1/health.options b/src/proto/grpc/health/v1/health.options new file mode 100644 index 00000000000..139cf2bb52b --- /dev/null +++ b/src/proto/grpc/health/v1/health.options @@ -0,0 +1 @@ +grpc.health.v1.HealthCheckRequest.service max_size:2048 From c3c475fd144b3d43a775b569dad36610014e08e4 Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 27 Dec 2016 10:37:26 -0800 Subject: [PATCH 010/126] move files to subdir and add generated files --- BUILD | 30 +++-- CMakeLists.txt | 21 ++-- Makefile | 34 +++-- build.yaml | 10 +- .../default_health_check_service.cc | 2 +- .../default_health_check_service.h | 0 src/cpp/server/{ => health}/health.pb.c | 0 src/cpp/server/{ => health}/health.pb.h | 0 .../{ => health}/health_check_service.cc | 0 ...lth_check_service_server_builder_option.cc | 0 src/cpp/server/server_cc.cc | 2 +- tools/doxygen/Doxyfile.c++.internal | 10 +- .../generated/sources_and_headers.json | 36 +++++- .../vcxproj/benchmark/benchmark.vcxproj | 48 ++++++- .../benchmark/benchmark.vcxproj.filters | 118 ++++++++++++++++++ vsprojects/vcxproj/grpc++/grpc++.vcxproj | 13 +- .../vcxproj/grpc++/grpc++.vcxproj.filters | 29 +++-- .../grpc++_unsecure/grpc++_unsecure.vcxproj | 13 +- .../grpc++_unsecure.vcxproj.filters | 29 +++-- 19 files changed, 318 insertions(+), 77 deletions(-) rename src/cpp/server/{ => health}/default_health_check_service.cc (98%) rename src/cpp/server/{ => health}/default_health_check_service.h (100%) rename src/cpp/server/{ => health}/health.pb.c (100%) rename src/cpp/server/{ => health}/health.pb.h (100%) rename src/cpp/server/{ => health}/health_check_service.cc (100%) rename src/cpp/server/{ => health}/health_check_service_server_builder_option.cc (100%) diff --git a/BUILD b/BUILD index 6e786607ccc..c680232d247 100644 --- a/BUILD +++ b/BUILD @@ -1374,8 +1374,9 @@ cc_library( "src/cpp/server/secure_server_credentials.h", "src/cpp/client/create_channel_internal.h", "src/cpp/common/channel_filter.h", - "src/cpp/server/default_health_check_service.h", "src/cpp/server/dynamic_thread_pool.h", + "src/cpp/server/health/default_health_check_service.h", + "src/cpp/server/health/health.pb.h", "src/cpp/server/thread_pool_interface.h", "src/cpp/thread_manager/thread_manager.h", "src/cpp/client/insecure_credentials.cc", @@ -1402,10 +1403,11 @@ cc_library( "src/cpp/common/version_cc.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", - "src/cpp/server/default_health_check_service.cc", "src/cpp/server/dynamic_thread_pool.cc", - "src/cpp/server/health_check_service.cc", - "src/cpp/server/health_check_service_server_builder_option.cc", + "src/cpp/server/health/default_health_check_service.cc", + "src/cpp/server/health/health.pb.c", + "src/cpp/server/health/health_check_service.cc", + "src/cpp/server/health/health_check_service_server_builder_option.cc", "src/cpp/server/server_builder.cc", "src/cpp/server/server_cc.cc", "src/cpp/server/server_context.cc", @@ -1528,8 +1530,9 @@ cc_library( srcs = [ "src/cpp/client/create_channel_internal.h", "src/cpp/common/channel_filter.h", - "src/cpp/server/default_health_check_service.h", "src/cpp/server/dynamic_thread_pool.h", + "src/cpp/server/health/default_health_check_service.h", + "src/cpp/server/health/health.pb.h", "src/cpp/server/thread_pool_interface.h", "src/cpp/thread_manager/thread_manager.h", "src/core/ext/transport/chttp2/client/chttp2_connector.h", @@ -1698,10 +1701,11 @@ cc_library( "src/cpp/common/version_cc.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", - "src/cpp/server/default_health_check_service.cc", "src/cpp/server/dynamic_thread_pool.cc", - "src/cpp/server/health_check_service.cc", - "src/cpp/server/health_check_service_server_builder_option.cc", + "src/cpp/server/health/default_health_check_service.cc", + "src/cpp/server/health/health.pb.c", + "src/cpp/server/health/health_check_service.cc", + "src/cpp/server/health/health_check_service_server_builder_option.cc", "src/cpp/server/server_builder.cc", "src/cpp/server/server_cc.cc", "src/cpp/server/server_context.cc", @@ -2029,8 +2033,9 @@ cc_library( srcs = [ "src/cpp/client/create_channel_internal.h", "src/cpp/common/channel_filter.h", - "src/cpp/server/default_health_check_service.h", "src/cpp/server/dynamic_thread_pool.h", + "src/cpp/server/health/default_health_check_service.h", + "src/cpp/server/health/health.pb.h", "src/cpp/server/thread_pool_interface.h", "src/cpp/thread_manager/thread_manager.h", "src/cpp/client/insecure_credentials.cc", @@ -2052,10 +2057,11 @@ cc_library( "src/cpp/common/version_cc.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", - "src/cpp/server/default_health_check_service.cc", "src/cpp/server/dynamic_thread_pool.cc", - "src/cpp/server/health_check_service.cc", - "src/cpp/server/health_check_service_server_builder_option.cc", + "src/cpp/server/health/default_health_check_service.cc", + "src/cpp/server/health/health.pb.c", + "src/cpp/server/health/health_check_service.cc", + "src/cpp/server/health/health_check_service_server_builder_option.cc", "src/cpp/server/server_builder.cc", "src/cpp/server/server_cc.cc", "src/cpp/server/server_context.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index c32a4aaf960..3f191431793 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1090,10 +1090,11 @@ add_library(grpc++ src/cpp/common/version_cc.cc src/cpp/server/async_generic_service.cc src/cpp/server/create_default_thread_pool.cc - src/cpp/server/default_health_check_service.cc src/cpp/server/dynamic_thread_pool.cc - src/cpp/server/health_check_service.cc - src/cpp/server/health_check_service_server_builder_option.cc + src/cpp/server/health/default_health_check_service.cc + src/cpp/server/health/health.pb.c + src/cpp/server/health/health_check_service.cc + src/cpp/server/health/health_check_service_server_builder_option.cc src/cpp/server/server_builder.cc src/cpp/server/server_cc.cc src/cpp/server/server_context.cc @@ -1253,10 +1254,11 @@ add_library(grpc++_cronet src/cpp/common/version_cc.cc src/cpp/server/async_generic_service.cc src/cpp/server/create_default_thread_pool.cc - src/cpp/server/default_health_check_service.cc src/cpp/server/dynamic_thread_pool.cc - src/cpp/server/health_check_service.cc - src/cpp/server/health_check_service_server_builder_option.cc + src/cpp/server/health/default_health_check_service.cc + src/cpp/server/health/health.pb.c + src/cpp/server/health/health_check_service.cc + src/cpp/server/health/health_check_service_server_builder_option.cc src/cpp/server/server_builder.cc src/cpp/server/server_cc.cc src/cpp/server/server_context.cc @@ -1639,10 +1641,11 @@ add_library(grpc++_unsecure src/cpp/common/version_cc.cc src/cpp/server/async_generic_service.cc src/cpp/server/create_default_thread_pool.cc - src/cpp/server/default_health_check_service.cc src/cpp/server/dynamic_thread_pool.cc - src/cpp/server/health_check_service.cc - src/cpp/server/health_check_service_server_builder_option.cc + src/cpp/server/health/default_health_check_service.cc + src/cpp/server/health/health.pb.c + src/cpp/server/health/health_check_service.cc + src/cpp/server/health/health_check_service_server_builder_option.cc src/cpp/server/server_builder.cc src/cpp/server/server_cc.cc src/cpp/server/server_context.cc diff --git a/Makefile b/Makefile index 6c7a0c15187..6ee90856493 100644 --- a/Makefile +++ b/Makefile @@ -3804,10 +3804,11 @@ LIBGRPC++_SRC = \ src/cpp/common/version_cc.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ - src/cpp/server/default_health_check_service.cc \ src/cpp/server/dynamic_thread_pool.cc \ - src/cpp/server/health_check_service.cc \ - src/cpp/server/health_check_service_server_builder_option.cc \ + src/cpp/server/health/default_health_check_service.cc \ + src/cpp/server/health/health.pb.c \ + src/cpp/server/health/health_check_service.cc \ + src/cpp/server/health/health_check_service_server_builder_option.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_cc.cc \ src/cpp/server/server_context.cc \ @@ -3996,10 +3997,11 @@ LIBGRPC++_CRONET_SRC = \ src/cpp/common/version_cc.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ - src/cpp/server/default_health_check_service.cc \ src/cpp/server/dynamic_thread_pool.cc \ - src/cpp/server/health_check_service.cc \ - src/cpp/server/health_check_service_server_builder_option.cc \ + src/cpp/server/health/default_health_check_service.cc \ + src/cpp/server/health/health.pb.c \ + src/cpp/server/health/health_check_service.cc \ + src/cpp/server/health/health_check_service_server_builder_option.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_cc.cc \ src/cpp/server/server_context.cc \ @@ -4710,10 +4712,11 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/common/version_cc.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ - src/cpp/server/default_health_check_service.cc \ src/cpp/server/dynamic_thread_pool.cc \ - src/cpp/server/health_check_service.cc \ - src/cpp/server/health_check_service_server_builder_option.cc \ + src/cpp/server/health/default_health_check_service.cc \ + src/cpp/server/health/health.pb.c \ + src/cpp/server/health/health_check_service.cc \ + src/cpp/server/health/health_check_service_server_builder_option.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_cc.cc \ src/cpp/server/server_context.cc \ @@ -7035,6 +7038,19 @@ endif LIBBENCHMARK_SRC = \ + third_party/benchmark/src/benchmark.cc \ + third_party/benchmark/src/benchmark_register.cc \ + third_party/benchmark/src/colorprint.cc \ + third_party/benchmark/src/commandlineflags.cc \ + third_party/benchmark/src/complexity.cc \ + third_party/benchmark/src/console_reporter.cc \ + third_party/benchmark/src/csv_reporter.cc \ + third_party/benchmark/src/json_reporter.cc \ + third_party/benchmark/src/reporter.cc \ + third_party/benchmark/src/sleep.cc \ + third_party/benchmark/src/string_util.cc \ + third_party/benchmark/src/sysinfo.cc \ + third_party/benchmark/src/timers.cc \ PUBLIC_HEADERS_CXX += \ diff --git a/build.yaml b/build.yaml index 8be83187b1d..4a33891e33b 100644 --- a/build.yaml +++ b/build.yaml @@ -759,8 +759,9 @@ filegroups: headers: - src/cpp/client/create_channel_internal.h - src/cpp/common/channel_filter.h - - src/cpp/server/default_health_check_service.h - src/cpp/server/dynamic_thread_pool.h + - src/cpp/server/health/default_health_check_service.h + - src/cpp/server/health/health.pb.h - src/cpp/server/thread_pool_interface.h - src/cpp/thread_manager/thread_manager.h src: @@ -780,10 +781,11 @@ filegroups: - src/cpp/common/version_cc.cc - src/cpp/server/async_generic_service.cc - src/cpp/server/create_default_thread_pool.cc - - src/cpp/server/default_health_check_service.cc - src/cpp/server/dynamic_thread_pool.cc - - src/cpp/server/health_check_service.cc - - src/cpp/server/health_check_service_server_builder_option.cc + - src/cpp/server/health/default_health_check_service.cc + - src/cpp/server/health/health.pb.c + - src/cpp/server/health/health_check_service.cc + - src/cpp/server/health/health_check_service_server_builder_option.cc - src/cpp/server/server_builder.cc - src/cpp/server/server_cc.cc - src/cpp/server/server_context.cc diff --git a/src/cpp/server/default_health_check_service.cc b/src/cpp/server/health/default_health_check_service.cc similarity index 98% rename from src/cpp/server/default_health_check_service.cc rename to src/cpp/server/health/default_health_check_service.cc index 1bd5973e47c..bc6087f1caf 100644 --- a/src/cpp/server/default_health_check_service.cc +++ b/src/cpp/server/health/default_health_check_service.cc @@ -37,7 +37,7 @@ #include #include -#include "src/cpp/server/default_health_check_service.h" +#include "src/cpp/server/health/default_health_check_service.h" #include "third_party/nanopb/pb_encode.h" #include "third_party/nanopb/pb_decode.h" diff --git a/src/cpp/server/default_health_check_service.h b/src/cpp/server/health/default_health_check_service.h similarity index 100% rename from src/cpp/server/default_health_check_service.h rename to src/cpp/server/health/default_health_check_service.h diff --git a/src/cpp/server/health.pb.c b/src/cpp/server/health/health.pb.c similarity index 100% rename from src/cpp/server/health.pb.c rename to src/cpp/server/health/health.pb.c diff --git a/src/cpp/server/health.pb.h b/src/cpp/server/health/health.pb.h similarity index 100% rename from src/cpp/server/health.pb.h rename to src/cpp/server/health/health.pb.h diff --git a/src/cpp/server/health_check_service.cc b/src/cpp/server/health/health_check_service.cc similarity index 100% rename from src/cpp/server/health_check_service.cc rename to src/cpp/server/health/health_check_service.cc diff --git a/src/cpp/server/health_check_service_server_builder_option.cc b/src/cpp/server/health/health_check_service_server_builder_option.cc similarity index 100% rename from src/cpp/server/health_check_service_server_builder_option.cc rename to src/cpp/server/health/health_check_service_server_builder_option.cc diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index b8558cfc3de..c50c076bdc5 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -51,7 +51,7 @@ #include #include "src/core/lib/profiling/timers.h" -#include "src/cpp/server/default_health_check_service.h" +#include "src/cpp/server/health/default_health_check_service.h" #include "src/cpp/thread_manager/thread_manager.h" namespace grpc { diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 5e3f2266032..c2dbfb68f98 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -855,8 +855,9 @@ src/cpp/common/secure_auth_context.h \ src/cpp/server/secure_server_credentials.h \ src/cpp/client/create_channel_internal.h \ src/cpp/common/channel_filter.h \ -src/cpp/server/default_health_check_service.h \ src/cpp/server/dynamic_thread_pool.h \ +src/cpp/server/health/default_health_check_service.h \ +src/cpp/server/health/health.pb.h \ src/cpp/server/thread_pool_interface.h \ src/cpp/thread_manager/thread_manager.h \ src/cpp/client/insecure_credentials.cc \ @@ -883,10 +884,11 @@ src/cpp/common/rpc_method.cc \ src/cpp/common/version_cc.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ -src/cpp/server/default_health_check_service.cc \ src/cpp/server/dynamic_thread_pool.cc \ -src/cpp/server/health_check_service.cc \ -src/cpp/server/health_check_service_server_builder_option.cc \ +src/cpp/server/health/default_health_check_service.cc \ +src/cpp/server/health/health.pb.c \ +src/cpp/server/health/health_check_service.cc \ +src/cpp/server/health/health_check_service_server_builder_option.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_cc.cc \ src/cpp/server/server_context.cc \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 9366e3366be..86986a99a6d 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -6227,7 +6227,28 @@ }, { "deps": [], - "headers": [], + "headers": [ + "third_party/benchmark/include/benchmark/benchmark.h", + "third_party/benchmark/include/benchmark/benchmark_api.h", + "third_party/benchmark/include/benchmark/macros.h", + "third_party/benchmark/include/benchmark/reporter.h", + "third_party/benchmark/src/arraysize.h", + "third_party/benchmark/src/benchmark_api_internal.h", + "third_party/benchmark/src/check.h", + "third_party/benchmark/src/colorprint.h", + "third_party/benchmark/src/commandlineflags.h", + "third_party/benchmark/src/complexity.h", + "third_party/benchmark/src/cycleclock.h", + "third_party/benchmark/src/internal_macros.h", + "third_party/benchmark/src/log.h", + "third_party/benchmark/src/mutex.h", + "third_party/benchmark/src/re.h", + "third_party/benchmark/src/sleep.h", + "third_party/benchmark/src/stat.h", + "third_party/benchmark/src/string_util.h", + "third_party/benchmark/src/sysinfo.h", + "third_party/benchmark/src/timers.h" + ], "is_filegroup": false, "language": "c++", "name": "benchmark", @@ -7658,8 +7679,9 @@ "include/grpc++/support/time.h", "src/cpp/client/create_channel_internal.h", "src/cpp/common/channel_filter.h", - "src/cpp/server/default_health_check_service.h", "src/cpp/server/dynamic_thread_pool.h", + "src/cpp/server/health/default_health_check_service.h", + "src/cpp/server/health/health.pb.h", "src/cpp/server/thread_pool_interface.h", "src/cpp/thread_manager/thread_manager.h" ], @@ -7729,12 +7751,14 @@ "src/cpp/common/version_cc.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", - "src/cpp/server/default_health_check_service.cc", - "src/cpp/server/default_health_check_service.h", "src/cpp/server/dynamic_thread_pool.cc", "src/cpp/server/dynamic_thread_pool.h", - "src/cpp/server/health_check_service.cc", - "src/cpp/server/health_check_service_server_builder_option.cc", + "src/cpp/server/health/default_health_check_service.cc", + "src/cpp/server/health/default_health_check_service.h", + "src/cpp/server/health/health.pb.c", + "src/cpp/server/health/health.pb.h", + "src/cpp/server/health/health_check_service.cc", + "src/cpp/server/health/health_check_service_server_builder_option.cc", "src/cpp/server/server_builder.cc", "src/cpp/server/server_cc.cc", "src/cpp/server/server_context.cc", diff --git a/vsprojects/vcxproj/benchmark/benchmark.vcxproj b/vsprojects/vcxproj/benchmark/benchmark.vcxproj index 811317595f4..9f262b3b00c 100644 --- a/vsprojects/vcxproj/benchmark/benchmark.vcxproj +++ b/vsprojects/vcxproj/benchmark/benchmark.vcxproj @@ -147,7 +147,53 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vsprojects/vcxproj/benchmark/benchmark.vcxproj.filters b/vsprojects/vcxproj/benchmark/benchmark.vcxproj.filters index 00e4276f1d4..ccc9ca2cae7 100644 --- a/vsprojects/vcxproj/benchmark/benchmark.vcxproj.filters +++ b/vsprojects/vcxproj/benchmark/benchmark.vcxproj.filters @@ -1,7 +1,125 @@ + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + + + third_party\benchmark\include\benchmark + + + third_party\benchmark\include\benchmark + + + third_party\benchmark\include\benchmark + + + third_party\benchmark\include\benchmark + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + third_party\benchmark\src + + + + {7b593518-9fee-107e-6b64-24bdce73f939} + + + {f0d35de1-6b41-778d-0ba0-faad514fb0f4} + + + {cbc02dfa-face-8cc6-0efb-efacc0c3369c} + + + {4f2f03fc-b82d-df33-63ee-bedebeb2c0ee} + + + {f42a8e0a-5a76-0e6f-d708-f0306858f673} + diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index 4af3454e39a..0f0949cbd11 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -355,8 +355,9 @@ - + + @@ -409,13 +410,15 @@ - - - + + + + + - + diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index 17ea98381a0..fc64c44e083 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -73,17 +73,20 @@ src\cpp\server - - src\cpp\server - src\cpp\server - - src\cpp\server + + src\cpp\server\health - - src\cpp\server + + src\cpp\server\health + + + src\cpp\server\health + + + src\cpp\server\health src\cpp\server @@ -410,12 +413,15 @@ src\cpp\common - - src\cpp\server - src\cpp\server + + src\cpp\server\health + + + src\cpp\server\health + src\cpp\server @@ -479,6 +485,9 @@ {321b0980-74ad-e8ca-f23b-deffa5d6bb8f} + + {5bc9ef4e-78c1-159e-4e4e-30ddfce3e140} + {23f9df56-8604-52a0-e6a2-f01b8e68d0e7} diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 060f2818e32..0c53d641c7e 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -351,8 +351,9 @@ - + + @@ -395,13 +396,15 @@ - - - + + + + + - + diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 8aa4a77d400..a1ac8702262 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -58,17 +58,20 @@ src\cpp\server - - src\cpp\server - src\cpp\server - - src\cpp\server + + src\cpp\server\health - - src\cpp\server + + src\cpp\server\health + + + src\cpp\server\health + + + src\cpp\server\health src\cpp\server @@ -383,12 +386,15 @@ src\cpp\common - - src\cpp\server - src\cpp\server + + src\cpp\server\health + + + src\cpp\server\health + src\cpp\server @@ -452,6 +458,9 @@ {8a54a279-d14b-4237-0df3-1ffe1ef5a7af} + + {a003cb5c-7249-106c-8ee5-de5e11a6692c} + {e5b55f25-d99f-b8e5-9981-7da7fa7ba628} From b74cf429fdec9e72364b4cbe4ae1b7389d28672d Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 27 Dec 2016 13:17:47 -0800 Subject: [PATCH 011/126] test pass --- .../health/default_health_check_service.cc | 59 ++++++++++++++++++- .../health/default_health_check_service.h | 4 +- src/cpp/server/health/health.pb.c | 8 +-- src/cpp/server/health/health.pb.h | 4 +- src/proto/grpc/health/v1/health.options | 2 +- .../end2end/health_service_end2end_test.cc | 13 +++- 6 files changed, 73 insertions(+), 17 deletions(-) diff --git a/src/cpp/server/health/default_health_check_service.cc b/src/cpp/server/health/default_health_check_service.cc index bc6087f1caf..665a99f86b1 100644 --- a/src/cpp/server/health/default_health_check_service.cc +++ b/src/cpp/server/health/default_health_check_service.cc @@ -38,8 +38,9 @@ #include #include "src/cpp/server/health/default_health_check_service.h" -#include "third_party/nanopb/pb_encode.h" +#include "src/cpp/server/health/health.pb.h" #include "third_party/nanopb/pb_decode.h" +#include "third_party/nanopb/pb_encode.h" namespace grpc { namespace { @@ -61,7 +62,60 @@ DefaultHealthCheckService::SyncHealthCheckServiceImpl:: Status DefaultHealthCheckService::SyncHealthCheckServiceImpl::Check( ServerContext* context, const ByteBuffer* request, ByteBuffer* response) { + // Decode request. + std::vector slices; + request->Dump(&slices); + const uint8_t* request_bytes = nullptr; + size_t request_size = 0; + grpc_health_v1_HealthCheckRequest request_struct; + if (slices.empty()) { + request_struct.has_service = false; + } else if (slices.size() == 1) { + request_bytes = slices[0].begin(); + request_size = slices[0].size(); + } else { + abort(); // TODO + } + + if (request_bytes != nullptr) { + pb_istream_t istream = pb_istream_from_buffer(request_bytes, request_size); + bool decode_status = pb_decode( + &istream, grpc_health_v1_HealthCheckRequest_fields, &request_struct); + if (!decode_status) { + return Status(StatusCode::INVALID_ARGUMENT, ""); + } + } + + // Check status from the associated default health checking service. + DefaultHealthCheckService::ServingStatus serving_status = + service_->GetServingStatus( + request_struct.has_service ? request_struct.service : ""); + if (serving_status == DefaultHealthCheckService::NOT_FOUND) { + return Status(StatusCode::NOT_FOUND, ""); + } + // Encode response + grpc_health_v1_HealthCheckResponse response_struct; + response_struct.has_status = true; + response_struct.status = + serving_status == DefaultHealthCheckService::SERVING + ? grpc_health_v1_HealthCheckResponse_ServingStatus_SERVING + : grpc_health_v1_HealthCheckResponse_ServingStatus_NOT_SERVING; + pb_ostream_t ostream; + memset(&ostream, 0, sizeof(ostream)); + pb_encode(&ostream, grpc_health_v1_HealthCheckResponse_fields, + &response_struct); + grpc_slice response_slice = grpc_slice_malloc(ostream.bytes_written); + ostream = pb_ostream_from_buffer(GRPC_SLICE_START_PTR(response_slice), + GRPC_SLICE_LENGTH(response_slice)); + bool encode_status = pb_encode( + &ostream, grpc_health_v1_HealthCheckResponse_fields, &response_struct); + if (!encode_status) { + return Status(StatusCode::INTERNAL, "Failed to encode response."); + } + Slice encoded_response(response_slice, Slice::STEAL_REF); + ByteBuffer response_buffer(&encoded_response, 1); + response->Swap(&response_buffer); return Status::OK; } @@ -84,7 +138,8 @@ void DefaultHealthCheckService::SetServingStatus(bool serving) { } DefaultHealthCheckService::ServingStatus -DefaultHealthCheckService::GetServingStatus(const grpc::string& service_name) { +DefaultHealthCheckService::GetServingStatus( + const grpc::string& service_name) const { std::lock_guard lock(mu_); const auto& iter = services_map_.find(service_name); if (iter == services_map_.end()) { diff --git a/src/cpp/server/health/default_health_check_service.h b/src/cpp/server/health/default_health_check_service.h index 23ee1cb7dc3..541c720aaa6 100644 --- a/src/cpp/server/health/default_health_check_service.h +++ b/src/cpp/server/health/default_health_check_service.h @@ -60,13 +60,13 @@ class DefaultHealthCheckService : public HealthCheckServiceInterface { void SetServingStatus(const grpc::string& service_name, bool serving) final; void SetServingStatus(bool serving) final; enum ServingStatus { NOT_FOUND, SERVING, NOT_SERVING }; - ServingStatus GetServingStatus(const grpc::string& service_name); + ServingStatus GetServingStatus(const grpc::string& service_name) const; SyncHealthCheckServiceImpl* GetSyncHealthCheckService() const { return sync_service_.get(); } private: - std::mutex mu_; + mutable std::mutex mu_; std::map services_map_; std::unique_ptr sync_service_; }; diff --git a/src/cpp/server/health/health.pb.c b/src/cpp/server/health/health.pb.c index cfd06b496ff..1fca2c55c84 100644 --- a/src/cpp/server/health/health.pb.c +++ b/src/cpp/server/health/health.pb.c @@ -33,7 +33,7 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.3.7-dev */ -#include "/usr/local/google/home/yangg/github/grpc/src/cpp/server//health.pb.h" +#include "src/cpp/server/health/health.pb.h" /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 @@ -53,10 +53,4 @@ const pb_field_t grpc_health_v1_HealthCheckResponse_fields[2] = { }; -/* Check that field information fits in pb_field_t */ -#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT) -#error Field descriptor for grpc_health_v1_HealthCheckRequest.service is too large. Define PB_FIELD_16BIT to fix this. -#endif - - /* @@protoc_insertion_point(eof) */ diff --git a/src/cpp/server/health/health.pb.h b/src/cpp/server/health/health.pb.h index 5782b9c1984..dc790fb1035 100644 --- a/src/cpp/server/health/health.pb.h +++ b/src/cpp/server/health/health.pb.h @@ -58,7 +58,7 @@ typedef enum _grpc_health_v1_HealthCheckResponse_ServingStatus { /* Struct definitions */ typedef struct _grpc_health_v1_HealthCheckRequest { bool has_service; - char service[2048]; + char service[200]; /* @@protoc_insertion_point(struct:grpc_health_v1_HealthCheckRequest) */ } grpc_health_v1_HealthCheckRequest; @@ -85,7 +85,7 @@ extern const pb_field_t grpc_health_v1_HealthCheckRequest_fields[2]; extern const pb_field_t grpc_health_v1_HealthCheckResponse_fields[2]; /* Maximum encoded size of messages (where known) */ -#define grpc_health_v1_HealthCheckRequest_size 2051 +#define grpc_health_v1_HealthCheckRequest_size 203 #define grpc_health_v1_HealthCheckResponse_size 2 /* Message IDs (where set with "msgid" option) */ diff --git a/src/proto/grpc/health/v1/health.options b/src/proto/grpc/health/v1/health.options index 139cf2bb52b..240b498b580 100644 --- a/src/proto/grpc/health/v1/health.options +++ b/src/proto/grpc/health/v1/health.options @@ -1 +1 @@ -grpc.health.v1.HealthCheckRequest.service max_size:2048 +grpc.health.v1.HealthCheckRequest.service max_size:200 diff --git a/test/cpp/end2end/health_service_end2end_test.cc b/test/cpp/end2end/health_service_end2end_test.cc index 17e8c4b7615..02aa5cea3f6 100644 --- a/test/cpp/end2end/health_service_end2end_test.cc +++ b/test/cpp/end2end/health_service_end2end_test.cc @@ -85,7 +85,6 @@ class HealthServiceEnd2endTest : public ::testing::Test { void ResetStubs() { std::shared_ptr channel = CreateChannel(server_address_.str(), InsecureChannelCredentials()); - stub_ = grpc::testing::EchoTestService::NewStub(channel); hc_stub_ = grpc::health::v1::Health::NewStub(channel); } @@ -98,14 +97,12 @@ class HealthServiceEnd2endTest : public ::testing::Test { ClientContext context; Status s = hc_stub_->Check(&context, request, &response); EXPECT_EQ(expected_status.error_code(), s.error_code()); - // EXPECT_EQ(expected_status.error_details(), s.error_details()); if (s.ok()) { EXPECT_EQ(expected_serving_status, response.status()); } } TestServiceImpl echo_test_service_; - std::unique_ptr stub_; std::unique_ptr hc_stub_; std::unique_ptr server_; std::ostringstream server_address_; @@ -129,6 +126,8 @@ TEST_F(HealthServiceEnd2endTest, DefaultHealthService) { EXPECT_TRUE(default_service != nullptr); const grpc::string kHealthyService("healthy_service"); const grpc::string kUnhealthyService("unhealthy_service"); + const grpc::string kNotRegisteredService("not_registered"); + const grpc::string kTooLongServiceName(201, 'x'); default_service->SetServingStatus(kHealthyService, true); default_service->SetServingStatus(kUnhealthyService, false); @@ -138,6 +137,10 @@ TEST_F(HealthServiceEnd2endTest, DefaultHealthService) { SendHealthCheckRpc(kHealthyService, Status::OK, HealthCheckResponse::SERVING); SendHealthCheckRpc(kUnhealthyService, Status::OK, HealthCheckResponse::NOT_SERVING); + SendHealthCheckRpc(kNotRegisteredService, Status(StatusCode::NOT_FOUND, ""), + HealthCheckResponse::NOT_SERVING); + SendHealthCheckRpc(kTooLongServiceName, Status(StatusCode::INVALID_ARGUMENT, ""), + HealthCheckResponse::NOT_SERVING); default_service->SetServingStatus(false); SendHealthCheckRpc("", Status::OK, HealthCheckResponse::NOT_SERVING); @@ -145,6 +148,10 @@ TEST_F(HealthServiceEnd2endTest, DefaultHealthService) { HealthCheckResponse::NOT_SERVING); SendHealthCheckRpc(kUnhealthyService, Status::OK, HealthCheckResponse::NOT_SERVING); + SendHealthCheckRpc(kNotRegisteredService, Status(StatusCode::NOT_FOUND, ""), + HealthCheckResponse::NOT_SERVING); + SendHealthCheckRpc(kTooLongServiceName, Status(StatusCode::INVALID_ARGUMENT, ""), + HealthCheckResponse::NOT_SERVING); } } // namespace From 4eaf96920f7949cdf7f0d81973769cb6bc42bcaf Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 27 Dec 2016 13:52:38 -0800 Subject: [PATCH 012/126] fix todo --- .../server/health/default_health_check_service.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cpp/server/health/default_health_check_service.cc b/src/cpp/server/health/default_health_check_service.cc index 665a99f86b1..bc7d5767419 100644 --- a/src/cpp/server/health/default_health_check_service.cc +++ b/src/cpp/server/health/default_health_check_service.cc @@ -66,6 +66,7 @@ Status DefaultHealthCheckService::SyncHealthCheckServiceImpl::Check( std::vector slices; request->Dump(&slices); const uint8_t* request_bytes = nullptr; + bool request_bytes_owned = false; size_t request_size = 0; grpc_health_v1_HealthCheckRequest request_struct; if (slices.empty()) { @@ -74,13 +75,22 @@ Status DefaultHealthCheckService::SyncHealthCheckServiceImpl::Check( request_bytes = slices[0].begin(); request_size = slices[0].size(); } else { - abort(); // TODO + request_bytes_owned = true; + request_bytes = gpr_malloc(request->Length()); + uint8_t* copy_to = request_bytes; + for (size_t i = 0; i < slices.size(); i++) { + memcpy(copy_to, slices[i].begin(), slices[i].size()); + copy_to += slices[i].size(); + } } if (request_bytes != nullptr) { pb_istream_t istream = pb_istream_from_buffer(request_bytes, request_size); bool decode_status = pb_decode( &istream, grpc_health_v1_HealthCheckRequest_fields, &request_struct); + if (request_bytes_owned) { + gpr_free(request_bytes); + } if (!decode_status) { return Status(StatusCode::INVALID_ARGUMENT, ""); } From 9bef0740a4ad649b6eb7438fc9575dfc1e98250e Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 27 Dec 2016 15:31:57 -0800 Subject: [PATCH 013/126] Add test for explicit option --- ...alth_check_service_server_builder_option.h | 2 +- .../health/default_health_check_service.cc | 7 +- .../end2end/health_service_end2end_test.cc | 186 +++++++++++++++--- 3 files changed, 159 insertions(+), 36 deletions(-) diff --git a/include/grpc++/ext/health_check_service_server_builder_option.h b/include/grpc++/ext/health_check_service_server_builder_option.h index e00c4c3dd59..6a8fd943178 100644 --- a/include/grpc++/ext/health_check_service_server_builder_option.h +++ b/include/grpc++/ext/health_check_service_server_builder_option.h @@ -47,7 +47,7 @@ class HealthCheckServiceServerBuilderOption : public ServerBuilderOption { // Use nullptr to disable default service. explicit HealthCheckServiceServerBuilderOption( std::unique_ptr hc); - ~HealthCheckServiceServerBuilderOption() {} + ~HealthCheckServiceServerBuilderOption() override {} void UpdateArguments(ChannelArguments* args) override; void UpdatePlugins(std::vector>* plugins) override; private: diff --git a/src/cpp/server/health/default_health_check_service.cc b/src/cpp/server/health/default_health_check_service.cc index bc7d5767419..cec7ecce70a 100644 --- a/src/cpp/server/health/default_health_check_service.cc +++ b/src/cpp/server/health/default_health_check_service.cc @@ -35,6 +35,7 @@ #include #include +#include #include #include "src/cpp/server/health/default_health_check_service.h" @@ -65,18 +66,18 @@ Status DefaultHealthCheckService::SyncHealthCheckServiceImpl::Check( // Decode request. std::vector slices; request->Dump(&slices); - const uint8_t* request_bytes = nullptr; + uint8_t* request_bytes = nullptr; bool request_bytes_owned = false; size_t request_size = 0; grpc_health_v1_HealthCheckRequest request_struct; if (slices.empty()) { request_struct.has_service = false; } else if (slices.size() == 1) { - request_bytes = slices[0].begin(); + request_bytes = const_cast(slices[0].begin()); request_size = slices[0].size(); } else { request_bytes_owned = true; - request_bytes = gpr_malloc(request->Length()); + request_bytes = static_cast(gpr_malloc(request->Length())); uint8_t* copy_to = request_bytes; for (size_t i = 0; i < slices.size(); i++) { memcpy(copy_to, slices[i].begin(), slices[i].size()); diff --git a/test/cpp/end2end/health_service_end2end_test.cc b/test/cpp/end2end/health_service_end2end_test.cc index 02aa5cea3f6..969aea1318f 100644 --- a/test/cpp/end2end/health_service_end2end_test.cc +++ b/test/cpp/end2end/health_service_end2end_test.cc @@ -32,11 +32,14 @@ */ #include +#include #include +#include #include #include #include +#include #include #include #include @@ -59,20 +62,92 @@ namespace grpc { namespace testing { namespace { +// A sample sync implementation of the health checking service. This does the +// same thing as the default one. +class HealthCheckServiceImpl : public ::grpc::health::v1::Health::Service { + public: + Status Check(ServerContext* context, const HealthCheckRequest* request, + HealthCheckResponse* response) override { + std::lock_guard lock(mu_); + auto iter = status_map_.find(request->service()); + if (iter == status_map_.end()) { + return Status(StatusCode::NOT_FOUND, ""); + } + response->set_status(iter->second); + return Status::OK; + } + + void SetStatus(const grpc::string& service_name, + HealthCheckResponse::ServingStatus status) { + std::lock_guard lock(mu_); + status_map_[service_name] = status; + } + + void SetAll(HealthCheckResponse::ServingStatus status) { + std::lock_guard lock(mu_); + for (auto iter = status_map_.begin(); iter != status_map_.end(); ++iter) { + iter->second = status; + } + } + + private: + std::mutex mu_; + std::map status_map_; +}; + +// A custom implementation of the health checking service interface. This is +// used to test that it prevents the server from creating a default service and +// also serves as an example of how to override the default service. +class CustomHealthCheckService : public HealthCheckServiceInterface { + public: + explicit CustomHealthCheckService(HealthCheckServiceImpl* impl) + : impl_(impl) { + impl_->SetStatus("", HealthCheckResponse::SERVING); + } + void SetServingStatus(const grpc::string& service_name, + bool serving) override { + impl_->SetStatus(service_name, serving ? HealthCheckResponse::SERVING + : HealthCheckResponse::NOT_SERVING); + } + + void SetServingStatus(bool serving) override { + impl_->SetAll(serving ? HealthCheckResponse::SERVING + : HealthCheckResponse::NOT_SERVING); + } + + private: + HealthCheckServiceImpl* impl_; // not owned +}; + class HealthServiceEnd2endTest : public ::testing::Test { protected: HealthServiceEnd2endTest() {} - void SetUpServer(grpc::Service* explicit_health_service) { + void SetUpServer(bool register_sync_test_service, + bool explicit_health_service, + std::unique_ptr service) { int port = grpc_pick_unused_port_or_die(); server_address_ << "localhost:" << port; + bool register_sync_health_service_impl = + explicit_health_service && service != nullptr; + // Setup server ServerBuilder builder; + if (explicit_health_service) { + std::unique_ptr option( + new HealthCheckServiceServerBuilderOption(std::move(service))); + builder.SetOption(std::move(option)); + } builder.AddListeningPort(server_address_.str(), grpc::InsecureServerCredentials()); - // Register a sync service. - builder.RegisterService(&echo_test_service_); + if (register_sync_test_service) { + // Register a sync service. + builder.RegisterService(&echo_test_service_); + } + if (register_sync_health_service_impl) { + builder.RegisterService(&health_check_service_impl_); + } server_ = builder.BuildAndStart(); } @@ -88,6 +163,14 @@ class HealthServiceEnd2endTest : public ::testing::Test { hc_stub_ = grpc::health::v1::Health::NewStub(channel); } + // When the expected_status is NOT OK, we do not care about the response. + void SendHealthCheckRpc(const grpc::string& service_name, + const Status& expected_status) { + EXPECT_FALSE(expected_status.ok()); + SendHealthCheckRpc(service_name, expected_status, + HealthCheckResponse::UNKNOWN); + } + void SendHealthCheckRpc( const grpc::string& service_name, const Status& expected_status, HealthCheckResponse::ServingStatus expected_serving_status) { @@ -102,7 +185,37 @@ class HealthServiceEnd2endTest : public ::testing::Test { } } + void VerifyHealthCheckService() { + HealthCheckServiceInterface* service = server_->GetHealthCheckService(); + EXPECT_TRUE(service != nullptr); + const grpc::string kHealthyService("healthy_service"); + const grpc::string kUnhealthyService("unhealthy_service"); + const grpc::string kNotRegisteredService("not_registered"); + service->SetServingStatus(kHealthyService, true); + service->SetServingStatus(kUnhealthyService, false); + + ResetStubs(); + + SendHealthCheckRpc("", Status::OK, HealthCheckResponse::SERVING); + SendHealthCheckRpc(kHealthyService, Status::OK, + HealthCheckResponse::SERVING); + SendHealthCheckRpc(kUnhealthyService, Status::OK, + HealthCheckResponse::NOT_SERVING); + SendHealthCheckRpc(kNotRegisteredService, + Status(StatusCode::NOT_FOUND, "")); + + service->SetServingStatus(false); + SendHealthCheckRpc("", Status::OK, HealthCheckResponse::NOT_SERVING); + SendHealthCheckRpc(kHealthyService, Status::OK, + HealthCheckResponse::NOT_SERVING); + SendHealthCheckRpc(kUnhealthyService, Status::OK, + HealthCheckResponse::NOT_SERVING); + SendHealthCheckRpc(kNotRegisteredService, + Status(StatusCode::NOT_FOUND, "")); + } + TestServiceImpl echo_test_service_; + HealthCheckServiceImpl health_check_service_impl_; std::unique_ptr hc_stub_; std::unique_ptr server_; std::ostringstream server_address_; @@ -111,47 +224,56 @@ class HealthServiceEnd2endTest : public ::testing::Test { TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceDisabled) { EnableDefaultHealthCheckService(false); EXPECT_FALSE(DefaultHealthCheckServiceEnabled()); - SetUpServer(nullptr); + SetUpServer(true, false, nullptr); HealthCheckServiceInterface* default_service = server_->GetHealthCheckService(); EXPECT_TRUE(default_service == nullptr); + + ResetStubs(); + + SendHealthCheckRpc("", Status(StatusCode::UNIMPLEMENTED, "")); } TEST_F(HealthServiceEnd2endTest, DefaultHealthService) { EnableDefaultHealthCheckService(true); EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); - SetUpServer(nullptr); - HealthCheckServiceInterface* default_service = - server_->GetHealthCheckService(); - EXPECT_TRUE(default_service != nullptr); - const grpc::string kHealthyService("healthy_service"); - const grpc::string kUnhealthyService("unhealthy_service"); - const grpc::string kNotRegisteredService("not_registered"); + SetUpServer(true, false, nullptr); + VerifyHealthCheckService(); + + // The default service has a size limit of the service name. const grpc::string kTooLongServiceName(201, 'x'); - default_service->SetServingStatus(kHealthyService, true); - default_service->SetServingStatus(kUnhealthyService, false); + SendHealthCheckRpc(kTooLongServiceName, + Status(StatusCode::INVALID_ARGUMENT, "")); +} + +// Provide an empty service to disable the default service. +TEST_F(HealthServiceEnd2endTest, ExplicitlyDisableViaOverride) { + EnableDefaultHealthCheckService(true); + EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); + std::unique_ptr empty_service; + SetUpServer(true, true, std::move(empty_service)); + HealthCheckServiceInterface* service = server_->GetHealthCheckService(); + EXPECT_TRUE(service == nullptr); + + ResetStubs(); + + SendHealthCheckRpc("", Status(StatusCode::UNIMPLEMENTED, "")); +} + +// Provide an explicit override of health checking service interface. +TEST_F(HealthServiceEnd2endTest, ExplicitlyOverride) { + EnableDefaultHealthCheckService(true); + EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); + std::unique_ptr override_service( + new CustomHealthCheckService(&health_check_service_impl_)); + HealthCheckServiceInterface* underlying_service = override_service.get(); + SetUpServer(false, true, std::move(override_service)); + HealthCheckServiceInterface* service = server_->GetHealthCheckService(); + EXPECT_TRUE(service == underlying_service); ResetStubs(); - SendHealthCheckRpc("", Status::OK, HealthCheckResponse::SERVING); - SendHealthCheckRpc(kHealthyService, Status::OK, HealthCheckResponse::SERVING); - SendHealthCheckRpc(kUnhealthyService, Status::OK, - HealthCheckResponse::NOT_SERVING); - SendHealthCheckRpc(kNotRegisteredService, Status(StatusCode::NOT_FOUND, ""), - HealthCheckResponse::NOT_SERVING); - SendHealthCheckRpc(kTooLongServiceName, Status(StatusCode::INVALID_ARGUMENT, ""), - HealthCheckResponse::NOT_SERVING); - - default_service->SetServingStatus(false); - SendHealthCheckRpc("", Status::OK, HealthCheckResponse::NOT_SERVING); - SendHealthCheckRpc(kHealthyService, Status::OK, - HealthCheckResponse::NOT_SERVING); - SendHealthCheckRpc(kUnhealthyService, Status::OK, - HealthCheckResponse::NOT_SERVING); - SendHealthCheckRpc(kNotRegisteredService, Status(StatusCode::NOT_FOUND, ""), - HealthCheckResponse::NOT_SERVING); - SendHealthCheckRpc(kTooLongServiceName, Status(StatusCode::INVALID_ARGUMENT, ""), - HealthCheckResponse::NOT_SERVING); + VerifyHealthCheckService(); } } // namespace From f56c251af79577edfda3da795c8a26f31e4c7e01 Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 27 Dec 2016 15:36:20 -0800 Subject: [PATCH 014/126] clang-format --- .../ext/health_check_service_server_builder_option.h | 4 +++- .../ext/health_check_service_server_builder_option.cc | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/grpc++/ext/health_check_service_server_builder_option.h b/include/grpc++/ext/health_check_service_server_builder_option.h index 6a8fd943178..2dd1e6dd329 100644 --- a/include/grpc++/ext/health_check_service_server_builder_option.h +++ b/include/grpc++/ext/health_check_service_server_builder_option.h @@ -49,7 +49,9 @@ class HealthCheckServiceServerBuilderOption : public ServerBuilderOption { std::unique_ptr hc); ~HealthCheckServiceServerBuilderOption() override {} void UpdateArguments(ChannelArguments* args) override; - void UpdatePlugins(std::vector>* plugins) override; + void UpdatePlugins( + std::vector>* plugins) override; + private: std::unique_ptr hc_; }; diff --git a/src/cpp/ext/health_check_service_server_builder_option.cc b/src/cpp/ext/health_check_service_server_builder_option.cc index 4afc82dc144..0d523285e9c 100644 --- a/src/cpp/ext/health_check_service_server_builder_option.cc +++ b/src/cpp/ext/health_check_service_server_builder_option.cc @@ -36,14 +36,15 @@ namespace grpc { HealthCheckServiceServerBuilderOption::HealthCheckServiceServerBuilderOption( - std::unique_ptr hc) : hc_(std::move(hc)) { } + std::unique_ptr hc) + : hc_(std::move(hc)) {} -HealthCheckServiceServerBuilderOption::UpdateArguments(ChannelArguments* args) override { +HealthCheckServiceServerBuilderOption::UpdateArguments( + ChannelArguments* args) override { args->SetPointer(DefaultHealthCheckServiceInterfaceArg(), hc_.release()); } -void HealthCheckServiceServerBuilderOption::UpdatePlugins(std::vector>* plugins) override { -} +void HealthCheckServiceServerBuilderOption::UpdatePlugins( + std::vector>* plugins) override {} } // namespace grpc - From 1accb12408d89160055e687d49b3b346e57ad14a Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 28 Dec 2016 10:38:04 -0800 Subject: [PATCH 015/126] fix path --- BUILD | 6 +++--- CMakeLists.txt | 6 +++--- Makefile | 6 +++--- build.yaml | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- tools/run_tests/generated/sources_and_headers.json | 4 ++-- vsprojects/vcxproj/grpc++/grpc++.vcxproj | 2 +- vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters | 6 +++--- vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj | 2 +- .../vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters | 6 +++--- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/BUILD b/BUILD index c680232d247..0d4f290e321 100644 --- a/BUILD +++ b/BUILD @@ -1428,11 +1428,11 @@ cc_library( "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", "include/grpc++/create_channel_posix.h", - "include/grpc++/ext/health_check_service_interface.h", "include/grpc++/ext/health_check_service_server_builder_option.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", + "include/grpc++/health_check_service_interface.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/codegen/core_codegen.h", @@ -1898,11 +1898,11 @@ cc_library( "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", "include/grpc++/create_channel_posix.h", - "include/grpc++/ext/health_check_service_interface.h", "include/grpc++/ext/health_check_service_server_builder_option.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", + "include/grpc++/health_check_service_interface.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/codegen/core_codegen.h", @@ -2082,11 +2082,11 @@ cc_library( "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", "include/grpc++/create_channel_posix.h", - "include/grpc++/ext/health_check_service_interface.h", "include/grpc++/ext/health_check_service_server_builder_option.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", + "include/grpc++/health_check_service_interface.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/codegen/core_codegen.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f191431793..5a2d368d590 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1132,11 +1132,11 @@ foreach(_hdr include/grpc++/completion_queue.h include/grpc++/create_channel.h include/grpc++/create_channel_posix.h - include/grpc++/ext/health_check_service_interface.h include/grpc++/ext/health_check_service_server_builder_option.h include/grpc++/generic/async_generic_service.h include/grpc++/generic/generic_stub.h include/grpc++/grpc++.h + include/grpc++/health_check_service_interface.h include/grpc++/impl/call.h include/grpc++/impl/client_unary_call.h include/grpc++/impl/codegen/core_codegen.h @@ -1471,11 +1471,11 @@ foreach(_hdr include/grpc++/completion_queue.h include/grpc++/create_channel.h include/grpc++/create_channel_posix.h - include/grpc++/ext/health_check_service_interface.h include/grpc++/ext/health_check_service_server_builder_option.h include/grpc++/generic/async_generic_service.h include/grpc++/generic/generic_stub.h include/grpc++/grpc++.h + include/grpc++/health_check_service_interface.h include/grpc++/impl/call.h include/grpc++/impl/client_unary_call.h include/grpc++/impl/codegen/core_codegen.h @@ -1683,11 +1683,11 @@ foreach(_hdr include/grpc++/completion_queue.h include/grpc++/create_channel.h include/grpc++/create_channel_posix.h - include/grpc++/ext/health_check_service_interface.h include/grpc++/ext/health_check_service_server_builder_option.h include/grpc++/generic/async_generic_service.h include/grpc++/generic/generic_stub.h include/grpc++/grpc++.h + include/grpc++/health_check_service_interface.h include/grpc++/impl/call.h include/grpc++/impl/client_unary_call.h include/grpc++/impl/codegen/core_codegen.h diff --git a/Makefile b/Makefile index 6ee90856493..e7a2c653dc8 100644 --- a/Makefile +++ b/Makefile @@ -3829,11 +3829,11 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ include/grpc++/create_channel_posix.h \ - include/grpc++/ext/health_check_service_interface.h \ include/grpc++/ext/health_check_service_server_builder_option.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ + include/grpc++/health_check_service_interface.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/codegen/core_codegen.h \ @@ -4197,11 +4197,11 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ include/grpc++/create_channel_posix.h \ - include/grpc++/ext/health_check_service_interface.h \ include/grpc++/ext/health_check_service_server_builder_option.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ + include/grpc++/health_check_service_interface.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/codegen/core_codegen.h \ @@ -4737,11 +4737,11 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ include/grpc++/create_channel_posix.h \ - include/grpc++/ext/health_check_service_interface.h \ include/grpc++/ext/health_check_service_server_builder_option.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ + include/grpc++/health_check_service_interface.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/codegen/core_codegen.h \ diff --git a/build.yaml b/build.yaml index 4a33891e33b..634394a1ad7 100644 --- a/build.yaml +++ b/build.yaml @@ -718,11 +718,11 @@ filegroups: - include/grpc++/completion_queue.h - include/grpc++/create_channel.h - include/grpc++/create_channel_posix.h - - include/grpc++/ext/health_check_service_interface.h - include/grpc++/ext/health_check_service_server_builder_option.h - include/grpc++/generic/async_generic_service.h - include/grpc++/generic/generic_stub.h - include/grpc++/grpc++.h + - include/grpc++/health_check_service_interface.h - include/grpc++/impl/call.h - include/grpc++/impl/client_unary_call.h - include/grpc++/impl/codegen/core_codegen.h diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 77e9c7fc9ac..6d4f128cbb4 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -766,11 +766,11 @@ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ include/grpc++/create_channel_posix.h \ -include/grpc++/ext/health_check_service_interface.h \ include/grpc++/ext/health_check_service_server_builder_option.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ +include/grpc++/health_check_service_interface.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/codegen/core_codegen.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index c2dbfb68f98..7f24e84a5ad 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -766,11 +766,11 @@ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ include/grpc++/create_channel_posix.h \ -include/grpc++/ext/health_check_service_interface.h \ include/grpc++/ext/health_check_service_server_builder_option.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ +include/grpc++/health_check_service_interface.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/codegen/core_codegen.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 86986a99a6d..a8157ffb9a9 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7639,11 +7639,11 @@ "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", "include/grpc++/create_channel_posix.h", - "include/grpc++/ext/health_check_service_interface.h", "include/grpc++/ext/health_check_service_server_builder_option.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", + "include/grpc++/health_check_service_interface.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/codegen/core_codegen.h", @@ -7695,11 +7695,11 @@ "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", "include/grpc++/create_channel_posix.h", - "include/grpc++/ext/health_check_service_interface.h", "include/grpc++/ext/health_check_service_server_builder_option.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", + "include/grpc++/health_check_service_interface.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/codegen/core_codegen.h", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index 0f0949cbd11..9d98447a707 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -264,11 +264,11 @@ - + diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index fc64c44e083..a9acb5c588e 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -144,9 +144,6 @@ include\grpc++ - - include\grpc++\ext - include\grpc++\ext @@ -159,6 +156,9 @@ include\grpc++ + + include\grpc++ + include\grpc++\impl diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 0c53d641c7e..a9786a1c84c 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -264,11 +264,11 @@ - + diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index a1ac8702262..f43e859eee4 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -129,9 +129,6 @@ include\grpc++ - - include\grpc++\ext - include\grpc++\ext @@ -144,6 +141,9 @@ include\grpc++ + + include\grpc++ + include\grpc++\impl From 50993b7a4c083b8b202010aca1bb95cf9902cf74 Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 29 Dec 2016 10:00:27 -0800 Subject: [PATCH 016/126] async first take --- .../grpc++/impl/codegen/server_interface.h | 7 +- include/grpc++/server.h | 3 + .../health/default_health_check_service.cc | 54 ++++++++---- .../health/default_health_check_service.h | 16 ++++ src/cpp/server/server_cc.cc | 82 ++++++++++++++++++- .../end2end/health_service_end2end_test.cc | 30 +++++++ 6 files changed, 170 insertions(+), 22 deletions(-) diff --git a/include/grpc++/impl/codegen/server_interface.h b/include/grpc++/impl/codegen/server_interface.h index 666b9ff66eb..2acb174baf0 100644 --- a/include/grpc++/impl/codegen/server_interface.h +++ b/include/grpc++/impl/codegen/server_interface.h @@ -159,7 +159,8 @@ class ServerInterface : public CallHook { public: RegisteredAsyncRequest(ServerInterface* server, ServerContext* context, ServerAsyncStreamingInterface* stream, - CompletionQueue* call_cq, void* tag); + CompletionQueue* call_cq, void* tag, + bool delete_on_finalize); // uses BaseAsyncRequest::FinalizeResult @@ -175,7 +176,7 @@ class ServerInterface : public CallHook { ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, ServerCompletionQueue* notification_cq, void* tag) - : RegisteredAsyncRequest(server, context, stream, call_cq, tag) { + : RegisteredAsyncRequest(server, context, stream, call_cq, tag, true) { IssueRequest(registered_method, nullptr, notification_cq); } @@ -191,7 +192,7 @@ class ServerInterface : public CallHook { CompletionQueue* call_cq, ServerCompletionQueue* notification_cq, void* tag, Message* request) - : RegisteredAsyncRequest(server, context, stream, call_cq, tag), + : RegisteredAsyncRequest(server, context, stream, call_cq, tag, true), request_(request) { IssueRequest(registered_method, &payload_, notification_cq); } diff --git a/include/grpc++/server.h b/include/grpc++/server.h index e3e9174c9c2..9f31d00ef0b 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -119,6 +119,9 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen { class UnimplementedAsyncRequest; class UnimplementedAsyncResponse; + class HealthCheckAsyncRequestContext; + class HealthCheckAsyncRequest; + /// Server constructors. To be used by \a ServerBuilder only. /// /// \param max_message_size Maximum message length that the channel can diff --git a/src/cpp/server/health/default_health_check_service.cc b/src/cpp/server/health/default_health_check_service.cc index cec7ecce70a..26d8fd999fb 100644 --- a/src/cpp/server/health/default_health_check_service.cc +++ b/src/cpp/server/health/default_health_check_service.cc @@ -48,21 +48,9 @@ namespace { const char kHealthCheckMethodName[] = "/grpc.health.v1.Health/Check"; -} // namespace - -DefaultHealthCheckService::SyncHealthCheckServiceImpl:: - SyncHealthCheckServiceImpl(DefaultHealthCheckService* service) - : service_(service) { - auto* handler = - new RpcMethodHandler( - std::mem_fn(&SyncHealthCheckServiceImpl::Check), this); - auto* method = new RpcServiceMethod(kHealthCheckMethodName, - RpcMethod::NORMAL_RPC, handler); - AddMethod(method); -} - -Status DefaultHealthCheckService::SyncHealthCheckServiceImpl::Check( - ServerContext* context, const ByteBuffer* request, ByteBuffer* response) { +Status CheckHealth(const DefaultHealthCheckService* service, + ServerContext* context, const ByteBuffer* request, + ByteBuffer* response) { // Decode request. std::vector slices; request->Dump(&slices); @@ -99,7 +87,7 @@ Status DefaultHealthCheckService::SyncHealthCheckServiceImpl::Check( // Check status from the associated default health checking service. DefaultHealthCheckService::ServingStatus serving_status = - service_->GetServingStatus( + service->GetServingStatus( request_struct.has_service ? request_struct.service : ""); if (serving_status == DefaultHealthCheckService::NOT_FOUND) { return Status(StatusCode::NOT_FOUND, ""); @@ -129,9 +117,41 @@ Status DefaultHealthCheckService::SyncHealthCheckServiceImpl::Check( response->Swap(&response_buffer); return Status::OK; } +} // namespace + +DefaultHealthCheckService::SyncHealthCheckServiceImpl:: + SyncHealthCheckServiceImpl(DefaultHealthCheckService* service) + : service_(service) { + auto* handler = + new RpcMethodHandler( + std::mem_fn(&SyncHealthCheckServiceImpl::Check), this); + auto* method = new RpcServiceMethod(kHealthCheckMethodName, + RpcMethod::NORMAL_RPC, handler); + AddMethod(method); +} + +Status DefaultHealthCheckService::SyncHealthCheckServiceImpl::Check( + ServerContext* context, const ByteBuffer* request, ByteBuffer* response) { + return CheckHealth(service_, context, request, response); +} + +DefaultHealthCheckService::AsyncHealthCheckServiceImpl:: + AsyncHealthCheckServiceImpl(DefaultHealthCheckService* service) + : service_(service) { + auto* method = new RpcServiceMethod(kHealthCheckMethodName, + RpcMethod::NORMAL_RPC, nullptr); + AddMethod(method); + method_ = method; +} + +Status DefaultHealthCheckService::AsyncHealthCheckServiceImpl::Check( + ServerContext* context, const ByteBuffer* request, ByteBuffer* response) { + return CheckHealth(service_, context, request, response); +} DefaultHealthCheckService::DefaultHealthCheckService() - : sync_service_(new SyncHealthCheckServiceImpl(this)) { + : sync_service_(new SyncHealthCheckServiceImpl(this)), + async_service_(new AsyncHealthCheckServiceImpl(this)) { services_map_.emplace("", true); } diff --git a/src/cpp/server/health/default_health_check_service.h b/src/cpp/server/health/default_health_check_service.h index 541c720aaa6..411aac97138 100644 --- a/src/cpp/server/health/default_health_check_service.h +++ b/src/cpp/server/health/default_health_check_service.h @@ -56,6 +56,18 @@ class DefaultHealthCheckService : public HealthCheckServiceInterface { const DefaultHealthCheckService* service_; }; + class AsyncHealthCheckServiceImpl : public Service { + public: + explicit AsyncHealthCheckServiceImpl(DefaultHealthCheckService* service); + Status Check(ServerContext* context, const ByteBuffer* request, + ByteBuffer* response); + const RpcServiceMethod* method() const { return method_; } + + private: + const DefaultHealthCheckService* service_; + const RpcServiceMethod* method_; + }; + DefaultHealthCheckService(); void SetServingStatus(const grpc::string& service_name, bool serving) final; void SetServingStatus(bool serving) final; @@ -64,11 +76,15 @@ class DefaultHealthCheckService : public HealthCheckServiceInterface { SyncHealthCheckServiceImpl* GetSyncHealthCheckService() const { return sync_service_.get(); } + AsyncHealthCheckServiceImpl* GetAsyncHealthCheckService() const { + return async_service_.get(); + } private: mutable std::mutex mu_; std::map services_map_; std::unique_ptr sync_service_; + std::unique_ptr async_service_; }; } // namespace grpc diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index c50c076bdc5..20641aeea8d 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -118,6 +119,67 @@ class Server::UnimplementedAsyncResponse final UnimplementedAsyncRequest* const request_; }; +class Server::HealthCheckAsyncRequestContext { + protected: + HealthCheckAsyncRequestContext() : rpc_(&server_context_) {} + ServerContext server_context_; + ServerAsyncResponseWriter rpc_; +}; + +class Server::HealthCheckAsyncRequest final + : public HealthCheckAsyncRequestContext, + public RegisteredAsyncRequest { + public: + HealthCheckAsyncRequest( + DefaultHealthCheckService::AsyncHealthCheckServiceImpl* service, + Server* server, ServerCompletionQueue* cq) + : RegisteredAsyncRequest(server, &server_context_, &rpc_, cq, this, + false), + service_(service), + server_(server), + cq_(cq), + had_request_(false) { + IssueRequest(service->method()->server_tag(), &payload_, cq); + } + + bool FinalizeResult(void** tag, bool* status) override; + + private: + DefaultHealthCheckService::AsyncHealthCheckServiceImpl* service_; + Server* const server_; + ServerCompletionQueue* const cq_; + grpc_byte_buffer* payload_; + bool had_request_; + ByteBuffer request_; + ByteBuffer response_; +}; + +bool Server::HealthCheckAsyncRequest::FinalizeResult(void** tag, bool* status) { + if (!had_request_) { + had_request_ = true; + bool serialization_status = + *status && payload_ && + SerializationTraits::Deserialize( + payload_, &request_, server_->max_receive_message_size()) + .ok(); + RegisteredAsyncRequest::FinalizeResult(tag, status); + *status = serialization_status && *status; + if (*status) { + new HealthCheckAsyncRequest(service_, server_, cq_); + Status s = service_->Check(&server_context_, &request_, &response_); + rpc_.Finish(response_, s, this); + return false; + } else { + // TODO what to do here + delete this; + return false; + } + } else { + delete this; + return false; + } +} + class ShutdownTag : public CompletionQueueTag { public: bool FinalizeResult(void** tag, bool* status) { return false; } @@ -498,6 +560,8 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { // Only create default health check service when user did not provide an // explicit one. + DefaultHealthCheckService::AsyncHealthCheckServiceImpl* async_health_service = + nullptr; if (health_check_service_ == nullptr && !health_check_service_disabled_ && DefaultHealthCheckServiceEnabled()) { auto* default_hc_service = new DefaultHealthCheckService; @@ -505,6 +569,10 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { if (!sync_server_cqs_->empty()) { // Has sync methods. RegisterService(nullptr, default_hc_service->GetSyncHealthCheckService()); } + if (sync_server_cqs_->empty()) { // No sync methods. + async_health_service = default_hc_service->GetAsyncHealthCheckService(); + RegisterService(nullptr, async_health_service); + } } grpc_server_start(server_); @@ -521,6 +589,14 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { } } + if (async_health_service) { + for (size_t i = 0; i < num_cqs; i++) { + if (cqs[i]->IsFrequentlyPolled()) { + new HealthCheckAsyncRequest(async_health_service, this, cqs[i]); + } + } + } + for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { (*it)->Start(); } @@ -641,8 +717,10 @@ bool ServerInterface::BaseAsyncRequest::FinalizeResult(void** tag, ServerInterface::RegisteredAsyncRequest::RegisteredAsyncRequest( ServerInterface* server, ServerContext* context, - ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag) - : BaseAsyncRequest(server, context, stream, call_cq, tag, true) {} + ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag, + bool delete_on_finalize) + : BaseAsyncRequest(server, context, stream, call_cq, tag, + delete_on_finalize) {} void ServerInterface::RegisteredAsyncRequest::IssueRequest( void* registered_method, grpc_byte_buffer** payload, diff --git a/test/cpp/end2end/health_service_end2end_test.cc b/test/cpp/end2end/health_service_end2end_test.cc index 969aea1318f..c41a75ec37c 100644 --- a/test/cpp/end2end/health_service_end2end_test.cc +++ b/test/cpp/end2end/health_service_end2end_test.cc @@ -45,6 +45,7 @@ #include #include #include +#include #include #include "src/proto/grpc/health/v1/health.grpc.pb.h" @@ -148,12 +149,17 @@ class HealthServiceEnd2endTest : public ::testing::Test { if (register_sync_health_service_impl) { builder.RegisterService(&health_check_service_impl_); } + cq_ = builder.AddCompletionQueue(); server_ = builder.BuildAndStart(); } void TearDown() override { if (server_) { server_->Shutdown(); + cq_->Shutdown(); + if (cq_thread_.joinable()) { + cq_thread_.join(); + } } } @@ -219,6 +225,8 @@ class HealthServiceEnd2endTest : public ::testing::Test { std::unique_ptr hc_stub_; std::unique_ptr server_; std::ostringstream server_address_; + std::unique_ptr cq_; + std::thread cq_thread_; }; TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceDisabled) { @@ -246,6 +254,28 @@ TEST_F(HealthServiceEnd2endTest, DefaultHealthService) { Status(StatusCode::INVALID_ARGUMENT, "")); } +void LoopCompletionQueue(ServerCompletionQueue* cq) { + void* tag; + bool ok; + while (cq->Next(&tag, &ok)) { + gpr_log(GPR_ERROR, "next %p %d", tag, ok); + } + gpr_log(GPR_ERROR, "returning from thread"); +} + +TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceAsync) { + EnableDefaultHealthCheckService(true); + EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); + SetUpServer(false, false, nullptr); + cq_thread_ = std::thread(LoopCompletionQueue, cq_.get()); + VerifyHealthCheckService(); + + // The default service has a size limit of the service name. + const grpc::string kTooLongServiceName(201, 'x'); + SendHealthCheckRpc(kTooLongServiceName, + Status(StatusCode::INVALID_ARGUMENT, "")); +} + // Provide an empty service to disable the default service. TEST_F(HealthServiceEnd2endTest, ExplicitlyDisableViaOverride) { EnableDefaultHealthCheckService(true); From 8e708b12cb1c88f5cb6e3984d887c3c2b9bee54f Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 29 Dec 2016 11:44:36 -0800 Subject: [PATCH 017/126] WIP --- include/grpc++/server.h | 1 + src/cpp/server/server_cc.cc | 103 ++++++++++---- .../end2end/health_service_end2end_test.cc | 126 +++++++++--------- 3 files changed, 141 insertions(+), 89 deletions(-) diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 9f31d00ef0b..3f205625ee7 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -121,6 +121,7 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen { class HealthCheckAsyncRequestContext; class HealthCheckAsyncRequest; + class HealthCheckAsyncResponse; /// Server constructors. To be used by \a ServerBuilder only. /// diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 20641aeea8d..43f09470959 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -119,11 +119,24 @@ class Server::UnimplementedAsyncResponse final UnimplementedAsyncRequest* const request_; }; +class HealthCheckAsyncResponseWriter final + : public ServerAsyncStreamingInterface { + public: + HealthCheckAsyncResponseWriter() : call_(nullptr, nullptr, nullptr) {} + void SendInitialMetadata(void* tag) override { + abort(); // should not be called. + } + void BindCall(Call* call) override { call_ = *call; } + Call* call() { return &call_; } + + private: + Call call_; +}; + class Server::HealthCheckAsyncRequestContext { protected: - HealthCheckAsyncRequestContext() : rpc_(&server_context_) {} ServerContext server_context_; - ServerAsyncResponseWriter rpc_; + HealthCheckAsyncResponseWriter rpc_; }; class Server::HealthCheckAsyncRequest final @@ -137,49 +150,86 @@ class Server::HealthCheckAsyncRequest final false), service_(service), server_(server), - cq_(cq), - had_request_(false) { + cq_(cq) { IssueRequest(service->method()->server_tag(), &payload_, cq); } bool FinalizeResult(void** tag, bool* status) override; + Call* call() { return rpc_.call(); } + ByteBuffer* response() { return &response_; } + Status* status() { return &status_; } + ServerContext* server_context() { return &server_context_; } private: DefaultHealthCheckService::AsyncHealthCheckServiceImpl* service_; Server* const server_; ServerCompletionQueue* const cq_; grpc_byte_buffer* payload_; - bool had_request_; ByteBuffer request_; ByteBuffer response_; + Status status_; +}; + +typedef SneakyCallOpSet + HealthCheckAsyncResponseOp; +class Server::HealthCheckAsyncResponse final + : public HealthCheckAsyncResponseOp { + public: + HealthCheckAsyncResponse(HealthCheckAsyncRequest* request); + ~HealthCheckAsyncResponse() { delete request_; } + + bool FinalizeResult(void** tag, bool* status) override { + HealthCheckAsyncResponseOp::FinalizeResult(tag, status); + delete this; + return false; + } + + private: + HealthCheckAsyncRequest* const request_; }; bool Server::HealthCheckAsyncRequest::FinalizeResult(void** tag, bool* status) { - if (!had_request_) { - had_request_ = true; - bool serialization_status = - *status && payload_ && - SerializationTraits::Deserialize( - payload_, &request_, server_->max_receive_message_size()) - .ok(); - RegisteredAsyncRequest::FinalizeResult(tag, status); - *status = serialization_status && *status; - if (*status) { - new HealthCheckAsyncRequest(service_, server_, cq_); - Status s = service_->Check(&server_context_, &request_, &response_); - rpc_.Finish(response_, s, this); - return false; - } else { - // TODO what to do here - delete this; - return false; - } + bool serialization_status = + *status && payload_ && + SerializationTraits::Deserialize( + payload_, &request_, server_->max_receive_message_size()) + .ok(); + RegisteredAsyncRequest::FinalizeResult(tag, status); + *status = serialization_status && *status; + if (*status) { + new HealthCheckAsyncRequest(service_, server_, cq_); + status_ = service_->Check(&server_context_, &request_, &response_); + new HealthCheckAsyncResponse(this); + return false; } else { delete this; return false; } } +Server::HealthCheckAsyncResponse::HealthCheckAsyncResponse( + HealthCheckAsyncRequest* request) + : request_(request) { + ServerContext* context = request_->server_context(); + if (!context->sent_initial_metadata_) { + SendInitialMetadata(context->initial_metadata_, + context->initial_metadata_flags()); + if (context->compression_level_set()) { + set_compression_level(context->compression_level()); + } + context->sent_initial_metadata_ = true; + } + Status* status = request_->status(); + if (status->ok()) { + ServerSendStatus(context->trailing_metadata_, + SendMessage(*request_->response())); + } else { + ServerSendStatus(context->trailing_metadata_, *status); + } + request_->call()->PerformOps(this); +} + class ShutdownTag : public CompletionQueueTag { public: bool FinalizeResult(void** tag, bool* status) { return false; } @@ -567,9 +617,10 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { auto* default_hc_service = new DefaultHealthCheckService; health_check_service_.reset(default_hc_service); if (!sync_server_cqs_->empty()) { // Has sync methods. + gpr_log(GPR_ERROR, "register sync"); // XXX RegisterService(nullptr, default_hc_service->GetSyncHealthCheckService()); - } - if (sync_server_cqs_->empty()) { // No sync methods. + } else { + gpr_log(GPR_ERROR, "register async"); // XXX async_health_service = default_hc_service->GetAsyncHealthCheckService(); RegisterService(nullptr, async_health_service); } diff --git a/test/cpp/end2end/health_service_end2end_test.cc b/test/cpp/end2end/health_service_end2end_test.cc index c41a75ec37c..9f2df90207a 100644 --- a/test/cpp/end2end/health_service_end2end_test.cc +++ b/test/cpp/end2end/health_service_end2end_test.cc @@ -242,69 +242,69 @@ TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceDisabled) { SendHealthCheckRpc("", Status(StatusCode::UNIMPLEMENTED, "")); } -TEST_F(HealthServiceEnd2endTest, DefaultHealthService) { - EnableDefaultHealthCheckService(true); - EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); - SetUpServer(true, false, nullptr); - VerifyHealthCheckService(); - - // The default service has a size limit of the service name. - const grpc::string kTooLongServiceName(201, 'x'); - SendHealthCheckRpc(kTooLongServiceName, - Status(StatusCode::INVALID_ARGUMENT, "")); -} - -void LoopCompletionQueue(ServerCompletionQueue* cq) { - void* tag; - bool ok; - while (cq->Next(&tag, &ok)) { - gpr_log(GPR_ERROR, "next %p %d", tag, ok); - } - gpr_log(GPR_ERROR, "returning from thread"); -} - -TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceAsync) { - EnableDefaultHealthCheckService(true); - EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); - SetUpServer(false, false, nullptr); - cq_thread_ = std::thread(LoopCompletionQueue, cq_.get()); - VerifyHealthCheckService(); - - // The default service has a size limit of the service name. - const grpc::string kTooLongServiceName(201, 'x'); - SendHealthCheckRpc(kTooLongServiceName, - Status(StatusCode::INVALID_ARGUMENT, "")); -} - -// Provide an empty service to disable the default service. -TEST_F(HealthServiceEnd2endTest, ExplicitlyDisableViaOverride) { - EnableDefaultHealthCheckService(true); - EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); - std::unique_ptr empty_service; - SetUpServer(true, true, std::move(empty_service)); - HealthCheckServiceInterface* service = server_->GetHealthCheckService(); - EXPECT_TRUE(service == nullptr); - - ResetStubs(); - - SendHealthCheckRpc("", Status(StatusCode::UNIMPLEMENTED, "")); -} - -// Provide an explicit override of health checking service interface. -TEST_F(HealthServiceEnd2endTest, ExplicitlyOverride) { - EnableDefaultHealthCheckService(true); - EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); - std::unique_ptr override_service( - new CustomHealthCheckService(&health_check_service_impl_)); - HealthCheckServiceInterface* underlying_service = override_service.get(); - SetUpServer(false, true, std::move(override_service)); - HealthCheckServiceInterface* service = server_->GetHealthCheckService(); - EXPECT_TRUE(service == underlying_service); - - ResetStubs(); - - VerifyHealthCheckService(); -} +// TEST_F(HealthServiceEnd2endTest, DefaultHealthService) { +// EnableDefaultHealthCheckService(true); +// EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); +// SetUpServer(true, false, nullptr); +// VerifyHealthCheckService(); +// +// // The default service has a size limit of the service name. +// const grpc::string kTooLongServiceName(201, 'x'); +// SendHealthCheckRpc(kTooLongServiceName, +// Status(StatusCode::INVALID_ARGUMENT, "")); +// } +// +// void LoopCompletionQueue(ServerCompletionQueue* cq) { +// void* tag; +// bool ok; +// while (cq->Next(&tag, &ok)) { +// abort(); // Nothing should come out of the cq. +// } +// gpr_log(GPR_ERROR, "returning from thread"); +// } +// +// TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceAsync) { +// EnableDefaultHealthCheckService(true); +// EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); +// SetUpServer(false, false, nullptr); +// cq_thread_ = std::thread(LoopCompletionQueue, cq_.get()); +// VerifyHealthCheckService(); +// +// // The default service has a size limit of the service name. +// const grpc::string kTooLongServiceName(201, 'x'); +// SendHealthCheckRpc(kTooLongServiceName, +// Status(StatusCode::INVALID_ARGUMENT, "")); +// } +// +// // Provide an empty service to disable the default service. +// TEST_F(HealthServiceEnd2endTest, ExplicitlyDisableViaOverride) { +// EnableDefaultHealthCheckService(true); +// EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); +// std::unique_ptr empty_service; +// SetUpServer(true, true, std::move(empty_service)); +// HealthCheckServiceInterface* service = server_->GetHealthCheckService(); +// EXPECT_TRUE(service == nullptr); +// +// ResetStubs(); +// +// SendHealthCheckRpc("", Status(StatusCode::UNIMPLEMENTED, "")); +// } +// +// // Provide an explicit override of health checking service interface. +// TEST_F(HealthServiceEnd2endTest, ExplicitlyOverride) { +// EnableDefaultHealthCheckService(true); +// EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); +// std::unique_ptr override_service( +// new CustomHealthCheckService(&health_check_service_impl_)); +// HealthCheckServiceInterface* underlying_service = override_service.get(); +// SetUpServer(false, true, std::move(override_service)); +// HealthCheckServiceInterface* service = server_->GetHealthCheckService(); +// EXPECT_TRUE(service == underlying_service); +// +// ResetStubs(); +// +// VerifyHealthCheckService(); +// } } // namespace } // namespace testing From a3c95529c7e1267c8d7e78e689ab8a4699adebf0 Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 29 Dec 2016 12:10:52 -0800 Subject: [PATCH 018/126] async works --- src/cpp/server/server_cc.cc | 2 - .../end2end/health_service_end2end_test.cc | 128 +++++++++--------- 2 files changed, 64 insertions(+), 66 deletions(-) diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 43f09470959..8a0ad36c535 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -617,10 +617,8 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { auto* default_hc_service = new DefaultHealthCheckService; health_check_service_.reset(default_hc_service); if (!sync_server_cqs_->empty()) { // Has sync methods. - gpr_log(GPR_ERROR, "register sync"); // XXX RegisterService(nullptr, default_hc_service->GetSyncHealthCheckService()); } else { - gpr_log(GPR_ERROR, "register async"); // XXX async_health_service = default_hc_service->GetAsyncHealthCheckService(); RegisterService(nullptr, async_health_service); } diff --git a/test/cpp/end2end/health_service_end2end_test.cc b/test/cpp/end2end/health_service_end2end_test.cc index 9f2df90207a..beb84e0a3fc 100644 --- a/test/cpp/end2end/health_service_end2end_test.cc +++ b/test/cpp/end2end/health_service_end2end_test.cc @@ -120,6 +120,14 @@ class CustomHealthCheckService : public HealthCheckServiceInterface { HealthCheckServiceImpl* impl_; // not owned }; +void LoopCompletionQueue(ServerCompletionQueue* cq) { + void* tag; + bool ok; + while (cq->Next(&tag, &ok)) { + abort(); // Nothing should come out of the cq. + } +} + class HealthServiceEnd2endTest : public ::testing::Test { protected: HealthServiceEnd2endTest() {} @@ -160,6 +168,7 @@ class HealthServiceEnd2endTest : public ::testing::Test { if (cq_thread_.joinable()) { cq_thread_.join(); } + LoopCompletionQueue(cq_.get()); } } @@ -223,9 +232,9 @@ class HealthServiceEnd2endTest : public ::testing::Test { TestServiceImpl echo_test_service_; HealthCheckServiceImpl health_check_service_impl_; std::unique_ptr hc_stub_; + std::unique_ptr cq_; std::unique_ptr server_; std::ostringstream server_address_; - std::unique_ptr cq_; std::thread cq_thread_; }; @@ -242,69 +251,60 @@ TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceDisabled) { SendHealthCheckRpc("", Status(StatusCode::UNIMPLEMENTED, "")); } -// TEST_F(HealthServiceEnd2endTest, DefaultHealthService) { -// EnableDefaultHealthCheckService(true); -// EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); -// SetUpServer(true, false, nullptr); -// VerifyHealthCheckService(); -// -// // The default service has a size limit of the service name. -// const grpc::string kTooLongServiceName(201, 'x'); -// SendHealthCheckRpc(kTooLongServiceName, -// Status(StatusCode::INVALID_ARGUMENT, "")); -// } -// -// void LoopCompletionQueue(ServerCompletionQueue* cq) { -// void* tag; -// bool ok; -// while (cq->Next(&tag, &ok)) { -// abort(); // Nothing should come out of the cq. -// } -// gpr_log(GPR_ERROR, "returning from thread"); -// } -// -// TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceAsync) { -// EnableDefaultHealthCheckService(true); -// EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); -// SetUpServer(false, false, nullptr); -// cq_thread_ = std::thread(LoopCompletionQueue, cq_.get()); -// VerifyHealthCheckService(); -// -// // The default service has a size limit of the service name. -// const grpc::string kTooLongServiceName(201, 'x'); -// SendHealthCheckRpc(kTooLongServiceName, -// Status(StatusCode::INVALID_ARGUMENT, "")); -// } -// -// // Provide an empty service to disable the default service. -// TEST_F(HealthServiceEnd2endTest, ExplicitlyDisableViaOverride) { -// EnableDefaultHealthCheckService(true); -// EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); -// std::unique_ptr empty_service; -// SetUpServer(true, true, std::move(empty_service)); -// HealthCheckServiceInterface* service = server_->GetHealthCheckService(); -// EXPECT_TRUE(service == nullptr); -// -// ResetStubs(); -// -// SendHealthCheckRpc("", Status(StatusCode::UNIMPLEMENTED, "")); -// } -// -// // Provide an explicit override of health checking service interface. -// TEST_F(HealthServiceEnd2endTest, ExplicitlyOverride) { -// EnableDefaultHealthCheckService(true); -// EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); -// std::unique_ptr override_service( -// new CustomHealthCheckService(&health_check_service_impl_)); -// HealthCheckServiceInterface* underlying_service = override_service.get(); -// SetUpServer(false, true, std::move(override_service)); -// HealthCheckServiceInterface* service = server_->GetHealthCheckService(); -// EXPECT_TRUE(service == underlying_service); -// -// ResetStubs(); -// -// VerifyHealthCheckService(); -// } +TEST_F(HealthServiceEnd2endTest, DefaultHealthService) { + EnableDefaultHealthCheckService(true); + EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); + SetUpServer(true, false, nullptr); + VerifyHealthCheckService(); + + // The default service has a size limit of the service name. + const grpc::string kTooLongServiceName(201, 'x'); + SendHealthCheckRpc(kTooLongServiceName, + Status(StatusCode::INVALID_ARGUMENT, "")); +} + +TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceAsync) { + EnableDefaultHealthCheckService(true); + EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); + SetUpServer(false, false, nullptr); + cq_thread_ = std::thread(LoopCompletionQueue, cq_.get()); + VerifyHealthCheckService(); + + // The default service has a size limit of the service name. + const grpc::string kTooLongServiceName(201, 'x'); + SendHealthCheckRpc(kTooLongServiceName, + Status(StatusCode::INVALID_ARGUMENT, "")); +} + +// Provide an empty service to disable the default service. +TEST_F(HealthServiceEnd2endTest, ExplicitlyDisableViaOverride) { + EnableDefaultHealthCheckService(true); + EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); + std::unique_ptr empty_service; + SetUpServer(true, true, std::move(empty_service)); + HealthCheckServiceInterface* service = server_->GetHealthCheckService(); + EXPECT_TRUE(service == nullptr); + + ResetStubs(); + + SendHealthCheckRpc("", Status(StatusCode::UNIMPLEMENTED, "")); +} + +// Provide an explicit override of health checking service interface. +TEST_F(HealthServiceEnd2endTest, ExplicitlyOverride) { + EnableDefaultHealthCheckService(true); + EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); + std::unique_ptr override_service( + new CustomHealthCheckService(&health_check_service_impl_)); + HealthCheckServiceInterface* underlying_service = override_service.get(); + SetUpServer(false, true, std::move(override_service)); + HealthCheckServiceInterface* service = server_->GetHealthCheckService(); + EXPECT_TRUE(service == underlying_service); + + ResetStubs(); + + VerifyHealthCheckService(); +} } // namespace } // namespace testing From ef163280637a288685bd6f09c548fc02f6bf513f Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 29 Dec 2016 13:21:04 -0800 Subject: [PATCH 019/126] cleanup --- .../health/default_health_check_service.cc | 65 ++++++++----------- .../health/default_health_check_service.h | 41 +++++------- src/cpp/server/server_cc.cc | 22 +++---- 3 files changed, 52 insertions(+), 76 deletions(-) diff --git a/src/cpp/server/health/default_health_check_service.cc b/src/cpp/server/health/default_health_check_service.cc index 26d8fd999fb..9743bd5775e 100644 --- a/src/cpp/server/health/default_health_check_service.cc +++ b/src/cpp/server/health/default_health_check_service.cc @@ -45,12 +45,25 @@ namespace grpc { namespace { - const char kHealthCheckMethodName[] = "/grpc.health.v1.Health/Check"; +} // namespace + +DefaultHealthCheckService::HealthCheckServiceImpl::HealthCheckServiceImpl( + DefaultHealthCheckService* service, bool sync) + : service_(service), method_(nullptr), sync_(sync) { + MethodHandler* handler = nullptr; + if (sync_) { + handler = + new RpcMethodHandler( + std::mem_fn(&HealthCheckServiceImpl::Check), this); + } + method_ = new RpcServiceMethod(kHealthCheckMethodName, RpcMethod::NORMAL_RPC, + handler); + AddMethod(method_); +} -Status CheckHealth(const DefaultHealthCheckService* service, - ServerContext* context, const ByteBuffer* request, - ByteBuffer* response) { +Status DefaultHealthCheckService::HealthCheckServiceImpl::Check( + ServerContext* context, const ByteBuffer* request, ByteBuffer* response) { // Decode request. std::vector slices; request->Dump(&slices); @@ -87,7 +100,7 @@ Status CheckHealth(const DefaultHealthCheckService* service, // Check status from the associated default health checking service. DefaultHealthCheckService::ServingStatus serving_status = - service->GetServingStatus( + service_->GetServingStatus( request_struct.has_service ? request_struct.service : ""); if (serving_status == DefaultHealthCheckService::NOT_FOUND) { return Status(StatusCode::NOT_FOUND, ""); @@ -117,41 +130,8 @@ Status CheckHealth(const DefaultHealthCheckService* service, response->Swap(&response_buffer); return Status::OK; } -} // namespace -DefaultHealthCheckService::SyncHealthCheckServiceImpl:: - SyncHealthCheckServiceImpl(DefaultHealthCheckService* service) - : service_(service) { - auto* handler = - new RpcMethodHandler( - std::mem_fn(&SyncHealthCheckServiceImpl::Check), this); - auto* method = new RpcServiceMethod(kHealthCheckMethodName, - RpcMethod::NORMAL_RPC, handler); - AddMethod(method); -} - -Status DefaultHealthCheckService::SyncHealthCheckServiceImpl::Check( - ServerContext* context, const ByteBuffer* request, ByteBuffer* response) { - return CheckHealth(service_, context, request, response); -} - -DefaultHealthCheckService::AsyncHealthCheckServiceImpl:: - AsyncHealthCheckServiceImpl(DefaultHealthCheckService* service) - : service_(service) { - auto* method = new RpcServiceMethod(kHealthCheckMethodName, - RpcMethod::NORMAL_RPC, nullptr); - AddMethod(method); - method_ = method; -} - -Status DefaultHealthCheckService::AsyncHealthCheckServiceImpl::Check( - ServerContext* context, const ByteBuffer* request, ByteBuffer* response) { - return CheckHealth(service_, context, request, response); -} - -DefaultHealthCheckService::DefaultHealthCheckService() - : sync_service_(new SyncHealthCheckServiceImpl(this)), - async_service_(new AsyncHealthCheckServiceImpl(this)) { +DefaultHealthCheckService::DefaultHealthCheckService() { services_map_.emplace("", true); } @@ -179,4 +159,11 @@ DefaultHealthCheckService::GetServingStatus( return iter->second ? SERVING : NOT_SERVING; } +DefaultHealthCheckService::HealthCheckServiceImpl* +DefaultHealthCheckService::GetHealthCheckService(bool sync) { + GPR_ASSERT(impl_ == nullptr); + impl_.reset(new HealthCheckServiceImpl(this, sync)); + return impl_.get(); +} + } // namespace grpc diff --git a/src/cpp/server/health/default_health_check_service.h b/src/cpp/server/health/default_health_check_service.h index 411aac97138..1ecb0a2ba94 100644 --- a/src/cpp/server/health/default_health_check_service.h +++ b/src/cpp/server/health/default_health_check_service.h @@ -44,47 +44,40 @@ namespace grpc { // Default implementation of HealthCheckServiceInterface. Server will create and // own it. -class DefaultHealthCheckService : public HealthCheckServiceInterface { +class DefaultHealthCheckService final : public HealthCheckServiceInterface { public: - class SyncHealthCheckServiceImpl : public Service { + // The service impl to register with the server. + class HealthCheckServiceImpl : public Service { public: - explicit SyncHealthCheckServiceImpl(DefaultHealthCheckService* service); + HealthCheckServiceImpl(DefaultHealthCheckService* service, bool sync); + Status Check(ServerContext* context, const ByteBuffer* request, ByteBuffer* response); - private: - const DefaultHealthCheckService* service_; - }; + bool sync() { return sync_; } - class AsyncHealthCheckServiceImpl : public Service { - public: - explicit AsyncHealthCheckServiceImpl(DefaultHealthCheckService* service); - Status Check(ServerContext* context, const ByteBuffer* request, - ByteBuffer* response); - const RpcServiceMethod* method() const { return method_; } + // This is only useful for the async mode. It should be called after + // RegisterService returns. + void* server_tag() const { return method_->server_tag(); } private: - const DefaultHealthCheckService* service_; - const RpcServiceMethod* method_; + const DefaultHealthCheckService* const service_; + RpcServiceMethod* method_; + const bool sync_; }; DefaultHealthCheckService(); - void SetServingStatus(const grpc::string& service_name, bool serving) final; - void SetServingStatus(bool serving) final; + void SetServingStatus(const grpc::string& service_name, + bool serving) override; + void SetServingStatus(bool serving) override; enum ServingStatus { NOT_FOUND, SERVING, NOT_SERVING }; ServingStatus GetServingStatus(const grpc::string& service_name) const; - SyncHealthCheckServiceImpl* GetSyncHealthCheckService() const { - return sync_service_.get(); - } - AsyncHealthCheckServiceImpl* GetAsyncHealthCheckService() const { - return async_service_.get(); - } + HealthCheckServiceImpl* GetHealthCheckService(bool sync); private: mutable std::mutex mu_; std::map services_map_; - std::unique_ptr sync_service_; - std::unique_ptr async_service_; + std::unique_ptr impl_; }; } // namespace grpc diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 8a0ad36c535..d9c972c64a0 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -144,14 +144,14 @@ class Server::HealthCheckAsyncRequest final public RegisteredAsyncRequest { public: HealthCheckAsyncRequest( - DefaultHealthCheckService::AsyncHealthCheckServiceImpl* service, + DefaultHealthCheckService::HealthCheckServiceImpl* service, Server* server, ServerCompletionQueue* cq) : RegisteredAsyncRequest(server, &server_context_, &rpc_, cq, this, false), service_(service), server_(server), cq_(cq) { - IssueRequest(service->method()->server_tag(), &payload_, cq); + IssueRequest(service->server_tag(), &payload_, cq); } bool FinalizeResult(void** tag, bool* status) override; @@ -161,7 +161,7 @@ class Server::HealthCheckAsyncRequest final ServerContext* server_context() { return &server_context_; } private: - DefaultHealthCheckService::AsyncHealthCheckServiceImpl* service_; + DefaultHealthCheckService::HealthCheckServiceImpl* service_; Server* const server_; ServerCompletionQueue* const cq_; grpc_byte_buffer* payload_; @@ -610,18 +610,14 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { // Only create default health check service when user did not provide an // explicit one. - DefaultHealthCheckService::AsyncHealthCheckServiceImpl* async_health_service = - nullptr; + DefaultHealthCheckService::HealthCheckServiceImpl* health_service = nullptr; if (health_check_service_ == nullptr && !health_check_service_disabled_ && DefaultHealthCheckServiceEnabled()) { auto* default_hc_service = new DefaultHealthCheckService; health_check_service_.reset(default_hc_service); - if (!sync_server_cqs_->empty()) { // Has sync methods. - RegisterService(nullptr, default_hc_service->GetSyncHealthCheckService()); - } else { - async_health_service = default_hc_service->GetAsyncHealthCheckService(); - RegisterService(nullptr, async_health_service); - } + health_service = + default_hc_service->GetHealthCheckService(!sync_server_cqs_->empty()); + RegisterService(nullptr, health_service); } grpc_server_start(server_); @@ -638,10 +634,10 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { } } - if (async_health_service) { + if (health_service && !health_service->sync()) { for (size_t i = 0; i < num_cqs; i++) { if (cqs[i]->IsFrequentlyPolled()) { - new HealthCheckAsyncRequest(async_health_service, this, cqs[i]); + new HealthCheckAsyncRequest(health_service, this, cqs[i]); } } } From a36ea4be8b3aa665be7b789ce4b4f97506f2ad65 Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 29 Dec 2016 13:45:06 -0800 Subject: [PATCH 020/126] remove file --- ...lth_check_service_server_builder_option.cc | 50 ------------------- 1 file changed, 50 deletions(-) delete mode 100644 src/cpp/ext/health_check_service_server_builder_option.cc diff --git a/src/cpp/ext/health_check_service_server_builder_option.cc b/src/cpp/ext/health_check_service_server_builder_option.cc deleted file mode 100644 index 0d523285e9c..00000000000 --- a/src/cpp/ext/health_check_service_server_builder_option.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - * 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 - -namespace grpc { - -HealthCheckServiceServerBuilderOption::HealthCheckServiceServerBuilderOption( - std::unique_ptr hc) - : hc_(std::move(hc)) {} - -HealthCheckServiceServerBuilderOption::UpdateArguments( - ChannelArguments* args) override { - args->SetPointer(DefaultHealthCheckServiceInterfaceArg(), hc_.release()); -} - -void HealthCheckServiceServerBuilderOption::UpdatePlugins( - std::vector>* plugins) override {} - -} // namespace grpc From b90631d3f08aaea88345a2ce950bf16fbcb77ad0 Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 29 Dec 2016 14:08:13 -0800 Subject: [PATCH 021/126] more cleanup --- .../grpc++/health_check_service_interface.h | 13 ++- ...lth_check_service_server_builder_option.cc | 2 +- src/cpp/server/server_cc.cc | 89 ++++++++++--------- 3 files changed, 56 insertions(+), 48 deletions(-) diff --git a/include/grpc++/health_check_service_interface.h b/include/grpc++/health_check_service_interface.h index 70153d65cbb..0eed7026839 100644 --- a/include/grpc++/health_check_service_interface.h +++ b/include/grpc++/health_check_service_interface.h @@ -38,26 +38,31 @@ namespace grpc { -const char kDefaultHealthCheckServiceInterfaceArg[] = - "grpc.default_health_check_service_interface"; +const char kHealthCheckServiceInterfaceArg[] = + "grpc.health_check_service_interface"; +// The gRPC server uses this interface to expose the health checking service +// without depending on protobuf. class HealthCheckServiceInterface { public: virtual ~HealthCheckServiceInterface() {} + + // Set or change the serving status of the given service_name. virtual void SetServingStatus(const grpc::string& service_name, bool serving) = 0; // Apply to all registered service names. virtual void SetServingStatus(bool serving) = 0; }; -bool DefaultHealthCheckServiceEnabled(); - // Enable/disable the default health checking service. This applies to all C++ // servers created afterwards. For each server, user can override the default // with a HealthCheckServiceServerBuilderOption. // NOT thread safe. void EnableDefaultHealthCheckService(bool enable); +// NOT thread safe. +bool DefaultHealthCheckServiceEnabled(); + } // namespace grpc #endif // GRPCXX_HEALTH_CHECK_SERVICE_INTERFACE_H diff --git a/src/cpp/server/health/health_check_service_server_builder_option.cc b/src/cpp/server/health/health_check_service_server_builder_option.cc index 6680bed2e2b..24264204b35 100644 --- a/src/cpp/server/health/health_check_service_server_builder_option.cc +++ b/src/cpp/server/health/health_check_service_server_builder_option.cc @@ -41,7 +41,7 @@ HealthCheckServiceServerBuilderOption::HealthCheckServiceServerBuilderOption( // Hand over hc_ to the server. void HealthCheckServiceServerBuilderOption::UpdateArguments( ChannelArguments* args) { - args->SetPointer(kDefaultHealthCheckServiceInterfaceArg, hc_.release()); + args->SetPointer(kHealthCheckServiceInterfaceArg, hc_.release()); } void HealthCheckServiceServerBuilderOption::UpdatePlugins( diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index d9c972c64a0..00aea485db9 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -119,6 +119,9 @@ class Server::UnimplementedAsyncResponse final UnimplementedAsyncRequest* const request_; }; +// This is a dummy implementation of the interface so that +// HealthCheckAsyncRequest can get Call from RegisteredAsyncRequest. It does not +// do any reading or writing. class HealthCheckAsyncResponseWriter final : public ServerAsyncStreamingInterface { public: @@ -189,47 +192,6 @@ class Server::HealthCheckAsyncResponse final HealthCheckAsyncRequest* const request_; }; -bool Server::HealthCheckAsyncRequest::FinalizeResult(void** tag, bool* status) { - bool serialization_status = - *status && payload_ && - SerializationTraits::Deserialize( - payload_, &request_, server_->max_receive_message_size()) - .ok(); - RegisteredAsyncRequest::FinalizeResult(tag, status); - *status = serialization_status && *status; - if (*status) { - new HealthCheckAsyncRequest(service_, server_, cq_); - status_ = service_->Check(&server_context_, &request_, &response_); - new HealthCheckAsyncResponse(this); - return false; - } else { - delete this; - return false; - } -} - -Server::HealthCheckAsyncResponse::HealthCheckAsyncResponse( - HealthCheckAsyncRequest* request) - : request_(request) { - ServerContext* context = request_->server_context(); - if (!context->sent_initial_metadata_) { - SendInitialMetadata(context->initial_metadata_, - context->initial_metadata_flags()); - if (context->compression_level_set()) { - set_compression_level(context->compression_level()); - } - context->sent_initial_metadata_ = true; - } - Status* status = request_->status(); - if (status->ok()) { - ServerSendStatus(context->trailing_metadata_, - SendMessage(*request_->response())); - } else { - ServerSendStatus(context->trailing_metadata_, *status); - } - request_->call()->PerformOps(this); -} - class ShutdownTag : public CompletionQueueTag { public: bool FinalizeResult(void** tag, bool* status) { return false; } @@ -490,8 +452,8 @@ Server::Server( args->SetChannelArgs(&channel_args); for (size_t i = 0; i < channel_args.num_args; i++) { - if (0 == strcmp(channel_args.args[i].key, - kDefaultHealthCheckServiceInterfaceArg)) { + if (0 == + strcmp(channel_args.args[i].key, kHealthCheckServiceInterfaceArg)) { if (channel_args.args[i].value.pointer.p == nullptr) { health_check_service_disabled_ = true; } else { @@ -822,6 +784,47 @@ Server::UnimplementedAsyncResponse::UnimplementedAsyncResponse( request_->stream()->call_.PerformOps(this); } +bool Server::HealthCheckAsyncRequest::FinalizeResult(void** tag, bool* status) { + bool serialization_status = + *status && payload_ && + SerializationTraits::Deserialize( + payload_, &request_, server_->max_receive_message_size()) + .ok(); + RegisteredAsyncRequest::FinalizeResult(tag, status); + *status = serialization_status && *status; + if (*status) { + new HealthCheckAsyncRequest(service_, server_, cq_); + status_ = service_->Check(&server_context_, &request_, &response_); + new HealthCheckAsyncResponse(this); + return false; + } else { + delete this; + return false; + } +} + +Server::HealthCheckAsyncResponse::HealthCheckAsyncResponse( + HealthCheckAsyncRequest* request) + : request_(request) { + ServerContext* context = request_->server_context(); + if (!context->sent_initial_metadata_) { + SendInitialMetadata(context->initial_metadata_, + context->initial_metadata_flags()); + if (context->compression_level_set()) { + set_compression_level(context->compression_level()); + } + context->sent_initial_metadata_ = true; + } + Status* status = request_->status(); + if (status->ok()) { + ServerSendStatus(context->trailing_metadata_, + SendMessage(*request_->response())); + } else { + ServerSendStatus(context->trailing_metadata_, *status); + } + request_->call()->PerformOps(this); +} + ServerInitializer* Server::initializer() { return server_initializer_.get(); } } // namespace grpc From 35674af901576b078fe158814fa9d730e09426f6 Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 29 Dec 2016 15:15:12 -0800 Subject: [PATCH 022/126] make test robust --- .../end2end/health_service_end2end_test.cc | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/test/cpp/end2end/health_service_end2end_test.cc b/test/cpp/end2end/health_service_end2end_test.cc index beb84e0a3fc..8a6a9886c9a 100644 --- a/test/cpp/end2end/health_service_end2end_test.cc +++ b/test/cpp/end2end/health_service_end2end_test.cc @@ -132,7 +132,7 @@ class HealthServiceEnd2endTest : public ::testing::Test { protected: HealthServiceEnd2endTest() {} - void SetUpServer(bool register_sync_test_service, + void SetUpServer(bool register_sync_test_service, bool add_async_cq, bool explicit_health_service, std::unique_ptr service) { int port = grpc_pick_unused_port_or_die(); @@ -157,18 +157,21 @@ class HealthServiceEnd2endTest : public ::testing::Test { if (register_sync_health_service_impl) { builder.RegisterService(&health_check_service_impl_); } - cq_ = builder.AddCompletionQueue(); + if (add_async_cq) { + cq_ = builder.AddCompletionQueue(); + } server_ = builder.BuildAndStart(); } void TearDown() override { if (server_) { server_->Shutdown(); - cq_->Shutdown(); + if (cq_ != nullptr) { + cq_->Shutdown(); + } if (cq_thread_.joinable()) { cq_thread_.join(); } - LoopCompletionQueue(cq_.get()); } } @@ -241,7 +244,7 @@ class HealthServiceEnd2endTest : public ::testing::Test { TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceDisabled) { EnableDefaultHealthCheckService(false); EXPECT_FALSE(DefaultHealthCheckServiceEnabled()); - SetUpServer(true, false, nullptr); + SetUpServer(true, false, false, nullptr); HealthCheckServiceInterface* default_service = server_->GetHealthCheckService(); EXPECT_TRUE(default_service == nullptr); @@ -254,7 +257,7 @@ TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceDisabled) { TEST_F(HealthServiceEnd2endTest, DefaultHealthService) { EnableDefaultHealthCheckService(true); EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); - SetUpServer(true, false, nullptr); + SetUpServer(true, false, false, nullptr); VerifyHealthCheckService(); // The default service has a size limit of the service name. @@ -263,11 +266,13 @@ TEST_F(HealthServiceEnd2endTest, DefaultHealthService) { Status(StatusCode::INVALID_ARGUMENT, "")); } -TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceAsync) { +// The server has no sync service. +TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceAsyncOnly) { EnableDefaultHealthCheckService(true); EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); - SetUpServer(false, false, nullptr); + SetUpServer(false, true, false, nullptr); cq_thread_ = std::thread(LoopCompletionQueue, cq_.get()); + VerifyHealthCheckService(); // The default service has a size limit of the service name. @@ -281,7 +286,7 @@ TEST_F(HealthServiceEnd2endTest, ExplicitlyDisableViaOverride) { EnableDefaultHealthCheckService(true); EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); std::unique_ptr empty_service; - SetUpServer(true, true, std::move(empty_service)); + SetUpServer(true, false, true, std::move(empty_service)); HealthCheckServiceInterface* service = server_->GetHealthCheckService(); EXPECT_TRUE(service == nullptr); @@ -297,7 +302,7 @@ TEST_F(HealthServiceEnd2endTest, ExplicitlyOverride) { std::unique_ptr override_service( new CustomHealthCheckService(&health_check_service_impl_)); HealthCheckServiceInterface* underlying_service = override_service.get(); - SetUpServer(false, true, std::move(override_service)); + SetUpServer(false, false, true, std::move(override_service)); HealthCheckServiceInterface* service = server_->GetHealthCheckService(); EXPECT_TRUE(service == underlying_service); From 740ae63a8a816369b18b8ac9602a9acc7cc0b30d Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 21 Oct 2016 13:59:14 -0700 Subject: [PATCH 023/126] Packet coalescing transport layer and end2end test changes --- .../cronet/transport/cronet_api_dummy.c | 3 +- .../cronet/transport/cronet_transport.c | 146 ++++++--- .../CoreCronetEnd2EndTests.m | 4 + src/objective-c/tests/Podfile | 1 + .../tests/Tests.xcodeproj/project.pbxproj | 1 + test/core/end2end/end2end_nosec_tests.c | 10 + test/core/end2end/end2end_tests.c | 8 + test/core/end2end/tests/packet_coalescing.c | 288 ++++++++++++++++++ .../objective_c/Cronet/cronet_c_for_grpc.h | 115 ++++--- 9 files changed, 496 insertions(+), 80 deletions(-) create mode 100644 test/core/end2end/tests/packet_coalescing.c diff --git a/src/core/ext/transport/cronet/transport/cronet_api_dummy.c b/src/core/ext/transport/cronet/transport/cronet_api_dummy.c index 687026c9fde..38755604b97 100644 --- a/src/core/ext/transport/cronet/transport/cronet_api_dummy.c +++ b/src/core/ext/transport/cronet/transport/cronet_api_dummy.c @@ -77,9 +77,8 @@ int cronet_bidirectional_stream_write(cronet_bidirectional_stream* stream, return 0; } -int cronet_bidirectional_stream_cancel(cronet_bidirectional_stream* stream) { +void cronet_bidirectional_stream_cancel(cronet_bidirectional_stream* stream) { GPR_ASSERT(0); - return 0; } #endif /* GRPC_COMPILE_WITH_CRONET */ diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index afc59f4b12a..4063dcaefcb 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -86,7 +86,7 @@ enum e_op_id { /* Cronet callbacks. See cronet_c_for_grpc.h for documentation for each. */ -static void on_request_headers_sent(cronet_bidirectional_stream *); +static void on_stream_ready(cronet_bidirectional_stream *); static void on_response_headers_received( cronet_bidirectional_stream *, const cronet_bidirectional_stream_header_array *, const char *); @@ -99,7 +99,7 @@ static void on_succeeded(cronet_bidirectional_stream *); static void on_failed(cronet_bidirectional_stream *, int); static void on_canceled(cronet_bidirectional_stream *); static cronet_bidirectional_stream_callback cronet_callbacks = { - on_request_headers_sent, + on_stream_ready, on_response_headers_received, on_read_completed, on_write_completed, @@ -151,6 +151,11 @@ struct op_state { bool state_callback_received[OP_NUM_OPS]; bool fail_state; bool flush_read; +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + bool flush_cronet_when_ready; + bool pending_write_for_trailer; +#endif + bool unprocessed_send_message; grpc_error *cancel_error; /* data structure for storing data coming from server */ struct read_state rs; @@ -273,6 +278,9 @@ static void add_to_storage(struct stream_obj *s, grpc_transport_stream_op *op) { new_op->next = storage->head; storage->head = new_op; storage->num_pending_ops++; + if (op->send_message) { + s->state.unprocessed_send_message = true; + } CRONET_LOG(GPR_DEBUG, "adding new op %p. %d in the queue.", new_op, storage->num_pending_ops); gpr_mu_unlock(&s->mu); @@ -405,8 +413,8 @@ static void on_succeeded(cronet_bidirectional_stream *stream) { /* Cronet callback */ -static void on_request_headers_sent(cronet_bidirectional_stream *stream) { - CRONET_LOG(GPR_DEBUG, "W: on_request_headers_sent(%p)", stream); +static void on_stream_ready(cronet_bidirectional_stream *stream) { + CRONET_LOG(GPR_DEBUG, "W: on_stream_ready(%p)", stream); stream_obj *s = (stream_obj *)stream->annotation; gpr_mu_lock(&s->mu); s->state.state_op_done[OP_SEND_INITIAL_METADATA] = true; @@ -416,6 +424,14 @@ static void on_request_headers_sent(cronet_bidirectional_stream *stream) { gpr_free(s->header_array.headers); s->header_array.headers = NULL; } +/* Send the initial metadata on wire if there is no SEND_MESSAGE or + * SEND_TRAILING_METADATA ops pending */ +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + if (s->state.flush_cronet_when_ready) { + CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_flush (%p)", s->cbs); + cronet_bidirectional_stream_flush(stream); + } +#endif gpr_mu_unlock(&s->mu); execute_from_storage(s); } @@ -551,6 +567,10 @@ static void on_response_trailers_received( CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_write (%p, 0)", s->cbs); s->state.state_callback_received[OP_SEND_MESSAGE] = false; cronet_bidirectional_stream_write(s->cbs, "", 0, true); +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_flush (%p)", s->cbs); + cronet_bidirectional_stream_flush(s->cbs); +#endif s->state.state_op_done[OP_SEND_TRAILING_METADATA] = true; gpr_mu_unlock(&s->mu); @@ -598,7 +618,7 @@ static void convert_metadata_to_cronet_headers( curr = curr->next; num_headers_available++; } - /* Allocate enough memory. It is freed in the on_request_headers_sent callback + /* Allocate enough memory. It is freed in the on_stream_ready callback */ cronet_bidirectional_stream_header *headers = (cronet_bidirectional_stream_header *)gpr_malloc( @@ -740,12 +760,16 @@ static bool op_can_be_run(grpc_transport_stream_op *curr_op, else if (!stream_state->state_callback_received[OP_SEND_INITIAL_METADATA]) result = false; /* we haven't sent message yet */ - else if (curr_op->send_message && + else if (stream_state->unprocessed_send_message && !stream_state->state_op_done[OP_SEND_MESSAGE]) result = false; /* we haven't got on_write_completed for the send yet */ else if (stream_state->state_op_done[OP_SEND_MESSAGE] && - !stream_state->state_callback_received[OP_SEND_MESSAGE]) + !stream_state->state_callback_received[OP_SEND_MESSAGE] +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + && !stream_state->pending_write_for_trailer +#endif + ) result = false; } else if (op_id == OP_CANCEL_ERROR) { /* already executed */ @@ -831,6 +855,10 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, s->cbs = cronet_bidirectional_stream_create(s->curr_ct.engine, s->curr_gs, &cronet_callbacks); CRONET_LOG(GPR_DEBUG, "%p = cronet_bidirectional_stream_create()", s->cbs); +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + cronet_bidirectional_stream_disable_auto_flush(s->cbs, true); + cronet_bidirectional_stream_delay_request_headers_until_flush(s->cbs, true); +#endif char *url = NULL; const char *method = "POST"; s->header_array.headers = NULL; @@ -843,30 +871,17 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, cronet_bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, false); stream_state->state_op_done[OP_SEND_INITIAL_METADATA] = true; - result = ACTION_TAKEN_WITH_CALLBACK; - } else if (stream_op->recv_initial_metadata && - op_can_be_run(stream_op, stream_state, &oas->state, - 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_exec_ctx_sched(exec_ctx, stream_op->recv_initial_metadata_ready, - GRPC_ERROR_CANCELLED, NULL); - } else if (stream_state->state_callback_received[OP_FAILED]) { - grpc_exec_ctx_sched( - exec_ctx, stream_op->recv_initial_metadata_ready, - make_error_with_desc(GRPC_STATUS_UNAVAILABLE, "Unavailable."), NULL); - } else { - grpc_chttp2_incoming_metadata_buffer_publish( - &oas->s->state.rs.initial_metadata, stream_op->recv_initial_metadata); - grpc_exec_ctx_sched(exec_ctx, stream_op->recv_initial_metadata_ready, - GRPC_ERROR_NONE, NULL); +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + if (!stream_op->send_message && !stream_op->send_trailing_metadata) { + s->state.flush_cronet_when_ready = true; } - stream_state->state_op_done[OP_RECV_INITIAL_METADATA] = true; - result = ACTION_TAKEN_NO_CALLBACK; +#endif + result = ACTION_TAKEN_WITH_CALLBACK; } else if (stream_op->send_message && op_can_be_run(stream_op, stream_state, &oas->state, OP_SEND_MESSAGE)) { CRONET_LOG(GPR_DEBUG, "running: %p OP_SEND_MESSAGE", oas); + stream_state->unprocessed_send_message = false; if (stream_state->state_callback_received[OP_FAILED]) { result = NO_ACTION_POSSIBLE; CRONET_LOG(GPR_DEBUG, "Stream is either cancelled or failed."); @@ -897,13 +912,63 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_state->state_callback_received[OP_SEND_MESSAGE] = false; cronet_bidirectional_stream_write(s->cbs, stream_state->ws.write_buffer, (int)write_buffer_size, false); +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + if (!stream_op->send_trailing_metadata) { + CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_flush (%p)", + s->cbs); + cronet_bidirectional_stream_flush(s->cbs); + result = ACTION_TAKEN_WITH_CALLBACK; + } else { + stream_state->pending_write_for_trailer = true; + result = ACTION_TAKEN_NO_CALLBACK; + } +#else result = ACTION_TAKEN_WITH_CALLBACK; +#endif } else { result = NO_ACTION_POSSIBLE; } } stream_state->state_op_done[OP_SEND_MESSAGE] = true; oas->state.state_op_done[OP_SEND_MESSAGE] = true; + } else if (stream_op->send_trailing_metadata && + op_can_be_run(stream_op, stream_state, &oas->state, + OP_SEND_TRAILING_METADATA)) { + CRONET_LOG(GPR_DEBUG, "running: %p OP_SEND_TRAILING_METADATA", oas); + if (stream_state->state_callback_received[OP_FAILED]) { + result = NO_ACTION_POSSIBLE; + CRONET_LOG(GPR_DEBUG, "Stream is either cancelled or failed."); + } else { + CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_write (%p, 0)", + s->cbs); + stream_state->state_callback_received[OP_SEND_MESSAGE] = false; + cronet_bidirectional_stream_write(s->cbs, "", 0, true); +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_flush (%p)", s->cbs); + cronet_bidirectional_stream_flush(s->cbs); +#endif + result = ACTION_TAKEN_WITH_CALLBACK; + } + stream_state->state_op_done[OP_SEND_TRAILING_METADATA] = true; + } else if (stream_op->recv_initial_metadata && + op_can_be_run(stream_op, stream_state, &oas->state, + 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_exec_ctx_sched(exec_ctx, stream_op->recv_initial_metadata_ready, + GRPC_ERROR_CANCELLED, NULL); + } else if (stream_state->state_callback_received[OP_FAILED]) { + grpc_exec_ctx_sched( + exec_ctx, stream_op->recv_initial_metadata_ready, + make_error_with_desc(GRPC_STATUS_UNAVAILABLE, "Unavailable."), NULL); + } else { + grpc_chttp2_incoming_metadata_buffer_publish( + &oas->s->state.rs.initial_metadata, stream_op->recv_initial_metadata); + grpc_exec_ctx_sched(exec_ctx, stream_op->recv_initial_metadata_ready, + GRPC_ERROR_NONE, NULL); + } + stream_state->state_op_done[OP_RECV_INITIAL_METADATA] = true; + result = ACTION_TAKEN_NO_CALLBACK; } else if (stream_op->recv_message && op_can_be_run(stream_op, stream_state, &oas->state, OP_RECV_MESSAGE)) { @@ -962,6 +1027,16 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, GRPC_ERROR_NONE, NULL); stream_state->state_op_done[OP_RECV_MESSAGE] = true; oas->state.state_op_done[OP_RECV_MESSAGE] = true; + + /* Extra read to trigger on_succeed */ + stream_state->rs.read_buffer = stream_state->rs.grpc_header_bytes; + stream_state->rs.remaining_bytes = GRPC_HEADER_SIZE_IN_BYTES; + stream_state->rs.received_bytes = 0; + CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_read(%p)", s->cbs); + stream_state->state_op_done[OP_READ_REQ_MADE] = + true; /* Indicates that at least one read request has been made */ + cronet_bidirectional_stream_read(s->cbs, stream_state->rs.read_buffer, + stream_state->rs.remaining_bytes); result = ACTION_TAKEN_NO_CALLBACK; } } else if (stream_state->rs.remaining_bytes == 0) { @@ -1020,21 +1095,6 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, } stream_state->state_op_done[OP_RECV_TRAILING_METADATA] = true; result = ACTION_TAKEN_NO_CALLBACK; - } else if (stream_op->send_trailing_metadata && - op_can_be_run(stream_op, stream_state, &oas->state, - OP_SEND_TRAILING_METADATA)) { - CRONET_LOG(GPR_DEBUG, "running: %p OP_SEND_TRAILING_METADATA", oas); - if (stream_state->state_callback_received[OP_FAILED]) { - result = NO_ACTION_POSSIBLE; - CRONET_LOG(GPR_DEBUG, "Stream is either cancelled or failed."); - } else { - CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_write (%p, 0)", - s->cbs); - stream_state->state_callback_received[OP_SEND_MESSAGE] = false; - cronet_bidirectional_stream_write(s->cbs, "", 0, true); - result = ACTION_TAKEN_WITH_CALLBACK; - } - stream_state->state_op_done[OP_SEND_TRAILING_METADATA] = true; } else if (stream_op->cancel_error && op_can_be_run(stream_op, stream_state, &oas->state, OP_CANCEL_ERROR)) { @@ -1117,6 +1177,10 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, sizeof(s->state.state_callback_received)); s->state.fail_state = s->state.flush_read = false; s->state.cancel_error = NULL; +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + s->state.flush_cronet_when_ready = s->state.pending_write_for_trailer = false; +#endif + s->state.unprocessed_send_message = false; gpr_mu_init(&s->mu); return 0; } diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m index 4ba7badd866..fe9a7c2247b 100644 --- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m +++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m @@ -346,6 +346,10 @@ static char *roots_filename; [self testIndividualCase:"no_op"]; } +- (void)testPacketCoalescing { + [self testIndividualCase:"packet_coalescing"]; +} + - (void)testPayload { [self testIndividualCase:"payload"]; } diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index 5785b976f2d..d1ef0886fe4 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -92,6 +92,7 @@ post_install do |installer| # GPR_UNREACHABLE_CODE causes "Control may reach end of non-void # function" warning config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO' + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_CRONET_WITH_PACKET_COALESCING=1' end end diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index c4a6567ae0e..8455e71b026 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -1296,6 +1296,7 @@ "$(inherited)", "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1", "GRPC_COMPILE_WITH_CRONET=1", + "GRPC_CRONET_WITH_PACKET_COALESCING=1", ); INFOPLIST_FILE = InteropTestsRemoteWithCronet/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.3; diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index 663489082f9..86d6ab9c9a7 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -103,6 +103,8 @@ extern void no_logging(grpc_end2end_test_config config); extern void no_logging_pre_init(void); extern void no_op(grpc_end2end_test_config config); extern void no_op_pre_init(void); +extern void packet_coalescing(grpc_end2end_test_config config); +extern void packet_coalescing_pre_init(void); extern void payload(grpc_end2end_test_config config); extern void payload_pre_init(void); extern void ping(grpc_end2end_test_config config); @@ -135,6 +137,8 @@ extern void streaming_error_response(grpc_end2end_test_config config); extern void streaming_error_response_pre_init(void); extern void trailing_metadata(grpc_end2end_test_config config); extern void trailing_metadata_pre_init(void); +extern void packet_coalescing(grpc_end2end_test_config config); +extern void packet_coalescing_pre_init(void); void grpc_end2end_tests_pre_init(void) { GPR_ASSERT(!g_pre_init_called); @@ -169,6 +173,7 @@ void grpc_end2end_tests_pre_init(void) { network_status_change_pre_init(); no_logging_pre_init(); no_op_pre_init(); + packet_coalescing_pre_init(); payload_pre_init(); ping_pre_init(); ping_pong_streaming_pre_init(); @@ -224,6 +229,7 @@ void grpc_end2end_tests(int argc, char **argv, network_status_change(config); no_logging(config); no_op(config); + packet_coalescing(config); payload(config); ping(config); ping_pong_streaming(config); @@ -364,6 +370,10 @@ void grpc_end2end_tests(int argc, char **argv, no_op(config); continue; } + if (0 == strcmp("packet_coalescing", argv[i])) { + packet_coalescing(config); + continue; + } if (0 == strcmp("payload", argv[i])) { payload(config); continue; diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index 25c7c62fde5..66908bab606 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -105,6 +105,8 @@ extern void no_logging(grpc_end2end_test_config config); extern void no_logging_pre_init(void); extern void no_op(grpc_end2end_test_config config); extern void no_op_pre_init(void); +extern void packet_coalescing(grpc_end2end_test_config config); +extern void packet_coalescing_pre_init(void); extern void payload(grpc_end2end_test_config config); extern void payload_pre_init(void); extern void ping(grpc_end2end_test_config config); @@ -172,6 +174,7 @@ void grpc_end2end_tests_pre_init(void) { network_status_change_pre_init(); no_logging_pre_init(); no_op_pre_init(); + packet_coalescing_pre_init(); payload_pre_init(); ping_pre_init(); ping_pong_streaming_pre_init(); @@ -228,6 +231,7 @@ void grpc_end2end_tests(int argc, char **argv, network_status_change(config); no_logging(config); no_op(config); + packet_coalescing(config); payload(config); ping(config); ping_pong_streaming(config); @@ -372,6 +376,10 @@ void grpc_end2end_tests(int argc, char **argv, no_op(config); continue; } + if (0 == strcmp("packet_coalescing", argv[i])) { + packet_coalescing(config); + continue; + } if (0 == strcmp("payload", argv[i])) { payload(config); continue; diff --git a/test/core/end2end/tests/packet_coalescing.c b/test/core/end2end/tests/packet_coalescing.c new file mode 100644 index 00000000000..d560c57da80 --- /dev/null +++ b/test/core/end2end/tests/packet_coalescing.c @@ -0,0 +1,288 @@ +/* + * + * Copyright 2015, 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 "test/core/end2end/end2end_tests.h" + +#include +#include + +#include +#include +#include +#include +#include +#include "test/core/end2end/cq_verifier.h" + +extern void gpr_default_log(gpr_log_func_args *args); + +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, "%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_time(int n) { + return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(n); +} + +static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } + +static void drain_cq(grpc_completion_queue *cq) { + grpc_event ev; + do { + ev = grpc_completion_queue_next(cq, five_seconds_time(), 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->cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck( + f->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); +} + +static bool coalesced_message_and_eos; + +static void log_processor(gpr_log_func_args *args) { + const int file_len = (int)strlen(args->file); + const char suffix1[] = "secure_endpoint.c"; + const int suffix1_len = sizeof(suffix1) - 1; + const char suffix2[] = "tcp_posix.c"; + const int suffix2_len = sizeof(suffix2) - 1; + const char prefix[] = "READ"; + const int prefix_len = sizeof(prefix) - 1; + if (((file_len >= suffix1_len && + 0 == strcmp(suffix1, &args->file[file_len - suffix1_len])) || + (file_len >= suffix2_len && + 0 == strcmp(suffix2, &args->file[file_len - suffix2_len]))) && + 0 == strncmp(prefix, args->message, (size_t)prefix_len) && + strstr(args->message, + "00 00 10 00 01 00 00 00 01 00 00 00 00 0b 68 65 6c 6c 6f 20 77 " + "6f 72 6c 64")) { + fprintf(stderr, "%s, %s\n", args->file, args->message); + coalesced_message_and_eos = true; + } +} + +/* Request/response with metadata and payload.*/ +static void test_request_response_with_metadata_and_payload( + grpc_end2end_test_config config) { + grpc_call *c; + grpc_call *s; + grpc_slice request_payload_slice = + grpc_slice_from_copied_string("hello world"); + grpc_byte_buffer *request_payload = + grpc_raw_byte_buffer_create(&request_payload_slice, 1); + gpr_timespec deadline = five_seconds_time(); + grpc_metadata meta_c[2] = { + {"key1", "val1", 4, 0, {{NULL, NULL, NULL, NULL}}}, + {"key2", "val2", 4, 0, {{NULL, NULL, NULL, NULL}}}}; + grpc_metadata meta_s[2] = { + {"key3", "val3", 4, 0, {{NULL, NULL, NULL, NULL}}}, + {"key4", "val4", 4, 0, {{NULL, NULL, NULL, NULL}}}}; + grpc_end2end_test_fixture f = begin_test( + config, "test_request_response_with_metadata_and_payload", NULL, NULL); + cq_verifier *cqv = cq_verifier_create(f.cq); + grpc_op ops[6]; + grpc_op *op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_byte_buffer *request_payload_recv = NULL; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + char *details = NULL; + size_t details_capacity = 0; + int was_cancelled = 2; + coalesced_message_and_eos = false; + + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("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 = 2; + op->data.send_initial_metadata.metadata = meta_c; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message = request_payload; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + 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->data.recv_status_on_client.status_details_capacity = &details_capacity; + 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_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 2; + op->data.send_initial_metadata.metadata = meta_s; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message = &request_payload_recv; + 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_verify(cqv); + + 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_STATUS_FROM_SERVER; + op->data.send_status_from_server.trailing_metadata_count = 0; + op->data.send_status_from_server.status = GRPC_STATUS_OK; + op->data.send_status_from_server.status_details = "xyz"; + 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(103), 1); + CQ_EXPECT_COMPLETION(cqv, tag(1), 1); + cq_verify(cqv); + + GPR_ASSERT(status == GRPC_STATUS_OK); + GPR_ASSERT(0 == strcmp(details, "xyz")); + GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); + GPR_ASSERT(was_cancelled == 0); + GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); + GPR_ASSERT(contains_metadata(&request_metadata_recv, "key1", "val1")); + GPR_ASSERT(contains_metadata(&request_metadata_recv, "key2", "val2")); + GPR_ASSERT(coalesced_message_and_eos); + + gpr_free(details); + 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_call_destroy(c); + grpc_call_destroy(s); + + cq_verifier_destroy(cqv); + + grpc_byte_buffer_destroy(request_payload); + grpc_byte_buffer_destroy(request_payload_recv); + + end_test(&f); + config.tear_down_data(&f); +} + +void packet_coalescing(grpc_end2end_test_config config) { + /* The test case does not support the fixture socketpair_one_byte_at_a_time */ + if (0 == strcmp(config.name, "chttp2/socketpair_one_byte_at_a_time")) { + return; + } + gpr_set_log_verbosity(GPR_LOG_SEVERITY_DEBUG); + grpc_tracer_set_enabled("all", 1); + gpr_set_log_function(log_processor); + test_request_response_with_metadata_and_payload(config); + gpr_set_log_function(gpr_default_log); + grpc_tracer_set_enabled("all", 0); +} + +void packet_coalescing_pre_init(void) {} diff --git a/third_party/objective_c/Cronet/cronet_c_for_grpc.h b/third_party/objective_c/Cronet/cronet_c_for_grpc.h index 15a511aebd0..3d58a8370ef 100644 --- a/third_party/objective_c/Cronet/cronet_c_for_grpc.h +++ b/third_party/objective_c/Cronet/cronet_c_for_grpc.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_CRONET_IOS_CRONET_C_FOR_GRPC_H_ #define COMPONENTS_CRONET_IOS_CRONET_C_FOR_GRPC_H_ +#define CRONET_EXPORT __attribute__((visibility("default"))) + #ifdef __cplusplus extern "C" { #endif @@ -15,12 +17,10 @@ extern "C" { /* Opaque object representing Cronet Engine. Created and configured outside * of this API to facilitate sharing with other components */ -typedef struct cronet_engine { void* obj; } cronet_engine; - -void cronet_engine_add_quic_hint(cronet_engine* engine, - const char* host, - int port, - int alternate_port); +typedef struct cronet_engine { + void* obj; + void* annotation; +} cronet_engine; /* Cronet Bidirectional Stream API */ @@ -45,11 +45,12 @@ typedef struct cronet_bidirectional_stream_header_array { /* Set of callbacks used to receive callbacks from bidirectional stream. */ typedef struct cronet_bidirectional_stream_callback { - /* Invoked when request headers are sent. Indicates that stream has initiated - * the request. Consumer may call cronet_bidirectional_stream_write() to start - * writing data. + /* Invoked when the stream is ready for reading and writing. + * Consumer may call cronet_bidirectional_stream_read() to start reading data. + * Consumer may call cronet_bidirectional_stream_write() to start writing + * data. */ - void (*on_request_headers_sent)(cronet_bidirectional_stream* stream); + void (*on_stream_ready)(cronet_bidirectional_stream* stream); /* Invoked when initial response headers are received. * Consumer must call cronet_bidirectional_stream_read() to start reading. @@ -67,20 +68,19 @@ typedef struct cronet_bidirectional_stream_callback { * It may be invoked after on_response_trailers_received()}, if there was * pending read data before trailers were received. * - * If count is 0, it means the remote side has signaled that it will send no - * more data; future calls to cronet_bidirectional_stream_read() will result - * in the on_data_read() callback or on_succeded() callback if + * If |bytes_read| is 0, it means the remote side has signaled that it will + * send no more data; future calls to cronet_bidirectional_stream_read() + * will result in the on_data_read() callback or on_succeded() callback if * cronet_bidirectional_stream_write() was invoked with end_of_stream set to * true. */ void (*on_read_completed)(cronet_bidirectional_stream* stream, char* data, - int count); + int bytes_read); /** * Invoked when all data passed to cronet_bidirectional_stream_write() is - * sent. - * To continue writing, call cronet_bidirectional_stream_write(). + * sent. To continue writing, call cronet_bidirectional_stream_write(). */ void (*on_write_completed)(cronet_bidirectional_stream* stream, const char* data); @@ -117,7 +117,7 @@ typedef struct cronet_bidirectional_stream_callback { void (*on_canceled)(cronet_bidirectional_stream* stream); } cronet_bidirectional_stream_callback; -/* Create a new stream object that uses |engine| and |callback|. All stream +/* Creates a new stream object that uses |engine| and |callback|. All stream * tasks are performed asynchronously on the |engine| network thread. |callback| * methods are invoked synchronously on the |engine| network thread, but must * not run tasks on the current thread to prevent blocking networking operations @@ -129,6 +129,7 @@ typedef struct cronet_bidirectional_stream_callback { * * Both |calback| and |engine| must remain valid until stream is destroyed. */ +CRONET_EXPORT cronet_bidirectional_stream* cronet_bidirectional_stream_create( cronet_engine* engine, void* annotation, @@ -136,15 +137,40 @@ cronet_bidirectional_stream* cronet_bidirectional_stream_create( /* TBD: The following methods return int. Should it be a custom type? */ -/* Destroy stream object. Destroy could be called from any thread, including +/* Destroys stream object. Destroy could be called from any thread, including * network thread, but is posted, so |stream| is valid until calling task is * complete. */ +CRONET_EXPORT int cronet_bidirectional_stream_destroy(cronet_bidirectional_stream* stream); -/* Start the stream by sending request to |url| using |method| and |headers|. If - * |end_of_stream| is true, then no data is expected to be written. +/** + * Disables or enables auto flush. By default, data is flushed after + * every cronet_bidirectional_stream_write(). If the auto flush is disabled, + * the client should explicitly call cronet_bidirectional_stream_flush to flush + * the data. + */ +CRONET_EXPORT void cronet_bidirectional_stream_disable_auto_flush( + cronet_bidirectional_stream* stream, + bool disable_auto_flush); + +/** + * Delays sending request headers until cronet_bidirectional_stream_flush() + * is called. This flag is currently only respected when QUIC is negotiated. + * When true, QUIC will send request header frame along with data frame(s) + * as a single packet when possible. + */ +CRONET_EXPORT +void cronet_bidirectional_stream_delay_request_headers_until_flush( + cronet_bidirectional_stream* stream, + bool delay_headers_until_flush); + +/* Starts the stream by sending request to |url| using |method| and |headers|. + * If |end_of_stream| is true, then no data is expected to be written. The + * |method| is HTTP verb, with PUT having a special meaning to mark idempotent + * request, which could use QUIC 0-RTT. */ +CRONET_EXPORT int cronet_bidirectional_stream_start( cronet_bidirectional_stream* stream, const char* url, @@ -153,46 +179,61 @@ int cronet_bidirectional_stream_start( const cronet_bidirectional_stream_header_array* headers, bool end_of_stream); -/* Read response data into |buffer| of |capacity| length. Must only be called at - * most once in response to each invocation of the - * on_response_headers_received() and on_read_completed() methods of the - * cronet_bidirectional_stream_callback. - * Each call will result in an invocation of one of the callback's - * on_read_completed method if data is read, its on_succeeded() method if - * the stream is closed, or its on_failed() method if there's an error. +/* Reads response data into |buffer| of |capacity| length. Must only be called + * at most once in response to each invocation of the + * on_stream_ready()/on_response_headers_received() and on_read_completed() + * methods of the cronet_bidirectional_stream_callback. + * Each call will result in an invocation of the callback's + * on_read_completed() method if data is read, or its on_failed() method if + * there's an error. The callback's on_succeeded() method is also invoked if + * there is no more data to read and |end_of_stream| was previously sent. */ +CRONET_EXPORT int cronet_bidirectional_stream_read(cronet_bidirectional_stream* stream, char* buffer, int capacity); -/* Read response data into |buffer| of |capacity| length. Must only be called at - * most once in response to each invocation of the - * on_response_headers_received() and on_read_completed() methods of the - * cronet_bidirectional_stream_callback. - * Each call will result in an invocation of one of the callback's - * on_read_completed method if data is read, its on_succeeded() method if - * the stream is closed, or its on_failed() method if there's an error. +/* Writes request data from |buffer| of |buffer_length| length. If auto flush is + * disabled, data will be sent only after cronet_bidirectional_stream_flush() is + * called. + * Each call will result in an invocation the callback's on_write_completed() + * method if data is sent, or its on_failed() method if there's an error. + * The callback's on_succeeded() method is also invoked if |end_of_stream| is + * set and all response data has been read. */ +CRONET_EXPORT int cronet_bidirectional_stream_write(cronet_bidirectional_stream* stream, const char* buffer, - int count, + int buffer_length, bool end_of_stream); +/** + * Flushes pending writes. This method should not be called before invocation of + * on_stream_ready() method of the cronet_bidirectional_stream_callback. + * For each previously called cronet_bidirectional_stream_write() + * a corresponding on_write_completed() callback will be invoked when the buffer + * is sent. + */ +CRONET_EXPORT +void cronet_bidirectional_stream_flush(cronet_bidirectional_stream* stream); + /* Cancels the stream. Can be called at any time after * cronet_bidirectional_stream_start(). The on_canceled() method of * cronet_bidirectional_stream_callback will be invoked when cancelation * is complete and no further callback methods will be invoked. If the * stream has completed or has not started, calling * cronet_bidirectional_stream_cancel() has no effect and on_canceled() will not - * be invoked. At most one callback method may be invoked after + * be invoked. At most one callback method may be invoked after * cronet_bidirectional_stream_cancel() has completed. */ -int cronet_bidirectional_stream_cancel(cronet_bidirectional_stream* stream); +CRONET_EXPORT +void cronet_bidirectional_stream_cancel(cronet_bidirectional_stream* stream); /* Returns true if the |stream| was successfully started and is now done * (succeeded, canceled, or failed). * Returns false if the |stream| stream is not yet started or is in progress. */ +CRONET_EXPORT bool cronet_bidirectional_stream_is_done(cronet_bidirectional_stream* stream); #ifdef __cplusplus From 8bd6a0542b7d3ad08497e14fce5470cb50c7bc87 Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 4 Jan 2017 13:10:30 -0800 Subject: [PATCH 024/126] remove copyright from generated files --- ...alth_check_service_server_builder_option.h | 3 +- src/cpp/server/health/health.pb.c | 32 ------------------- src/cpp/server/health/health.pb.h | 32 ------------------- 3 files changed, 2 insertions(+), 65 deletions(-) diff --git a/include/grpc++/ext/health_check_service_server_builder_option.h b/include/grpc++/ext/health_check_service_server_builder_option.h index 2dd1e6dd329..4861daacd40 100644 --- a/include/grpc++/ext/health_check_service_server_builder_option.h +++ b/include/grpc++/ext/health_check_service_server_builder_option.h @@ -44,7 +44,8 @@ namespace grpc { class HealthCheckServiceServerBuilderOption : public ServerBuilderOption { public: - // Use nullptr to disable default service. + // The ownership of hc will be taken and transferred to the grpc server. + // To explicitly disable default service, pass in a nullptr. explicit HealthCheckServiceServerBuilderOption( std::unique_ptr hc); ~HealthCheckServiceServerBuilderOption() override {} diff --git a/src/cpp/server/health/health.pb.c b/src/cpp/server/health/health.pb.c index 1fca2c55c84..09bd98a3d97 100644 --- a/src/cpp/server/health/health.pb.c +++ b/src/cpp/server/health/health.pb.c @@ -1,35 +1,3 @@ -/* - * - * 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. - * - */ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.3.7-dev */ diff --git a/src/cpp/server/health/health.pb.h b/src/cpp/server/health/health.pb.h index dc790fb1035..7051b3260ac 100644 --- a/src/cpp/server/health/health.pb.h +++ b/src/cpp/server/health/health.pb.h @@ -1,35 +1,3 @@ -/* - * - * 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. - * - */ /* Automatically generated nanopb header */ /* Generated by nanopb-0.3.7-dev */ From 26d20a8016feaeb0a2fe182505ee60960fb03275 Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 4 Jan 2017 13:12:39 -0800 Subject: [PATCH 025/126] exclude newly added file from copyright check --- tools/distrib/check_copyright.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 718bb563f3a..4f9655e9950 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -105,6 +105,8 @@ _EXEMPT = frozenset(( 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h', 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', + 'src/cpp/server/health/health.pb.h', + 'src/cpp/server/health/health.pb.c', # An older file originally from outside gRPC. 'src/php/tests/bootstrap.php', From 8803ae8c3a643f35d15c9269872d3c1fd2cc8409 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 3 Jan 2017 21:16:05 -0800 Subject: [PATCH 026/126] build changes --- Makefile | 2 + test/core/end2end/end2end_nosec_tests.c | 2 - test/core/end2end/gen_build_yaml.py | 3 +- .../generated/sources_and_headers.json | 2 + tools/run_tests/generated/tests.json | 738 +++++++++++++++++- .../end2end_nosec_tests.vcxproj | 2 + .../end2end_nosec_tests.vcxproj.filters | 3 + .../tests/end2end_tests/end2end_tests.vcxproj | 2 + .../end2end_tests.vcxproj.filters | 3 + 9 files changed, 745 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 8f7328ae285..66e992ef09a 100644 --- a/Makefile +++ b/Makefile @@ -7199,6 +7199,7 @@ LIBEND2END_TESTS_SRC = \ test/core/end2end/tests/network_status_change.c \ test/core/end2end/tests/no_logging.c \ test/core/end2end/tests/no_op.c \ + test/core/end2end/tests/packet_coalescing.c \ test/core/end2end/tests/payload.c \ test/core/end2end/tests/ping.c \ test/core/end2end/tests/ping_pong_streaming.c \ @@ -7285,6 +7286,7 @@ LIBEND2END_NOSEC_TESTS_SRC = \ test/core/end2end/tests/network_status_change.c \ test/core/end2end/tests/no_logging.c \ test/core/end2end/tests/no_op.c \ + test/core/end2end/tests/packet_coalescing.c \ test/core/end2end/tests/payload.c \ test/core/end2end/tests/ping.c \ test/core/end2end/tests/ping_pong_streaming.c \ diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index 86d6ab9c9a7..0581607e808 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -137,8 +137,6 @@ extern void streaming_error_response(grpc_end2end_test_config config); extern void streaming_error_response_pre_init(void); extern void trailing_metadata(grpc_end2end_test_config config); extern void trailing_metadata_pre_init(void); -extern void packet_coalescing(grpc_end2end_test_config config); -extern void packet_coalescing_pre_init(void); void grpc_end2end_tests_pre_init(void) { GPR_ASSERT(!g_pre_init_called); diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index 201a92a1fdc..3ae2b2cb9c9 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -91,6 +91,7 @@ LOWCPU = 0.1 # maps test names to options END2END_TESTS = { + 'authority_not_supported': default_test_options, 'bad_hostname': default_test_options, 'binary_metadata': default_test_options, 'resource_quota_server': default_test_options._replace(large_writes=True, @@ -125,6 +126,7 @@ END2END_TESTS = { 'network_status_change': default_test_options, 'no_logging': default_test_options._replace(traceable=False), 'no_op': default_test_options, + 'packet_coalescing': default_test_options, 'payload': default_test_options, 'load_reporting_hook': default_test_options, 'ping_pong_streaming': default_test_options, @@ -142,7 +144,6 @@ END2END_TESTS = { 'simple_request': default_test_options, 'streaming_error_response': default_test_options, 'trailing_metadata': default_test_options, - 'authority_not_supported': default_test_options, } diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 6ae269cc20d..a96856c1ab9 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -6347,6 +6347,7 @@ "test/core/end2end/tests/network_status_change.c", "test/core/end2end/tests/no_logging.c", "test/core/end2end/tests/no_op.c", + "test/core/end2end/tests/packet_coalescing.c", "test/core/end2end/tests/payload.c", "test/core/end2end/tests/ping.c", "test/core/end2end/tests/ping_pong_streaming.c", @@ -6416,6 +6417,7 @@ "test/core/end2end/tests/network_status_change.c", "test/core/end2end/tests/no_logging.c", "test/core/end2end/tests/no_op.c", + "test/core/end2end/tests/packet_coalescing.c", "test/core/end2end/tests/payload.c", "test/core/end2end/tests/ping.c", "test/core/end2end/tests/ping_pong_streaming.c", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index b76263b8b98..0ba2f2a6f48 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -5712,6 +5712,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_census_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -6795,6 +6818,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -7847,6 +7893,28 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_fakesec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -8843,6 +8911,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_fd_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -9880,6 +9971,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -10837,6 +10951,25 @@ "linux" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, { "args": [ "payload" @@ -11810,6 +11943,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -12922,6 +13078,30 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_http_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -14021,6 +14201,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_load_reporting_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -15133,6 +15336,30 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_oauth2_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -16165,6 +16392,30 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -17151,7 +17402,7 @@ }, { "args": [ - "payload" + "packet_coalescing" ], "ci_platforms": [ "windows", @@ -17175,7 +17426,7 @@ }, { "args": [ - "ping_pong_streaming" + "payload" ], "ci_platforms": [ "windows", @@ -17199,7 +17450,7 @@ }, { "args": [ - "registered_call" + "ping_pong_streaming" ], "ci_platforms": [ "windows", @@ -17223,14 +17474,14 @@ }, { "args": [ - "request_with_flags" + "registered_call" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17247,14 +17498,14 @@ }, { "args": [ - "request_with_payload" + "request_with_flags" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17271,7 +17522,7 @@ }, { "args": [ - "resource_quota_server" + "request_with_payload" ], "ci_platforms": [ "windows", @@ -17295,7 +17546,31 @@ }, { "args": [ - "server_finishes_request" + "resource_quota_server" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "server_finishes_request" ], "ci_platforms": [ "windows", @@ -18109,6 +18384,30 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -19149,6 +19448,32 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [ + "msan" + ], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_1byte_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -20202,6 +20527,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -21285,6 +21633,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_cert_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -22301,6 +22672,30 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_ssl_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -23303,6 +23698,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "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": [ "payload" @@ -24363,6 +24781,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_census_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -25423,6 +25864,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -26412,6 +26876,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_fd_nosec_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -27426,6 +27913,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -28364,6 +28874,25 @@ "linux" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_nosec_test", + "platforms": [ + "linux" + ] + }, { "args": [ "payload" @@ -29314,6 +29843,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -30402,6 +30954,30 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_http_proxy_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -31478,6 +32054,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_load_reporting_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -32470,6 +33069,30 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_proxy_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -33430,6 +34053,30 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -34366,6 +35013,30 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair+trace_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -35380,6 +36051,32 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [ + "msan" + ], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_1byte_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" @@ -36385,6 +37082,29 @@ "posix" ] }, + { + "args": [ + "packet_coalescing" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_uds_nosec_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, { "args": [ "payload" 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 4fb8f8f4a15..196d924287f 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 @@ -215,6 +215,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 ff82a4dd43c..73801e36354 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 @@ -97,6 +97,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 0b7d7c2e752..7b1701005db 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj @@ -217,6 +217,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 e641930e64a..2b707651768 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 @@ -100,6 +100,9 @@ test\core\end2end\tests + + test\core\end2end\tests + test\core\end2end\tests From dc739bd659384252ae31234a439f1abcd7a512ff Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 5 Jan 2017 21:04:40 -0800 Subject: [PATCH 027/126] Remove packet coalescing testing on chttp2 --- Makefile | 2 - .../CoreCronetEnd2EndTests.m | 9 +- 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/tests/packet_coalescing.c | 4 - .../generated/sources_and_headers.json | 2 - tools/run_tests/generated/tests.json | 736 +----------------- .../end2end_nosec_tests.vcxproj | 2 - .../end2end_nosec_tests.vcxproj.filters | 3 - .../tests/end2end_tests/end2end_tests.vcxproj | 2 - .../end2end_tests.vcxproj.filters | 3 - 12 files changed, 16 insertions(+), 764 deletions(-) diff --git a/Makefile b/Makefile index 66e992ef09a..8f7328ae285 100644 --- a/Makefile +++ b/Makefile @@ -7199,7 +7199,6 @@ LIBEND2END_TESTS_SRC = \ test/core/end2end/tests/network_status_change.c \ test/core/end2end/tests/no_logging.c \ test/core/end2end/tests/no_op.c \ - test/core/end2end/tests/packet_coalescing.c \ test/core/end2end/tests/payload.c \ test/core/end2end/tests/ping.c \ test/core/end2end/tests/ping_pong_streaming.c \ @@ -7286,7 +7285,6 @@ LIBEND2END_NOSEC_TESTS_SRC = \ test/core/end2end/tests/network_status_change.c \ test/core/end2end/tests/no_logging.c \ test/core/end2end/tests/no_op.c \ - test/core/end2end/tests/packet_coalescing.c \ test/core/end2end/tests/payload.c \ test/core/end2end/tests/ping.c \ test/core/end2end/tests/ping_pong_streaming.c \ diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m index fe9a7c2247b..315d9424845 100644 --- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m +++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m @@ -168,6 +168,9 @@ static grpc_end2end_test_config configs[] = { chttp2_tear_down_secure_fullstack}, }; +extern void packet_coalescing(grpc_end2end_test_config config); +extern void packet_coalescing_pre_init(void); + static char *roots_filename; @interface CoreCronetEnd2EndTests : XCTestCase @@ -347,7 +350,11 @@ static char *roots_filename; } - (void)testPacketCoalescing { - [self testIndividualCase:"packet_coalescing"]; + // Directly invoke the test function since the test is for Cronet only and thus not included in + // end2end_tests.c + // TODO (mxyan): Do the same to all test cases so that this file will no longer depend on + // end2end_tests.c + packet_coalescing(configs[0]); } - (void)testPayload { diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index 0581607e808..663489082f9 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -103,8 +103,6 @@ extern void no_logging(grpc_end2end_test_config config); extern void no_logging_pre_init(void); extern void no_op(grpc_end2end_test_config config); extern void no_op_pre_init(void); -extern void packet_coalescing(grpc_end2end_test_config config); -extern void packet_coalescing_pre_init(void); extern void payload(grpc_end2end_test_config config); extern void payload_pre_init(void); extern void ping(grpc_end2end_test_config config); @@ -171,7 +169,6 @@ void grpc_end2end_tests_pre_init(void) { network_status_change_pre_init(); no_logging_pre_init(); no_op_pre_init(); - packet_coalescing_pre_init(); payload_pre_init(); ping_pre_init(); ping_pong_streaming_pre_init(); @@ -227,7 +224,6 @@ void grpc_end2end_tests(int argc, char **argv, network_status_change(config); no_logging(config); no_op(config); - packet_coalescing(config); payload(config); ping(config); ping_pong_streaming(config); @@ -368,10 +364,6 @@ void grpc_end2end_tests(int argc, char **argv, no_op(config); continue; } - if (0 == strcmp("packet_coalescing", argv[i])) { - packet_coalescing(config); - continue; - } if (0 == strcmp("payload", argv[i])) { payload(config); continue; diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index 66908bab606..25c7c62fde5 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -105,8 +105,6 @@ extern void no_logging(grpc_end2end_test_config config); extern void no_logging_pre_init(void); extern void no_op(grpc_end2end_test_config config); extern void no_op_pre_init(void); -extern void packet_coalescing(grpc_end2end_test_config config); -extern void packet_coalescing_pre_init(void); extern void payload(grpc_end2end_test_config config); extern void payload_pre_init(void); extern void ping(grpc_end2end_test_config config); @@ -174,7 +172,6 @@ void grpc_end2end_tests_pre_init(void) { network_status_change_pre_init(); no_logging_pre_init(); no_op_pre_init(); - packet_coalescing_pre_init(); payload_pre_init(); ping_pre_init(); ping_pong_streaming_pre_init(); @@ -231,7 +228,6 @@ void grpc_end2end_tests(int argc, char **argv, network_status_change(config); no_logging(config); no_op(config); - packet_coalescing(config); payload(config); ping(config); ping_pong_streaming(config); @@ -376,10 +372,6 @@ void grpc_end2end_tests(int argc, char **argv, no_op(config); continue; } - if (0 == strcmp("packet_coalescing", argv[i])) { - packet_coalescing(config); - continue; - } if (0 == strcmp("payload", argv[i])) { payload(config); continue; diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index 3ae2b2cb9c9..78779908a94 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -126,7 +126,6 @@ END2END_TESTS = { 'network_status_change': default_test_options, 'no_logging': default_test_options._replace(traceable=False), 'no_op': default_test_options, - 'packet_coalescing': default_test_options, 'payload': default_test_options, 'load_reporting_hook': default_test_options, 'ping_pong_streaming': default_test_options, diff --git a/test/core/end2end/tests/packet_coalescing.c b/test/core/end2end/tests/packet_coalescing.c index d560c57da80..336f765a13f 100644 --- a/test/core/end2end/tests/packet_coalescing.c +++ b/test/core/end2end/tests/packet_coalescing.c @@ -273,10 +273,6 @@ static void test_request_response_with_metadata_and_payload( } void packet_coalescing(grpc_end2end_test_config config) { - /* The test case does not support the fixture socketpair_one_byte_at_a_time */ - if (0 == strcmp(config.name, "chttp2/socketpair_one_byte_at_a_time")) { - return; - } gpr_set_log_verbosity(GPR_LOG_SEVERITY_DEBUG); grpc_tracer_set_enabled("all", 1); gpr_set_log_function(log_processor); diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index a96856c1ab9..6ae269cc20d 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -6347,7 +6347,6 @@ "test/core/end2end/tests/network_status_change.c", "test/core/end2end/tests/no_logging.c", "test/core/end2end/tests/no_op.c", - "test/core/end2end/tests/packet_coalescing.c", "test/core/end2end/tests/payload.c", "test/core/end2end/tests/ping.c", "test/core/end2end/tests/ping_pong_streaming.c", @@ -6417,7 +6416,6 @@ "test/core/end2end/tests/network_status_change.c", "test/core/end2end/tests/no_logging.c", "test/core/end2end/tests/no_op.c", - "test/core/end2end/tests/packet_coalescing.c", "test/core/end2end/tests/payload.c", "test/core/end2end/tests/ping.c", "test/core/end2end/tests/ping_pong_streaming.c", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 0ba2f2a6f48..b76263b8b98 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -5712,29 +5712,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_census_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -6818,29 +6795,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_compress_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -7893,28 +7847,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_fakesec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -8911,29 +8843,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_fd_test", - "platforms": [ - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -9971,29 +9880,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_full_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -10951,25 +10837,6 @@ "linux" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_full+pipe_test", - "platforms": [ - "linux" - ] - }, { "args": [ "payload" @@ -11943,29 +11810,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_full+trace_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -13078,30 +12922,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_http_proxy_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -14201,29 +14021,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_load_reporting_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -15336,30 +15133,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_oauth2_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -16392,30 +16165,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_proxy_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -17402,7 +17151,7 @@ }, { "args": [ - "packet_coalescing" + "payload" ], "ci_platforms": [ "windows", @@ -17426,7 +17175,7 @@ }, { "args": [ - "payload" + "ping_pong_streaming" ], "ci_platforms": [ "windows", @@ -17450,7 +17199,7 @@ }, { "args": [ - "ping_pong_streaming" + "registered_call" ], "ci_platforms": [ "windows", @@ -17474,14 +17223,14 @@ }, { "args": [ - "registered_call" + "request_with_flags" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17498,14 +17247,14 @@ }, { "args": [ - "request_with_flags" + "request_with_payload" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17522,31 +17271,7 @@ }, { "args": [ - "request_with_payload" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_sockpair_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "resource_quota_server" + "resource_quota_server" ], "ci_platforms": [ "windows", @@ -18384,30 +18109,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_sockpair+trace_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -19448,32 +19149,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [ - "msan" - ], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_sockpair_1byte_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -20527,29 +20202,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -21633,29 +21285,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl_cert_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -22672,30 +22301,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_ssl_proxy_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -23698,29 +23303,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "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": [ "payload" @@ -24781,29 +24363,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_census_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -25864,29 +25423,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_compress_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -26876,29 +26412,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_fd_nosec_test", - "platforms": [ - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -27913,29 +27426,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_full_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -28874,25 +28364,6 @@ "linux" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_full+pipe_nosec_test", - "platforms": [ - "linux" - ] - }, { "args": [ "payload" @@ -29843,29 +29314,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_full+trace_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -30954,30 +30402,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_http_proxy_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -32054,29 +31478,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_load_reporting_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -33069,30 +32470,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_proxy_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -34053,30 +33430,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_sockpair_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -35013,30 +34366,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_sockpair+trace_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -36051,32 +35380,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [ - "msan" - ], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_sockpair_1byte_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" @@ -37082,29 +36385,6 @@ "posix" ] }, - { - "args": [ - "packet_coalescing" - ], - "ci_platforms": [ - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [ - "uv" - ], - "flaky": false, - "language": "c", - "name": "h2_uds_nosec_test", - "platforms": [ - "linux", - "mac", - "posix" - ] - }, { "args": [ "payload" 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 196d924287f..4fb8f8f4a15 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 @@ -215,8 +215,6 @@ - - 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 73801e36354..ff82a4dd43c 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 @@ -97,9 +97,6 @@ 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 7b1701005db..0b7d7c2e752 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj @@ -217,8 +217,6 @@ - - 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 2b707651768..e641930e64a 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 @@ -100,9 +100,6 @@ test\core\end2end\tests - - test\core\end2end\tests - test\core\end2end\tests From 850fcb97d235a5fe977d5aa8489fbcab5c837c50 Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 11 Jan 2017 14:26:15 -0800 Subject: [PATCH 028/126] typo --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index 350ed1baf0b..9842015b06b 100644 --- a/BUILD +++ b/BUILD @@ -1100,7 +1100,7 @@ grpc_cc_library( "src/cpp/client/create_channel_internal.h", "src/cpp/common/channel_filter.h", "src/cpp/server/dynamic_thread_pool.h", - "src/cpp/server/health/defult_health_check_service.h", + "src/cpp/server/health/default_health_check_service.h", "src/cpp/server/health/health.pb.h", "src/cpp/server/thread_pool_interface.h", "src/cpp/thread_manager/thread_manager.h", From 8fe20bf093a96a50d0e1021e51f26c9e418fcb65 Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 12 Jan 2017 10:33:12 -0800 Subject: [PATCH 029/126] typo --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index 9842015b06b..9738085ee37 100644 --- a/BUILD +++ b/BUILD @@ -1117,7 +1117,7 @@ grpc_cc_library( "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", - "include/grpc++/health_check_service_interfac.h", + "include/grpc++/health_check_service_interface.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/codegen/core_codegen.h", From b0bd22dfc7116975245c6d15fcc9485a25885845 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 20 Jan 2017 17:06:23 -0800 Subject: [PATCH 030/126] Test packet coalescing using TLS endpoint --- .../tests/CronetUnitTests/CronetUnitTests.m | 228 +++++++++++++++++- 1 file changed, 225 insertions(+), 3 deletions(-) diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m index dbd28076ddb..dcd7f2fa8db 100644 --- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m +++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m @@ -50,6 +50,9 @@ #import "src/core/lib/support/string.h" #import "src/core/lib/support/tmpfile.h" #import "test/core/util/test_config.h" +#import "test/core/end2end/data/ssl_test_data.h" + +#import static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; @@ -77,20 +80,70 @@ static void drain_cq(grpc_completion_queue *cq) { grpc_init(); [Cronet setHttp2Enabled:YES]; + [Cronet setSslKeyLogFileName:@"Documents/key"]; + [Cronet enableTestCertVerifierForTesting]; NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; NSLog(@"Documents directory: %@", url); [Cronet start]; [Cronet startNetLogToFile:@"Documents/cronet_netlog.json" logBytes:YES]; + + init_ssl(); } + (void)tearDown { grpc_shutdown(); + cleanup_ssl(); [super tearDown]; } +void init_ssl(void) { + SSL_load_error_strings(); + OpenSSL_add_ssl_algorithms(); +} + +void cleanup_ssl(void) { + EVP_cleanup(); +} + +int alpn_cb(SSL *ssl, const unsigned char **out, unsigned char *outlen, + const unsigned char *in, unsigned int inlen, void *arg) { + // Always select "h2" as the ALPN protocol to be used + *out = (const unsigned char*)"h2"; + *outlen = 2; + return SSL_TLSEXT_ERR_OK; +} + +void init_ctx(SSL_CTX *ctx) { + // Install server certificate + BIO *pem = BIO_new_mem_buf((void*)test_server1_cert, (int)strlen(test_server1_cert)); + X509 *cert = PEM_read_bio_X509_AUX(pem, NULL, NULL, ""); + SSL_CTX_use_certificate(ctx, cert); + X509_free(cert); + BIO_free(pem); + + // Install server private key + pem = BIO_new_mem_buf((void *)test_server1_key, (int)strlen(test_server1_key)); + EVP_PKEY *key = PEM_read_bio_PrivateKey(pem, NULL, NULL, ""); + SSL_CTX_use_PrivateKey(ctx, key); + EVP_PKEY_free(key); + BIO_free(pem); + + // Select cipher suite + SSL_CTX_set_cipher_list(ctx, "ECDHE-RSA-AES128-GCM-SHA256"); + + // Select ALPN protocol + SSL_CTX_set_alpn_select_cb(ctx, alpn_cb, NULL); +} + +unsigned int parse_h2_length(const char *field) { + return ((unsigned int)(unsigned char)(field[0])) * 65536 + + ((unsigned int)(unsigned char)(field[1])) * 256 + + ((unsigned int)(unsigned char)(field[2])); +} + - (void)testInternalError { grpc_call *c; grpc_slice request_payload_slice = @@ -106,7 +159,7 @@ static void drain_cq(grpc_completion_queue *cq) { char *addr; gpr_join_host_port(&addr, "127.0.0.1", port); grpc_completion_queue *cq = grpc_completion_queue_create(NULL); - cronet_engine *cronetEngine = [Cronet getGlobalEngine]; + stream_engine *cronetEngine = [Cronet getGlobalEngine]; grpc_channel *client = grpc_cronet_secure_channel_create(cronetEngine, addr, NULL, NULL); @@ -174,14 +227,19 @@ static void drain_cq(grpc_completion_queue *cq) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ int sl = socket(AF_INET, SOCK_STREAM, 0); GPR_ASSERT(sl >= 0); + + // Make and TCP endpoint to accept the connection struct sockaddr_in s_addr; memset(&s_addr, 0, sizeof(s_addr)); s_addr.sin_family = AF_INET; s_addr.sin_addr.s_addr = htonl(INADDR_ANY); s_addr.sin_port = htons(port); - bind(sl, (struct sockaddr*)&s_addr, sizeof(s_addr)); - listen(sl, 5); + GPR_ASSERT(0 == bind(sl, (struct sockaddr*)&s_addr, sizeof(s_addr))); + GPR_ASSERT(0 == listen(sl, 5)); int s = accept(sl, NULL, NULL); + GPR_ASSERT(s >= 0); + + // Close the connection after 1 second to trigger Cronet's on_failed() sleep(1); close(s); close(sl); @@ -211,4 +269,168 @@ static void drain_cq(grpc_completion_queue *cq) { grpc_completion_queue_destroy(cq); } +- (void)testPacketCoalescing { + grpc_call *c; + grpc_slice request_payload_slice = + grpc_slice_from_copied_string("hello world"); + grpc_byte_buffer *request_payload = + grpc_raw_byte_buffer_create(&request_payload_slice, 1); + gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5); + grpc_metadata meta_c[2] = { + {"key1", "val1", 4, 0, {{NULL, NULL, NULL, NULL}}}, + {"key2", "val2", 4, 0, {{NULL, NULL, NULL, NULL}}}}; + + int port = grpc_pick_unused_port_or_die(); + char *addr; + gpr_join_host_port(&addr, "127.0.0.1", port); + grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + stream_engine *cronetEngine = [Cronet getGlobalEngine]; + grpc_channel *client = grpc_cronet_secure_channel_create(cronetEngine, addr, + NULL, NULL); + + cq_verifier *cqv = cq_verifier_create(cq); + grpc_op ops[6]; + grpc_op *op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_byte_buffer *response_payload_recv = NULL; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + char *details = NULL; + size_t details_capacity = 0; + + c = grpc_channel_create_call( + client, NULL, GRPC_PROPAGATE_DEFAULTS, cq, "/foo", + NULL, 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 = 2; + op->data.send_initial_metadata.metadata = meta_c; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message = request_payload; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message = &response_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + 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->data.recv_status_on_client.status_details_capacity = &details_capacity; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), (void*)1, NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + int sl = socket(AF_INET, SOCK_STREAM, 0); + GPR_ASSERT(sl >= 0); + struct sockaddr_in s_addr; + memset(&s_addr, 0, sizeof(s_addr)); + s_addr.sin_family = AF_INET; + s_addr.sin_addr.s_addr = htonl(INADDR_ANY); + s_addr.sin_port = htons(port); + GPR_ASSERT(0 == bind(sl, (struct sockaddr*)&s_addr, sizeof(s_addr))); + GPR_ASSERT(0 == listen(sl, 5)); + int s = accept(sl, NULL, NULL); + GPR_ASSERT(s >= 0); + struct timeval tv; + tv.tv_sec = 2; + tv.tv_usec = 0; + setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + + // Make an TLS endpoint to receive Cronet's transmission + SSL_CTX *ctx = SSL_CTX_new(TLSv1_2_server_method()); + init_ctx(ctx); + SSL *ssl = SSL_new(ctx); + SSL_set_fd(ssl, s); + SSL_accept(ssl); + + const char magic[] = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"; + + char buf[4096]; + long len; + bool coalesced = false; + while ((len = SSL_read(ssl, buf, sizeof(buf))) > 0) { + NSLog(@"Read len: %ld", len); + + // Analyze the HTTP/2 frames in the same TLS PDU to identify if + // coalescing is successful + unsigned int p = 0; + while (p < len) { + if (len - p >= 24 && 0 == memcmp(&buf[p], magic, 24)) { + p += 24; + continue; + } + + if (buf[p+3] == 0 && // Type is DATA + parse_h2_length(&buf[p]) == 0x10 && // Length is correct + (buf[p+4] & 1) != 0 && // EOS bit is set + 0 == memcmp("hello world", &buf[p+14], 11)) { // Message is correct + coalesced = true; + break; + } + p += (parse_h2_length(&buf[p]) + 9); + } + if (coalesced) { + break; + } + } + + XCTAssert(coalesced); + SSL_free(ssl); + SSL_CTX_free(ctx); + close(s); + close(sl); + }); + + CQ_EXPECT_COMPLETION(cqv, (void*)1, 1); + cq_verify(cqv); + + gpr_free(details); + 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_call_destroy(c); + + cq_verifier_destroy(cqv); + + grpc_byte_buffer_destroy(request_payload); + grpc_byte_buffer_destroy(response_payload_recv); + + grpc_channel_destroy(client); + grpc_completion_queue_shutdown(cq); + drain_cq(cq); + grpc_completion_queue_destroy(cq); +} + @end From 60ab7ef00ac0a988ee2672c636d946c964e6fa41 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 23 Jan 2017 23:00:35 -0800 Subject: [PATCH 031/126] Dynamically enable/disable packet coalecsing and test it --- include/grpc/grpc_cronet.h | 2 + .../client/secure/cronet_channel_create.c | 6 ++ .../cronet/transport/cronet_transport.c | 72 +++++++++---------- .../tests/CronetUnitTests/CronetUnitTests.m | 13 +++- src/objective-c/tests/Podfile | 1 - 5 files changed, 52 insertions(+), 42 deletions(-) diff --git a/include/grpc/grpc_cronet.h b/include/grpc/grpc_cronet.h index 295e0f55e80..566c34a388d 100644 --- a/include/grpc/grpc_cronet.h +++ b/include/grpc/grpc_cronet.h @@ -44,6 +44,8 @@ GRPCAPI grpc_channel *grpc_cronet_secure_channel_create( void *engine, const char *target, const grpc_channel_args *args, void *reserved); +GRPCAPI void grpc_cronet_use_packet_coalescing(bool use_coalescing); + #ifdef __cplusplus } #endif diff --git a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c index 477cf07f45d..2e40020ae05 100644 --- a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c +++ b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c @@ -51,6 +51,8 @@ typedef struct cronet_transport { extern grpc_transport_vtable grpc_cronet_vtable; +bool grpc_cronet_packet_coalescing_enabled = true; + GRPCAPI grpc_channel *grpc_cronet_secure_channel_create( void *engine, const char *target, const grpc_channel_args *args, void *reserved) { @@ -67,3 +69,7 @@ GRPCAPI grpc_channel *grpc_cronet_secure_channel_create( return grpc_channel_create(&exec_ctx, target, args, GRPC_CLIENT_DIRECT_CHANNEL, (grpc_transport *)ct); } + +GRPCAPI void grpc_cronet_use_packet_coalescing(bool use_coalescing) { + grpc_cronet_packet_coalescing_enabled = use_coalescing; +} diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 447f3f31ec1..5429eb32e3c 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -61,6 +61,8 @@ /* TODO (makdharma): Hook up into the wider tracing mechanism */ int grpc_cronet_trace = 0; +extern bool grpc_cronet_packet_coalescing_enabled; + enum e_op_result { ACTION_TAKEN_WITH_CALLBACK, ACTION_TAKEN_NO_CALLBACK, @@ -150,12 +152,13 @@ struct op_state { bool state_callback_received[OP_NUM_OPS]; bool fail_state; bool flush_read; -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING bool flush_cronet_when_ready; bool pending_write_for_trailer; -#endif bool unprocessed_send_message; grpc_error *cancel_error; + + /* Whether packet coalescing is enabled */ + bool packet_coalescing_enabled; /* data structure for storing data coming from server */ struct read_state rs; /* data structure for storing data going to the server */ @@ -425,12 +428,10 @@ static void on_stream_ready(bidirectional_stream *stream) { } /* Send the initial metadata on wire if there is no SEND_MESSAGE or * SEND_TRAILING_METADATA ops pending */ -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - if (s->state.flush_cronet_when_ready) { + if (s->state.packet_coalescing_enabled && s->state.flush_cronet_when_ready) { CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_flush (%p)", s->cbs); bidirectional_stream_flush(stream); } -#endif gpr_mu_unlock(&s->mu); execute_from_storage(s); } @@ -568,10 +569,10 @@ static void on_response_trailers_received( CRONET_LOG(GPR_DEBUG, "bidirectional_stream_write (%p, 0)", s->cbs); s->state.state_callback_received[OP_SEND_MESSAGE] = false; bidirectional_stream_write(s->cbs, "", 0, true); -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); - bidirectional_stream_flush(s->cbs); -#endif + if (s->state.packet_coalescing_enabled) { + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); + bidirectional_stream_flush(s->cbs); + } s->state.state_op_done[OP_SEND_TRAILING_METADATA] = true; gpr_mu_unlock(&s->mu); @@ -768,11 +769,9 @@ static bool op_can_be_run(grpc_transport_stream_op *curr_op, result = false; /* we haven't got on_write_completed for the send yet */ else if (stream_state->state_op_done[OP_SEND_MESSAGE] && - !stream_state->state_callback_received[OP_SEND_MESSAGE] -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - && !stream_state->pending_write_for_trailer -#endif - ) + !stream_state->state_callback_received[OP_SEND_MESSAGE] && + !(stream_state->packet_coalescing_enabled && + stream_state->pending_write_for_trailer)) result = false; } else if (op_id == OP_CANCEL_ERROR) { /* already executed */ @@ -858,10 +857,10 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, s->cbs = bidirectional_stream_create(s->curr_ct.engine, s->curr_gs, &cronet_callbacks); CRONET_LOG(GPR_DEBUG, "%p = bidirectional_stream_create()", s->cbs); -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - bidirectional_stream_disable_auto_flush(s->cbs, true); - bidirectional_stream_delay_request_headers_until_flush(s->cbs, true); -#endif + if (stream_state->packet_coalescing_enabled) { + bidirectional_stream_disable_auto_flush(s->cbs, true); + bidirectional_stream_delay_request_headers_until_flush(s->cbs, true); + } char *url = NULL; const char *method = "POST"; s->header_array.headers = NULL; @@ -872,11 +871,10 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, CRONET_LOG(GPR_DEBUG, "bidirectional_stream_start(%p, %s)", s->cbs, url); bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, false); stream_state->state_op_done[OP_SEND_INITIAL_METADATA] = true; -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - if (!stream_op->send_message && !stream_op->send_trailing_metadata) { + if (stream_state->packet_coalescing_enabled && !stream_op->send_message && + !stream_op->send_trailing_metadata) { s->state.flush_cronet_when_ready = true; } -#endif result = ACTION_TAKEN_WITH_CALLBACK; } else if (stream_op->send_message && op_can_be_run(stream_op, stream_state, &oas->state, @@ -913,19 +911,18 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_state->state_callback_received[OP_SEND_MESSAGE] = false; bidirectional_stream_write(s->cbs, stream_state->ws.write_buffer, (int)write_buffer_size, false); -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - if (!stream_op->send_trailing_metadata) { - CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", - s->cbs); - bidirectional_stream_flush(s->cbs); - result = ACTION_TAKEN_WITH_CALLBACK; + if (stream_state->packet_coalescing_enabled) { + if (!stream_op->send_trailing_metadata) { + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); + bidirectional_stream_flush(s->cbs); + result = ACTION_TAKEN_WITH_CALLBACK; + } else { + stream_state->pending_write_for_trailer = true; + result = ACTION_TAKEN_NO_CALLBACK; + } } else { - stream_state->pending_write_for_trailer = true; - result = ACTION_TAKEN_NO_CALLBACK; + result = ACTION_TAKEN_WITH_CALLBACK; } -#else - result = ACTION_TAKEN_WITH_CALLBACK; -#endif } else { result = NO_ACTION_POSSIBLE; } @@ -944,10 +941,10 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, s->cbs); stream_state->state_callback_received[OP_SEND_MESSAGE] = false; bidirectional_stream_write(s->cbs, "", 0, true); -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); - bidirectional_stream_flush(s->cbs); -#endif + if (stream_state->packet_coalescing_enabled) { + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); + bidirectional_stream_flush(s->cbs); + } result = ACTION_TAKEN_WITH_CALLBACK; } stream_state->state_op_done[OP_SEND_TRAILING_METADATA] = true; @@ -1176,10 +1173,9 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, sizeof(s->state.state_callback_received)); s->state.fail_state = s->state.flush_read = false; s->state.cancel_error = NULL; -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING s->state.flush_cronet_when_ready = s->state.pending_write_for_trailer = false; -#endif s->state.unprocessed_send_message = false; + s->state.packet_coalescing_enabled = grpc_cronet_packet_coalescing_enabled; gpr_mu_init(&s->mu); return 0; } diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m index dcd7f2fa8db..9bbf3cdb113 100644 --- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m +++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m @@ -269,7 +269,9 @@ unsigned int parse_h2_length(const char *field) { grpc_completion_queue_destroy(cq); } -- (void)testPacketCoalescing { +- (void)PacketCoalescing:(bool)use_coalescing { + grpc_cronet_use_packet_coalescing(use_coalescing); + grpc_call *c; grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world"); @@ -379,7 +381,7 @@ unsigned int parse_h2_length(const char *field) { long len; bool coalesced = false; while ((len = SSL_read(ssl, buf, sizeof(buf))) > 0) { - NSLog(@"Read len: %ld", len); + gpr_log(GPR_DEBUG, "Read len: %ld", len); // Analyze the HTTP/2 frames in the same TLS PDU to identify if // coalescing is successful @@ -404,7 +406,7 @@ unsigned int parse_h2_length(const char *field) { } } - XCTAssert(coalesced); + XCTAssert(coalesced == use_coalescing); SSL_free(ssl); SSL_CTX_free(ctx); close(s); @@ -433,4 +435,9 @@ unsigned int parse_h2_length(const char *field) { grpc_completion_queue_destroy(cq); } +- (void)testPacketCoalescing { + [self PacketCoalescing:false]; + [self PacketCoalescing:true]; +} + @end diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index 462c6a8e0eb..3760330be9a 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -97,7 +97,6 @@ post_install do |installer| # GPR_UNREACHABLE_CODE causes "Control may reach end of non-void # function" warning config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO' - config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_CRONET_WITH_PACKET_COALESCING=1' end end From 8d1d95d07cdb7e8fa78ab93399fcf3742fcee63f Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 23 Jan 2017 23:01:10 -0800 Subject: [PATCH 032/126] Clean up old packet coalescing tests --- .../CoreCronetEnd2EndTests.m | 11 - test/core/end2end/tests/packet_coalescing.c | 284 ------------------ 2 files changed, 295 deletions(-) delete mode 100644 test/core/end2end/tests/packet_coalescing.c diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m index 9af38fd9b22..01612a84b28 100644 --- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m +++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m @@ -170,9 +170,6 @@ static grpc_end2end_test_config configs[] = { chttp2_tear_down_secure_fullstack}, }; -extern void packet_coalescing(grpc_end2end_test_config config); -extern void packet_coalescing_pre_init(void); - static char *roots_filename; @interface CoreCronetEnd2EndTests : XCTestCase @@ -351,14 +348,6 @@ static char *roots_filename; [self testIndividualCase:"no_op"]; } -- (void)testPacketCoalescing { - // Directly invoke the test function since the test is for Cronet only and thus not included in - // end2end_tests.c - // TODO (mxyan): Do the same to all test cases so that this file will no longer depend on - // end2end_tests.c - packet_coalescing(configs[0]); -} - - (void)testPayload { [self testIndividualCase:"payload"]; } diff --git a/test/core/end2end/tests/packet_coalescing.c b/test/core/end2end/tests/packet_coalescing.c deleted file mode 100644 index 336f765a13f..00000000000 --- a/test/core/end2end/tests/packet_coalescing.c +++ /dev/null @@ -1,284 +0,0 @@ -/* - * - * Copyright 2015, 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 "test/core/end2end/end2end_tests.h" - -#include -#include - -#include -#include -#include -#include -#include -#include "test/core/end2end/cq_verifier.h" - -extern void gpr_default_log(gpr_log_func_args *args); - -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, "%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_time(int n) { - return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(n); -} - -static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } - -static void drain_cq(grpc_completion_queue *cq) { - grpc_event ev; - do { - ev = grpc_completion_queue_next(cq, five_seconds_time(), 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->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->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); -} - -static bool coalesced_message_and_eos; - -static void log_processor(gpr_log_func_args *args) { - const int file_len = (int)strlen(args->file); - const char suffix1[] = "secure_endpoint.c"; - const int suffix1_len = sizeof(suffix1) - 1; - const char suffix2[] = "tcp_posix.c"; - const int suffix2_len = sizeof(suffix2) - 1; - const char prefix[] = "READ"; - const int prefix_len = sizeof(prefix) - 1; - if (((file_len >= suffix1_len && - 0 == strcmp(suffix1, &args->file[file_len - suffix1_len])) || - (file_len >= suffix2_len && - 0 == strcmp(suffix2, &args->file[file_len - suffix2_len]))) && - 0 == strncmp(prefix, args->message, (size_t)prefix_len) && - strstr(args->message, - "00 00 10 00 01 00 00 00 01 00 00 00 00 0b 68 65 6c 6c 6f 20 77 " - "6f 72 6c 64")) { - fprintf(stderr, "%s, %s\n", args->file, args->message); - coalesced_message_and_eos = true; - } -} - -/* Request/response with metadata and payload.*/ -static void test_request_response_with_metadata_and_payload( - grpc_end2end_test_config config) { - grpc_call *c; - grpc_call *s; - grpc_slice request_payload_slice = - grpc_slice_from_copied_string("hello world"); - grpc_byte_buffer *request_payload = - grpc_raw_byte_buffer_create(&request_payload_slice, 1); - gpr_timespec deadline = five_seconds_time(); - grpc_metadata meta_c[2] = { - {"key1", "val1", 4, 0, {{NULL, NULL, NULL, NULL}}}, - {"key2", "val2", 4, 0, {{NULL, NULL, NULL, NULL}}}}; - grpc_metadata meta_s[2] = { - {"key3", "val3", 4, 0, {{NULL, NULL, NULL, NULL}}}, - {"key4", "val4", 4, 0, {{NULL, NULL, NULL, NULL}}}}; - grpc_end2end_test_fixture f = begin_test( - config, "test_request_response_with_metadata_and_payload", NULL, NULL); - cq_verifier *cqv = cq_verifier_create(f.cq); - grpc_op ops[6]; - grpc_op *op; - grpc_metadata_array initial_metadata_recv; - grpc_metadata_array trailing_metadata_recv; - grpc_metadata_array request_metadata_recv; - grpc_byte_buffer *request_payload_recv = NULL; - grpc_call_details call_details; - grpc_status_code status; - grpc_call_error error; - char *details = NULL; - size_t details_capacity = 0; - int was_cancelled = 2; - coalesced_message_and_eos = false; - - c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", - get_host_override_string("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 = 2; - op->data.send_initial_metadata.metadata = meta_c; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_SEND_MESSAGE; - op->data.send_message = request_payload; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_RECV_INITIAL_METADATA; - op->data.recv_initial_metadata = &initial_metadata_recv; - op->flags = 0; - op->reserved = NULL; - op++; - 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->data.recv_status_on_client.status_details_capacity = &details_capacity; - 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_SEND_INITIAL_METADATA; - op->data.send_initial_metadata.count = 2; - op->data.send_initial_metadata.metadata = meta_s; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_RECV_MESSAGE; - op->data.recv_message = &request_payload_recv; - 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_verify(cqv); - - 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_STATUS_FROM_SERVER; - op->data.send_status_from_server.trailing_metadata_count = 0; - op->data.send_status_from_server.status = GRPC_STATUS_OK; - op->data.send_status_from_server.status_details = "xyz"; - 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(103), 1); - CQ_EXPECT_COMPLETION(cqv, tag(1), 1); - cq_verify(cqv); - - GPR_ASSERT(status == GRPC_STATUS_OK); - GPR_ASSERT(0 == strcmp(details, "xyz")); - GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); - GPR_ASSERT(was_cancelled == 0); - GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); - GPR_ASSERT(contains_metadata(&request_metadata_recv, "key1", "val1")); - GPR_ASSERT(contains_metadata(&request_metadata_recv, "key2", "val2")); - GPR_ASSERT(coalesced_message_and_eos); - - gpr_free(details); - 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_call_destroy(c); - grpc_call_destroy(s); - - cq_verifier_destroy(cqv); - - grpc_byte_buffer_destroy(request_payload); - grpc_byte_buffer_destroy(request_payload_recv); - - end_test(&f); - config.tear_down_data(&f); -} - -void packet_coalescing(grpc_end2end_test_config config) { - gpr_set_log_verbosity(GPR_LOG_SEVERITY_DEBUG); - grpc_tracer_set_enabled("all", 1); - gpr_set_log_function(log_processor); - test_request_response_with_metadata_and_payload(config); - gpr_set_log_function(gpr_default_log); - grpc_tracer_set_enabled("all", 0); -} - -void packet_coalescing_pre_init(void) {} From 0ed9fd4fefc832a4fa8019e377ed350cca6c72bf Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 26 Jan 2017 15:33:39 -0800 Subject: [PATCH 033/126] update submodules --- CMakeLists.txt | 583 +++++++- Makefile | 719 +++++++++- binding.gyp | 41 +- config.m4 | 43 +- grpc.gemspec | 58 +- package.xml | 58 +- src/boringssl/err_data.c | 1266 +++++++++-------- src/python/grpcio/grpc_core_dependencies.py | 41 +- .../generated/sources_and_headers.json | 291 +++- tools/run_tests/generated/tests.json | 248 +++- .../vcxproj/boringssl/boringssl.vcxproj | 93 +- .../boringssl/boringssl.vcxproj.filters | 170 +-- .../boringssl_chacha_test.vcxproj} | 10 +- .../boringssl_chacha_test.vcxproj.filters} | 0 .../boringssl_chacha_test_lib.vcxproj | 170 +++ .../boringssl_chacha_test_lib.vcxproj.filters | 24 + .../boringssl_ecdh_test.vcxproj | 198 +++ .../boringssl_ecdh_test.vcxproj.filters | 7 + .../boringssl_ecdh_test_lib.vcxproj} | 8 +- .../boringssl_ecdh_test_lib.vcxproj.filters | 24 + .../boringssl_ecdsa_sign_test.vcxproj | 198 +++ .../boringssl_ecdsa_sign_test.vcxproj.filters | 7 + .../boringssl_ecdsa_sign_test_lib.vcxproj | 170 +++ ...ingssl_ecdsa_sign_test_lib.vcxproj.filters | 24 + .../boringssl_ecdsa_verify_test.vcxproj | 198 +++ ...oringssl_ecdsa_verify_test.vcxproj.filters | 7 + .../boringssl_ecdsa_verify_test_lib.vcxproj | 170 +++ ...gssl_ecdsa_verify_test_lib.vcxproj.filters | 24 + .../boringssl_gcm_test_lib.vcxproj | 2 +- .../boringssl_gcm_test_lib.vcxproj.filters | 2 +- ...boringssl_newhope_statistical_test.vcxproj | 198 +++ ...l_newhope_statistical_test.vcxproj.filters | 7 + ...ngssl_newhope_statistical_test_lib.vcxproj | 170 +++ ...whope_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 +++ ...ngssl_newhope_vectors_test.vcxproj.filters | 7 + ...boringssl_newhope_vectors_test_lib.vcxproj | 170 +++ ...l_newhope_vectors_test_lib.vcxproj.filters | 24 + .../boringssl_obj_test.vcxproj | 198 +++ .../boringssl_obj_test.vcxproj.filters | 7 + .../boringssl_obj_test_lib.vcxproj | 170 +++ .../boringssl_obj_test_lib.vcxproj.filters} | 16 +- .../boringssl_spake25519_test.vcxproj | 198 +++ .../boringssl_spake25519_test.vcxproj.filters | 7 + .../boringssl_spake25519_test_lib.vcxproj | 170 +++ ...ingssl_spake25519_test_lib.vcxproj.filters | 24 + 50 files changed, 5703 insertions(+), 1138 deletions(-) rename vsprojects/vcxproj/test/boringssl/{boringssl_pqueue_test/boringssl_pqueue_test.vcxproj => boringssl_chacha_test/boringssl_chacha_test.vcxproj} (97%) rename vsprojects/vcxproj/test/boringssl/{boringssl_pqueue_test/boringssl_pqueue_test.vcxproj.filters => boringssl_chacha_test/boringssl_chacha_test.vcxproj.filters} (100%) create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ecdh_test/boringssl_ecdh_test.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ecdh_test/boringssl_ecdh_test.vcxproj.filters rename vsprojects/vcxproj/test/boringssl/{boringssl_pqueue_test_lib/boringssl_pqueue_test_lib.vcxproj => boringssl_ecdh_test_lib/boringssl_ecdh_test_lib.vcxproj} (97%) create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ecdh_test_lib/boringssl_ecdh_test_lib.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test/boringssl_ecdsa_sign_test.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test/boringssl_ecdsa_sign_test.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test_lib/boringssl_ecdsa_sign_test_lib.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test_lib/boringssl_ecdsa_sign_test_lib.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test/boringssl_ecdsa_verify_test.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test/boringssl_ecdsa_verify_test.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test_lib/boringssl_ecdsa_verify_test_lib.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test_lib/boringssl_ecdsa_verify_test_lib.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj create 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_obj_test/boringssl_obj_test.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_obj_test/boringssl_obj_test.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_obj_test_lib/boringssl_obj_test_lib.vcxproj rename vsprojects/vcxproj/test/boringssl/{boringssl_pqueue_test_lib/boringssl_pqueue_test_lib.vcxproj.filters => boringssl_obj_test_lib/boringssl_obj_test_lib.vcxproj.filters} (52%) create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test/boringssl_spake25519_test.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test/boringssl_spake25519_test.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test_lib/boringssl_spake25519_test_lib.vcxproj create mode 100644 vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test_lib/boringssl_spake25519_test_lib.vcxproj.filters diff --git a/CMakeLists.txt b/CMakeLists.txt index 7626e1d1587..e1c71f2c69f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2868,7 +2868,6 @@ add_library(boringssl third_party/boringssl/crypto/aes/mode_wrappers.c third_party/boringssl/crypto/asn1/a_bitstr.c third_party/boringssl/crypto/asn1/a_bool.c - third_party/boringssl/crypto/asn1/a_bytes.c third_party/boringssl/crypto/asn1/a_d2i_fp.c third_party/boringssl/crypto/asn1/a_dup.c third_party/boringssl/crypto/asn1/a_enum.c @@ -2887,18 +2886,14 @@ add_library(boringssl third_party/boringssl/crypto/asn1/asn1_lib.c third_party/boringssl/crypto/asn1/asn1_par.c third_party/boringssl/crypto/asn1/asn_pack.c - third_party/boringssl/crypto/asn1/bio_asn1.c - third_party/boringssl/crypto/asn1/bio_ndef.c third_party/boringssl/crypto/asn1/f_enum.c third_party/boringssl/crypto/asn1/f_int.c third_party/boringssl/crypto/asn1/f_string.c third_party/boringssl/crypto/asn1/t_bitst.c - third_party/boringssl/crypto/asn1/t_pkey.c third_party/boringssl/crypto/asn1/tasn_dec.c third_party/boringssl/crypto/asn1/tasn_enc.c third_party/boringssl/crypto/asn1/tasn_fre.c third_party/boringssl/crypto/asn1/tasn_new.c - third_party/boringssl/crypto/asn1/tasn_prn.c third_party/boringssl/crypto/asn1/tasn_typ.c third_party/boringssl/crypto/asn1/tasn_utl.c third_party/boringssl/crypto/asn1/x_bignum.c @@ -2928,6 +2923,7 @@ add_library(boringssl third_party/boringssl/crypto/bn/generic.c third_party/boringssl/crypto/bn/kronecker.c third_party/boringssl/crypto/bn/montgomery.c + third_party/boringssl/crypto/bn/montgomery_inv.c third_party/boringssl/crypto/bn/mul.c third_party/boringssl/crypto/bn/prime.c third_party/boringssl/crypto/bn/random.c @@ -2939,8 +2935,7 @@ add_library(boringssl third_party/boringssl/crypto/bytestring/ber.c third_party/boringssl/crypto/bytestring/cbb.c third_party/boringssl/crypto/bytestring/cbs.c - third_party/boringssl/crypto/chacha/chacha_generic.c - third_party/boringssl/crypto/chacha/chacha_vec.c + third_party/boringssl/crypto/chacha/chacha.c third_party/boringssl/crypto/cipher/aead.c third_party/boringssl/crypto/cipher/cipher.c third_party/boringssl/crypto/cipher/derive_key.c @@ -2955,10 +2950,14 @@ add_library(boringssl third_party/boringssl/crypto/cipher/tls_cbc.c third_party/boringssl/crypto/cmac/cmac.c third_party/boringssl/crypto/conf/conf.c + third_party/boringssl/crypto/cpu-aarch64-linux.c + third_party/boringssl/crypto/cpu-arm-linux.c third_party/boringssl/crypto/cpu-arm.c third_party/boringssl/crypto/cpu-intel.c + third_party/boringssl/crypto/cpu-ppc64le.c third_party/boringssl/crypto/crypto.c third_party/boringssl/crypto/curve25519/curve25519.c + third_party/boringssl/crypto/curve25519/spake25519.c third_party/boringssl/crypto/curve25519/x25519-x86_64.c third_party/boringssl/crypto/des/des.c third_party/boringssl/crypto/dh/check.c @@ -2967,8 +2966,6 @@ add_library(boringssl third_party/boringssl/crypto/dh/params.c third_party/boringssl/crypto/digest/digest.c third_party/boringssl/crypto/digest/digests.c - third_party/boringssl/crypto/directory_posix.c - third_party/boringssl/crypto/directory_win.c third_party/boringssl/crypto/dsa/dsa.c third_party/boringssl/crypto/dsa/dsa_asn1.c third_party/boringssl/crypto/ec/ec.c @@ -2987,7 +2984,6 @@ add_library(boringssl third_party/boringssl/crypto/ecdsa/ecdsa_asn1.c third_party/boringssl/crypto/engine/engine.c third_party/boringssl/crypto/err/err.c - third_party/boringssl/crypto/evp/algorithm.c third_party/boringssl/crypto/evp/digestsign.c third_party/boringssl/crypto/evp/evp.c third_party/boringssl/crypto/evp/evp_asn1.c @@ -2998,6 +2994,7 @@ add_library(boringssl third_party/boringssl/crypto/evp/p_rsa.c third_party/boringssl/crypto/evp/p_rsa_asn1.c third_party/boringssl/crypto/evp/pbkdf.c + third_party/boringssl/crypto/evp/print.c third_party/boringssl/crypto/evp/sign.c third_party/boringssl/crypto/ex_data.c third_party/boringssl/crypto/hkdf/hkdf.c @@ -3011,6 +3008,12 @@ add_library(boringssl 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/obj/obj.c third_party/boringssl/crypto/obj/obj_xref.c third_party/boringssl/crypto/pem/pem_all.c @@ -3028,6 +3031,7 @@ add_library(boringssl 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/rand/deterministic.c third_party/boringssl/crypto/rand/rand.c third_party/boringssl/crypto/rand/urandom.c third_party/boringssl/crypto/rand/windows.c @@ -3052,11 +3056,13 @@ add_library(boringssl third_party/boringssl/crypto/x509/a_sign.c third_party/boringssl/crypto/x509/a_strex.c third_party/boringssl/crypto/x509/a_verify.c + third_party/boringssl/crypto/x509/algorithm.c third_party/boringssl/crypto/x509/asn1_gen.c third_party/boringssl/crypto/x509/by_dir.c third_party/boringssl/crypto/x509/by_file.c third_party/boringssl/crypto/x509/i2d_pr.c third_party/boringssl/crypto/x509/pkcs7.c + third_party/boringssl/crypto/x509/rsa_pss.c third_party/boringssl/crypto/x509/t_crl.c third_party/boringssl/crypto/x509/t_req.c third_party/boringssl/crypto/x509/t_x509.c @@ -3131,21 +3137,17 @@ add_library(boringssl third_party/boringssl/crypto/x509v3/v3_utl.c third_party/boringssl/ssl/custom_extensions.c third_party/boringssl/ssl/d1_both.c - third_party/boringssl/ssl/d1_clnt.c third_party/boringssl/ssl/d1_lib.c - third_party/boringssl/ssl/d1_meth.c third_party/boringssl/ssl/d1_pkt.c third_party/boringssl/ssl/d1_srtp.c - third_party/boringssl/ssl/d1_srvr.c + third_party/boringssl/ssl/dtls_method.c third_party/boringssl/ssl/dtls_record.c - third_party/boringssl/ssl/pqueue/pqueue.c + 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_clnt.c third_party/boringssl/ssl/s3_enc.c third_party/boringssl/ssl/s3_lib.c - third_party/boringssl/ssl/s3_meth.c third_party/boringssl/ssl/s3_pkt.c - third_party/boringssl/ssl/s3_srvr.c third_party/boringssl/ssl/ssl_aead_ctx.c third_party/boringssl/ssl/ssl_asn1.c third_party/boringssl/ssl/ssl_buffer.c @@ -3159,6 +3161,11 @@ add_library(boringssl third_party/boringssl/ssl/ssl_stat.c third_party/boringssl/ssl/t1_enc.c third_party/boringssl/ssl/t1_lib.c + third_party/boringssl/ssl/tls13_both.c + third_party/boringssl/ssl/tls13_client.c + third_party/boringssl/ssl/tls13_enc.c + third_party/boringssl/ssl/tls13_server.c + third_party/boringssl/ssl/tls_method.c third_party/boringssl/ssl/tls_record.c ) @@ -3367,6 +3374,33 @@ target_link_libraries(boringssl_bytestring_test_lib ) +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_library(boringssl_chacha_test_lib + third_party/boringssl/crypto/chacha/chacha_test.cc +) + + +target_include_directories(boringssl_chacha_test_lib + 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} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_chacha_test_lib + ${_gRPC_SSL_LIBRARIES} + boringssl_test_util + boringssl +) + + endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -3500,6 +3534,33 @@ target_link_libraries(boringssl_ed25519_test_lib ) +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_library(boringssl_spake25519_test_lib + third_party/boringssl/crypto/curve25519/spake25519_test.cc +) + + +target_include_directories(boringssl_spake25519_test_lib + 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} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_spake25519_test_lib + ${_gRPC_SSL_LIBRARIES} + boringssl_test_util + boringssl +) + + endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -3658,6 +3719,60 @@ target_link_libraries(boringssl_example_mul_lib ) +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_library(boringssl_ecdh_test_lib + third_party/boringssl/crypto/ecdh/ecdh_test.cc +) + + +target_include_directories(boringssl_ecdh_test_lib + 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} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_ecdh_test_lib + ${_gRPC_SSL_LIBRARIES} + boringssl_test_util + boringssl +) + + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_library(boringssl_ecdsa_sign_test_lib + third_party/boringssl/crypto/ecdsa/ecdsa_sign_test.cc +) + + +target_include_directories(boringssl_ecdsa_sign_test_lib + 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} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_ecdsa_sign_test_lib + ${_gRPC_SSL_LIBRARIES} + boringssl_test_util + boringssl +) + + endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -3685,6 +3800,33 @@ target_link_libraries(boringssl_ecdsa_test_lib ) +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_library(boringssl_ecdsa_verify_test_lib + third_party/boringssl/crypto/ecdsa/ecdsa_verify_test.cc +) + + +target_include_directories(boringssl_ecdsa_verify_test_lib + 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} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_ecdsa_verify_test_lib + ${_gRPC_SSL_LIBRARIES} + boringssl_test_util + boringssl +) + + endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -3874,7 +4016,7 @@ endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) add_library(boringssl_gcm_test_lib - third_party/boringssl/crypto/modes/gcm_test.c + third_party/boringssl/crypto/modes/gcm_test.cc ) @@ -3886,6 +4028,8 @@ target_include_directories(boringssl_gcm_test_lib PRIVATE ${ZLIB_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest ) target_link_libraries(boringssl_gcm_test_lib @@ -3895,6 +4039,114 @@ target_link_libraries(boringssl_gcm_test_lib ) +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_library(boringssl_newhope_statistical_test_lib + third_party/boringssl/crypto/newhope/newhope_statistical_test.cc +) + + +target_include_directories(boringssl_newhope_statistical_test_lib + 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} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_newhope_statistical_test_lib + ${_gRPC_SSL_LIBRARIES} + boringssl_test_util + boringssl +) + + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_library(boringssl_newhope_test_lib + third_party/boringssl/crypto/newhope/newhope_test.cc +) + + +target_include_directories(boringssl_newhope_test_lib + 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} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_newhope_test_lib + ${_gRPC_SSL_LIBRARIES} + boringssl_test_util + boringssl +) + + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_library(boringssl_newhope_vectors_test_lib + third_party/boringssl/crypto/newhope/newhope_vectors_test.cc +) + + +target_include_directories(boringssl_newhope_vectors_test_lib + 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} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_newhope_vectors_test_lib + ${_gRPC_SSL_LIBRARIES} + boringssl_test_util + boringssl +) + + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_library(boringssl_obj_test_lib + third_party/boringssl/crypto/obj/obj_test.cc +) + + +target_include_directories(boringssl_obj_test_lib + 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} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_obj_test_lib + ${_gRPC_SSL_LIBRARIES} + boringssl_test_util + boringssl +) + + endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -4155,31 +4407,6 @@ target_link_libraries(boringssl_v3name_test_lib ) -endif (gRPC_BUILD_TESTS) -if (gRPC_BUILD_TESTS) - -add_library(boringssl_pqueue_test_lib - third_party/boringssl/ssl/pqueue/pqueue_test.c -) - - -target_include_directories(boringssl_pqueue_test_lib - 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} - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include -) - -target_link_libraries(boringssl_pqueue_test_lib - ${_gRPC_SSL_LIBRARIES} - boringssl_test_util - boringssl -) - - endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9401,6 +9628,33 @@ target_link_libraries(boringssl_bytestring_test endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) +add_executable(boringssl_chacha_test + third_party/googletest/src/gtest-all.cc +) + +target_include_directories(boringssl_chacha_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_chacha_test + ${_gRPC_SSL_LIBRARIES} + boringssl_chacha_test_lib + boringssl_test_util + boringssl + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + add_executable(boringssl_aead_test third_party/googletest/src/gtest-all.cc ) @@ -9536,6 +9790,33 @@ target_link_libraries(boringssl_ed25519_test endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) +add_executable(boringssl_spake25519_test + third_party/googletest/src/gtest-all.cc +) + +target_include_directories(boringssl_spake25519_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_spake25519_test + ${_gRPC_SSL_LIBRARIES} + boringssl_spake25519_test_lib + boringssl_test_util + boringssl + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + add_executable(boringssl_x25519_test third_party/googletest/src/gtest-all.cc ) @@ -9698,6 +9979,60 @@ target_link_libraries(boringssl_example_mul endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) +add_executable(boringssl_ecdh_test + third_party/googletest/src/gtest-all.cc +) + +target_include_directories(boringssl_ecdh_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_ecdh_test + ${_gRPC_SSL_LIBRARIES} + boringssl_ecdh_test_lib + boringssl_test_util + boringssl + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_executable(boringssl_ecdsa_sign_test + third_party/googletest/src/gtest-all.cc +) + +target_include_directories(boringssl_ecdsa_sign_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_ecdsa_sign_test + ${_gRPC_SSL_LIBRARIES} + boringssl_ecdsa_sign_test_lib + boringssl_test_util + boringssl + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + add_executable(boringssl_ecdsa_test third_party/googletest/src/gtest-all.cc ) @@ -9725,6 +10060,33 @@ target_link_libraries(boringssl_ecdsa_test endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) +add_executable(boringssl_ecdsa_verify_test + third_party/googletest/src/gtest-all.cc +) + +target_include_directories(boringssl_ecdsa_verify_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_ecdsa_verify_test + ${_gRPC_SSL_LIBRARIES} + boringssl_ecdsa_verify_test_lib + boringssl_test_util + boringssl + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + add_executable(boringssl_err_test third_party/googletest/src/gtest-all.cc ) @@ -9941,6 +10303,114 @@ target_link_libraries(boringssl_gcm_test endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) +add_executable(boringssl_newhope_statistical_test + third_party/googletest/src/gtest-all.cc +) + +target_include_directories(boringssl_newhope_statistical_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_newhope_statistical_test + ${_gRPC_SSL_LIBRARIES} + boringssl_newhope_statistical_test_lib + boringssl_test_util + boringssl + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_executable(boringssl_newhope_test + third_party/googletest/src/gtest-all.cc +) + +target_include_directories(boringssl_newhope_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_newhope_test + ${_gRPC_SSL_LIBRARIES} + boringssl_newhope_test_lib + boringssl_test_util + boringssl + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_executable(boringssl_newhope_vectors_test + third_party/googletest/src/gtest-all.cc +) + +target_include_directories(boringssl_newhope_vectors_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_newhope_vectors_test + ${_gRPC_SSL_LIBRARIES} + boringssl_newhope_vectors_test_lib + boringssl_test_util + boringssl + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_executable(boringssl_obj_test + third_party/googletest/src/gtest-all.cc +) + +target_include_directories(boringssl_obj_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest +) + +target_link_libraries(boringssl_obj_test + ${_gRPC_SSL_LIBRARIES} + boringssl_obj_test_lib + boringssl_test_util + boringssl + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + add_executable(boringssl_pkcs12_test third_party/googletest/src/gtest-all.cc ) @@ -10211,33 +10681,6 @@ target_link_libraries(boringssl_v3name_test endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) -add_executable(boringssl_pqueue_test - third_party/googletest/src/gtest-all.cc -) - -target_include_directories(boringssl_pqueue_test - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${BORINGSSL_ROOT_DIR}/include - PRIVATE ${PROTOBUF_ROOT_DIR}/src - PRIVATE ${ZLIB_ROOT_DIR} - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest -) - -target_link_libraries(boringssl_pqueue_test - ${_gRPC_SSL_LIBRARIES} - boringssl_pqueue_test_lib - boringssl_test_util - boringssl - ${_gRPC_GFLAGS_LIBRARIES} -) - -endif (gRPC_BUILD_TESTS) -if (gRPC_BUILD_TESTS) - add_executable(boringssl_ssl_test third_party/googletest/src/gtest-all.cc ) diff --git a/Makefile b/Makefile index f71365f115f..42d1238224b 100644 --- a/Makefile +++ b/Makefile @@ -1135,18 +1135,23 @@ 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 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_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 @@ -1155,6 +1160,10 @@ 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 @@ -1165,7 +1174,6 @@ 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_pqueue_test: $(BINDIR)/$(CONFIG)/boringssl_pqueue_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 @@ -1275,7 +1283,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.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_ed25519_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_ecdsa_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_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.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 else privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_proto_reflection_desc_db.a $(LIBDIR)/$(CONFIG)/libgrpc++_test.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 @@ -1521,18 +1529,23 @@ 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 \ $(BINDIR)/$(CONFIG)/boringssl_constant_time_test \ $(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_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 \ @@ -1541,6 +1554,10 @@ 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 \ @@ -1551,7 +1568,6 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/boringssl_x509_test \ $(BINDIR)/$(CONFIG)/boringssl_tab_test \ $(BINDIR)/$(CONFIG)/boringssl_v3name_test \ - $(BINDIR)/$(CONFIG)/boringssl_pqueue_test \ $(BINDIR)/$(CONFIG)/boringssl_ssl_test \ else @@ -5475,7 +5491,6 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/aes/mode_wrappers.c \ third_party/boringssl/crypto/asn1/a_bitstr.c \ third_party/boringssl/crypto/asn1/a_bool.c \ - third_party/boringssl/crypto/asn1/a_bytes.c \ third_party/boringssl/crypto/asn1/a_d2i_fp.c \ third_party/boringssl/crypto/asn1/a_dup.c \ third_party/boringssl/crypto/asn1/a_enum.c \ @@ -5494,18 +5509,14 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/asn1/asn1_lib.c \ third_party/boringssl/crypto/asn1/asn1_par.c \ third_party/boringssl/crypto/asn1/asn_pack.c \ - third_party/boringssl/crypto/asn1/bio_asn1.c \ - third_party/boringssl/crypto/asn1/bio_ndef.c \ third_party/boringssl/crypto/asn1/f_enum.c \ third_party/boringssl/crypto/asn1/f_int.c \ third_party/boringssl/crypto/asn1/f_string.c \ third_party/boringssl/crypto/asn1/t_bitst.c \ - third_party/boringssl/crypto/asn1/t_pkey.c \ third_party/boringssl/crypto/asn1/tasn_dec.c \ third_party/boringssl/crypto/asn1/tasn_enc.c \ third_party/boringssl/crypto/asn1/tasn_fre.c \ third_party/boringssl/crypto/asn1/tasn_new.c \ - third_party/boringssl/crypto/asn1/tasn_prn.c \ third_party/boringssl/crypto/asn1/tasn_typ.c \ third_party/boringssl/crypto/asn1/tasn_utl.c \ third_party/boringssl/crypto/asn1/x_bignum.c \ @@ -5535,6 +5546,7 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/bn/generic.c \ third_party/boringssl/crypto/bn/kronecker.c \ third_party/boringssl/crypto/bn/montgomery.c \ + third_party/boringssl/crypto/bn/montgomery_inv.c \ third_party/boringssl/crypto/bn/mul.c \ third_party/boringssl/crypto/bn/prime.c \ third_party/boringssl/crypto/bn/random.c \ @@ -5546,8 +5558,7 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/bytestring/ber.c \ third_party/boringssl/crypto/bytestring/cbb.c \ third_party/boringssl/crypto/bytestring/cbs.c \ - third_party/boringssl/crypto/chacha/chacha_generic.c \ - third_party/boringssl/crypto/chacha/chacha_vec.c \ + third_party/boringssl/crypto/chacha/chacha.c \ third_party/boringssl/crypto/cipher/aead.c \ third_party/boringssl/crypto/cipher/cipher.c \ third_party/boringssl/crypto/cipher/derive_key.c \ @@ -5562,10 +5573,14 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/cipher/tls_cbc.c \ third_party/boringssl/crypto/cmac/cmac.c \ third_party/boringssl/crypto/conf/conf.c \ + third_party/boringssl/crypto/cpu-aarch64-linux.c \ + third_party/boringssl/crypto/cpu-arm-linux.c \ third_party/boringssl/crypto/cpu-arm.c \ third_party/boringssl/crypto/cpu-intel.c \ + third_party/boringssl/crypto/cpu-ppc64le.c \ third_party/boringssl/crypto/crypto.c \ third_party/boringssl/crypto/curve25519/curve25519.c \ + third_party/boringssl/crypto/curve25519/spake25519.c \ third_party/boringssl/crypto/curve25519/x25519-x86_64.c \ third_party/boringssl/crypto/des/des.c \ third_party/boringssl/crypto/dh/check.c \ @@ -5574,8 +5589,6 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/dh/params.c \ third_party/boringssl/crypto/digest/digest.c \ third_party/boringssl/crypto/digest/digests.c \ - third_party/boringssl/crypto/directory_posix.c \ - third_party/boringssl/crypto/directory_win.c \ third_party/boringssl/crypto/dsa/dsa.c \ third_party/boringssl/crypto/dsa/dsa_asn1.c \ third_party/boringssl/crypto/ec/ec.c \ @@ -5594,7 +5607,6 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/ecdsa/ecdsa_asn1.c \ third_party/boringssl/crypto/engine/engine.c \ third_party/boringssl/crypto/err/err.c \ - third_party/boringssl/crypto/evp/algorithm.c \ third_party/boringssl/crypto/evp/digestsign.c \ third_party/boringssl/crypto/evp/evp.c \ third_party/boringssl/crypto/evp/evp_asn1.c \ @@ -5605,6 +5617,7 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/evp/p_rsa.c \ third_party/boringssl/crypto/evp/p_rsa_asn1.c \ third_party/boringssl/crypto/evp/pbkdf.c \ + third_party/boringssl/crypto/evp/print.c \ third_party/boringssl/crypto/evp/sign.c \ third_party/boringssl/crypto/ex_data.c \ third_party/boringssl/crypto/hkdf/hkdf.c \ @@ -5618,6 +5631,12 @@ 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/obj/obj.c \ third_party/boringssl/crypto/obj/obj_xref.c \ third_party/boringssl/crypto/pem/pem_all.c \ @@ -5635,6 +5654,7 @@ LIBBORINGSSL_SRC = \ 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/rand/deterministic.c \ third_party/boringssl/crypto/rand/rand.c \ third_party/boringssl/crypto/rand/urandom.c \ third_party/boringssl/crypto/rand/windows.c \ @@ -5659,11 +5679,13 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/x509/a_sign.c \ third_party/boringssl/crypto/x509/a_strex.c \ third_party/boringssl/crypto/x509/a_verify.c \ + third_party/boringssl/crypto/x509/algorithm.c \ third_party/boringssl/crypto/x509/asn1_gen.c \ third_party/boringssl/crypto/x509/by_dir.c \ third_party/boringssl/crypto/x509/by_file.c \ third_party/boringssl/crypto/x509/i2d_pr.c \ third_party/boringssl/crypto/x509/pkcs7.c \ + third_party/boringssl/crypto/x509/rsa_pss.c \ third_party/boringssl/crypto/x509/t_crl.c \ third_party/boringssl/crypto/x509/t_req.c \ third_party/boringssl/crypto/x509/t_x509.c \ @@ -5738,21 +5760,17 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/x509v3/v3_utl.c \ third_party/boringssl/ssl/custom_extensions.c \ third_party/boringssl/ssl/d1_both.c \ - third_party/boringssl/ssl/d1_clnt.c \ third_party/boringssl/ssl/d1_lib.c \ - third_party/boringssl/ssl/d1_meth.c \ third_party/boringssl/ssl/d1_pkt.c \ third_party/boringssl/ssl/d1_srtp.c \ - third_party/boringssl/ssl/d1_srvr.c \ + third_party/boringssl/ssl/dtls_method.c \ third_party/boringssl/ssl/dtls_record.c \ - third_party/boringssl/ssl/pqueue/pqueue.c \ + 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_clnt.c \ third_party/boringssl/ssl/s3_enc.c \ third_party/boringssl/ssl/s3_lib.c \ - third_party/boringssl/ssl/s3_meth.c \ third_party/boringssl/ssl/s3_pkt.c \ - third_party/boringssl/ssl/s3_srvr.c \ third_party/boringssl/ssl/ssl_aead_ctx.c \ third_party/boringssl/ssl/ssl_asn1.c \ third_party/boringssl/ssl/ssl_buffer.c \ @@ -5766,6 +5784,11 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/ssl/ssl_stat.c \ third_party/boringssl/ssl/t1_enc.c \ third_party/boringssl/ssl/t1_lib.c \ + third_party/boringssl/ssl/tls13_both.c \ + third_party/boringssl/ssl/tls13_client.c \ + third_party/boringssl/ssl/tls13_enc.c \ + third_party/boringssl/ssl/tls13_server.c \ + third_party/boringssl/ssl/tls_method.c \ third_party/boringssl/ssl/tls_record.c \ PUBLIC_HEADERS_C += \ @@ -6060,6 +6083,44 @@ 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) $(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 \ @@ -6239,6 +6300,44 @@ ifneq ($(NO_DEPS),true) endif +LIBBORINGSSL_SPAKE25519_TEST_LIB_SRC = \ + third_party/boringssl/crypto/curve25519/spake25519_test.cc \ + +PUBLIC_HEADERS_CXX += \ + +LIBBORINGSSL_SPAKE25519_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_SPAKE25519_TEST_LIB_SRC)))) + +$(LIBBORINGSSL_SPAKE25519_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_SPAKE25519_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_spake25519_test_lib.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libboringssl_spake25519_test_lib.a: $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_SPAKE25519_TEST_LIB_OBJS) + $(E) "[AR] Creating $@" + $(Q) mkdir -p `dirname $@` + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_spake25519_test_lib.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_spake25519_test_lib.a $(LIBBORINGSSL_SPAKE25519_TEST_LIB_OBJS) +ifeq ($(SYSTEM),Darwin) + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_spake25519_test_lib.a +endif + + + + +endif + +ifneq ($(NO_DEPS),true) +-include $(LIBBORINGSSL_SPAKE25519_TEST_LIB_OBJS:.o=.dep) +endif + + LIBBORINGSSL_X25519_TEST_LIB_SRC = \ third_party/boringssl/crypto/curve25519/x25519_test.cc \ @@ -6445,6 +6544,82 @@ ifneq ($(NO_DEPS),true) endif +LIBBORINGSSL_ECDH_TEST_LIB_SRC = \ + third_party/boringssl/crypto/ecdh/ecdh_test.cc \ + +PUBLIC_HEADERS_CXX += \ + +LIBBORINGSSL_ECDH_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_ECDH_TEST_LIB_SRC)))) + +$(LIBBORINGSSL_ECDH_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_ECDH_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_ecdh_test_lib.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libboringssl_ecdh_test_lib.a: $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_ECDH_TEST_LIB_OBJS) + $(E) "[AR] Creating $@" + $(Q) mkdir -p `dirname $@` + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_ecdh_test_lib.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_ecdh_test_lib.a $(LIBBORINGSSL_ECDH_TEST_LIB_OBJS) +ifeq ($(SYSTEM),Darwin) + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_ecdh_test_lib.a +endif + + + + +endif + +ifneq ($(NO_DEPS),true) +-include $(LIBBORINGSSL_ECDH_TEST_LIB_OBJS:.o=.dep) +endif + + +LIBBORINGSSL_ECDSA_SIGN_TEST_LIB_SRC = \ + third_party/boringssl/crypto/ecdsa/ecdsa_sign_test.cc \ + +PUBLIC_HEADERS_CXX += \ + +LIBBORINGSSL_ECDSA_SIGN_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_ECDSA_SIGN_TEST_LIB_SRC)))) + +$(LIBBORINGSSL_ECDSA_SIGN_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_ECDSA_SIGN_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_ecdsa_sign_test_lib.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_sign_test_lib.a: $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_ECDSA_SIGN_TEST_LIB_OBJS) + $(E) "[AR] Creating $@" + $(Q) mkdir -p `dirname $@` + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_sign_test_lib.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_sign_test_lib.a $(LIBBORINGSSL_ECDSA_SIGN_TEST_LIB_OBJS) +ifeq ($(SYSTEM),Darwin) + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_sign_test_lib.a +endif + + + + +endif + +ifneq ($(NO_DEPS),true) +-include $(LIBBORINGSSL_ECDSA_SIGN_TEST_LIB_OBJS:.o=.dep) +endif + + LIBBORINGSSL_ECDSA_TEST_LIB_SRC = \ third_party/boringssl/crypto/ecdsa/ecdsa_test.cc \ @@ -6483,6 +6658,44 @@ ifneq ($(NO_DEPS),true) endif +LIBBORINGSSL_ECDSA_VERIFY_TEST_LIB_SRC = \ + third_party/boringssl/crypto/ecdsa/ecdsa_verify_test.cc \ + +PUBLIC_HEADERS_CXX += \ + +LIBBORINGSSL_ECDSA_VERIFY_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_ECDSA_VERIFY_TEST_LIB_SRC)))) + +$(LIBBORINGSSL_ECDSA_VERIFY_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_ECDSA_VERIFY_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_ecdsa_verify_test_lib.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_verify_test_lib.a: $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_ECDSA_VERIFY_TEST_LIB_OBJS) + $(E) "[AR] Creating $@" + $(Q) mkdir -p `dirname $@` + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_verify_test_lib.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_verify_test_lib.a $(LIBBORINGSSL_ECDSA_VERIFY_TEST_LIB_OBJS) +ifeq ($(SYSTEM),Darwin) + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_verify_test_lib.a +endif + + + + +endif + +ifneq ($(NO_DEPS),true) +-include $(LIBBORINGSSL_ECDSA_VERIFY_TEST_LIB_OBJS:.o=.dep) +endif + + LIBBORINGSSL_ERR_TEST_LIB_SRC = \ third_party/boringssl/crypto/err/err_test.cc \ @@ -6728,16 +6941,25 @@ endif LIBBORINGSSL_GCM_TEST_LIB_SRC = \ - third_party/boringssl/crypto/modes/gcm_test.c \ + third_party/boringssl/crypto/modes/gcm_test.cc \ -PUBLIC_HEADERS_C += \ +PUBLIC_HEADERS_CXX += \ LIBBORINGSSL_GCM_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_GCM_TEST_LIB_SRC)))) $(LIBBORINGSSL_GCM_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_GCM_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_gcm_test_lib.a: $(ZLIB_DEP) $(LIBBORINGSSL_GCM_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_gcm_test_lib.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libboringssl_gcm_test_lib.a: $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_GCM_TEST_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_gcm_test_lib.a @@ -6749,11 +6971,165 @@ endif +endif + ifneq ($(NO_DEPS),true) -include $(LIBBORINGSSL_GCM_TEST_LIB_OBJS:.o=.dep) 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) $(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) $(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) $(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 \ + +PUBLIC_HEADERS_CXX += \ + +LIBBORINGSSL_OBJ_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_OBJ_TEST_LIB_SRC)))) + +$(LIBBORINGSSL_OBJ_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_OBJ_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_obj_test_lib.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libboringssl_obj_test_lib.a: $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_OBJ_TEST_LIB_OBJS) + $(E) "[AR] Creating $@" + $(Q) mkdir -p `dirname $@` + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_obj_test_lib.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_obj_test_lib.a $(LIBBORINGSSL_OBJ_TEST_LIB_OBJS) +ifeq ($(SYSTEM),Darwin) + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_obj_test_lib.a +endif + + + + +endif + +ifneq ($(NO_DEPS),true) +-include $(LIBBORINGSSL_OBJ_TEST_LIB_OBJS:.o=.dep) +endif + + LIBBORINGSSL_PKCS12_TEST_LIB_SRC = \ third_party/boringssl/crypto/pkcs8/pkcs12_test.cc \ @@ -7079,33 +7455,6 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_PQUEUE_TEST_LIB_SRC = \ - third_party/boringssl/ssl/pqueue/pqueue_test.c \ - -PUBLIC_HEADERS_C += \ - -LIBBORINGSSL_PQUEUE_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_PQUEUE_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_PQUEUE_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_PQUEUE_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_pqueue_test_lib.a: $(ZLIB_DEP) $(LIBBORINGSSL_PQUEUE_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_pqueue_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_pqueue_test_lib.a $(LIBBORINGSSL_PQUEUE_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_pqueue_test_lib.a -endif - - - - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_PQUEUE_TEST_LIB_OBJS:.o=.dep) -endif - - LIBBORINGSSL_SSL_TEST_LIB_SRC = \ third_party/boringssl/ssl/ssl_test.cc \ @@ -14640,6 +14989,33 @@ endif +# 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 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 @@ -14775,6 +15151,33 @@ endif +# 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_SPAKE25519_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) +$(BORINGSSL_SPAKE25519_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) +$(BORINGSSL_SPAKE25519_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_spake25519_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/boringssl_spake25519_test: $(LIBDIR)/$(CONFIG)/libboringssl_spake25519_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_spake25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_spake25519_test + +endif + + + + + # 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 @@ -14937,6 +15340,60 @@ endif +# 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_ECDH_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) +$(BORINGSSL_ECDH_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) +$(BORINGSSL_ECDH_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_ecdh_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/boringssl_ecdh_test: $(LIBDIR)/$(CONFIG)/libboringssl_ecdh_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_ecdh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_ecdh_test + +endif + + + + + +# 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_ECDSA_SIGN_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) +$(BORINGSSL_ECDSA_SIGN_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) +$(BORINGSSL_ECDSA_SIGN_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_ecdsa_sign_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/boringssl_ecdsa_sign_test: $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_sign_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_ecdsa_sign_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_ecdsa_sign_test + +endif + + + + + # 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 @@ -14964,6 +15421,33 @@ endif +# 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_ECDSA_VERIFY_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) +$(BORINGSSL_ECDSA_VERIFY_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) +$(BORINGSSL_ECDSA_VERIFY_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_ecdsa_verify_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/boringssl_ecdsa_verify_test: $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_verify_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_ecdsa_verify_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_ecdsa_verify_test + +endif + + + + + # 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 @@ -15180,6 +15664,114 @@ endif +# 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 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 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 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_OBJ_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) +$(BORINGSSL_OBJ_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) +$(BORINGSSL_OBJ_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_obj_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/boringssl_obj_test: $(LIBDIR)/$(CONFIG)/libboringssl_obj_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_obj_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_obj_test + +endif + + + + + # 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 @@ -15450,33 +16042,6 @@ endif -# 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_PQUEUE_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_PQUEUE_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_PQUEUE_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_pqueue_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_pqueue_test: $(LIBDIR)/$(CONFIG)/libboringssl_pqueue_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_pqueue_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_pqueue_test - -endif - - - - - # 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 diff --git a/binding.gyp b/binding.gyp index d75b05472a6..9328a30929c 100644 --- a/binding.gyp +++ b/binding.gyp @@ -161,7 +161,6 @@ 'third_party/boringssl/crypto/aes/mode_wrappers.c', 'third_party/boringssl/crypto/asn1/a_bitstr.c', 'third_party/boringssl/crypto/asn1/a_bool.c', - 'third_party/boringssl/crypto/asn1/a_bytes.c', 'third_party/boringssl/crypto/asn1/a_d2i_fp.c', 'third_party/boringssl/crypto/asn1/a_dup.c', 'third_party/boringssl/crypto/asn1/a_enum.c', @@ -180,18 +179,14 @@ 'third_party/boringssl/crypto/asn1/asn1_lib.c', 'third_party/boringssl/crypto/asn1/asn1_par.c', 'third_party/boringssl/crypto/asn1/asn_pack.c', - 'third_party/boringssl/crypto/asn1/bio_asn1.c', - 'third_party/boringssl/crypto/asn1/bio_ndef.c', 'third_party/boringssl/crypto/asn1/f_enum.c', 'third_party/boringssl/crypto/asn1/f_int.c', 'third_party/boringssl/crypto/asn1/f_string.c', 'third_party/boringssl/crypto/asn1/t_bitst.c', - 'third_party/boringssl/crypto/asn1/t_pkey.c', 'third_party/boringssl/crypto/asn1/tasn_dec.c', 'third_party/boringssl/crypto/asn1/tasn_enc.c', 'third_party/boringssl/crypto/asn1/tasn_fre.c', 'third_party/boringssl/crypto/asn1/tasn_new.c', - 'third_party/boringssl/crypto/asn1/tasn_prn.c', 'third_party/boringssl/crypto/asn1/tasn_typ.c', 'third_party/boringssl/crypto/asn1/tasn_utl.c', 'third_party/boringssl/crypto/asn1/x_bignum.c', @@ -221,6 +216,7 @@ 'third_party/boringssl/crypto/bn/generic.c', 'third_party/boringssl/crypto/bn/kronecker.c', 'third_party/boringssl/crypto/bn/montgomery.c', + 'third_party/boringssl/crypto/bn/montgomery_inv.c', 'third_party/boringssl/crypto/bn/mul.c', 'third_party/boringssl/crypto/bn/prime.c', 'third_party/boringssl/crypto/bn/random.c', @@ -232,8 +228,7 @@ 'third_party/boringssl/crypto/bytestring/ber.c', 'third_party/boringssl/crypto/bytestring/cbb.c', 'third_party/boringssl/crypto/bytestring/cbs.c', - 'third_party/boringssl/crypto/chacha/chacha_generic.c', - 'third_party/boringssl/crypto/chacha/chacha_vec.c', + 'third_party/boringssl/crypto/chacha/chacha.c', 'third_party/boringssl/crypto/cipher/aead.c', 'third_party/boringssl/crypto/cipher/cipher.c', 'third_party/boringssl/crypto/cipher/derive_key.c', @@ -248,10 +243,14 @@ 'third_party/boringssl/crypto/cipher/tls_cbc.c', 'third_party/boringssl/crypto/cmac/cmac.c', 'third_party/boringssl/crypto/conf/conf.c', + 'third_party/boringssl/crypto/cpu-aarch64-linux.c', + 'third_party/boringssl/crypto/cpu-arm-linux.c', 'third_party/boringssl/crypto/cpu-arm.c', 'third_party/boringssl/crypto/cpu-intel.c', + 'third_party/boringssl/crypto/cpu-ppc64le.c', 'third_party/boringssl/crypto/crypto.c', 'third_party/boringssl/crypto/curve25519/curve25519.c', + 'third_party/boringssl/crypto/curve25519/spake25519.c', 'third_party/boringssl/crypto/curve25519/x25519-x86_64.c', 'third_party/boringssl/crypto/des/des.c', 'third_party/boringssl/crypto/dh/check.c', @@ -260,8 +259,6 @@ 'third_party/boringssl/crypto/dh/params.c', 'third_party/boringssl/crypto/digest/digest.c', 'third_party/boringssl/crypto/digest/digests.c', - 'third_party/boringssl/crypto/directory_posix.c', - 'third_party/boringssl/crypto/directory_win.c', 'third_party/boringssl/crypto/dsa/dsa.c', 'third_party/boringssl/crypto/dsa/dsa_asn1.c', 'third_party/boringssl/crypto/ec/ec.c', @@ -280,7 +277,6 @@ 'third_party/boringssl/crypto/ecdsa/ecdsa_asn1.c', 'third_party/boringssl/crypto/engine/engine.c', 'third_party/boringssl/crypto/err/err.c', - 'third_party/boringssl/crypto/evp/algorithm.c', 'third_party/boringssl/crypto/evp/digestsign.c', 'third_party/boringssl/crypto/evp/evp.c', 'third_party/boringssl/crypto/evp/evp_asn1.c', @@ -291,6 +287,7 @@ 'third_party/boringssl/crypto/evp/p_rsa.c', 'third_party/boringssl/crypto/evp/p_rsa_asn1.c', 'third_party/boringssl/crypto/evp/pbkdf.c', + 'third_party/boringssl/crypto/evp/print.c', 'third_party/boringssl/crypto/evp/sign.c', 'third_party/boringssl/crypto/ex_data.c', 'third_party/boringssl/crypto/hkdf/hkdf.c', @@ -304,6 +301,12 @@ '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/obj/obj.c', 'third_party/boringssl/crypto/obj/obj_xref.c', 'third_party/boringssl/crypto/pem/pem_all.c', @@ -321,6 +324,7 @@ '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/rand/deterministic.c', 'third_party/boringssl/crypto/rand/rand.c', 'third_party/boringssl/crypto/rand/urandom.c', 'third_party/boringssl/crypto/rand/windows.c', @@ -345,11 +349,13 @@ 'third_party/boringssl/crypto/x509/a_sign.c', 'third_party/boringssl/crypto/x509/a_strex.c', 'third_party/boringssl/crypto/x509/a_verify.c', + 'third_party/boringssl/crypto/x509/algorithm.c', 'third_party/boringssl/crypto/x509/asn1_gen.c', 'third_party/boringssl/crypto/x509/by_dir.c', 'third_party/boringssl/crypto/x509/by_file.c', 'third_party/boringssl/crypto/x509/i2d_pr.c', 'third_party/boringssl/crypto/x509/pkcs7.c', + 'third_party/boringssl/crypto/x509/rsa_pss.c', 'third_party/boringssl/crypto/x509/t_crl.c', 'third_party/boringssl/crypto/x509/t_req.c', 'third_party/boringssl/crypto/x509/t_x509.c', @@ -424,21 +430,17 @@ 'third_party/boringssl/crypto/x509v3/v3_utl.c', 'third_party/boringssl/ssl/custom_extensions.c', 'third_party/boringssl/ssl/d1_both.c', - 'third_party/boringssl/ssl/d1_clnt.c', 'third_party/boringssl/ssl/d1_lib.c', - 'third_party/boringssl/ssl/d1_meth.c', 'third_party/boringssl/ssl/d1_pkt.c', 'third_party/boringssl/ssl/d1_srtp.c', - 'third_party/boringssl/ssl/d1_srvr.c', + 'third_party/boringssl/ssl/dtls_method.c', 'third_party/boringssl/ssl/dtls_record.c', - 'third_party/boringssl/ssl/pqueue/pqueue.c', + '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_clnt.c', 'third_party/boringssl/ssl/s3_enc.c', 'third_party/boringssl/ssl/s3_lib.c', - 'third_party/boringssl/ssl/s3_meth.c', 'third_party/boringssl/ssl/s3_pkt.c', - 'third_party/boringssl/ssl/s3_srvr.c', 'third_party/boringssl/ssl/ssl_aead_ctx.c', 'third_party/boringssl/ssl/ssl_asn1.c', 'third_party/boringssl/ssl/ssl_buffer.c', @@ -452,6 +454,11 @@ 'third_party/boringssl/ssl/ssl_stat.c', 'third_party/boringssl/ssl/t1_enc.c', 'third_party/boringssl/ssl/t1_lib.c', + 'third_party/boringssl/ssl/tls13_both.c', + 'third_party/boringssl/ssl/tls13_client.c', + 'third_party/boringssl/ssl/tls13_enc.c', + 'third_party/boringssl/ssl/tls13_server.c', + 'third_party/boringssl/ssl/tls_method.c', 'third_party/boringssl/ssl/tls_record.c', ] }, diff --git a/config.m4 b/config.m4 index 6a2c0ddb47e..9b2d8192a60 100644 --- a/config.m4 +++ b/config.m4 @@ -305,7 +305,6 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/aes/mode_wrappers.c \ third_party/boringssl/crypto/asn1/a_bitstr.c \ third_party/boringssl/crypto/asn1/a_bool.c \ - third_party/boringssl/crypto/asn1/a_bytes.c \ third_party/boringssl/crypto/asn1/a_d2i_fp.c \ third_party/boringssl/crypto/asn1/a_dup.c \ third_party/boringssl/crypto/asn1/a_enum.c \ @@ -324,18 +323,14 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/asn1/asn1_lib.c \ third_party/boringssl/crypto/asn1/asn1_par.c \ third_party/boringssl/crypto/asn1/asn_pack.c \ - third_party/boringssl/crypto/asn1/bio_asn1.c \ - third_party/boringssl/crypto/asn1/bio_ndef.c \ third_party/boringssl/crypto/asn1/f_enum.c \ third_party/boringssl/crypto/asn1/f_int.c \ third_party/boringssl/crypto/asn1/f_string.c \ third_party/boringssl/crypto/asn1/t_bitst.c \ - third_party/boringssl/crypto/asn1/t_pkey.c \ third_party/boringssl/crypto/asn1/tasn_dec.c \ third_party/boringssl/crypto/asn1/tasn_enc.c \ third_party/boringssl/crypto/asn1/tasn_fre.c \ third_party/boringssl/crypto/asn1/tasn_new.c \ - third_party/boringssl/crypto/asn1/tasn_prn.c \ third_party/boringssl/crypto/asn1/tasn_typ.c \ third_party/boringssl/crypto/asn1/tasn_utl.c \ third_party/boringssl/crypto/asn1/x_bignum.c \ @@ -365,6 +360,7 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/bn/generic.c \ third_party/boringssl/crypto/bn/kronecker.c \ third_party/boringssl/crypto/bn/montgomery.c \ + third_party/boringssl/crypto/bn/montgomery_inv.c \ third_party/boringssl/crypto/bn/mul.c \ third_party/boringssl/crypto/bn/prime.c \ third_party/boringssl/crypto/bn/random.c \ @@ -376,8 +372,7 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/bytestring/ber.c \ third_party/boringssl/crypto/bytestring/cbb.c \ third_party/boringssl/crypto/bytestring/cbs.c \ - third_party/boringssl/crypto/chacha/chacha_generic.c \ - third_party/boringssl/crypto/chacha/chacha_vec.c \ + third_party/boringssl/crypto/chacha/chacha.c \ third_party/boringssl/crypto/cipher/aead.c \ third_party/boringssl/crypto/cipher/cipher.c \ third_party/boringssl/crypto/cipher/derive_key.c \ @@ -392,10 +387,14 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/cipher/tls_cbc.c \ third_party/boringssl/crypto/cmac/cmac.c \ third_party/boringssl/crypto/conf/conf.c \ + third_party/boringssl/crypto/cpu-aarch64-linux.c \ + third_party/boringssl/crypto/cpu-arm-linux.c \ third_party/boringssl/crypto/cpu-arm.c \ third_party/boringssl/crypto/cpu-intel.c \ + third_party/boringssl/crypto/cpu-ppc64le.c \ third_party/boringssl/crypto/crypto.c \ third_party/boringssl/crypto/curve25519/curve25519.c \ + third_party/boringssl/crypto/curve25519/spake25519.c \ third_party/boringssl/crypto/curve25519/x25519-x86_64.c \ third_party/boringssl/crypto/des/des.c \ third_party/boringssl/crypto/dh/check.c \ @@ -404,8 +403,6 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/dh/params.c \ third_party/boringssl/crypto/digest/digest.c \ third_party/boringssl/crypto/digest/digests.c \ - third_party/boringssl/crypto/directory_posix.c \ - third_party/boringssl/crypto/directory_win.c \ third_party/boringssl/crypto/dsa/dsa.c \ third_party/boringssl/crypto/dsa/dsa_asn1.c \ third_party/boringssl/crypto/ec/ec.c \ @@ -424,7 +421,6 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/ecdsa/ecdsa_asn1.c \ third_party/boringssl/crypto/engine/engine.c \ third_party/boringssl/crypto/err/err.c \ - third_party/boringssl/crypto/evp/algorithm.c \ third_party/boringssl/crypto/evp/digestsign.c \ third_party/boringssl/crypto/evp/evp.c \ third_party/boringssl/crypto/evp/evp_asn1.c \ @@ -435,6 +431,7 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/evp/p_rsa.c \ third_party/boringssl/crypto/evp/p_rsa_asn1.c \ third_party/boringssl/crypto/evp/pbkdf.c \ + third_party/boringssl/crypto/evp/print.c \ third_party/boringssl/crypto/evp/sign.c \ third_party/boringssl/crypto/ex_data.c \ third_party/boringssl/crypto/hkdf/hkdf.c \ @@ -448,6 +445,12 @@ 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/obj/obj.c \ third_party/boringssl/crypto/obj/obj_xref.c \ third_party/boringssl/crypto/pem/pem_all.c \ @@ -465,6 +468,7 @@ if test "$PHP_GRPC" != "no"; then 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/rand/deterministic.c \ third_party/boringssl/crypto/rand/rand.c \ third_party/boringssl/crypto/rand/urandom.c \ third_party/boringssl/crypto/rand/windows.c \ @@ -489,11 +493,13 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/x509/a_sign.c \ third_party/boringssl/crypto/x509/a_strex.c \ third_party/boringssl/crypto/x509/a_verify.c \ + third_party/boringssl/crypto/x509/algorithm.c \ third_party/boringssl/crypto/x509/asn1_gen.c \ third_party/boringssl/crypto/x509/by_dir.c \ third_party/boringssl/crypto/x509/by_file.c \ third_party/boringssl/crypto/x509/i2d_pr.c \ third_party/boringssl/crypto/x509/pkcs7.c \ + third_party/boringssl/crypto/x509/rsa_pss.c \ third_party/boringssl/crypto/x509/t_crl.c \ third_party/boringssl/crypto/x509/t_req.c \ third_party/boringssl/crypto/x509/t_x509.c \ @@ -568,21 +574,17 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/x509v3/v3_utl.c \ third_party/boringssl/ssl/custom_extensions.c \ third_party/boringssl/ssl/d1_both.c \ - third_party/boringssl/ssl/d1_clnt.c \ third_party/boringssl/ssl/d1_lib.c \ - third_party/boringssl/ssl/d1_meth.c \ third_party/boringssl/ssl/d1_pkt.c \ third_party/boringssl/ssl/d1_srtp.c \ - third_party/boringssl/ssl/d1_srvr.c \ + third_party/boringssl/ssl/dtls_method.c \ third_party/boringssl/ssl/dtls_record.c \ - third_party/boringssl/ssl/pqueue/pqueue.c \ + 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_clnt.c \ third_party/boringssl/ssl/s3_enc.c \ third_party/boringssl/ssl/s3_lib.c \ - third_party/boringssl/ssl/s3_meth.c \ third_party/boringssl/ssl/s3_pkt.c \ - third_party/boringssl/ssl/s3_srvr.c \ third_party/boringssl/ssl/ssl_aead_ctx.c \ third_party/boringssl/ssl/ssl_asn1.c \ third_party/boringssl/ssl/ssl_buffer.c \ @@ -596,6 +598,11 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/ssl/ssl_stat.c \ third_party/boringssl/ssl/t1_enc.c \ third_party/boringssl/ssl/t1_lib.c \ + third_party/boringssl/ssl/tls13_both.c \ + third_party/boringssl/ssl/tls13_client.c \ + third_party/boringssl/ssl/tls13_enc.c \ + third_party/boringssl/ssl/tls13_server.c \ + third_party/boringssl/ssl/tls_method.c \ third_party/boringssl/ssl/tls_record.c \ , $ext_shared, , -Wall -Werror \ -Wno-parentheses-equality -Wno-unused-value -std=c11 \ @@ -678,6 +685,7 @@ 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) @@ -690,6 +698,5 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/x509) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/x509v3) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/ssl) - PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/ssl/pqueue) PHP_ADD_BUILD_DIR($ext_builddir/third_party/nanopb) fi diff --git a/grpc.gemspec b/grpc.gemspec index 32e4eb960b7..2d84682456b 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -583,23 +583,22 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/conf/internal.h ) s.files += %w( third_party/boringssl/crypto/curve25519/internal.h ) s.files += %w( third_party/boringssl/crypto/des/internal.h ) - s.files += %w( third_party/boringssl/crypto/dh/internal.h ) s.files += %w( third_party/boringssl/crypto/digest/internal.h ) s.files += %w( third_party/boringssl/crypto/digest/md32_common.h ) - s.files += %w( third_party/boringssl/crypto/directory.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/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/rand/internal.h ) s.files += %w( third_party/boringssl/crypto/rsa/internal.h ) - s.files += %w( third_party/boringssl/crypto/test/scoped_types.h ) - s.files += %w( third_party/boringssl/crypto/test/test_util.h ) s.files += %w( third_party/boringssl/crypto/x509/charmap.h ) + s.files += %w( third_party/boringssl/crypto/x509/internal.h ) s.files += %w( third_party/boringssl/crypto/x509/vpm_int.h ) s.files += %w( third_party/boringssl/crypto/x509v3/ext_dat.h ) s.files += %w( third_party/boringssl/crypto/x509v3/pcy_int.h ) @@ -645,10 +644,12 @@ 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 ) s.files += %w( third_party/boringssl/include/openssl/objects.h ) - s.files += %w( third_party/boringssl/include/openssl/opensslfeatures.h ) + s.files += %w( third_party/boringssl/include/openssl/opensslconf.h ) s.files += %w( third_party/boringssl/include/openssl/opensslv.h ) s.files += %w( third_party/boringssl/include/openssl/ossl_typ.h ) s.files += %w( third_party/boringssl/include/openssl/pem.h ) @@ -656,9 +657,9 @@ 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/pqueue.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 ) s.files += %w( third_party/boringssl/include/openssl/rsa.h ) s.files += %w( third_party/boringssl/include/openssl/safestack.h ) s.files += %w( third_party/boringssl/include/openssl/sha.h ) @@ -675,16 +676,11 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/include/openssl/x509_vfy.h ) s.files += %w( third_party/boringssl/include/openssl/x509v3.h ) s.files += %w( third_party/boringssl/ssl/internal.h ) - s.files += %w( third_party/boringssl/ssl/test/async_bio.h ) - s.files += %w( third_party/boringssl/ssl/test/packeted_bio.h ) - s.files += %w( third_party/boringssl/ssl/test/scoped_types.h ) - s.files += %w( third_party/boringssl/ssl/test/test_config.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/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 ) - s.files += %w( third_party/boringssl/crypto/asn1/a_bytes.c ) s.files += %w( third_party/boringssl/crypto/asn1/a_d2i_fp.c ) s.files += %w( third_party/boringssl/crypto/asn1/a_dup.c ) s.files += %w( third_party/boringssl/crypto/asn1/a_enum.c ) @@ -703,18 +699,14 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/asn1/asn1_lib.c ) s.files += %w( third_party/boringssl/crypto/asn1/asn1_par.c ) s.files += %w( third_party/boringssl/crypto/asn1/asn_pack.c ) - s.files += %w( third_party/boringssl/crypto/asn1/bio_asn1.c ) - s.files += %w( third_party/boringssl/crypto/asn1/bio_ndef.c ) s.files += %w( third_party/boringssl/crypto/asn1/f_enum.c ) s.files += %w( third_party/boringssl/crypto/asn1/f_int.c ) s.files += %w( third_party/boringssl/crypto/asn1/f_string.c ) s.files += %w( third_party/boringssl/crypto/asn1/t_bitst.c ) - s.files += %w( third_party/boringssl/crypto/asn1/t_pkey.c ) s.files += %w( third_party/boringssl/crypto/asn1/tasn_dec.c ) s.files += %w( third_party/boringssl/crypto/asn1/tasn_enc.c ) s.files += %w( third_party/boringssl/crypto/asn1/tasn_fre.c ) s.files += %w( third_party/boringssl/crypto/asn1/tasn_new.c ) - s.files += %w( third_party/boringssl/crypto/asn1/tasn_prn.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/x_bignum.c ) @@ -744,6 +736,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/bn/generic.c ) s.files += %w( third_party/boringssl/crypto/bn/kronecker.c ) s.files += %w( third_party/boringssl/crypto/bn/montgomery.c ) + s.files += %w( third_party/boringssl/crypto/bn/montgomery_inv.c ) s.files += %w( third_party/boringssl/crypto/bn/mul.c ) s.files += %w( third_party/boringssl/crypto/bn/prime.c ) s.files += %w( third_party/boringssl/crypto/bn/random.c ) @@ -755,8 +748,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/bytestring/ber.c ) s.files += %w( third_party/boringssl/crypto/bytestring/cbb.c ) s.files += %w( third_party/boringssl/crypto/bytestring/cbs.c ) - s.files += %w( third_party/boringssl/crypto/chacha/chacha_generic.c ) - s.files += %w( third_party/boringssl/crypto/chacha/chacha_vec.c ) + s.files += %w( third_party/boringssl/crypto/chacha/chacha.c ) s.files += %w( third_party/boringssl/crypto/cipher/aead.c ) s.files += %w( third_party/boringssl/crypto/cipher/cipher.c ) s.files += %w( third_party/boringssl/crypto/cipher/derive_key.c ) @@ -771,10 +763,14 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/cipher/tls_cbc.c ) s.files += %w( third_party/boringssl/crypto/cmac/cmac.c ) s.files += %w( third_party/boringssl/crypto/conf/conf.c ) + s.files += %w( third_party/boringssl/crypto/cpu-aarch64-linux.c ) + s.files += %w( third_party/boringssl/crypto/cpu-arm-linux.c ) s.files += %w( third_party/boringssl/crypto/cpu-arm.c ) s.files += %w( third_party/boringssl/crypto/cpu-intel.c ) + s.files += %w( third_party/boringssl/crypto/cpu-ppc64le.c ) s.files += %w( third_party/boringssl/crypto/crypto.c ) s.files += %w( third_party/boringssl/crypto/curve25519/curve25519.c ) + s.files += %w( third_party/boringssl/crypto/curve25519/spake25519.c ) s.files += %w( third_party/boringssl/crypto/curve25519/x25519-x86_64.c ) s.files += %w( third_party/boringssl/crypto/des/des.c ) s.files += %w( third_party/boringssl/crypto/dh/check.c ) @@ -783,8 +779,6 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/dh/params.c ) s.files += %w( third_party/boringssl/crypto/digest/digest.c ) s.files += %w( third_party/boringssl/crypto/digest/digests.c ) - s.files += %w( third_party/boringssl/crypto/directory_posix.c ) - s.files += %w( third_party/boringssl/crypto/directory_win.c ) s.files += %w( third_party/boringssl/crypto/dsa/dsa.c ) s.files += %w( third_party/boringssl/crypto/dsa/dsa_asn1.c ) s.files += %w( third_party/boringssl/crypto/ec/ec.c ) @@ -803,7 +797,6 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/ecdsa/ecdsa_asn1.c ) s.files += %w( third_party/boringssl/crypto/engine/engine.c ) s.files += %w( third_party/boringssl/crypto/err/err.c ) - s.files += %w( third_party/boringssl/crypto/evp/algorithm.c ) s.files += %w( third_party/boringssl/crypto/evp/digestsign.c ) s.files += %w( third_party/boringssl/crypto/evp/evp.c ) s.files += %w( third_party/boringssl/crypto/evp/evp_asn1.c ) @@ -814,6 +807,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/evp/p_rsa.c ) s.files += %w( third_party/boringssl/crypto/evp/p_rsa_asn1.c ) s.files += %w( third_party/boringssl/crypto/evp/pbkdf.c ) + s.files += %w( third_party/boringssl/crypto/evp/print.c ) s.files += %w( third_party/boringssl/crypto/evp/sign.c ) s.files += %w( third_party/boringssl/crypto/ex_data.c ) s.files += %w( third_party/boringssl/crypto/hkdf/hkdf.c ) @@ -827,6 +821,12 @@ 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/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 ) @@ -844,6 +844,7 @@ Gem::Specification.new do |s| 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/rand/deterministic.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 ) @@ -868,11 +869,13 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/x509/a_sign.c ) s.files += %w( third_party/boringssl/crypto/x509/a_strex.c ) s.files += %w( third_party/boringssl/crypto/x509/a_verify.c ) + s.files += %w( third_party/boringssl/crypto/x509/algorithm.c ) s.files += %w( third_party/boringssl/crypto/x509/asn1_gen.c ) s.files += %w( third_party/boringssl/crypto/x509/by_dir.c ) s.files += %w( third_party/boringssl/crypto/x509/by_file.c ) s.files += %w( third_party/boringssl/crypto/x509/i2d_pr.c ) s.files += %w( third_party/boringssl/crypto/x509/pkcs7.c ) + s.files += %w( third_party/boringssl/crypto/x509/rsa_pss.c ) s.files += %w( third_party/boringssl/crypto/x509/t_crl.c ) s.files += %w( third_party/boringssl/crypto/x509/t_req.c ) s.files += %w( third_party/boringssl/crypto/x509/t_x509.c ) @@ -947,21 +950,17 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/x509v3/v3_utl.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_clnt.c ) s.files += %w( third_party/boringssl/ssl/d1_lib.c ) - s.files += %w( third_party/boringssl/ssl/d1_meth.c ) s.files += %w( third_party/boringssl/ssl/d1_pkt.c ) s.files += %w( third_party/boringssl/ssl/d1_srtp.c ) - s.files += %w( third_party/boringssl/ssl/d1_srvr.c ) + s.files += %w( third_party/boringssl/ssl/dtls_method.c ) s.files += %w( third_party/boringssl/ssl/dtls_record.c ) - s.files += %w( third_party/boringssl/ssl/pqueue/pqueue.c ) + 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_clnt.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_meth.c ) s.files += %w( third_party/boringssl/ssl/s3_pkt.c ) - s.files += %w( third_party/boringssl/ssl/s3_srvr.c ) s.files += %w( third_party/boringssl/ssl/ssl_aead_ctx.c ) s.files += %w( third_party/boringssl/ssl/ssl_asn1.c ) s.files += %w( third_party/boringssl/ssl/ssl_buffer.c ) @@ -975,6 +974,11 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/ssl/ssl_stat.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 ) + s.files += %w( third_party/boringssl/ssl/tls13_client.c ) + s.files += %w( third_party/boringssl/ssl/tls13_enc.c ) + s.files += %w( third_party/boringssl/ssl/tls13_server.c ) + s.files += %w( third_party/boringssl/ssl/tls_method.c ) s.files += %w( third_party/boringssl/ssl/tls_record.c ) s.files += %w( third_party/zlib/crc32.h ) s.files += %w( third_party/zlib/deflate.h ) diff --git a/package.xml b/package.xml index 95a4b95345d..06ce67a02c0 100644 --- a/package.xml +++ b/package.xml @@ -592,23 +592,22 @@ - - + + - - + @@ -654,10 +653,12 @@ + + - + @@ -665,9 +666,9 @@ - + @@ -684,16 +685,11 @@ - - - - - @@ -712,18 +708,14 @@ - - - - @@ -753,6 +745,7 @@ + @@ -764,8 +757,7 @@ - - + @@ -780,10 +772,14 @@ + + + + @@ -792,8 +788,6 @@ - - @@ -812,7 +806,6 @@ - @@ -823,6 +816,7 @@ + @@ -836,6 +830,12 @@ + + + + + + @@ -853,6 +853,7 @@ + @@ -877,11 +878,13 @@ + + @@ -956,21 +959,17 @@ - - - + - + + - - - @@ -984,6 +983,11 @@ + + + + + diff --git a/src/boringssl/err_data.c b/src/boringssl/err_data.c index d4cc08bd99c..c1257cdc787 100644 --- a/src/boringssl/err_data.c +++ b/src/boringssl/err_data.c @@ -54,182 +54,166 @@ OPENSSL_COMPILE_ASSERT(ERR_LIB_USER == 32, library_values_changed_32); OPENSSL_COMPILE_ASSERT(ERR_NUM_LIBS == 33, library_values_changed_num); const uint32_t kOpenSSLReasonValues[] = { - 0xc3207ab, - 0xc3287c5, - 0xc3307d4, - 0xc3387e4, - 0xc3407f3, - 0xc34880c, - 0xc350818, - 0xc358835, - 0xc360847, - 0xc368855, - 0xc370865, - 0xc378872, - 0xc380882, - 0xc38888d, - 0xc3908a3, - 0xc3988b2, - 0xc3a08c6, - 0xc3a87b8, - 0xc3b00b0, - 0x10321484, - 0x10329490, - 0x103314a9, - 0x103394bc, - 0x10340ded, - 0x103494cf, - 0x103514e4, - 0x10359516, - 0x1036152f, - 0x10369544, - 0x10371562, - 0x10379571, - 0x1038158d, - 0x103895a8, - 0x103915b7, - 0x103995d3, - 0x103a15ee, - 0x103a9605, - 0x103b1616, - 0x103b962a, - 0x103c1649, - 0x103c9658, - 0x103d166f, - 0x103d9682, - 0x103e0b5d, - 0x103e96b3, - 0x103f16c6, - 0x103f96e0, - 0x104016f0, - 0x10409704, - 0x1041171a, - 0x10419732, - 0x10421747, - 0x1042975b, - 0x1043176d, - 0x104385c1, - 0x104408b2, - 0x10449782, - 0x10451799, - 0x104597ae, - 0x104617bc, - 0x10469695, - 0x104714f7, - 0x104787b8, - 0x104800b0, - 0x10488b8c, - 0x14320b40, - 0x14328b4e, - 0x14330b5d, - 0x14338b6f, + 0xc320838, + 0xc328852, + 0xc330861, + 0xc338871, + 0xc340880, + 0xc348899, + 0xc3508a5, + 0xc3588c2, + 0xc3608d4, + 0xc3688e2, + 0xc3708f2, + 0xc3788ff, + 0xc38090f, + 0xc38891a, + 0xc390930, + 0xc39893f, + 0xc3a0953, + 0xc3a8845, + 0xc3b00ea, + 0x10320845, + 0x103293ab, + 0x103313b7, + 0x103393d0, + 0x103413e3, + 0x10348e8b, + 0x10350c19, + 0x103593f6, + 0x1036140b, + 0x1036941e, + 0x1037143d, + 0x10379456, + 0x1038146b, + 0x10389489, + 0x10391498, + 0x103994b4, + 0x103a14cf, + 0x103a94de, + 0x103b14fa, + 0x103b9515, + 0x103c152c, + 0x103c80ea, + 0x103d153d, + 0x103d9551, + 0x103e1570, + 0x103e957f, + 0x103f1596, + 0x103f95a9, + 0x10400bea, + 0x104095bc, + 0x104115da, + 0x104195ed, + 0x10421607, + 0x10429617, + 0x1043162b, + 0x10439641, + 0x10441659, + 0x1044966e, + 0x10451682, + 0x10459694, + 0x104605fb, + 0x1046893f, + 0x104716a9, + 0x104796c0, + 0x104816d5, + 0x104896e3, + 0x14320bcd, + 0x14328bdb, + 0x14330bea, + 0x14338bfc, + 0x143400ac, + 0x143480ea, 0x18320083, - 0x18328e53, - 0x18340e81, - 0x18348e95, - 0x18358ecc, - 0x18368ef9, - 0x18370f0c, - 0x18378f20, - 0x18380f44, - 0x18388f52, - 0x18390f68, - 0x18398f7c, - 0x183a0f8c, - 0x183b0f9c, - 0x183b8fb1, - 0x183c8fdc, - 0x183d0ff0, - 0x183d9000, - 0x183e0b98, - 0x183e900d, - 0x183f101f, - 0x183f902a, - 0x1840103a, - 0x1840904b, - 0x1841105c, - 0x1841906e, - 0x18421097, - 0x184290c9, - 0x184310d8, - 0x18451141, - 0x18459157, - 0x18461172, - 0x18468ee4, - 0x184709ca, - 0x18478094, - 0x18480fc8, - 0x1848910d, - 0x18490e69, - 0x18498eaa, - 0x184a11a8, - 0x184a9125, - 0x184b10ec, - 0x184b8e43, - 0x184c10b0, - 0x184c865c, - 0x184d118d, - 0x184d80b0, - 0x203211cf, - 0x243211db, - 0x243288f8, - 0x243311ed, - 0x243391fa, - 0x24341207, - 0x24349219, - 0x24351228, - 0x24359245, - 0x24361252, - 0x24369260, - 0x2437126e, - 0x2437927c, - 0x24381285, - 0x24389292, - 0x243912a5, - 0x28320b80, - 0x28328b98, - 0x28330b5d, - 0x28338bab, - 0x28340b8c, - 0x28348094, - 0x283500b0, - 0x2c32281d, - 0x2c32a82b, - 0x2c33283d, - 0x2c33a84f, - 0x2c342863, - 0x2c34a875, - 0x2c352890, - 0x2c35a8a2, - 0x2c3628b5, - 0x2c3682f3, - 0x2c3728c2, - 0x2c37a8d4, - 0x2c3828e7, - 0x2c38a8f5, - 0x2c392905, - 0x2c39a917, - 0x2c3a292b, - 0x2c3aa93c, - 0x2c3b1365, - 0x2c3ba94d, - 0x2c3c2961, - 0x2c3ca977, - 0x2c3d2990, - 0x2c3da9be, - 0x2c3e29cc, - 0x2c3ea9e4, - 0x2c3f29fc, - 0x2c3faa09, - 0x2c402a2c, - 0x2c40aa4b, - 0x2c4111cf, - 0x2c41aa5c, - 0x2c422a6f, - 0x2c429141, - 0x2c432a80, - 0x2c438693, - 0x2c4429ad, + 0x18328ee1, + 0x183300ac, + 0x18338ef7, + 0x18340f0b, + 0x183480ea, + 0x18350f20, + 0x18358f38, + 0x18360f4d, + 0x18368f61, + 0x18370f85, + 0x18378f9b, + 0x18380faf, + 0x18388fbf, + 0x18390a57, + 0x18398fcf, + 0x183a0fe4, + 0x183a8ff8, + 0x183b0c25, + 0x183b9005, + 0x183c1017, + 0x183c9022, + 0x183d1032, + 0x183d9043, + 0x183e1054, + 0x183e9066, + 0x183f108f, + 0x183f90a8, + 0x184010c0, + 0x184086d3, + 0x203210e7, + 0x243210f3, + 0x24328985, + 0x24331105, + 0x24339112, + 0x2434111f, + 0x24349131, + 0x24351140, + 0x2435915d, + 0x2436116a, + 0x24369178, + 0x24371186, + 0x24379194, + 0x2438119d, + 0x243891aa, + 0x243911bd, + 0x28320c0d, + 0x28328c25, + 0x28330bea, + 0x28338c38, + 0x28340c19, + 0x283480ac, + 0x283500ea, + 0x2c3228ca, + 0x2c32a8d8, + 0x2c3328ea, + 0x2c33a8fc, + 0x2c342910, + 0x2c34a922, + 0x2c35293d, + 0x2c35a94f, + 0x2c362962, + 0x2c36832d, + 0x2c37296f, + 0x2c37a981, + 0x2c382994, + 0x2c38a9ab, + 0x2c3929b9, + 0x2c39a9c9, + 0x2c3a29db, + 0x2c3aa9ef, + 0x2c3b2a00, + 0x2c3baa1f, + 0x2c3c2a33, + 0x2c3caa49, + 0x2c3d2a62, + 0x2c3daa7f, + 0x2c3e2a90, + 0x2c3eaa9e, + 0x2c3f2ab6, + 0x2c3faace, + 0x2c402adb, + 0x2c4090e7, + 0x2c412aec, + 0x2c41aaff, + 0x2c4210c0, + 0x2c42ab10, + 0x2c430720, + 0x2c43aa11, 0x30320000, 0x30328015, 0x3033001f, @@ -239,443 +223,465 @@ const uint32_t kOpenSSLReasonValues[] = { 0x3035006b, 0x30358083, 0x30360094, - 0x303680a1, - 0x303700b0, - 0x303780bd, - 0x303800d0, - 0x303880eb, - 0x30390100, - 0x30398114, - 0x303a0128, - 0x303a8139, - 0x303b0152, - 0x303b816f, - 0x303c017d, - 0x303c8191, - 0x303d01a1, - 0x303d81ba, - 0x303e01ca, - 0x303e81dd, - 0x303f01ec, - 0x303f81f8, - 0x3040020d, - 0x3040821d, - 0x30410234, - 0x30418241, - 0x30420254, - 0x30428263, - 0x30430278, - 0x30438299, - 0x304402ac, - 0x304482bf, - 0x304502d8, - 0x304582f3, - 0x30460310, - 0x30468329, - 0x30470337, - 0x30478348, - 0x30480357, - 0x3048836f, - 0x30490381, - 0x30498395, - 0x304a03b4, - 0x304a83c7, - 0x304b03d2, - 0x304b83e3, - 0x304c03ef, - 0x304c8405, - 0x304d0413, - 0x304d8429, - 0x304e043b, - 0x304e844d, - 0x304f0460, - 0x304f8473, - 0x30500484, - 0x30508494, - 0x305104ac, - 0x305184c1, - 0x305204d9, - 0x305284ed, - 0x30530505, - 0x3053851e, - 0x30540537, - 0x30548554, - 0x3055055f, - 0x30558577, - 0x30560587, - 0x30568598, - 0x305705ab, - 0x305785c1, - 0x305805ca, - 0x305885df, - 0x305905f2, - 0x30598601, - 0x305a0621, - 0x305a8630, - 0x305b063c, - 0x305b865c, - 0x305c0678, - 0x305c8689, - 0x305d0693, - 0x34320aba, - 0x34328ace, - 0x34330aeb, - 0x34338afe, - 0x34340b0d, - 0x34348b2a, + 0x303680ac, + 0x303700b9, + 0x303780c8, + 0x303800ea, + 0x303880f7, + 0x3039010a, + 0x30398125, + 0x303a013a, + 0x303a814e, + 0x303b0162, + 0x303b8173, + 0x303c018c, + 0x303c81a9, + 0x303d01b7, + 0x303d81cb, + 0x303e01db, + 0x303e81f4, + 0x303f0204, + 0x303f8217, + 0x30400226, + 0x30408232, + 0x30410247, + 0x30418257, + 0x3042026e, + 0x3042827b, + 0x3043028e, + 0x3043829d, + 0x304402b2, + 0x304482d3, + 0x304502e6, + 0x304582f9, + 0x30460312, + 0x3046832d, + 0x3047034a, + 0x30478363, + 0x30480371, + 0x30488382, + 0x30490391, + 0x304983a9, + 0x304a03bb, + 0x304a83cf, + 0x304b03ee, + 0x304b8401, + 0x304c040c, + 0x304c841d, + 0x304d0429, + 0x304d843f, + 0x304e044d, + 0x304e8463, + 0x304f0475, + 0x304f8487, + 0x3050049a, + 0x305084ad, + 0x305104be, + 0x305184ce, + 0x305204e6, + 0x305284fb, + 0x30530513, + 0x30538527, + 0x3054053f, + 0x30548558, + 0x30550571, + 0x3055858e, + 0x30560599, + 0x305685b1, + 0x305705c1, + 0x305785d2, + 0x305805e5, + 0x305885fb, + 0x30590604, + 0x30598619, + 0x305a062c, + 0x305a863b, + 0x305b065b, + 0x305b866a, + 0x305c068b, + 0x305c86a7, + 0x305d06b3, + 0x305d86d3, + 0x305e06ef, + 0x305e8700, + 0x305f0716, + 0x305f8720, + 0x34320b47, + 0x34328b5b, + 0x34330b78, + 0x34338b8b, + 0x34340b9a, + 0x34348bb7, 0x3c320083, - 0x3c328bd5, - 0x3c330bee, - 0x3c338c09, - 0x3c340c26, - 0x3c348c50, - 0x3c350c6b, - 0x3c358c80, - 0x3c360c99, - 0x3c368cb1, - 0x3c370cc2, - 0x3c378cd0, - 0x3c380cdd, - 0x3c388cf1, - 0x3c390b98, - 0x3c398d05, - 0x3c3a0d19, - 0x3c3a8872, - 0x3c3b0d29, - 0x3c3b8d44, - 0x3c3c0d56, - 0x3c3c8d6c, - 0x3c3d0d76, - 0x3c3d8d8a, - 0x3c3e0d98, - 0x3c3e8dbd, - 0x3c3f0bc1, - 0x3c3f8da6, - 0x3c400094, - 0x3c4080b0, - 0x3c410c41, - 0x403217d3, - 0x403297e9, - 0x40331817, - 0x40339821, - 0x40341838, - 0x40349856, - 0x40351866, - 0x40359878, - 0x40361885, - 0x40369891, - 0x403718a6, - 0x403798b8, - 0x403818c3, - 0x403898d5, - 0x40390ded, - 0x403998e5, - 0x403a18f8, - 0x403a9919, - 0x403b192a, - 0x403b993a, + 0x3c328c62, + 0x3c330c7b, + 0x3c338c96, + 0x3c340cb3, + 0x3c348cdd, + 0x3c350cf8, + 0x3c358d1e, + 0x3c360d37, + 0x3c368d4f, + 0x3c370d60, + 0x3c378d6e, + 0x3c380d7b, + 0x3c388d8f, + 0x3c390c25, + 0x3c398da3, + 0x3c3a0db7, + 0x3c3a88ff, + 0x3c3b0dc7, + 0x3c3b8de2, + 0x3c3c0df4, + 0x3c3c8e0a, + 0x3c3d0e14, + 0x3c3d8e28, + 0x3c3e0e36, + 0x3c3e8e5b, + 0x3c3f0c4e, + 0x3c3f8e44, + 0x3c4000ac, + 0x3c4080ea, + 0x3c410cce, + 0x3c418d0d, + 0x403216fa, + 0x40329710, + 0x4033173e, + 0x40339748, + 0x4034175f, + 0x4034977d, + 0x4035178d, + 0x4035979f, + 0x403617ac, + 0x403697b8, + 0x403717cd, + 0x403797df, + 0x403817ea, + 0x403897fc, + 0x40390e8b, + 0x4039980c, + 0x403a181f, + 0x403a9840, + 0x403b1851, + 0x403b9861, 0x403c0064, 0x403c8083, - 0x403d1946, - 0x403d995c, - 0x403e196b, - 0x403e997e, - 0x403f1998, - 0x403f99a6, - 0x404019bb, - 0x404099cf, - 0x404119ec, - 0x40419a07, - 0x40421a20, - 0x40429a33, - 0x40431a47, - 0x40439a5f, - 0x40441a76, - 0x40448094, - 0x40451a8b, - 0x40459a9d, - 0x40461ac1, - 0x40469ae1, - 0x40471aef, - 0x40479b03, - 0x40481b18, - 0x40489b31, - 0x40491b48, - 0x40499b62, - 0x404a1b79, - 0x404a9b97, - 0x404b1baf, - 0x404b9bc6, - 0x404c1bdc, - 0x404c9bee, - 0x404d1c0f, - 0x404d9c31, - 0x404e1c45, - 0x404e9c52, - 0x404f1c69, - 0x404f9c79, - 0x40501c89, - 0x40509c9d, - 0x40511cb8, - 0x40519cc8, - 0x40521cdf, - 0x40529cf1, - 0x40531d09, - 0x40539d1c, - 0x40541d31, - 0x40549d54, - 0x40551d62, - 0x40559d7f, - 0x40561d8c, - 0x40569da5, - 0x40571dbd, - 0x40579dd0, - 0x40581de5, - 0x40589df7, - 0x40591e07, - 0x40599e20, - 0x405a1e34, - 0x405a9e44, - 0x405b1e5c, - 0x405b9e6d, - 0x405c1e80, - 0x405c9e91, - 0x405d1e9e, - 0x405d9eb5, - 0x405e1ed5, - 0x405e8a08, - 0x405f1ef6, - 0x405f9f03, - 0x40601f11, - 0x40609f33, - 0x40611f5b, - 0x40619f70, - 0x40621f87, - 0x40629f98, - 0x40631fa9, - 0x40639fbe, - 0x40641fd5, - 0x40649fe6, - 0x40652001, - 0x4065a018, - 0x40662030, - 0x4066a05a, - 0x40672085, - 0x4067a0a6, - 0x406820b9, - 0x4068a0da, - 0x406920f5, - 0x4069a123, - 0x406a2144, - 0x406aa164, - 0x406b22ec, - 0x406ba30f, - 0x406c2325, - 0x406ca551, - 0x406d2580, - 0x406da5a8, - 0x406e25c1, - 0x406ea5d9, - 0x406f25f8, - 0x406fa60d, - 0x40702620, - 0x4070a63d, - 0x40710773, - 0x4071a64f, - 0x40722662, - 0x4072a67b, - 0x40732693, - 0x407390c9, - 0x407426a7, - 0x4074a6c1, - 0x407526d2, - 0x4075a6e6, - 0x407626f4, - 0x40769292, - 0x40772719, - 0x4077a73b, - 0x40782756, - 0x4078a76b, - 0x40792782, - 0x4079a798, - 0x407a27a4, - 0x407aa7b7, - 0x407b27cc, - 0x407ba7de, - 0x407c27f3, - 0x407ca7fc, - 0x41f42217, - 0x41f922a9, - 0x41fe219c, - 0x41fea378, - 0x41ff2469, - 0x42032230, - 0x42082252, - 0x4208a28e, - 0x42092180, - 0x4209a2c8, - 0x420a21d7, - 0x420aa1b7, - 0x420b21f7, - 0x420ba270, - 0x420c2485, - 0x420ca345, - 0x420d235f, - 0x420da396, - 0x421223b0, - 0x4217244c, - 0x4217a3f2, - 0x421c2414, - 0x421f23cf, - 0x4221249c, - 0x4226242f, - 0x422b2535, - 0x422ba4fe, - 0x422c251d, - 0x422ca4d8, - 0x422d24b7, - 0x4432069e, - 0x443286ad, - 0x443306b9, - 0x443386c7, - 0x443406da, - 0x443486eb, - 0x443506f2, - 0x443586fc, - 0x4436070f, - 0x44368725, - 0x44370737, - 0x44378744, - 0x44380753, - 0x4438875b, - 0x44390773, - 0x44398781, - 0x443a0794, - 0x4c3212bc, - 0x4c3292cc, - 0x4c3312df, - 0x4c3392ff, - 0x4c340094, - 0x4c3480b0, - 0x4c35130b, - 0x4c359319, - 0x4c361335, - 0x4c369348, - 0x4c371357, - 0x4c379365, - 0x4c38137a, - 0x4c389386, - 0x4c3913a6, - 0x4c3993d0, - 0x4c3a13e9, - 0x4c3a9402, - 0x4c3b05c1, - 0x4c3b941b, - 0x4c3c142d, - 0x4c3c943c, - 0x4c3d10c9, - 0x4c3d9455, - 0x4c3e1462, - 0x50322a92, - 0x5032aaa1, - 0x50332aac, - 0x5033aabc, - 0x50342ad5, - 0x5034aaef, - 0x50352afd, - 0x5035ab13, - 0x50362b25, - 0x5036ab3b, - 0x50372b54, - 0x5037ab67, - 0x50382b7f, - 0x5038ab90, - 0x50392ba5, - 0x5039abb9, - 0x503a2bd9, - 0x503aabef, - 0x503b2c07, - 0x503bac19, - 0x503c2c35, - 0x503cac4c, - 0x503d2c65, - 0x503dac7b, - 0x503e2c88, - 0x503eac9e, - 0x503f2cb0, - 0x503f8348, - 0x50402cc3, - 0x5040acd3, - 0x50412ced, - 0x5041acfc, - 0x50422d16, - 0x5042ad33, - 0x50432d43, - 0x5043ad53, - 0x50442d62, - 0x50448405, - 0x50452d76, - 0x5045ad94, - 0x50462da7, - 0x5046adbd, - 0x50472dcf, - 0x5047ade4, - 0x50482e0a, - 0x5048ae18, - 0x50492e2b, - 0x5049ae40, - 0x504a2e56, - 0x504aae66, - 0x504b2e86, - 0x504bae99, - 0x504c2ebc, - 0x504caeea, - 0x504d2efc, - 0x504daf19, - 0x504e2f34, - 0x504eaf50, - 0x504f2f62, - 0x504faf79, - 0x50502f88, - 0x50508678, - 0x50512f9b, - 0x58320e2b, - 0x68320ded, - 0x68328b98, - 0x68330bab, - 0x68338dfb, - 0x68340e0b, - 0x683480b0, - 0x6c320dc9, - 0x6c328b6f, - 0x6c330dd4, - 0x7432097e, - 0x783208e3, - 0x783288f8, - 0x78330904, + 0x403d18aa, + 0x403d98c0, + 0x403e18cf, + 0x403e98e2, + 0x403f18fc, + 0x403f990a, + 0x4040191f, + 0x40409933, + 0x40411950, + 0x4041996b, + 0x40421984, + 0x40429997, + 0x404319ab, + 0x404399c3, + 0x404419da, + 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, + 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, + 0x40710800, + 0x4071a6d8, + 0x407226eb, + 0x4072a704, + 0x4073271c, + 0x4073936d, + 0x40742730, + 0x4074a74a, + 0x4075275b, + 0x4075a76f, + 0x4076277d, + 0x407691aa, + 0x407727a2, + 0x4077a7c4, + 0x407827df, + 0x4078a818, + 0x4079282f, + 0x4079a845, + 0x407a2851, + 0x407aa864, + 0x407b2879, + 0x407ba88b, + 0x407c28a0, + 0x407ca8a9, + 0x407d2152, + 0x407d9c57, + 0x407e27f4, + 0x407e9e16, + 0x407f1a67, + 0x407f9887, + 0x40801c2e, + 0x40809a8f, + 0x40811cd9, + 0x40819c08, + 0x40822635, + 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, + 0x4432072b, + 0x4432873a, + 0x44330746, + 0x44338754, + 0x44340767, + 0x44348778, + 0x4435077f, + 0x44358789, + 0x4436079c, + 0x443687b2, + 0x443707c4, + 0x443787d1, + 0x443807e0, + 0x443887e8, + 0x44390800, + 0x4439880e, + 0x443a0821, + 0x4c3211d4, + 0x4c3291e4, + 0x4c3311f7, + 0x4c339217, + 0x4c3400ac, + 0x4c3480ea, + 0x4c351223, + 0x4c359231, + 0x4c36124d, + 0x4c369260, + 0x4c37126f, + 0x4c37927d, + 0x4c381292, + 0x4c38929e, + 0x4c3912be, + 0x4c3992e8, + 0x4c3a1301, + 0x4c3a931a, + 0x4c3b05fb, + 0x4c3b9333, + 0x4c3c1345, + 0x4c3c9354, + 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, + 0x503f8382, + 0x50402d53, + 0x5040ad63, + 0x50412d7d, + 0x5041ad8c, + 0x50422da6, + 0x5042adc3, + 0x50432dd3, + 0x5043ade3, + 0x50442df2, + 0x5044843f, + 0x50452e06, + 0x5045ae24, + 0x50462e37, + 0x5046ae4d, + 0x50472e5f, + 0x5047ae74, + 0x50482e9a, + 0x5048aea8, + 0x50492ebb, + 0x5049aed0, + 0x504a2ee6, + 0x504aaef6, + 0x504b2f16, + 0x504baf29, + 0x504c2f4c, + 0x504caf7a, + 0x504d2f8c, + 0x504dafa9, + 0x504e2fc4, + 0x504eafe0, + 0x504f2ff2, + 0x504fb009, + 0x50503018, + 0x505086ef, + 0x5051302b, + 0x58320ec9, + 0x68320e8b, + 0x68328c25, + 0x68330c38, + 0x68338e99, + 0x68340ea9, + 0x683480ea, + 0x6c320e67, + 0x6c328bfc, + 0x6c330e72, + 0x74320a0b, + 0x78320970, + 0x78328985, + 0x78330991, 0x78338083, - 0x78340913, - 0x78348928, - 0x78350947, - 0x78358969, - 0x7836097e, - 0x78368994, - 0x783709a4, - 0x783789b7, - 0x783809ca, - 0x783889dc, - 0x783909e9, - 0x78398a08, - 0x783a0a1d, - 0x783a8a2b, - 0x783b0a35, - 0x783b8a49, - 0x783c0a60, - 0x783c8a75, - 0x783d0a8c, - 0x783d8aa1, - 0x783e09f7, - 0x7c3211be, + 0x783409a0, + 0x783489b5, + 0x783509d4, + 0x783589f6, + 0x78360a0b, + 0x78368a21, + 0x78370a31, + 0x78378a44, + 0x78380a57, + 0x78388a69, + 0x78390a76, + 0x78398a95, + 0x783a0aaa, + 0x783a8ab8, + 0x783b0ac2, + 0x783b8ad6, + 0x783c0aed, + 0x783c8b02, + 0x783d0b19, + 0x783d8b2e, + 0x783e0a84, + 0x7c3210d6, }; const size_t kOpenSSLReasonValuesLen = sizeof(kOpenSSLReasonValues) / sizeof(kOpenSSLReasonValues[0]); @@ -689,8 +695,10 @@ const char kOpenSSLReasonStringData[] = "BN_LIB\0" "BOOLEAN_IS_WRONG_LENGTH\0" "BUFFER_TOO_SMALL\0" + "CONTEXT_NOT_INITIALISED\0" "DECODE_ERROR\0" "DEPTH_EXCEEDED\0" + "DIGEST_AND_KEY_TYPE_NOT_SUPPORTED\0" "ENCODE_ERROR\0" "ERROR_GETTING_TIME\0" "EXPECTING_AN_ASN1_SEQUENCE\0" @@ -762,10 +770,13 @@ const char kOpenSSLReasonStringData[] = "UNEXPECTED_EOC\0" "UNIVERSALSTRING_IS_WRONG_LENGTH\0" "UNKNOWN_FORMAT\0" + "UNKNOWN_MESSAGE_DIGEST_ALGORITHM\0" + "UNKNOWN_SIGNATURE_ALGORITHM\0" "UNKNOWN_TAG\0" "UNSUPPORTED_ANY_DEFINED_BY_TYPE\0" "UNSUPPORTED_PUBLIC_KEY_TYPE\0" "UNSUPPORTED_TYPE\0" + "WRONG_PUBLIC_KEY_TYPE\0" "WRONG_TAG\0" "WRONG_TYPE\0" "BAD_FOPEN_MODE\0" @@ -849,6 +860,7 @@ const char kOpenSSLReasonStringData[] = "GROUP_MISMATCH\0" "I2D_ECPKPARAMETERS_FAILURE\0" "INCOMPATIBLE_OBJECTS\0" + "INVALID_COFACTOR\0" "INVALID_COMPRESSED_POINT\0" "INVALID_COMPRESSION_BIT\0" "INVALID_ENCODING\0" @@ -873,27 +885,19 @@ const char kOpenSSLReasonStringData[] = "NOT_IMPLEMENTED\0" "RANDOM_NUMBER_GENERATION_FAILED\0" "OPERATION_NOT_SUPPORTED\0" - "BN_DECODE_ERROR\0" "COMMAND_NOT_SUPPORTED\0" - "CONTEXT_NOT_INITIALISED\0" "DIFFERENT_KEY_TYPES\0" "DIFFERENT_PARAMETERS\0" - "DIGEST_AND_KEY_TYPE_NOT_SUPPORTED\0" "EXPECTING_AN_EC_KEY_KEY\0" "EXPECTING_AN_RSA_KEY\0" - "EXPECTING_A_DH_KEY\0" "EXPECTING_A_DSA_KEY\0" "ILLEGAL_OR_UNSUPPORTED_PADDING_MODE\0" - "INVALID_CURVE\0" "INVALID_DIGEST_LENGTH\0" "INVALID_DIGEST_TYPE\0" "INVALID_KEYBITS\0" "INVALID_MGF1_MD\0" "INVALID_PADDING_MODE\0" - "INVALID_PSS_PARAMETERS\0" "INVALID_PSS_SALTLEN\0" - "INVALID_SALT_LENGTH\0" - "INVALID_TRAILER\0" "KEYS_NOT_SET\0" "NO_DEFAULT_DIGEST\0" "NO_KEY_SET\0" @@ -903,17 +907,8 @@ const char kOpenSSLReasonStringData[] = "NO_PARAMETERS_SET\0" "OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE\0" "OPERATON_NOT_INITIALIZED\0" - "PARAMETER_ENCODING_ERROR\0" - "UNKNOWN_DIGEST\0" - "UNKNOWN_MASK_DIGEST\0" - "UNKNOWN_MESSAGE_DIGEST_ALGORITHM\0" "UNKNOWN_PUBLIC_KEY_TYPE\0" - "UNKNOWN_SIGNATURE_ALGORITHM\0" "UNSUPPORTED_ALGORITHM\0" - "UNSUPPORTED_MASK_ALGORITHM\0" - "UNSUPPORTED_MASK_PARAMETER\0" - "UNSUPPORTED_SIGNATURE_TYPE\0" - "WRONG_PUBLIC_KEY_TYPE\0" "OUTPUT_TOO_LARGE\0" "UNKNOWN_NID\0" "BAD_BASE64_DECODE\0" @@ -949,6 +944,7 @@ const char kOpenSSLReasonStringData[] = "UNKNOWN_ALGORITHM\0" "UNKNOWN_CIPHER\0" "UNKNOWN_CIPHER_ALGORITHM\0" + "UNKNOWN_DIGEST\0" "UNKNOWN_HASH\0" "UNSUPPORTED_PRIVATE_KEY_ALGORITHM\0" "BAD_E_VALUE\0" @@ -1009,6 +1005,8 @@ const char kOpenSSLReasonStringData[] = "BAD_SSL_FILETYPE\0" "BAD_WRITE_RETRY\0" "BIO_NOT_SET\0" + "BLOCK_CIPHER_PAD_IS_WRONG\0" + "BUFFERED_MESSAGES_ON_CIPHER_CHANGE\0" "CA_DN_LENGTH_MISMATCH\0" "CA_DN_TOO_LONG\0" "CCS_RECEIVED_EARLY\0" @@ -1029,7 +1027,10 @@ const char kOpenSSLReasonStringData[] = "DH_PUBLIC_VALUE_LENGTH_IS_WRONG\0" "DH_P_TOO_LONG\0" "DIGEST_CHECK_FAILED\0" + "DOWNGRADE_DETECTED\0" "DTLS_MESSAGE_TOO_BIG\0" + "DUPLICATE_EXTENSION\0" + "DUPLICATE_KEY_SHARE\0" "ECC_CERT_NOT_FOR_SIGNING\0" "EMS_STATE_INCONSISTENT\0" "ENCRYPTED_LENGTH_TOO_LONG\0" @@ -1044,13 +1045,17 @@ const char kOpenSSLReasonStringData[] = "HTTPS_PROXY_REQUEST\0" "HTTP_REQUEST\0" "INAPPROPRIATE_FALLBACK\0" + "INVALID_ALPN_PROTOCOL\0" "INVALID_COMMAND\0" + "INVALID_COMPRESSION_LIST\0" "INVALID_MESSAGE\0" + "INVALID_OUTER_RECORD_TYPE\0" "INVALID_SSL_SESSION\0" "INVALID_TICKET_KEYS_LENGTH\0" "LENGTH_MISMATCH\0" "LIBRARY_HAS_NO_CIPHERS\0" "MISSING_EXTENSION\0" + "MISSING_KEY_SHARE\0" "MISSING_RSA_CERTIFICATE\0" "MISSING_TMP_DH_KEY\0" "MISSING_TMP_ECDH_KEY\0" @@ -1063,8 +1068,11 @@ const char kOpenSSLReasonStringData[] = "NO_CERTIFICATE_SET\0" "NO_CIPHERS_AVAILABLE\0" "NO_CIPHERS_PASSED\0" + "NO_CIPHERS_SPECIFIED\0" "NO_CIPHER_MATCH\0" + "NO_COMMON_SIGNATURE_ALGORITHMS\0" "NO_COMPRESSION_SPECIFIED\0" + "NO_GROUPS_SPECIFIED\0" "NO_METHOD_SPECIFIED\0" "NO_P256_SUPPORT\0" "NO_PRIVATE_KEY_ASSIGNED\0" @@ -1086,6 +1094,7 @@ const char kOpenSSLReasonStringData[] = "READ_TIMEOUT_EXPIRED\0" "RECORD_LENGTH_MISMATCH\0" "RECORD_TOO_LARGE\0" + "RENEGOTIATION_EMS_MISMATCH\0" "RENEGOTIATION_ENCODING_ERR\0" "RENEGOTIATION_MISMATCH\0" "REQUIRED_CIPHER_MISSING\0" @@ -1095,6 +1104,7 @@ const char kOpenSSLReasonStringData[] = "SERVERHELLO_TLSEXT\0" "SESSION_ID_CONTEXT_UNINITIALIZED\0" "SESSION_MAY_NOT_BE_CREATED\0" + "SHUTDOWN_WHILE_IN_INIT\0" "SIGNATURE_ALGORITHMS_EXTENSION_SENT_BY_SERVER\0" "SRTP_COULD_NOT_ALLOCATE_PROFILES\0" "SRTP_UNKNOWN_PROTECTION_PROFILE\0" @@ -1135,6 +1145,7 @@ const char kOpenSSLReasonStringData[] = "TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST\0" "TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG\0" "TOO_MANY_EMPTY_FRAGMENTS\0" + "TOO_MANY_KEY_UPDATES\0" "TOO_MANY_WARNING_ALERTS\0" "UNABLE_TO_FIND_ECDH_PARAMETERS\0" "UNEXPECTED_EXTENSION\0" @@ -1153,6 +1164,7 @@ const char kOpenSSLReasonStringData[] = "UNSUPPORTED_COMPRESSION_ALGORITHM\0" "UNSUPPORTED_ELLIPTIC_CURVE\0" "UNSUPPORTED_PROTOCOL\0" + "UNSUPPORTED_PROTOCOL_FOR_CUSTOM_KEY\0" "WRONG_CERTIFICATE_TYPE\0" "WRONG_CIPHER_RETURNED\0" "WRONG_CURVE\0" @@ -1173,12 +1185,14 @@ const char kOpenSSLReasonStringData[] = "IDP_MISMATCH\0" "INVALID_DIRECTORY\0" "INVALID_FIELD_NAME\0" + "INVALID_PSS_PARAMETERS\0" "INVALID_TRUST\0" "ISSUER_MISMATCH\0" "KEY_TYPE_MISMATCH\0" "KEY_VALUES_MISMATCH\0" "LOADING_CERT_DIR\0" "LOADING_DEFAULTS\0" + "NAME_TOO_LONG\0" "NEWER_CRL_NOT_NEWER\0" "NOT_PKCS7_SIGNED_DATA\0" "NO_CERTIFICATES_INCLUDED\0" @@ -1188,8 +1202,6 @@ const char kOpenSSLReasonStringData[] = "PUBLIC_KEY_DECODE_ERROR\0" "PUBLIC_KEY_ENCODE_ERROR\0" "SHOULD_RETRY\0" - "UNABLE_TO_FIND_PARAMETERS_IN_CHAIN\0" - "UNABLE_TO_GET_CERTS_PUBLIC_KEY\0" "UNKNOWN_KEY_TYPE\0" "UNKNOWN_PURPOSE_ID\0" "UNKNOWN_TRUST_ID\0" diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 7adf6dbed87..9d470e17dfe 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -299,7 +299,6 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/aes/mode_wrappers.c', 'third_party/boringssl/crypto/asn1/a_bitstr.c', 'third_party/boringssl/crypto/asn1/a_bool.c', - 'third_party/boringssl/crypto/asn1/a_bytes.c', 'third_party/boringssl/crypto/asn1/a_d2i_fp.c', 'third_party/boringssl/crypto/asn1/a_dup.c', 'third_party/boringssl/crypto/asn1/a_enum.c', @@ -318,18 +317,14 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/asn1/asn1_lib.c', 'third_party/boringssl/crypto/asn1/asn1_par.c', 'third_party/boringssl/crypto/asn1/asn_pack.c', - 'third_party/boringssl/crypto/asn1/bio_asn1.c', - 'third_party/boringssl/crypto/asn1/bio_ndef.c', 'third_party/boringssl/crypto/asn1/f_enum.c', 'third_party/boringssl/crypto/asn1/f_int.c', 'third_party/boringssl/crypto/asn1/f_string.c', 'third_party/boringssl/crypto/asn1/t_bitst.c', - 'third_party/boringssl/crypto/asn1/t_pkey.c', 'third_party/boringssl/crypto/asn1/tasn_dec.c', 'third_party/boringssl/crypto/asn1/tasn_enc.c', 'third_party/boringssl/crypto/asn1/tasn_fre.c', 'third_party/boringssl/crypto/asn1/tasn_new.c', - 'third_party/boringssl/crypto/asn1/tasn_prn.c', 'third_party/boringssl/crypto/asn1/tasn_typ.c', 'third_party/boringssl/crypto/asn1/tasn_utl.c', 'third_party/boringssl/crypto/asn1/x_bignum.c', @@ -359,6 +354,7 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/bn/generic.c', 'third_party/boringssl/crypto/bn/kronecker.c', 'third_party/boringssl/crypto/bn/montgomery.c', + 'third_party/boringssl/crypto/bn/montgomery_inv.c', 'third_party/boringssl/crypto/bn/mul.c', 'third_party/boringssl/crypto/bn/prime.c', 'third_party/boringssl/crypto/bn/random.c', @@ -370,8 +366,7 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/bytestring/ber.c', 'third_party/boringssl/crypto/bytestring/cbb.c', 'third_party/boringssl/crypto/bytestring/cbs.c', - 'third_party/boringssl/crypto/chacha/chacha_generic.c', - 'third_party/boringssl/crypto/chacha/chacha_vec.c', + 'third_party/boringssl/crypto/chacha/chacha.c', 'third_party/boringssl/crypto/cipher/aead.c', 'third_party/boringssl/crypto/cipher/cipher.c', 'third_party/boringssl/crypto/cipher/derive_key.c', @@ -386,10 +381,14 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/cipher/tls_cbc.c', 'third_party/boringssl/crypto/cmac/cmac.c', 'third_party/boringssl/crypto/conf/conf.c', + 'third_party/boringssl/crypto/cpu-aarch64-linux.c', + 'third_party/boringssl/crypto/cpu-arm-linux.c', 'third_party/boringssl/crypto/cpu-arm.c', 'third_party/boringssl/crypto/cpu-intel.c', + 'third_party/boringssl/crypto/cpu-ppc64le.c', 'third_party/boringssl/crypto/crypto.c', 'third_party/boringssl/crypto/curve25519/curve25519.c', + 'third_party/boringssl/crypto/curve25519/spake25519.c', 'third_party/boringssl/crypto/curve25519/x25519-x86_64.c', 'third_party/boringssl/crypto/des/des.c', 'third_party/boringssl/crypto/dh/check.c', @@ -398,8 +397,6 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/dh/params.c', 'third_party/boringssl/crypto/digest/digest.c', 'third_party/boringssl/crypto/digest/digests.c', - 'third_party/boringssl/crypto/directory_posix.c', - 'third_party/boringssl/crypto/directory_win.c', 'third_party/boringssl/crypto/dsa/dsa.c', 'third_party/boringssl/crypto/dsa/dsa_asn1.c', 'third_party/boringssl/crypto/ec/ec.c', @@ -418,7 +415,6 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/ecdsa/ecdsa_asn1.c', 'third_party/boringssl/crypto/engine/engine.c', 'third_party/boringssl/crypto/err/err.c', - 'third_party/boringssl/crypto/evp/algorithm.c', 'third_party/boringssl/crypto/evp/digestsign.c', 'third_party/boringssl/crypto/evp/evp.c', 'third_party/boringssl/crypto/evp/evp_asn1.c', @@ -429,6 +425,7 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/evp/p_rsa.c', 'third_party/boringssl/crypto/evp/p_rsa_asn1.c', 'third_party/boringssl/crypto/evp/pbkdf.c', + 'third_party/boringssl/crypto/evp/print.c', 'third_party/boringssl/crypto/evp/sign.c', 'third_party/boringssl/crypto/ex_data.c', 'third_party/boringssl/crypto/hkdf/hkdf.c', @@ -442,6 +439,12 @@ 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/obj/obj.c', 'third_party/boringssl/crypto/obj/obj_xref.c', 'third_party/boringssl/crypto/pem/pem_all.c', @@ -459,6 +462,7 @@ CORE_SOURCE_FILES = [ '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/rand/deterministic.c', 'third_party/boringssl/crypto/rand/rand.c', 'third_party/boringssl/crypto/rand/urandom.c', 'third_party/boringssl/crypto/rand/windows.c', @@ -483,11 +487,13 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/x509/a_sign.c', 'third_party/boringssl/crypto/x509/a_strex.c', 'third_party/boringssl/crypto/x509/a_verify.c', + 'third_party/boringssl/crypto/x509/algorithm.c', 'third_party/boringssl/crypto/x509/asn1_gen.c', 'third_party/boringssl/crypto/x509/by_dir.c', 'third_party/boringssl/crypto/x509/by_file.c', 'third_party/boringssl/crypto/x509/i2d_pr.c', 'third_party/boringssl/crypto/x509/pkcs7.c', + 'third_party/boringssl/crypto/x509/rsa_pss.c', 'third_party/boringssl/crypto/x509/t_crl.c', 'third_party/boringssl/crypto/x509/t_req.c', 'third_party/boringssl/crypto/x509/t_x509.c', @@ -562,21 +568,17 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/x509v3/v3_utl.c', 'third_party/boringssl/ssl/custom_extensions.c', 'third_party/boringssl/ssl/d1_both.c', - 'third_party/boringssl/ssl/d1_clnt.c', 'third_party/boringssl/ssl/d1_lib.c', - 'third_party/boringssl/ssl/d1_meth.c', 'third_party/boringssl/ssl/d1_pkt.c', 'third_party/boringssl/ssl/d1_srtp.c', - 'third_party/boringssl/ssl/d1_srvr.c', + 'third_party/boringssl/ssl/dtls_method.c', 'third_party/boringssl/ssl/dtls_record.c', - 'third_party/boringssl/ssl/pqueue/pqueue.c', + '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_clnt.c', 'third_party/boringssl/ssl/s3_enc.c', 'third_party/boringssl/ssl/s3_lib.c', - 'third_party/boringssl/ssl/s3_meth.c', 'third_party/boringssl/ssl/s3_pkt.c', - 'third_party/boringssl/ssl/s3_srvr.c', 'third_party/boringssl/ssl/ssl_aead_ctx.c', 'third_party/boringssl/ssl/ssl_asn1.c', 'third_party/boringssl/ssl/ssl_buffer.c', @@ -590,6 +592,11 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/ssl/ssl_stat.c', 'third_party/boringssl/ssl/t1_enc.c', 'third_party/boringssl/ssl/t1_lib.c', + 'third_party/boringssl/ssl/tls13_both.c', + 'third_party/boringssl/ssl/tls13_client.c', + 'third_party/boringssl/ssl/tls13_enc.c', + 'third_party/boringssl/ssl/tls13_server.c', + 'third_party/boringssl/ssl/tls_method.c', 'third_party/boringssl/ssl/tls_record.c', 'third_party/zlib/adler32.c', 'third_party/zlib/compress.c', diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 0eaa832e147..e766dcbdb61 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -3545,6 +3545,20 @@ "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", @@ -3615,6 +3629,20 @@ "third_party": true, "type": "target" }, + { + "deps": [ + "boringssl", + "boringssl_spake25519_test_lib", + "boringssl_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "boringssl_spake25519_test", + "src": [], + "third_party": true, + "type": "target" + }, { "deps": [ "boringssl", @@ -3699,6 +3727,34 @@ "third_party": true, "type": "target" }, + { + "deps": [ + "boringssl", + "boringssl_ecdh_test_lib", + "boringssl_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "boringssl_ecdh_test", + "src": [], + "third_party": true, + "type": "target" + }, + { + "deps": [ + "boringssl", + "boringssl_ecdsa_sign_test_lib", + "boringssl_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "boringssl_ecdsa_sign_test", + "src": [], + "third_party": true, + "type": "target" + }, { "deps": [ "boringssl", @@ -3713,6 +3769,20 @@ "third_party": true, "type": "target" }, + { + "deps": [ + "boringssl", + "boringssl_ecdsa_verify_test_lib", + "boringssl_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "boringssl_ecdsa_verify_test", + "src": [], + "third_party": true, + "type": "target" + }, { "deps": [ "boringssl", @@ -3825,6 +3895,62 @@ "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", + "boringssl_obj_test_lib", + "boringssl_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "boringssl_obj_test", + "src": [], + "third_party": true, + "type": "target" + }, { "deps": [ "boringssl", @@ -3965,20 +4091,6 @@ "third_party": true, "type": "target" }, - { - "deps": [ - "boringssl", - "boringssl_pqueue_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_pqueue_test", - "src": [], - "third_party": true, - "type": "target" - }, { "deps": [ "boringssl", @@ -5710,23 +5822,22 @@ "third_party/boringssl/crypto/conf/internal.h", "third_party/boringssl/crypto/curve25519/internal.h", "third_party/boringssl/crypto/des/internal.h", - "third_party/boringssl/crypto/dh/internal.h", "third_party/boringssl/crypto/digest/internal.h", "third_party/boringssl/crypto/digest/md32_common.h", - "third_party/boringssl/crypto/directory.h", "third_party/boringssl/crypto/ec/internal.h", "third_party/boringssl/crypto/ec/p256-x86_64-table.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/rand/internal.h", "third_party/boringssl/crypto/rsa/internal.h", - "third_party/boringssl/crypto/test/scoped_types.h", - "third_party/boringssl/crypto/test/test_util.h", "third_party/boringssl/crypto/x509/charmap.h", + "third_party/boringssl/crypto/x509/internal.h", "third_party/boringssl/crypto/x509/vpm_int.h", "third_party/boringssl/crypto/x509v3/ext_dat.h", "third_party/boringssl/crypto/x509v3/pcy_int.h", @@ -5772,10 +5883,12 @@ "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", "third_party/boringssl/include/openssl/objects.h", - "third_party/boringssl/include/openssl/opensslfeatures.h", + "third_party/boringssl/include/openssl/opensslconf.h", "third_party/boringssl/include/openssl/opensslv.h", "third_party/boringssl/include/openssl/ossl_typ.h", "third_party/boringssl/include/openssl/pem.h", @@ -5783,9 +5896,9 @@ "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/pqueue.h", "third_party/boringssl/include/openssl/rand.h", "third_party/boringssl/include/openssl/rc4.h", + "third_party/boringssl/include/openssl/ripemd.h", "third_party/boringssl/include/openssl/rsa.h", "third_party/boringssl/include/openssl/safestack.h", "third_party/boringssl/include/openssl/sha.h", @@ -5801,11 +5914,7 @@ "third_party/boringssl/include/openssl/x509.h", "third_party/boringssl/include/openssl/x509_vfy.h", "third_party/boringssl/include/openssl/x509v3.h", - "third_party/boringssl/ssl/internal.h", - "third_party/boringssl/ssl/test/async_bio.h", - "third_party/boringssl/ssl/test/packeted_bio.h", - "third_party/boringssl/ssl/test/scoped_types.h", - "third_party/boringssl/ssl/test/test_config.h" + "third_party/boringssl/ssl/internal.h" ], "is_filegroup": false, "language": "c", @@ -5904,6 +6013,19 @@ "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", @@ -5969,6 +6091,19 @@ "third_party": true, "type": "lib" }, + { + "deps": [ + "boringssl", + "boringssl_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "boringssl_spake25519_test_lib", + "src": [], + "third_party": true, + "type": "lib" + }, { "deps": [ "boringssl", @@ -6047,6 +6182,32 @@ "third_party": true, "type": "lib" }, + { + "deps": [ + "boringssl", + "boringssl_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "boringssl_ecdh_test_lib", + "src": [], + "third_party": true, + "type": "lib" + }, + { + "deps": [ + "boringssl", + "boringssl_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "boringssl_ecdsa_sign_test_lib", + "src": [], + "third_party": true, + "type": "lib" + }, { "deps": [ "boringssl", @@ -6060,6 +6221,19 @@ "third_party": true, "type": "lib" }, + { + "deps": [ + "boringssl", + "boringssl_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "boringssl_ecdsa_verify_test_lib", + "src": [], + "third_party": true, + "type": "lib" + }, { "deps": [ "boringssl", @@ -6158,7 +6332,7 @@ ], "headers": [], "is_filegroup": false, - "language": "c", + "language": "c++", "name": "boringssl_gcm_test_lib", "src": [], "third_party": true, @@ -6172,7 +6346,7 @@ "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_pkcs12_test_lib", + "name": "boringssl_newhope_statistical_test_lib", "src": [], "third_party": true, "type": "lib" @@ -6185,7 +6359,7 @@ "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_pkcs8_test_lib", + "name": "boringssl_newhope_test_lib", "src": [], "third_party": true, "type": "lib" @@ -6198,7 +6372,7 @@ "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_poly1305_test_lib", + "name": "boringssl_newhope_vectors_test_lib", "src": [], "third_party": true, "type": "lib" @@ -6210,8 +6384,8 @@ ], "headers": [], "is_filegroup": false, - "language": "c", - "name": "boringssl_refcount_test_lib", + "language": "c++", + "name": "boringssl_obj_test_lib", "src": [], "third_party": true, "type": "lib" @@ -6224,7 +6398,7 @@ "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_rsa_test_lib", + "name": "boringssl_pkcs12_test_lib", "src": [], "third_party": true, "type": "lib" @@ -6236,8 +6410,21 @@ ], "headers": [], "is_filegroup": false, - "language": "c", - "name": "boringssl_thread_test_lib", + "language": "c++", + "name": "boringssl_pkcs8_test_lib", + "src": [], + "third_party": true, + "type": "lib" + }, + { + "deps": [ + "boringssl", + "boringssl_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "boringssl_poly1305_test_lib", "src": [], "third_party": true, "type": "lib" @@ -6250,7 +6437,7 @@ "headers": [], "is_filegroup": false, "language": "c", - "name": "boringssl_pkcs7_test_lib", + "name": "boringssl_refcount_test_lib", "src": [], "third_party": true, "type": "lib" @@ -6263,7 +6450,7 @@ "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_x509_test_lib", + "name": "boringssl_rsa_test_lib", "src": [], "third_party": true, "type": "lib" @@ -6276,7 +6463,7 @@ "headers": [], "is_filegroup": false, "language": "c", - "name": "boringssl_tab_test_lib", + "name": "boringssl_thread_test_lib", "src": [], "third_party": true, "type": "lib" @@ -6289,7 +6476,20 @@ "headers": [], "is_filegroup": false, "language": "c", - "name": "boringssl_v3name_test_lib", + "name": "boringssl_pkcs7_test_lib", + "src": [], + "third_party": true, + "type": "lib" + }, + { + "deps": [ + "boringssl", + "boringssl_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "boringssl_x509_test_lib", "src": [], "third_party": true, "type": "lib" @@ -6302,7 +6502,20 @@ "headers": [], "is_filegroup": false, "language": "c", - "name": "boringssl_pqueue_test_lib", + "name": "boringssl_tab_test_lib", + "src": [], + "third_party": true, + "type": "lib" + }, + { + "deps": [ + "boringssl", + "boringssl_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c", + "name": "boringssl_v3name_test_lib", "src": [], "third_party": true, "type": "lib" diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 1251932c256..1f40b8735af 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -3590,7 +3590,9 @@ ] }, { - "args": [], + "args": [ + "third_party/boringssl/crypto/bn/bn_tests.txt" + ], "boringssl": true, "ci_platforms": [ "linux", @@ -3637,6 +3639,30 @@ "windows" ] }, + { + "args": [], + "boringssl": true, + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "defaults": "boringssl", + "exclude_configs": [ + "asan" + ], + "flaky": false, + "language": "c++", + "name": "boringssl_chacha_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, { "args": [ "aes-128-gcm", @@ -3801,8 +3827,8 @@ }, { "args": [ - "rc4-md5-tls", - "third_party/boringssl/crypto/cipher/test/rc4_md5_tls_tests.txt" + "aes-128-cbc-sha1-tls", + "third_party/boringssl/crypto/cipher/test/aes_128_cbc_sha1_tls_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -3828,8 +3854,8 @@ }, { "args": [ - "rc4-sha1-tls", - "third_party/boringssl/crypto/cipher/test/rc4_sha1_tls_tests.txt" + "aes-128-cbc-sha1-tls-implicit-iv", + "third_party/boringssl/crypto/cipher/test/aes_128_cbc_sha1_tls_implicit_iv_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -3855,8 +3881,8 @@ }, { "args": [ - "aes-128-cbc-sha1-tls", - "third_party/boringssl/crypto/cipher/test/aes_128_cbc_sha1_tls_tests.txt" + "aes-128-cbc-sha256-tls", + "third_party/boringssl/crypto/cipher/test/aes_128_cbc_sha256_tls_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -3882,8 +3908,8 @@ }, { "args": [ - "aes-128-cbc-sha1-tls-implicit-iv", - "third_party/boringssl/crypto/cipher/test/aes_128_cbc_sha1_tls_implicit_iv_tests.txt" + "aes-256-cbc-sha1-tls", + "third_party/boringssl/crypto/cipher/test/aes_256_cbc_sha1_tls_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -3909,8 +3935,8 @@ }, { "args": [ - "aes-128-cbc-sha256-tls", - "third_party/boringssl/crypto/cipher/test/aes_128_cbc_sha256_tls_tests.txt" + "aes-256-cbc-sha1-tls-implicit-iv", + "third_party/boringssl/crypto/cipher/test/aes_256_cbc_sha1_tls_implicit_iv_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -3936,8 +3962,8 @@ }, { "args": [ - "aes-256-cbc-sha1-tls", - "third_party/boringssl/crypto/cipher/test/aes_256_cbc_sha1_tls_tests.txt" + "aes-256-cbc-sha256-tls", + "third_party/boringssl/crypto/cipher/test/aes_256_cbc_sha256_tls_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -3963,8 +3989,8 @@ }, { "args": [ - "aes-256-cbc-sha1-tls-implicit-iv", - "third_party/boringssl/crypto/cipher/test/aes_256_cbc_sha1_tls_implicit_iv_tests.txt" + "aes-256-cbc-sha384-tls", + "third_party/boringssl/crypto/cipher/test/aes_256_cbc_sha384_tls_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -3990,8 +4016,8 @@ }, { "args": [ - "aes-256-cbc-sha256-tls", - "third_party/boringssl/crypto/cipher/test/aes_256_cbc_sha256_tls_tests.txt" + "des-ede3-cbc-sha1-tls", + "third_party/boringssl/crypto/cipher/test/des_ede3_cbc_sha1_tls_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -4017,8 +4043,8 @@ }, { "args": [ - "aes-256-cbc-sha384-tls", - "third_party/boringssl/crypto/cipher/test/aes_256_cbc_sha384_tls_tests.txt" + "des-ede3-cbc-sha1-tls-implicit-iv", + "third_party/boringssl/crypto/cipher/test/des_ede3_cbc_sha1_tls_implicit_iv_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -4044,8 +4070,8 @@ }, { "args": [ - "des-ede3-cbc-sha1-tls", - "third_party/boringssl/crypto/cipher/test/des_ede3_cbc_sha1_tls_tests.txt" + "aes-128-cbc-sha1-ssl3", + "third_party/boringssl/crypto/cipher/test/aes_128_cbc_sha1_ssl3_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -4071,8 +4097,8 @@ }, { "args": [ - "des-ede3-cbc-sha1-tls-implicit-iv", - "third_party/boringssl/crypto/cipher/test/des_ede3_cbc_sha1_tls_implicit_iv_tests.txt" + "aes-256-cbc-sha1-ssl3", + "third_party/boringssl/crypto/cipher/test/aes_256_cbc_sha1_ssl3_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -4098,8 +4124,8 @@ }, { "args": [ - "rc4-md5-ssl3", - "third_party/boringssl/crypto/cipher/test/rc4_md5_ssl3_tests.txt" + "des-ede3-cbc-sha1-ssl3", + "third_party/boringssl/crypto/cipher/test/des_ede3_cbc_sha1_ssl3_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -4125,8 +4151,8 @@ }, { "args": [ - "rc4-sha1-ssl3", - "third_party/boringssl/crypto/cipher/test/rc4_sha1_ssl3_tests.txt" + "aes-128-ctr-hmac-sha256", + "third_party/boringssl/crypto/cipher/test/aes_128_ctr_hmac_sha256.txt" ], "boringssl": true, "ci_platforms": [ @@ -4152,8 +4178,8 @@ }, { "args": [ - "aes-128-cbc-sha1-ssl3", - "third_party/boringssl/crypto/cipher/test/aes_128_cbc_sha1_ssl3_tests.txt" + "aes-256-ctr-hmac-sha256", + "third_party/boringssl/crypto/cipher/test/aes_256_ctr_hmac_sha256.txt" ], "boringssl": true, "ci_platforms": [ @@ -4179,8 +4205,7 @@ }, { "args": [ - "aes-256-cbc-sha1-ssl3", - "third_party/boringssl/crypto/cipher/test/aes_256_cbc_sha1_ssl3_tests.txt" + "third_party/boringssl/crypto/cipher/test/cipher_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -4196,7 +4221,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_aead_test", + "name": "boringssl_cipher_test", "platforms": [ "linux", "mac", @@ -4205,10 +4230,7 @@ ] }, { - "args": [ - "des-ede3-cbc-sha1-ssl3", - "third_party/boringssl/crypto/cipher/test/des_ede3_cbc_sha1_ssl3_tests.txt" - ], + "args": [], "boringssl": true, "ci_platforms": [ "linux", @@ -4223,7 +4245,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_aead_test", + "name": "boringssl_cmac_test", "platforms": [ "linux", "mac", @@ -4232,10 +4254,7 @@ ] }, { - "args": [ - "aes-128-ctr-hmac-sha256", - "third_party/boringssl/crypto/cipher/test/aes_128_ctr_hmac_sha256.txt" - ], + "args": [], "boringssl": true, "ci_platforms": [ "linux", @@ -4250,7 +4269,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_aead_test", + "name": "boringssl_constant_time_test", "platforms": [ "linux", "mac", @@ -4260,8 +4279,7 @@ }, { "args": [ - "aes-256-ctr-hmac-sha256", - "third_party/boringssl/crypto/cipher/test/aes_256_ctr_hmac_sha256.txt" + "third_party/boringssl/crypto/curve25519/ed25519_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -4277,7 +4295,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_aead_test", + "name": "boringssl_ed25519_test", "platforms": [ "linux", "mac", @@ -4286,9 +4304,7 @@ ] }, { - "args": [ - "third_party/boringssl/crypto/cipher/test/cipher_test.txt" - ], + "args": [], "boringssl": true, "ci_platforms": [ "linux", @@ -4303,7 +4319,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_cipher_test", + "name": "boringssl_x25519_test", "platforms": [ "linux", "mac", @@ -4327,7 +4343,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_cmac_test", + "name": "boringssl_spake25519_test", "platforms": [ "linux", "mac", @@ -4351,7 +4367,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_constant_time_test", + "name": "boringssl_dh_test", "platforms": [ "linux", "mac", @@ -4360,9 +4376,7 @@ ] }, { - "args": [ - "third_party/boringssl/crypto/curve25519/ed25519_tests.txt" - ], + "args": [], "boringssl": true, "ci_platforms": [ "linux", @@ -4377,7 +4391,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_ed25519_test", + "name": "boringssl_digest_test", "platforms": [ "linux", "mac", @@ -4401,7 +4415,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_x25519_test", + "name": "boringssl_dsa_test", "platforms": [ "linux", "mac", @@ -4425,7 +4439,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_dh_test", + "name": "boringssl_ec_test", "platforms": [ "linux", "mac", @@ -4449,7 +4463,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_digest_test", + "name": "boringssl_example_mul", "platforms": [ "linux", "mac", @@ -4458,7 +4472,9 @@ ] }, { - "args": [], + "args": [ + "third_party/boringssl/crypto/ecdh/ecdh_tests.txt" + ], "boringssl": true, "ci_platforms": [ "linux", @@ -4473,7 +4489,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_dsa_test", + "name": "boringssl_ecdh_test", "platforms": [ "linux", "mac", @@ -4482,7 +4498,9 @@ ] }, { - "args": [], + "args": [ + "third_party/boringssl/crypto/ecdsa/ecdsa_sign_tests.txt" + ], "boringssl": true, "ci_platforms": [ "linux", @@ -4497,7 +4515,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_ec_test", + "name": "boringssl_ecdsa_sign_test", "platforms": [ "linux", "mac", @@ -4521,7 +4539,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_example_mul", + "name": "boringssl_ecdsa_test", "platforms": [ "linux", "mac", @@ -4530,7 +4548,9 @@ ] }, { - "args": [], + "args": [ + "third_party/boringssl/crypto/ecdsa/ecdsa_verify_tests.txt" + ], "boringssl": true, "ci_platforms": [ "linux", @@ -4545,7 +4565,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_ecdsa_test", + "name": "boringssl_ecdsa_verify_test", "platforms": [ "linux", "mac", @@ -4765,7 +4785,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_pkcs8_test", + "name": "boringssl_newhope_test", "platforms": [ "linux", "mac", @@ -4789,7 +4809,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_pkcs12_test", + "name": "boringssl_newhope_statistical_test", "platforms": [ "linux", "mac", @@ -4799,7 +4819,7 @@ }, { "args": [ - "third_party/boringssl/crypto/poly1305/poly1305_test.txt" + "third_party/boringssl/crypto/newhope/newhope_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -4815,7 +4835,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_poly1305_test", + "name": "boringssl_newhope_vectors_test", "platforms": [ "linux", "mac", @@ -4839,7 +4859,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_refcount_test", + "name": "boringssl_obj_test", "platforms": [ "linux", "mac", @@ -4863,7 +4883,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_rsa_test", + "name": "boringssl_pkcs12_test", "platforms": [ "linux", "mac", @@ -4887,7 +4907,33 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_thread_test", + "name": "boringssl_pkcs8_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, + { + "args": [ + "third_party/boringssl/crypto/poly1305/poly1305_tests.txt" + ], + "boringssl": true, + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "defaults": "boringssl", + "exclude_configs": [ + "asan" + ], + "flaky": false, + "language": "c++", + "name": "boringssl_poly1305_test", "platforms": [ "linux", "mac", @@ -4911,7 +4957,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_pkcs7_test", + "name": "boringssl_refcount_test", "platforms": [ "linux", "mac", @@ -4935,7 +4981,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_x509_test", + "name": "boringssl_rsa_test", "platforms": [ "linux", "mac", @@ -4959,7 +5005,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_tab_test", + "name": "boringssl_thread_test", "platforms": [ "linux", "mac", @@ -4983,7 +5029,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_v3name_test", + "name": "boringssl_pkcs7_test", "platforms": [ "linux", "mac", @@ -5007,7 +5053,55 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_pqueue_test", + "name": "boringssl_x509_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, + { + "args": [], + "boringssl": true, + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "defaults": "boringssl", + "exclude_configs": [ + "asan" + ], + "flaky": false, + "language": "c++", + "name": "boringssl_tab_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, + { + "args": [], + "boringssl": true, + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "defaults": "boringssl", + "exclude_configs": [ + "asan" + ], + "flaky": false, + "language": "c++", + "name": "boringssl_v3name_test", "platforms": [ "linux", "mac", diff --git a/vsprojects/vcxproj/boringssl/boringssl.vcxproj b/vsprojects/vcxproj/boringssl/boringssl.vcxproj index 59db775d799..a67b2c3a5d8 100644 --- a/vsprojects/vcxproj/boringssl/boringssl.vcxproj +++ b/vsprojects/vcxproj/boringssl/boringssl.vcxproj @@ -158,23 +158,22 @@ - - + + - - + @@ -220,10 +219,12 @@ + + - + @@ -231,9 +232,9 @@ - + @@ -250,10 +251,6 @@ - - - - @@ -266,8 +263,6 @@ - - @@ -304,10 +299,6 @@ - - - - @@ -316,8 +307,6 @@ - - @@ -326,8 +315,6 @@ - - @@ -386,6 +373,8 @@ + + @@ -408,9 +397,7 @@ - - - + @@ -440,14 +427,22 @@ + + + + + + + + @@ -464,10 +459,6 @@ - - - - @@ -504,8 +495,6 @@ - - @@ -526,6 +515,8 @@ + + @@ -552,6 +543,18 @@ + + + + + + + + + + + + @@ -586,6 +589,8 @@ + + @@ -634,6 +639,8 @@ + + @@ -644,6 +651,8 @@ + + @@ -792,36 +801,28 @@ - - - - - + - + - + - + - - - - @@ -848,6 +849,16 @@ + + + + + + + + + + diff --git a/vsprojects/vcxproj/boringssl/boringssl.vcxproj.filters b/vsprojects/vcxproj/boringssl/boringssl.vcxproj.filters index bd996bdc445..09aa067f785 100644 --- a/vsprojects/vcxproj/boringssl/boringssl.vcxproj.filters +++ b/vsprojects/vcxproj/boringssl/boringssl.vcxproj.filters @@ -16,9 +16,6 @@ third_party\boringssl\crypto\asn1 - - third_party\boringssl\crypto\asn1 - third_party\boringssl\crypto\asn1 @@ -73,12 +70,6 @@ third_party\boringssl\crypto\asn1 - - third_party\boringssl\crypto\asn1 - - - third_party\boringssl\crypto\asn1 - third_party\boringssl\crypto\asn1 @@ -91,9 +82,6 @@ third_party\boringssl\crypto\asn1 - - third_party\boringssl\crypto\asn1 - third_party\boringssl\crypto\asn1 @@ -106,9 +94,6 @@ third_party\boringssl\crypto\asn1 - - third_party\boringssl\crypto\asn1 - third_party\boringssl\crypto\asn1 @@ -196,6 +181,9 @@ third_party\boringssl\crypto\bn + + third_party\boringssl\crypto\bn + third_party\boringssl\crypto\bn @@ -229,10 +217,7 @@ third_party\boringssl\crypto\bytestring - - third_party\boringssl\crypto\chacha - - + third_party\boringssl\crypto\chacha @@ -277,18 +262,30 @@ third_party\boringssl\crypto\conf + + third_party\boringssl\crypto + + + third_party\boringssl\crypto + third_party\boringssl\crypto third_party\boringssl\crypto + + third_party\boringssl\crypto + third_party\boringssl\crypto third_party\boringssl\crypto\curve25519 + + third_party\boringssl\crypto\curve25519 + third_party\boringssl\crypto\curve25519 @@ -313,12 +310,6 @@ third_party\boringssl\crypto\digest - - third_party\boringssl\crypto - - - third_party\boringssl\crypto - third_party\boringssl\crypto\dsa @@ -373,9 +364,6 @@ third_party\boringssl\crypto\err - - third_party\boringssl\crypto\evp - third_party\boringssl\crypto\evp @@ -406,6 +394,9 @@ third_party\boringssl\crypto\evp + + third_party\boringssl\crypto\evp + third_party\boringssl\crypto\evp @@ -445,6 +436,24 @@ 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\obj @@ -496,6 +505,9 @@ third_party\boringssl\crypto\poly1305 + + third_party\boringssl\crypto\rand + third_party\boringssl\crypto\rand @@ -568,6 +580,9 @@ third_party\boringssl\crypto\x509 + + third_party\boringssl\crypto\x509 + third_party\boringssl\crypto\x509 @@ -583,6 +598,9 @@ third_party\boringssl\crypto\x509 + + third_party\boringssl\crypto\x509 + third_party\boringssl\crypto\x509 @@ -805,34 +823,28 @@ third_party\boringssl\ssl - - third_party\boringssl\ssl - third_party\boringssl\ssl - - third_party\boringssl\ssl - third_party\boringssl\ssl third_party\boringssl\ssl - + third_party\boringssl\ssl third_party\boringssl\ssl - - third_party\boringssl\ssl\pqueue + + third_party\boringssl\ssl - + third_party\boringssl\ssl - + third_party\boringssl\ssl @@ -841,15 +853,9 @@ third_party\boringssl\ssl - - third_party\boringssl\ssl - third_party\boringssl\ssl - - third_party\boringssl\ssl - third_party\boringssl\ssl @@ -889,6 +895,21 @@ third_party\boringssl\ssl + + third_party\boringssl\ssl + + + third_party\boringssl\ssl + + + third_party\boringssl\ssl + + + third_party\boringssl\ssl + + + third_party\boringssl\ssl + third_party\boringssl\ssl @@ -927,18 +948,12 @@ third_party\boringssl\crypto\des - - third_party\boringssl\crypto\dh - third_party\boringssl\crypto\digest third_party\boringssl\crypto\digest - - third_party\boringssl\crypto - third_party\boringssl\crypto\ec @@ -954,6 +969,9 @@ third_party\boringssl\crypto\modes + + third_party\boringssl\crypto\newhope + third_party\boringssl\crypto\obj @@ -963,21 +981,21 @@ third_party\boringssl\crypto\pkcs8 + + third_party\boringssl\crypto\poly1305 + third_party\boringssl\crypto\rand third_party\boringssl\crypto\rsa - - third_party\boringssl\crypto\test - - - third_party\boringssl\crypto\test - third_party\boringssl\crypto\x509 + + third_party\boringssl\crypto\x509 + third_party\boringssl\crypto\x509 @@ -1113,6 +1131,12 @@ third_party\boringssl\include\openssl + + third_party\boringssl\include\openssl + + + third_party\boringssl\include\openssl + third_party\boringssl\include\openssl @@ -1122,7 +1146,7 @@ third_party\boringssl\include\openssl - + third_party\boringssl\include\openssl @@ -1146,15 +1170,15 @@ third_party\boringssl\include\openssl - - third_party\boringssl\include\openssl - third_party\boringssl\include\openssl third_party\boringssl\include\openssl + + third_party\boringssl\include\openssl + third_party\boringssl\include\openssl @@ -1203,18 +1227,6 @@ third_party\boringssl\ssl - - third_party\boringssl\ssl\test - - - third_party\boringssl\ssl\test - - - third_party\boringssl\ssl\test - - - third_party\boringssl\ssl\test - @@ -1320,6 +1332,9 @@ {63ca8fcd-7644-61d6-4357-5a0bcfdc395b} + + {2a39f7c3-62df-5021-0825-36f18f10ad12} + {59349deb-4276-df4c-f4cd-e2cf707c3b4c} @@ -1347,9 +1362,6 @@ {7b1c1e89-c813-5ccd-fa2a-dd1b187f8da9} - - {eec8fd39-7429-3d4d-be78-028791b4b927} - {74c9e47d-193b-84c0-95d9-4b33703b7890} @@ -1365,12 +1377,6 @@ {e6e8c0c0-1755-4978-209e-5429ee3a2f5f} - - {89eb7fc9-98ec-dee5-ea8c-f7d23760aa94} - - - {8dda7bd5-b246-84a4-20c9-c92101caeb48} - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_pqueue_test/boringssl_pqueue_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj similarity index 97% rename from vsprojects/vcxproj/test/boringssl/boringssl_pqueue_test/boringssl_pqueue_test.vcxproj rename to vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj index 7c0189b6271..f8932983672 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_pqueue_test/boringssl_pqueue_test.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj @@ -20,7 +20,7 @@ - {CCAA2ACD-B171-6011-0646-93010DCF8BC5} + {0F12358C-9F7A-E3B5-23EC-250C29C9D3A2} true $(SolutionDir)IntDir\$(MSBuildProjectName)\ @@ -62,14 +62,14 @@ - boringssl_pqueue_test + boringssl_chacha_test static Debug static Debug - boringssl_pqueue_test + boringssl_chacha_test static Release static @@ -164,8 +164,8 @@ - - {D03600F9-540A-2691-69F6-3A1DC2874D24} + + {D15F1CF5-EC88-FDD5-55A0-CBE5DC8A9F29} {427037B1-B51B-D6F1-5025-AD12B200266A} diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_pqueue_test/boringssl_pqueue_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj.filters similarity index 100% rename from vsprojects/vcxproj/test/boringssl/boringssl_pqueue_test/boringssl_pqueue_test.vcxproj.filters rename to vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj.filters 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 new file mode 100644 index 00000000000..3c4c382c56d --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj @@ -0,0 +1,170 @@ + + + + + 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 new file mode 100644 index 00000000000..5fb3e2fc495 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + 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_ecdh_test/boringssl_ecdh_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ecdh_test/boringssl_ecdh_test.vcxproj new file mode 100644 index 00000000000..cb85dd53829 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_ecdh_test/boringssl_ecdh_test.vcxproj @@ -0,0 +1,198 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {8B7A464C-BC82-53A0-656A-0215D2BCE85D} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + boringssl_ecdh_test + static + Debug + static + Debug + + + boringssl_ecdh_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 + + + + + + + + + + {04FA7804-13C6-D0E4-144D-BD3736334565} + + + {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_ecdh_test/boringssl_ecdh_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_ecdh_test/boringssl_ecdh_test.vcxproj.filters new file mode 100644 index 00000000000..00e4276f1d4 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_ecdh_test/boringssl_ecdh_test.vcxproj.filters @@ -0,0 +1,7 @@ + + + + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_pqueue_test_lib/boringssl_pqueue_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ecdh_test_lib/boringssl_ecdh_test_lib.vcxproj similarity index 97% rename from vsprojects/vcxproj/test/boringssl/boringssl_pqueue_test_lib/boringssl_pqueue_test_lib.vcxproj rename to vsprojects/vcxproj/test/boringssl/boringssl_ecdh_test_lib/boringssl_ecdh_test_lib.vcxproj index 12198c11495..22c033c57b2 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_pqueue_test_lib/boringssl_pqueue_test_lib.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_ecdh_test_lib/boringssl_ecdh_test_lib.vcxproj @@ -19,7 +19,7 @@ - {D03600F9-540A-2691-69F6-3A1DC2874D24} + {04FA7804-13C6-D0E4-144D-BD3736334565} true $(SolutionDir)IntDir\$(MSBuildProjectName)\ @@ -57,10 +57,10 @@ - boringssl_pqueue_test_lib + boringssl_ecdh_test_lib - boringssl_pqueue_test_lib + boringssl_ecdh_test_lib @@ -147,7 +147,7 @@ - + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ecdh_test_lib/boringssl_ecdh_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_ecdh_test_lib/boringssl_ecdh_test_lib.vcxproj.filters new file mode 100644 index 00000000000..51393f51907 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_ecdh_test_lib/boringssl_ecdh_test_lib.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + third_party\boringssl\crypto\ecdh + + + + + + {100930cd-7241-d92b-da6a-a84ea68e24bd} + + + {2f0bb152-1c3a-5f3a-7512-ca92fef36751} + + + {c004f731-666a-9d7d-c448-96a16069cbc4} + + + {74176a90-7b93-c871-7de7-0048a1a55076} + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test/boringssl_ecdsa_sign_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test/boringssl_ecdsa_sign_test.vcxproj new file mode 100644 index 00000000000..db7fc98af66 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test/boringssl_ecdsa_sign_test.vcxproj @@ -0,0 +1,198 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {B9368314-B4D2-DEB2-A448-26D327059447} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + boringssl_ecdsa_sign_test + static + Debug + static + Debug + + + boringssl_ecdsa_sign_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 + + + + + + + + + + {8F0F763A-31D1-6710-6286-FD91EAC75EDB} + + + {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_ecdsa_sign_test/boringssl_ecdsa_sign_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test/boringssl_ecdsa_sign_test.vcxproj.filters new file mode 100644 index 00000000000..00e4276f1d4 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test/boringssl_ecdsa_sign_test.vcxproj.filters @@ -0,0 +1,7 @@ + + + + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test_lib/boringssl_ecdsa_sign_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test_lib/boringssl_ecdsa_sign_test_lib.vcxproj new file mode 100644 index 00000000000..947dcddd949 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test_lib/boringssl_ecdsa_sign_test_lib.vcxproj @@ -0,0 +1,170 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {8F0F763A-31D1-6710-6286-FD91EAC75EDB} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + true + Unicode + + + + + + + + + + + + boringssl_ecdsa_sign_test_lib + + + boringssl_ecdsa_sign_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_ecdsa_sign_test_lib/boringssl_ecdsa_sign_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test_lib/boringssl_ecdsa_sign_test_lib.vcxproj.filters new file mode 100644 index 00000000000..69fb20cc1bd --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_sign_test_lib/boringssl_ecdsa_sign_test_lib.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + third_party\boringssl\crypto\ecdsa + + + + + + {2407663e-0b17-cfb0-0aaa-fe639ecda00a} + + + {9ad9cf54-8113-a6e1-0689-09b051b5acf9} + + + {8057866a-62e2-5309-70fa-f98800b682a8} + + + {76196bab-7843-c0ca-4f97-32c3336af99b} + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test/boringssl_ecdsa_verify_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test/boringssl_ecdsa_verify_test.vcxproj new file mode 100644 index 00000000000..ddf4b0c0227 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test/boringssl_ecdsa_verify_test.vcxproj @@ -0,0 +1,198 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {BF550763-A8E9-1C98-89C5-7A4A00364E06} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + boringssl_ecdsa_verify_test + static + Debug + static + Debug + + + boringssl_ecdsa_verify_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 + + + + + + + + + + {3F79C89D-E5CA-4C28-DE1C-27E0E1BFCA43} + + + {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_ecdsa_verify_test/boringssl_ecdsa_verify_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test/boringssl_ecdsa_verify_test.vcxproj.filters new file mode 100644 index 00000000000..00e4276f1d4 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test/boringssl_ecdsa_verify_test.vcxproj.filters @@ -0,0 +1,7 @@ + + + + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test_lib/boringssl_ecdsa_verify_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test_lib/boringssl_ecdsa_verify_test_lib.vcxproj new file mode 100644 index 00000000000..5287bbec92b --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test_lib/boringssl_ecdsa_verify_test_lib.vcxproj @@ -0,0 +1,170 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {3F79C89D-E5CA-4C28-DE1C-27E0E1BFCA43} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + true + Unicode + + + + + + + + + + + + boringssl_ecdsa_verify_test_lib + + + boringssl_ecdsa_verify_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_ecdsa_verify_test_lib/boringssl_ecdsa_verify_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test_lib/boringssl_ecdsa_verify_test_lib.vcxproj.filters new file mode 100644 index 00000000000..01169e3656b --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_ecdsa_verify_test_lib/boringssl_ecdsa_verify_test_lib.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + third_party\boringssl\crypto\ecdsa + + + + + + {62c752a3-7d35-4a52-4e3e-af92d1ef7ae0} + + + {cf981be6-06c7-d75e-bb01-bdcf6cbac573} + + + {f4955fa6-0694-bb47-d2e7-59ee77f72e37} + + + {bc349ef0-99fd-5724-06c0-0c6f6e1f7b69} + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_gcm_test_lib/boringssl_gcm_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_gcm_test_lib/boringssl_gcm_test_lib.vcxproj index 7b5ffa1ca10..8b3f5f49bc6 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_gcm_test_lib/boringssl_gcm_test_lib.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_gcm_test_lib/boringssl_gcm_test_lib.vcxproj @@ -147,7 +147,7 @@ - + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_gcm_test_lib/boringssl_gcm_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_gcm_test_lib/boringssl_gcm_test_lib.vcxproj.filters index 7260136bd81..fbc3a077ecf 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_gcm_test_lib/boringssl_gcm_test_lib.vcxproj.filters +++ b/vsprojects/vcxproj/test/boringssl/boringssl_gcm_test_lib/boringssl_gcm_test_lib.vcxproj.filters @@ -1,7 +1,7 @@ - + third_party\boringssl\crypto\modes 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 new file mode 100644 index 00000000000..f3dde154ade --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj @@ -0,0 +1,198 @@ + + + + + + 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 new file mode 100644 index 00000000000..00e4276f1d4 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj.filters @@ -0,0 +1,7 @@ + + + + + + + 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 new file mode 100644 index 00000000000..c9cb80a4306 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj @@ -0,0 +1,170 @@ + + + + + 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 new file mode 100644 index 00000000000..95945c24671 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + 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 new file mode 100644 index 00000000000..7a085b638f1 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj @@ -0,0 +1,198 @@ + + + + + + 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 new file mode 100644 index 00000000000..00e4276f1d4 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj.filters @@ -0,0 +1,7 @@ + + + + + + + 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 new file mode 100644 index 00000000000..55046360614 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj @@ -0,0 +1,170 @@ + + + + + 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 new file mode 100644 index 00000000000..f2dc0e6a5bb --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + 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 new file mode 100644 index 00000000000..505f7cf33a8 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj @@ -0,0 +1,198 @@ + + + + + + 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 new file mode 100644 index 00000000000..00e4276f1d4 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj.filters @@ -0,0 +1,7 @@ + + + + + + + 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 new file mode 100644 index 00000000000..4f01ec4b706 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj @@ -0,0 +1,170 @@ + + + + + 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 new file mode 100644 index 00000000000..27b208d3507 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + 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_obj_test/boringssl_obj_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_obj_test/boringssl_obj_test.vcxproj new file mode 100644 index 00000000000..188663cd253 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_obj_test/boringssl_obj_test.vcxproj @@ -0,0 +1,198 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {CAF4E45E-3BA1-0EFD-2551-F16B4E43D0AB} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + boringssl_obj_test + static + Debug + static + Debug + + + boringssl_obj_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 + + + + + + + + + + {9C5FF985-A7D0-185E-4982-8166BC8267EF} + + + {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_obj_test/boringssl_obj_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_obj_test/boringssl_obj_test.vcxproj.filters new file mode 100644 index 00000000000..00e4276f1d4 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_obj_test/boringssl_obj_test.vcxproj.filters @@ -0,0 +1,7 @@ + + + + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_obj_test_lib/boringssl_obj_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_obj_test_lib/boringssl_obj_test_lib.vcxproj new file mode 100644 index 00000000000..5cff5dc611a --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_obj_test_lib/boringssl_obj_test_lib.vcxproj @@ -0,0 +1,170 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {9C5FF985-A7D0-185E-4982-8166BC8267EF} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + true + Unicode + + + + + + + + + + + + boringssl_obj_test_lib + + + boringssl_obj_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_pqueue_test_lib/boringssl_pqueue_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_obj_test_lib/boringssl_obj_test_lib.vcxproj.filters similarity index 52% rename from vsprojects/vcxproj/test/boringssl/boringssl_pqueue_test_lib/boringssl_pqueue_test_lib.vcxproj.filters rename to vsprojects/vcxproj/test/boringssl/boringssl_obj_test_lib/boringssl_obj_test_lib.vcxproj.filters index 50a19355fc4..e860a95a150 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_pqueue_test_lib/boringssl_pqueue_test_lib.vcxproj.filters +++ b/vsprojects/vcxproj/test/boringssl/boringssl_obj_test_lib/boringssl_obj_test_lib.vcxproj.filters @@ -1,23 +1,23 @@ - - third_party\boringssl\ssl\pqueue + + third_party\boringssl\crypto\obj - {5abc2e4b-4b3e-76f3-af5b-32b49bed5734} + {1e65df99-429c-84ab-e85c-2a74292dff99} - {ba7fa262-1d79-278b-6d33-494ef09bc0b0} + {f67c8934-df62-47c5-ab21-f2670e0624d4} - - {bbe38f66-e869-8d99-4ef8-a477041fda28} + + {a1c37911-be8c-bf36-9263-c4db89aa11dc} - - {c6deeb40-d424-ed7a-bcf9-8b33d62d603d} + + {26163139-0b8e-2ee1-11ac-7be64498bbab} diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test/boringssl_spake25519_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test/boringssl_spake25519_test.vcxproj new file mode 100644 index 00000000000..dd9022b2ac1 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test/boringssl_spake25519_test.vcxproj @@ -0,0 +1,198 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {6E1688D7-E3F2-8F4A-0748-8DEB832397A6} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + boringssl_spake25519_test + static + Debug + static + Debug + + + boringssl_spake25519_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 + + + + + + + + + + {B5EDD577-C90C-F122-313E-6D9803E91FEB} + + + {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_spake25519_test/boringssl_spake25519_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test/boringssl_spake25519_test.vcxproj.filters new file mode 100644 index 00000000000..00e4276f1d4 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test/boringssl_spake25519_test.vcxproj.filters @@ -0,0 +1,7 @@ + + + + + + + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test_lib/boringssl_spake25519_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test_lib/boringssl_spake25519_test_lib.vcxproj new file mode 100644 index 00000000000..f0347a48932 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test_lib/boringssl_spake25519_test_lib.vcxproj @@ -0,0 +1,170 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {B5EDD577-C90C-F122-313E-6D9803E91FEB} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + true + Unicode + + + + + + + + + + + + boringssl_spake25519_test_lib + + + boringssl_spake25519_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_spake25519_test_lib/boringssl_spake25519_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test_lib/boringssl_spake25519_test_lib.vcxproj.filters new file mode 100644 index 00000000000..a94780cf898 --- /dev/null +++ b/vsprojects/vcxproj/test/boringssl/boringssl_spake25519_test_lib/boringssl_spake25519_test_lib.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + third_party\boringssl\crypto\curve25519 + + + + + + {88324f4e-8e00-0e8c-b6ab-d9406be0cccf} + + + {067bed6d-c308-8eee-2225-771546a4eb5c} + + + {08b844f4-9df6-ff01-d951-1c944f9e5b6b} + + + {2f6416cc-d016-dedd-4e2f-d0ebd4d78fdb} + + + + From 113b094c690bb3afd3d1d68034c7490b95b12998 Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 26 Jan 2017 15:40:05 -0800 Subject: [PATCH 034/126] typo --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index 1b5a53f6d1f..5ef46e70df4 100644 --- a/BUILD +++ b/BUILD @@ -1122,7 +1122,7 @@ grpc_cc_library( "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", "include/grpc++/create_channel_posix.h", - "include/grpc++/ext/health_check_service_server_buieder_option.h", + "include/grpc++/ext/health_check_service_server_builder_option.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", From f0bf99ac41af04e0381ac256ac8e2c1a0f051965 Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 30 Jan 2017 10:27:01 -0800 Subject: [PATCH 035/126] test --- third_party/boringssl | 2 +- third_party/gflags | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/boringssl b/third_party/boringssl index c880e42ba1c..78684e5b222 160000 --- a/third_party/boringssl +++ b/third_party/boringssl @@ -1 +1 @@ -Subproject commit c880e42ba1c8032d4cdde2aba0541d8a9d9fa2e9 +Subproject commit 78684e5b222645828ca302e56b40b9daff2b2d27 diff --git a/third_party/gflags b/third_party/gflags index 05b155ff591..f8a0efe03aa 160000 --- a/third_party/gflags +++ b/third_party/gflags @@ -1 +1 @@ -Subproject commit 05b155ff59114735ec8cd089f669c4c3d8f59029 +Subproject commit f8a0efe03aa69b3336d8e228b37d4ccb17324b88 From 1e19b8d3e7a29a39fd4c5359cc99c941179be7f3 Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 30 Jan 2017 10:48:59 -0800 Subject: [PATCH 036/126] Update for API change --- src/cpp/server/server_cc.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index dec4551b101..69e491dc96b 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -779,9 +779,7 @@ Server::UnimplementedAsyncResponse::UnimplementedAsyncResponse( bool Server::HealthCheckAsyncRequest::FinalizeResult(void** tag, bool* status) { bool serialization_status = *status && payload_ && - SerializationTraits::Deserialize( - payload_, &request_, server_->max_receive_message_size()) - .ok(); + SerializationTraits::Deserialize(payload_, &request_).ok(); RegisteredAsyncRequest::FinalizeResult(tag, status); *status = serialization_status && *status; if (*status) { From 7240b54ddb1a10fc4400c81bede0ac0390aa6e0f Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 31 Jan 2017 16:00:49 -0800 Subject: [PATCH 037/126] make grpc-encoding:identity implicit --- src/core/lib/channel/compress_filter.c | 10 ++++++---- test/core/end2end/bad_server_response_test.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core/lib/channel/compress_filter.c b/src/core/lib/channel/compress_filter.c index c860d60d881..22781c78399 100644 --- a/src/core/lib/channel/compress_filter.c +++ b/src/core/lib/channel/compress_filter.c @@ -105,7 +105,6 @@ static grpc_error *process_send_initial_metadata( static grpc_error *process_send_initial_metadata( grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_metadata_batch *initial_metadata) { - grpc_error *error; call_data *calld = elem->call_data; channel_data *channeld = elem->channel_data; /* Parse incoming request for compression. If any, it'll be available @@ -144,10 +143,13 @@ static grpc_error *process_send_initial_metadata( calld->has_compression_algorithm = 1; /* GPR_TRUE */ } + grpc_error *error = GRPC_ERROR_NONE; /* hint compression algorithm */ - error = grpc_metadata_batch_add_tail( - exec_ctx, initial_metadata, &calld->compression_algorithm_storage, - grpc_compression_encoding_mdelem(calld->compression_algorithm)); + if (calld->compression_algorithm != GRPC_COMPRESS_NONE) { + error = grpc_metadata_batch_add_tail( + exec_ctx, initial_metadata, &calld->compression_algorithm_storage, + grpc_compression_encoding_mdelem(calld->compression_algorithm)); + } if (error != GRPC_ERROR_NONE) return error; diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c index d5f428eb829..9cfe0cebe01 100644 --- a/test/core/end2end/bad_server_response_test.c +++ b/test/core/end2end/bad_server_response_test.c @@ -82,7 +82,7 @@ #define HTTP1_DETAIL_MSG "Trying to connect an http1.x server" /* TODO(zyc) Check the content of incomming data instead of using this length */ -#define EXPECTED_INCOMING_DATA_LENGTH (size_t)310 +#define EXPECTED_INCOMING_DATA_LENGTH (size_t)300 struct rpc_state { char *target; @@ -135,7 +135,7 @@ static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { gpr_log(GPR_DEBUG, "got %" PRIuPTR " bytes, expected %" PRIuPTR " bytes", state.incoming_data_length, EXPECTED_INCOMING_DATA_LENGTH); - if (state.incoming_data_length > EXPECTED_INCOMING_DATA_LENGTH) { + if (state.incoming_data_length >= EXPECTED_INCOMING_DATA_LENGTH) { handle_write(exec_ctx); } else { grpc_endpoint_read(exec_ctx, state.tcp, &state.temp_incoming_buffer, From eb5ee45eec0c6f88bcf649f383060f3dc34f2084 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 1 Feb 2017 11:57:33 -0800 Subject: [PATCH 038/126] Revert "Dynamically enable/disable packet coalecsing and test it" This reverts commit 60ab7ef00ac0a988ee2672c636d946c964e6fa41. --- include/grpc/grpc_cronet.h | 2 - .../client/secure/cronet_channel_create.c | 6 -- .../cronet/transport/cronet_transport.c | 72 ++++++++++--------- .../tests/CronetUnitTests/CronetUnitTests.m | 13 +--- src/objective-c/tests/Podfile | 1 + 5 files changed, 42 insertions(+), 52 deletions(-) diff --git a/include/grpc/grpc_cronet.h b/include/grpc/grpc_cronet.h index 566c34a388d..295e0f55e80 100644 --- a/include/grpc/grpc_cronet.h +++ b/include/grpc/grpc_cronet.h @@ -44,8 +44,6 @@ GRPCAPI grpc_channel *grpc_cronet_secure_channel_create( void *engine, const char *target, const grpc_channel_args *args, void *reserved); -GRPCAPI void grpc_cronet_use_packet_coalescing(bool use_coalescing); - #ifdef __cplusplus } #endif diff --git a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c index 2e40020ae05..477cf07f45d 100644 --- a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c +++ b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c @@ -51,8 +51,6 @@ typedef struct cronet_transport { extern grpc_transport_vtable grpc_cronet_vtable; -bool grpc_cronet_packet_coalescing_enabled = true; - GRPCAPI grpc_channel *grpc_cronet_secure_channel_create( void *engine, const char *target, const grpc_channel_args *args, void *reserved) { @@ -69,7 +67,3 @@ GRPCAPI grpc_channel *grpc_cronet_secure_channel_create( return grpc_channel_create(&exec_ctx, target, args, GRPC_CLIENT_DIRECT_CHANNEL, (grpc_transport *)ct); } - -GRPCAPI void grpc_cronet_use_packet_coalescing(bool use_coalescing) { - grpc_cronet_packet_coalescing_enabled = use_coalescing; -} diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 5429eb32e3c..447f3f31ec1 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -61,8 +61,6 @@ /* TODO (makdharma): Hook up into the wider tracing mechanism */ int grpc_cronet_trace = 0; -extern bool grpc_cronet_packet_coalescing_enabled; - enum e_op_result { ACTION_TAKEN_WITH_CALLBACK, ACTION_TAKEN_NO_CALLBACK, @@ -152,13 +150,12 @@ struct op_state { bool state_callback_received[OP_NUM_OPS]; bool fail_state; bool flush_read; +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING bool flush_cronet_when_ready; bool pending_write_for_trailer; +#endif bool unprocessed_send_message; grpc_error *cancel_error; - - /* Whether packet coalescing is enabled */ - bool packet_coalescing_enabled; /* data structure for storing data coming from server */ struct read_state rs; /* data structure for storing data going to the server */ @@ -428,10 +425,12 @@ static void on_stream_ready(bidirectional_stream *stream) { } /* Send the initial metadata on wire if there is no SEND_MESSAGE or * SEND_TRAILING_METADATA ops pending */ - if (s->state.packet_coalescing_enabled && s->state.flush_cronet_when_ready) { +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + if (s->state.flush_cronet_when_ready) { CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_flush (%p)", s->cbs); bidirectional_stream_flush(stream); } +#endif gpr_mu_unlock(&s->mu); execute_from_storage(s); } @@ -569,10 +568,10 @@ static void on_response_trailers_received( CRONET_LOG(GPR_DEBUG, "bidirectional_stream_write (%p, 0)", s->cbs); s->state.state_callback_received[OP_SEND_MESSAGE] = false; bidirectional_stream_write(s->cbs, "", 0, true); - if (s->state.packet_coalescing_enabled) { - CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); - bidirectional_stream_flush(s->cbs); - } +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); + bidirectional_stream_flush(s->cbs); +#endif s->state.state_op_done[OP_SEND_TRAILING_METADATA] = true; gpr_mu_unlock(&s->mu); @@ -769,9 +768,11 @@ static bool op_can_be_run(grpc_transport_stream_op *curr_op, result = false; /* we haven't got on_write_completed for the send yet */ else if (stream_state->state_op_done[OP_SEND_MESSAGE] && - !stream_state->state_callback_received[OP_SEND_MESSAGE] && - !(stream_state->packet_coalescing_enabled && - stream_state->pending_write_for_trailer)) + !stream_state->state_callback_received[OP_SEND_MESSAGE] +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + && !stream_state->pending_write_for_trailer +#endif + ) result = false; } else if (op_id == OP_CANCEL_ERROR) { /* already executed */ @@ -857,10 +858,10 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, s->cbs = bidirectional_stream_create(s->curr_ct.engine, s->curr_gs, &cronet_callbacks); CRONET_LOG(GPR_DEBUG, "%p = bidirectional_stream_create()", s->cbs); - if (stream_state->packet_coalescing_enabled) { - bidirectional_stream_disable_auto_flush(s->cbs, true); - bidirectional_stream_delay_request_headers_until_flush(s->cbs, true); - } +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + bidirectional_stream_disable_auto_flush(s->cbs, true); + bidirectional_stream_delay_request_headers_until_flush(s->cbs, true); +#endif char *url = NULL; const char *method = "POST"; s->header_array.headers = NULL; @@ -871,10 +872,11 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, CRONET_LOG(GPR_DEBUG, "bidirectional_stream_start(%p, %s)", s->cbs, url); bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, false); stream_state->state_op_done[OP_SEND_INITIAL_METADATA] = true; - if (stream_state->packet_coalescing_enabled && !stream_op->send_message && - !stream_op->send_trailing_metadata) { +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + if (!stream_op->send_message && !stream_op->send_trailing_metadata) { s->state.flush_cronet_when_ready = true; } +#endif result = ACTION_TAKEN_WITH_CALLBACK; } else if (stream_op->send_message && op_can_be_run(stream_op, stream_state, &oas->state, @@ -911,18 +913,19 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_state->state_callback_received[OP_SEND_MESSAGE] = false; bidirectional_stream_write(s->cbs, stream_state->ws.write_buffer, (int)write_buffer_size, false); - if (stream_state->packet_coalescing_enabled) { - if (!stream_op->send_trailing_metadata) { - CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); - bidirectional_stream_flush(s->cbs); - result = ACTION_TAKEN_WITH_CALLBACK; - } else { - stream_state->pending_write_for_trailer = true; - result = ACTION_TAKEN_NO_CALLBACK; - } - } else { +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + if (!stream_op->send_trailing_metadata) { + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", + s->cbs); + bidirectional_stream_flush(s->cbs); result = ACTION_TAKEN_WITH_CALLBACK; + } else { + stream_state->pending_write_for_trailer = true; + result = ACTION_TAKEN_NO_CALLBACK; } +#else + result = ACTION_TAKEN_WITH_CALLBACK; +#endif } else { result = NO_ACTION_POSSIBLE; } @@ -941,10 +944,10 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, s->cbs); stream_state->state_callback_received[OP_SEND_MESSAGE] = false; bidirectional_stream_write(s->cbs, "", 0, true); - if (stream_state->packet_coalescing_enabled) { - CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); - bidirectional_stream_flush(s->cbs); - } +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); + bidirectional_stream_flush(s->cbs); +#endif result = ACTION_TAKEN_WITH_CALLBACK; } stream_state->state_op_done[OP_SEND_TRAILING_METADATA] = true; @@ -1173,9 +1176,10 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, sizeof(s->state.state_callback_received)); s->state.fail_state = s->state.flush_read = false; s->state.cancel_error = NULL; +#ifdef GRPC_CRONET_WITH_PACKET_COALESCING s->state.flush_cronet_when_ready = s->state.pending_write_for_trailer = false; +#endif s->state.unprocessed_send_message = false; - s->state.packet_coalescing_enabled = grpc_cronet_packet_coalescing_enabled; gpr_mu_init(&s->mu); return 0; } diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m index 9bbf3cdb113..dcd7f2fa8db 100644 --- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m +++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m @@ -269,9 +269,7 @@ unsigned int parse_h2_length(const char *field) { grpc_completion_queue_destroy(cq); } -- (void)PacketCoalescing:(bool)use_coalescing { - grpc_cronet_use_packet_coalescing(use_coalescing); - +- (void)testPacketCoalescing { grpc_call *c; grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world"); @@ -381,7 +379,7 @@ unsigned int parse_h2_length(const char *field) { long len; bool coalesced = false; while ((len = SSL_read(ssl, buf, sizeof(buf))) > 0) { - gpr_log(GPR_DEBUG, "Read len: %ld", len); + NSLog(@"Read len: %ld", len); // Analyze the HTTP/2 frames in the same TLS PDU to identify if // coalescing is successful @@ -406,7 +404,7 @@ unsigned int parse_h2_length(const char *field) { } } - XCTAssert(coalesced == use_coalescing); + XCTAssert(coalesced); SSL_free(ssl); SSL_CTX_free(ctx); close(s); @@ -435,9 +433,4 @@ unsigned int parse_h2_length(const char *field) { grpc_completion_queue_destroy(cq); } -- (void)testPacketCoalescing { - [self PacketCoalescing:false]; - [self PacketCoalescing:true]; -} - @end diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index 3760330be9a..462c6a8e0eb 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -97,6 +97,7 @@ post_install do |installer| # GPR_UNREACHABLE_CODE causes "Control may reach end of non-void # function" warning config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO' + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_CRONET_WITH_PACKET_COALESCING=1' end end From 191d52c4c1246b7fb80a901186fa39f101738815 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 1 Feb 2017 12:46:05 -0800 Subject: [PATCH 039/126] Renamed define for better readability --- test/core/end2end/bad_server_response_test.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c index 9cfe0cebe01..39a98e84ca9 100644 --- a/test/core/end2end/bad_server_response_test.c +++ b/test/core/end2end/bad_server_response_test.c @@ -82,7 +82,9 @@ #define HTTP1_DETAIL_MSG "Trying to connect an http1.x server" /* TODO(zyc) Check the content of incomming data instead of using this length */ -#define EXPECTED_INCOMING_DATA_LENGTH (size_t)300 +/* The 'bad' server will start sending responses after reading this amount of + * data from the client. */ +#define SERVER_INCOMING_DATA_LENGTH_LOWER_THRESHOLD (size_t)200 struct rpc_state { char *target; @@ -134,8 +136,10 @@ static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { } gpr_log(GPR_DEBUG, "got %" PRIuPTR " bytes, expected %" PRIuPTR " bytes", - state.incoming_data_length, EXPECTED_INCOMING_DATA_LENGTH); - if (state.incoming_data_length >= EXPECTED_INCOMING_DATA_LENGTH) { + state.incoming_data_length, + SERVER_INCOMING_DATA_LENGTH_LOWER_THRESHOLD); + if (state.incoming_data_length >= + SERVER_INCOMING_DATA_LENGTH_LOWER_THRESHOLD) { handle_write(exec_ctx); } else { grpc_endpoint_read(exec_ctx, state.tcp, &state.temp_incoming_buffer, From 0a2fae9aedeef98b39c5f825cb28b5ca32ecc6a2 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 1 Feb 2017 14:49:03 -0800 Subject: [PATCH 040/126] Dynamically enable packet coalescing by channel args --- BUILD | 1 + build.yaml | 1 + gRPC-Core.podspec | 3 +- include/grpc/impl/codegen/grpc_types.h | 4 + .../client/secure/cronet_channel_create.c | 13 +- .../cronet/transport/cronet_transport.c | 181 +++++++++++------- .../cronet/transport/cronet_transport.h | 43 +++++ .../tests/CronetUnitTests/CronetUnitTests.m | 20 +- src/objective-c/tests/Podfile | 1 - templates/gRPC-Core.podspec.template | 3 +- .../generated/sources_and_headers.json | 4 +- 11 files changed, 186 insertions(+), 88 deletions(-) create mode 100644 src/core/ext/transport/cronet/transport/cronet_transport.h diff --git a/BUILD b/BUILD index 54192514cc7..e5c2d20d25f 100644 --- a/BUILD +++ b/BUILD @@ -1028,6 +1028,7 @@ grpc_cc_library( ], hdrs = [ "third_party/Cronet/bidirectional_stream_c.h", + "src/core/ext/transport/cronet/transport/cronet_transport.h", ], language = "c", public_hdrs = [ diff --git a/build.yaml b/build.yaml index 23e2659ea1e..63c05b76c6c 100644 --- a/build.yaml +++ b/build.yaml @@ -684,6 +684,7 @@ filegroups: - include/grpc/grpc_security.h - include/grpc/grpc_security_constants.h headers: + - src/core/ext/transport/cronet/transport/cronet_transport.h - third_party/Cronet/bidirectional_stream_c.h src: - src/core/ext/transport/cronet/client/secure/cronet_channel_create.c diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 1eb178931dc..57816d066d9 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -848,7 +848,8 @@ Pod::Spec.new do |s| s.subspec 'Cronet-Interface' do |ss| ss.header_mappings_dir = 'include/grpc' - ss.source_files = 'include/grpc/grpc_cronet.h' + ss.source_files = 'include/grpc/grpc_cronet.h', + 'src/core/ext/transport/cronet/transport/cronet_transport.h' end s.subspec 'Cronet-Implementation' do |ss| diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index ee8101aab8d..74be7d0ccfc 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -217,6 +217,10 @@ typedef struct { #define GRPC_ARG_LB_POLICY_NAME "grpc.lb_policy_name" /** The grpc_socket_mutator instance that set the socket options. A pointer. */ #define GRPC_ARG_SOCKET_MUTATOR "grpc.socket_mutator" +/** If non-zero, Cronet transport will coalesce packets to fewer frames when + * possible. */ +#define GRPC_ARG_USE_CRONET_PACKET_COALESCING \ + "grpc.use_cronet_packet_coalescing" /** \} */ /** Result of a grpc call. If the caller satisfies the prerequisites of a diff --git a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c index 477cf07f45d..b6e9e845df3 100644 --- a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c +++ b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c @@ -39,6 +39,7 @@ #include #include +#include "src/core/ext/transport/cronet/transport/cronet_transport.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/transport/transport_impl.h" @@ -54,16 +55,14 @@ extern grpc_transport_vtable grpc_cronet_vtable; GRPCAPI grpc_channel *grpc_cronet_secure_channel_create( void *engine, const char *target, const grpc_channel_args *args, void *reserved) { - cronet_transport *ct = gpr_malloc(sizeof(cronet_transport)); - ct->base.vtable = &grpc_cronet_vtable; - ct->engine = engine; - ct->host = gpr_malloc(strlen(target) + 1); - strcpy(ct->host, target); gpr_log(GPR_DEBUG, "grpc_create_cronet_transport: stream_engine = %p, target=%s", engine, - ct->host); + target); + + grpc_transport *ct = + grpc_create_cronet_transport(engine, target, args, reserved); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; return grpc_channel_create(&exec_ctx, target, args, - GRPC_CLIENT_DIRECT_CHANNEL, (grpc_transport *)ct); + GRPC_CLIENT_DIRECT_CHANNEL, ct); } diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 447f3f31ec1..cba5365badc 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -112,6 +112,7 @@ struct grpc_cronet_transport { grpc_transport base; /* must be first element in this structure */ stream_engine *engine; char *host; + bool use_packet_coalescing; }; typedef struct grpc_cronet_transport grpc_cronet_transport; @@ -150,10 +151,8 @@ struct op_state { bool state_callback_received[OP_NUM_OPS]; bool fail_state; bool flush_read; -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING bool flush_cronet_when_ready; bool pending_write_for_trailer; -#endif bool unprocessed_send_message; grpc_error *cancel_error; /* data structure for storing data coming from server */ @@ -178,7 +177,7 @@ struct op_storage { struct stream_obj { struct op_and_state *oas; grpc_transport_stream_op *curr_op; - grpc_cronet_transport curr_ct; + grpc_cronet_transport *curr_ct; grpc_stream *curr_gs; bidirectional_stream *cbs; bidirectional_stream_header_array header_array; @@ -415,6 +414,7 @@ static void on_succeeded(bidirectional_stream *stream) { static void on_stream_ready(bidirectional_stream *stream) { CRONET_LOG(GPR_DEBUG, "W: on_stream_ready(%p)", stream); stream_obj *s = (stream_obj *)stream->annotation; + grpc_cronet_transport *t = (grpc_cronet_transport *)s->curr_ct; gpr_mu_lock(&s->mu); s->state.state_op_done[OP_SEND_INITIAL_METADATA] = true; s->state.state_callback_received[OP_SEND_INITIAL_METADATA] = true; @@ -425,12 +425,12 @@ static void on_stream_ready(bidirectional_stream *stream) { } /* Send the initial metadata on wire if there is no SEND_MESSAGE or * SEND_TRAILING_METADATA ops pending */ -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - if (s->state.flush_cronet_when_ready) { - CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_flush (%p)", s->cbs); - bidirectional_stream_flush(stream); + if (t->use_packet_coalescing) { + if (s->state.flush_cronet_when_ready) { + CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_flush (%p)", s->cbs); + bidirectional_stream_flush(stream); + } } -#endif gpr_mu_unlock(&s->mu); execute_from_storage(s); } @@ -540,6 +540,7 @@ static void on_response_trailers_received( CRONET_LOG(GPR_DEBUG, "R: on_response_trailers_received(%p,%p)", stream, trailers); stream_obj *s = (stream_obj *)stream->annotation; + grpc_cronet_transport *t = (grpc_cronet_transport *)s->curr_ct; gpr_mu_lock(&s->mu); memset(&s->state.rs.trailing_metadata, 0, sizeof(s->state.rs.trailing_metadata)); @@ -568,10 +569,10 @@ static void on_response_trailers_received( CRONET_LOG(GPR_DEBUG, "bidirectional_stream_write (%p, 0)", s->cbs); s->state.state_callback_received[OP_SEND_MESSAGE] = false; bidirectional_stream_write(s->cbs, "", 0, true); -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); - bidirectional_stream_flush(s->cbs); -#endif + if (t->use_packet_coalescing) { + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); + bidirectional_stream_flush(s->cbs); + } s->state.state_op_done[OP_SEND_TRAILING_METADATA] = true; gpr_mu_unlock(&s->mu); @@ -695,8 +696,10 @@ static bool header_has_authority(grpc_linked_mdelem *head) { executed. This is the heart of the state machine. */ static bool op_can_be_run(grpc_transport_stream_op *curr_op, - struct op_state *stream_state, - struct op_state *op_state, enum e_op_id op_id) { + struct stream_obj *s, struct op_state *op_state, + enum e_op_id op_id) { + struct op_state *stream_state = &s->state; + grpc_cronet_transport *t = s->curr_ct; bool result = true; /* When call is canceled, every op can be run, except under following conditions @@ -768,11 +771,9 @@ static bool op_can_be_run(grpc_transport_stream_op *curr_op, result = false; /* we haven't got on_write_completed for the send yet */ else if (stream_state->state_op_done[OP_SEND_MESSAGE] && - !stream_state->state_callback_received[OP_SEND_MESSAGE] -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - && !stream_state->pending_write_for_trailer -#endif - ) + !stream_state->state_callback_received[OP_SEND_MESSAGE] && + !(t->use_packet_coalescing && + stream_state->pending_write_for_trailer)) result = false; } else if (op_id == OP_CANCEL_ERROR) { /* already executed */ @@ -845,42 +846,41 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, struct op_and_state *oas) { grpc_transport_stream_op *stream_op = &oas->op; struct stream_obj *s = oas->s; + grpc_cronet_transport *t = (grpc_cronet_transport *)s->curr_ct; struct op_state *stream_state = &s->state; enum e_op_result result = NO_ACTION_POSSIBLE; if (stream_op->send_initial_metadata && - op_can_be_run(stream_op, stream_state, &oas->state, - OP_SEND_INITIAL_METADATA)) { + op_can_be_run(stream_op, s, &oas->state, OP_SEND_INITIAL_METADATA)) { CRONET_LOG(GPR_DEBUG, "running: %p OP_SEND_INITIAL_METADATA", oas); /* Start new cronet stream. It is destroyed in on_succeeded, on_canceled, * on_failed */ GPR_ASSERT(s->cbs == NULL); GPR_ASSERT(!stream_state->state_op_done[OP_SEND_INITIAL_METADATA]); - s->cbs = bidirectional_stream_create(s->curr_ct.engine, s->curr_gs, + s->cbs = bidirectional_stream_create(t->engine, s->curr_gs, &cronet_callbacks); CRONET_LOG(GPR_DEBUG, "%p = bidirectional_stream_create()", s->cbs); -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - bidirectional_stream_disable_auto_flush(s->cbs, true); - bidirectional_stream_delay_request_headers_until_flush(s->cbs, true); -#endif + if (t->use_packet_coalescing) { + bidirectional_stream_disable_auto_flush(s->cbs, true); + bidirectional_stream_delay_request_headers_until_flush(s->cbs, true); + } char *url = NULL; const char *method = "POST"; s->header_array.headers = NULL; convert_metadata_to_cronet_headers( - stream_op->send_initial_metadata->list.head, s->curr_ct.host, &url, + stream_op->send_initial_metadata->list.head, t->host, &url, &s->header_array.headers, &s->header_array.count, &method); s->header_array.capacity = s->header_array.count; CRONET_LOG(GPR_DEBUG, "bidirectional_stream_start(%p, %s)", s->cbs, url); bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, false); stream_state->state_op_done[OP_SEND_INITIAL_METADATA] = true; -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - if (!stream_op->send_message && !stream_op->send_trailing_metadata) { - s->state.flush_cronet_when_ready = true; + if (t->use_packet_coalescing) { + if (!stream_op->send_message && !stream_op->send_trailing_metadata) { + s->state.flush_cronet_when_ready = true; + } } -#endif result = ACTION_TAKEN_WITH_CALLBACK; } else if (stream_op->send_message && - op_can_be_run(stream_op, stream_state, &oas->state, - OP_SEND_MESSAGE)) { + op_can_be_run(stream_op, s, &oas->state, OP_SEND_MESSAGE)) { CRONET_LOG(GPR_DEBUG, "running: %p OP_SEND_MESSAGE", oas); stream_state->unprocessed_send_message = false; if (stream_state->state_callback_received[OP_FAILED]) { @@ -913,19 +913,18 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_state->state_callback_received[OP_SEND_MESSAGE] = false; bidirectional_stream_write(s->cbs, stream_state->ws.write_buffer, (int)write_buffer_size, false); -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - if (!stream_op->send_trailing_metadata) { - CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", - s->cbs); - bidirectional_stream_flush(s->cbs); - result = ACTION_TAKEN_WITH_CALLBACK; + if (t->use_packet_coalescing) { + if (!stream_op->send_trailing_metadata) { + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); + bidirectional_stream_flush(s->cbs); + result = ACTION_TAKEN_WITH_CALLBACK; + } else { + stream_state->pending_write_for_trailer = true; + result = ACTION_TAKEN_NO_CALLBACK; + } } else { - stream_state->pending_write_for_trailer = true; - result = ACTION_TAKEN_NO_CALLBACK; + result = ACTION_TAKEN_WITH_CALLBACK; } -#else - result = ACTION_TAKEN_WITH_CALLBACK; -#endif } else { result = NO_ACTION_POSSIBLE; } @@ -933,7 +932,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_state->state_op_done[OP_SEND_MESSAGE] = true; oas->state.state_op_done[OP_SEND_MESSAGE] = true; } else if (stream_op->send_trailing_metadata && - op_can_be_run(stream_op, stream_state, &oas->state, + op_can_be_run(stream_op, s, &oas->state, OP_SEND_TRAILING_METADATA)) { CRONET_LOG(GPR_DEBUG, "running: %p OP_SEND_TRAILING_METADATA", oas); if (stream_state->state_callback_received[OP_FAILED]) { @@ -944,15 +943,15 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, s->cbs); stream_state->state_callback_received[OP_SEND_MESSAGE] = false; bidirectional_stream_write(s->cbs, "", 0, true); -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING - CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); - bidirectional_stream_flush(s->cbs); -#endif + if (t->use_packet_coalescing) { + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs); + bidirectional_stream_flush(s->cbs); + } result = ACTION_TAKEN_WITH_CALLBACK; } stream_state->state_op_done[OP_SEND_TRAILING_METADATA] = true; } else if (stream_op->recv_initial_metadata && - op_can_be_run(stream_op, stream_state, &oas->state, + op_can_be_run(stream_op, s, &oas->state, OP_RECV_INITIAL_METADATA)) { CRONET_LOG(GPR_DEBUG, "running: %p OP_RECV_INITIAL_METADATA", oas); if (stream_state->state_op_done[OP_CANCEL_ERROR]) { @@ -971,8 +970,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_state->state_op_done[OP_RECV_INITIAL_METADATA] = true; result = ACTION_TAKEN_NO_CALLBACK; } else if (stream_op->recv_message && - op_can_be_run(stream_op, stream_state, &oas->state, - OP_RECV_MESSAGE)) { + op_can_be_run(stream_op, s, &oas->state, OP_RECV_MESSAGE)) { 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."); @@ -1084,7 +1082,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, result = ACTION_TAKEN_NO_CALLBACK; } } else if (stream_op->recv_trailing_metadata && - op_can_be_run(stream_op, stream_state, &oas->state, + op_can_be_run(stream_op, s, &oas->state, OP_RECV_TRAILING_METADATA)) { CRONET_LOG(GPR_DEBUG, "running: %p OP_RECV_TRAILING_METADATA", oas); if (oas->s->state.rs.trailing_metadata_valid) { @@ -1096,8 +1094,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_state->state_op_done[OP_RECV_TRAILING_METADATA] = true; result = ACTION_TAKEN_NO_CALLBACK; } else if (stream_op->cancel_error && - op_can_be_run(stream_op, stream_state, &oas->state, - OP_CANCEL_ERROR)) { + 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) { @@ -1111,8 +1108,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_state->cancel_error = GRPC_ERROR_REF(stream_op->cancel_error); } } else if (stream_op->on_complete && - op_can_be_run(stream_op, stream_state, &oas->state, - OP_ON_COMPLETE)) { + 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, @@ -1176,10 +1172,12 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, sizeof(s->state.state_callback_received)); s->state.fail_state = s->state.flush_read = false; s->state.cancel_error = NULL; -#ifdef GRPC_CRONET_WITH_PACKET_COALESCING s->state.flush_cronet_when_ready = s->state.pending_write_for_trailer = false; -#endif s->state.unprocessed_send_message = false; + + s->curr_gs = gs; + s->curr_ct = (grpc_cronet_transport *)gt; + gpr_mu_init(&s->mu); return 0; } @@ -1195,8 +1193,6 @@ static void perform_stream_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, grpc_stream *gs, grpc_transport_stream_op *op) { CRONET_LOG(GPR_DEBUG, "perform_stream_op"); stream_obj *s = (stream_obj *)gs; - s->curr_gs = gs; - memcpy(&s->curr_ct, gt, sizeof(grpc_cronet_transport)); add_to_storage(s, op); if (op->send_initial_metadata && header_has_authority(op->send_initial_metadata->list.head)) { @@ -1244,14 +1240,55 @@ static grpc_endpoint *get_endpoint(grpc_exec_ctx *exec_ctx, static void perform_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, grpc_transport_op *op) {} -const grpc_transport_vtable grpc_cronet_vtable = {sizeof(stream_obj), - "cronet_http", - init_stream, - set_pollset_do_nothing, - set_pollset_set_do_nothing, - perform_stream_op, - perform_op, - destroy_stream, - destroy_transport, - get_peer, - get_endpoint}; +static const grpc_transport_vtable grpc_cronet_vtable = { + sizeof(stream_obj), + "cronet_http", + init_stream, + set_pollset_do_nothing, + set_pollset_set_do_nothing, + perform_stream_op, + perform_op, + destroy_stream, + destroy_transport, + get_peer, + get_endpoint}; + +grpc_transport *grpc_create_cronet_transport(void *engine, const char *target, + const grpc_channel_args *args, + void *reserved) { + grpc_cronet_transport *ct = gpr_malloc(sizeof(grpc_cronet_transport)); + if (!ct) { + goto error; + } + ct->base.vtable = &grpc_cronet_vtable; + ct->engine = engine; + ct->host = gpr_malloc(strlen(target) + 1); + if (!ct->host) { + goto error; + } + strcpy(ct->host, target); + + ct->use_packet_coalescing = true; + for (size_t i = 0; i < args->num_args; i++) { + if (0 == strcmp(args->args[i].key, GRPC_ARG_USE_CRONET_PACKET_COALESCING)) { + if (args->args[i].type != GRPC_ARG_INTEGER) { + gpr_log(GPR_ERROR, "%s ignored: it must be an integer", + GRPC_ARG_USE_CRONET_PACKET_COALESCING); + } else { + ct->use_packet_coalescing = (args->args[i].value.integer != 0); + } + } + } + + return &ct->base; + +error: + if (ct) { + if (ct->host) { + gpr_free(ct->host); + } + gpr_free(ct); + } + + return NULL; +} \ No newline at end of file diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.h b/src/core/ext/transport/cronet/transport/cronet_transport.h new file mode 100644 index 00000000000..169ce31fd7d --- /dev/null +++ b/src/core/ext/transport/cronet/transport/cronet_transport.h @@ -0,0 +1,43 @@ +/* + * + * 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. + * + */ + +#ifndef GRPC_CORE_EXT_TRANSPORT_CRONET_TRANSPORT_CRONET_TRANSPORT_H +#define GRPC_CORE_EXT_TRANSPORT_CRONET_TRANSPORT_CRONET_TRANSPORT_H + +#include "src/core/lib/transport/transport.h" + +grpc_transport *grpc_create_cronet_transport(void *engine, const char *target, + const grpc_channel_args *args, + void *reserved); + +#endif /* GRPC_CORE_EXT_TRANSPORT_CRONET_TRANSPORT_CRONET_TRANSPORT_H */ diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m index dcd7f2fa8db..d06fe7767fa 100644 --- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m +++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m @@ -269,7 +269,12 @@ unsigned int parse_h2_length(const char *field) { grpc_completion_queue_destroy(cq); } -- (void)testPacketCoalescing { +- (void)PacketCoalescing:(bool)use_coalescing { + grpc_arg arg; + arg.key = GRPC_ARG_USE_CRONET_PACKET_COALESCING; + arg.type = GRPC_ARG_INTEGER; + arg.value.integer = use_coalescing ? 1:0; + grpc_channel_args *args = grpc_channel_args_copy_and_add(NULL, &arg, 1); grpc_call *c; grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world"); @@ -285,8 +290,8 @@ unsigned int parse_h2_length(const char *field) { gpr_join_host_port(&addr, "127.0.0.1", port); grpc_completion_queue *cq = grpc_completion_queue_create(NULL); stream_engine *cronetEngine = [Cronet getGlobalEngine]; - grpc_channel *client = grpc_cronet_secure_channel_create(cronetEngine, addr, - NULL, NULL); + grpc_channel *client = + grpc_cronet_secure_channel_create(cronetEngine, addr, args, NULL); cq_verifier *cqv = cq_verifier_create(cq); grpc_op ops[6]; @@ -379,7 +384,7 @@ unsigned int parse_h2_length(const char *field) { long len; bool coalesced = false; while ((len = SSL_read(ssl, buf, sizeof(buf))) > 0) { - NSLog(@"Read len: %ld", len); + gpr_log(GPR_DEBUG, "Read len: %ld", len); // Analyze the HTTP/2 frames in the same TLS PDU to identify if // coalescing is successful @@ -404,7 +409,7 @@ unsigned int parse_h2_length(const char *field) { } } - XCTAssert(coalesced); + XCTAssert(coalesced == use_coalescing); SSL_free(ssl); SSL_CTX_free(ctx); close(s); @@ -433,4 +438,9 @@ unsigned int parse_h2_length(const char *field) { grpc_completion_queue_destroy(cq); } +- (void)testPacketCoalescing { + [self PacketCoalescing:true]; + [self PacketCoalescing:false]; +} + @end diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index 462c6a8e0eb..3760330be9a 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -97,7 +97,6 @@ post_install do |installer| # GPR_UNREACHABLE_CODE causes "Control may reach end of non-void # function" warning config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO' - config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_CRONET_WITH_PACKET_COALESCING=1' end end diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 1b97d18f163..0738b7221b5 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -161,7 +161,8 @@ s.subspec 'Cronet-Interface' do |ss| ss.header_mappings_dir = 'include/grpc' - ss.source_files = 'include/grpc/grpc_cronet.h' + ss.source_files = 'include/grpc/grpc_cronet.h', + 'src/core/ext/transport/cronet/transport/cronet_transport.h' end s.subspec 'Cronet-Implementation' do |ss| diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 9bc82486d2b..7f594110197 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7873,6 +7873,7 @@ "include/grpc/grpc_cronet.h", "include/grpc/grpc_security.h", "include/grpc/grpc_security_constants.h", + "src/core/ext/transport/cronet/transport/cronet_transport.h", "third_party/Cronet/bidirectional_stream_c.h" ], "is_filegroup": true, @@ -7884,7 +7885,8 @@ "include/grpc/grpc_security_constants.h", "src/core/ext/transport/cronet/client/secure/cronet_channel_create.c", "src/core/ext/transport/cronet/transport/cronet_api_dummy.c", - "src/core/ext/transport/cronet/transport/cronet_transport.c" + "src/core/ext/transport/cronet/transport/cronet_transport.c", + "src/core/ext/transport/cronet/transport/cronet_transport.h" ], "third_party": false, "type": "filegroup" From 1a5f90fa8a1a9c647e151575fa9651ae1715045f Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 1 Feb 2017 15:46:21 -0800 Subject: [PATCH 041/126] Fix and clang-format Cronet unit tests --- .../tests/CronetUnitTests/CronetUnitTests.m | 283 +++++++++--------- 1 file changed, 146 insertions(+), 137 deletions(-) diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m index a50bf4728f8..9589926d8b5 100644 --- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m +++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m @@ -32,13 +32,13 @@ */ #import -#import #import +#import #import -#import -#import #import +#import +#import #import "test/core/end2end/cq_verifier.h" #import "test/core/util/port.h" @@ -49,19 +49,19 @@ #import "src/core/lib/support/env.h" #import "src/core/lib/support/string.h" #import "src/core/lib/support/tmpfile.h" -#import "test/core/util/test_config.h" #import "test/core/end2end/data/ssl_test_data.h" +#import "test/core/util/test_config.h" #import static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, grpc_timeout_seconds_to_deadline(5), NULL); + ev = grpc_completion_queue_next(cq, grpc_timeout_seconds_to_deadline(5), + NULL); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } - @interface CronetUnitTests : XCTestCase @end @@ -71,8 +71,8 @@ static void drain_cq(grpc_completion_queue *cq) { + (void)setUp { [super setUp]; -/*** FILE *roots_file; - size_t roots_size = strlen(test_root_cert);*/ + /*** FILE *roots_file; + size_t roots_size = strlen(test_root_cert);*/ char *argv[] = {"CoreCronetEnd2EndTests"}; grpc_test_init(1, argv); @@ -83,8 +83,8 @@ static void drain_cq(grpc_completion_queue *cq) { [Cronet setSslKeyLogFileName:@"Documents/key"]; [Cronet enableTestCertVerifierForTesting]; NSURL *url = [[[NSFileManager defaultManager] - URLsForDirectory:NSDocumentDirectory - inDomains:NSUserDomainMask] lastObject]; + URLsForDirectory:NSDocumentDirectory + inDomains:NSUserDomainMask] lastObject]; NSLog(@"Documents directory: %@", url); [Cronet start]; [Cronet startNetLogToFile:@"Documents/cronet_netlog.json" logBytes:YES]; @@ -104,28 +104,28 @@ void init_ssl(void) { OpenSSL_add_ssl_algorithms(); } -void cleanup_ssl(void) { - EVP_cleanup(); -} +void cleanup_ssl(void) { EVP_cleanup(); } int alpn_cb(SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg) { // Always select "h2" as the ALPN protocol to be used - *out = (const unsigned char*)"h2"; + *out = (const unsigned char *)"h2"; *outlen = 2; return SSL_TLSEXT_ERR_OK; } void init_ctx(SSL_CTX *ctx) { // Install server certificate - BIO *pem = BIO_new_mem_buf((void*)test_server1_cert, (int)strlen(test_server1_cert)); + BIO *pem = BIO_new_mem_buf((void *)test_server1_cert, + (int)strlen(test_server1_cert)); X509 *cert = PEM_read_bio_X509_AUX(pem, NULL, NULL, ""); SSL_CTX_use_certificate(ctx, cert); X509_free(cert); BIO_free(pem); // Install server private key - pem = BIO_new_mem_buf((void *)test_server1_key, (int)strlen(test_server1_key)); + pem = + BIO_new_mem_buf((void *)test_server1_key, (int)strlen(test_server1_key)); EVP_PKEY *key = PEM_read_bio_PrivateKey(pem, NULL, NULL, ""); SSL_CTX_use_PrivateKey(ctx, key); EVP_PKEY_free(key); @@ -139,29 +139,34 @@ void init_ctx(SSL_CTX *ctx) { } unsigned int parse_h2_length(const char *field) { - return ((unsigned int)(unsigned char)(field[0])) * 65536 + - ((unsigned int)(unsigned char)(field[1])) * 256 + - ((unsigned int)(unsigned char)(field[2])); + return ((unsigned int)(unsigned char)(field[0])) * 65536 + + ((unsigned int)(unsigned char)(field[1])) * 256 + + ((unsigned int)(unsigned char)(field[2])); } - (void)testInternalError { grpc_call *c; grpc_slice request_payload_slice = - grpc_slice_from_copied_string("hello world"); + grpc_slice_from_copied_string("hello world"); grpc_byte_buffer *request_payload = - grpc_raw_byte_buffer_create(&request_payload_slice, 1); + grpc_raw_byte_buffer_create(&request_payload_slice, 1); gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5); - grpc_metadata meta_c[2] = { - {"key1", "val1", 4, 0, {{NULL, NULL, NULL, NULL}}}, - {"key2", "val2", 4, 0, {{NULL, NULL, NULL, NULL}}}}; + grpc_metadata meta_c[2] = {{grpc_slice_from_static_string("key1"), + grpc_slice_from_static_string("val1"), + 0, + {{NULL, NULL, NULL, NULL}}}, + {grpc_slice_from_static_string("key2"), + grpc_slice_from_static_string("val2"), + 0, + {{NULL, NULL, NULL, NULL}}}}; int port = grpc_pick_unused_port_or_die(); char *addr; gpr_join_host_port(&addr, "127.0.0.1", port); grpc_completion_queue *cq = grpc_completion_queue_create(NULL); stream_engine *cronetEngine = [Cronet getGlobalEngine]; - grpc_channel *client = grpc_cronet_secure_channel_create(cronetEngine, addr, - NULL, NULL); + grpc_channel *client = + grpc_cronet_secure_channel_create(cronetEngine, addr, NULL, NULL); cq_verifier *cqv = cq_verifier_create(cq); grpc_op ops[6]; @@ -173,12 +178,11 @@ unsigned int parse_h2_length(const char *field) { grpc_call_details call_details; grpc_status_code status; grpc_call_error error; - char *details = NULL; - size_t details_capacity = 0; + grpc_slice details; - c = grpc_channel_create_call( - client, NULL, GRPC_PROPAGATE_DEFAULTS, cq, "/foo", - NULL, deadline, NULL); + c = grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + grpc_slice_from_static_string("/foo"), NULL, + deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -217,40 +221,40 @@ unsigned int parse_h2_length(const char *field) { 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->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), (void*)1, NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), (void *)1, NULL); GPR_ASSERT(GRPC_CALL_OK == error); - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - int sl = socket(AF_INET, SOCK_STREAM, 0); - GPR_ASSERT(sl >= 0); - - // Make and TCP endpoint to accept the connection - struct sockaddr_in s_addr; - memset(&s_addr, 0, sizeof(s_addr)); - s_addr.sin_family = AF_INET; - s_addr.sin_addr.s_addr = htonl(INADDR_ANY); - s_addr.sin_port = htons(port); - GPR_ASSERT(0 == bind(sl, (struct sockaddr*)&s_addr, sizeof(s_addr))); - GPR_ASSERT(0 == listen(sl, 5)); - int s = accept(sl, NULL, NULL); - GPR_ASSERT(s >= 0); - - // Close the connection after 1 second to trigger Cronet's on_failed() - sleep(1); - close(s); - close(sl); - }); - - CQ_EXPECT_COMPLETION(cqv, (void*)1, 1); + dispatch_async( + dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + int sl = socket(AF_INET, SOCK_STREAM, 0); + GPR_ASSERT(sl >= 0); + + // Make and TCP endpoint to accept the connection + struct sockaddr_in s_addr; + memset(&s_addr, 0, sizeof(s_addr)); + s_addr.sin_family = AF_INET; + s_addr.sin_addr.s_addr = htonl(INADDR_ANY); + s_addr.sin_port = htons(port); + GPR_ASSERT(0 == bind(sl, (struct sockaddr *)&s_addr, sizeof(s_addr))); + GPR_ASSERT(0 == listen(sl, 5)); + int s = accept(sl, NULL, NULL); + GPR_ASSERT(s >= 0); + + // Close the connection after 1 second to trigger Cronet's on_failed() + sleep(1); + close(s); + close(sl); + }); + + CQ_EXPECT_COMPLETION(cqv, (void *)1, 1); cq_verify(cqv); GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); - gpr_free(details); + grpc_slice_unref(details); grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv); grpc_metadata_array_destroy(&request_metadata_recv); @@ -262,7 +266,7 @@ unsigned int parse_h2_length(const char *field) { grpc_byte_buffer_destroy(request_payload); grpc_byte_buffer_destroy(response_payload_recv); - + grpc_channel_destroy(client); grpc_completion_queue_shutdown(cq); drain_cq(cq); @@ -273,17 +277,22 @@ unsigned int parse_h2_length(const char *field) { grpc_arg arg; arg.key = GRPC_ARG_USE_CRONET_PACKET_COALESCING; arg.type = GRPC_ARG_INTEGER; - arg.value.integer = use_coalescing ? 1:0; + arg.value.integer = use_coalescing ? 1 : 0; grpc_channel_args *args = grpc_channel_args_copy_and_add(NULL, &arg, 1); grpc_call *c; grpc_slice request_payload_slice = - grpc_slice_from_copied_string("hello world"); + grpc_slice_from_copied_string("hello world"); grpc_byte_buffer *request_payload = - grpc_raw_byte_buffer_create(&request_payload_slice, 1); - gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5); - grpc_metadata meta_c[2] = { - {"key1", "val1", 4, 0, {{NULL, NULL, NULL, NULL}}}, - {"key2", "val2", 4, 0, {{NULL, NULL, NULL, NULL}}}}; + grpc_raw_byte_buffer_create(&request_payload_slice, 1); + gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5); + grpc_metadata meta_c[2] = {{grpc_slice_from_static_string("key1"), + grpc_slice_from_static_string("val1"), + 0, + {{NULL, NULL, NULL, NULL}}}, + {grpc_slice_from_static_string("key2"), + grpc_slice_from_static_string("val2"), + 0, + {{NULL, NULL, NULL, NULL}}}}; int port = grpc_pick_unused_port_or_die(); char *addr; @@ -303,12 +312,11 @@ unsigned int parse_h2_length(const char *field) { grpc_call_details call_details; grpc_status_code status; grpc_call_error error; - char *details = NULL; - size_t details_capacity = 0; + grpc_slice details; - c = grpc_channel_create_call( - client, NULL, GRPC_PROPAGATE_DEFAULTS, cq, "/foo", - NULL, deadline, NULL); + c = grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + grpc_slice_from_static_string("/foo"), NULL, + deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -325,7 +333,7 @@ unsigned int parse_h2_length(const char *field) { op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; - op->data.send_message = request_payload; + op->data.send_message.send_message = request_payload; op->flags = 0; op->reserved = NULL; op++; @@ -334,12 +342,12 @@ unsigned int parse_h2_length(const char *field) { op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; - op->data.recv_initial_metadata = &initial_metadata_recv; + 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 = &response_payload_recv; + op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; op->reserved = NULL; op++; @@ -347,79 +355,80 @@ unsigned int parse_h2_length(const char *field) { 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->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), (void*)1, NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), (void *)1, NULL); GPR_ASSERT(GRPC_CALL_OK == error); - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - int sl = socket(AF_INET, SOCK_STREAM, 0); - GPR_ASSERT(sl >= 0); - struct sockaddr_in s_addr; - memset(&s_addr, 0, sizeof(s_addr)); - s_addr.sin_family = AF_INET; - s_addr.sin_addr.s_addr = htonl(INADDR_ANY); - s_addr.sin_port = htons(port); - GPR_ASSERT(0 == bind(sl, (struct sockaddr*)&s_addr, sizeof(s_addr))); - GPR_ASSERT(0 == listen(sl, 5)); - int s = accept(sl, NULL, NULL); - GPR_ASSERT(s >= 0); - struct timeval tv; - tv.tv_sec = 2; - tv.tv_usec = 0; - setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); - - // Make an TLS endpoint to receive Cronet's transmission - SSL_CTX *ctx = SSL_CTX_new(TLSv1_2_server_method()); - init_ctx(ctx); - SSL *ssl = SSL_new(ctx); - SSL_set_fd(ssl, s); - SSL_accept(ssl); - - const char magic[] = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"; - - char buf[4096]; - long len; - bool coalesced = false; - while ((len = SSL_read(ssl, buf, sizeof(buf))) > 0) { - gpr_log(GPR_DEBUG, "Read len: %ld", len); - - // Analyze the HTTP/2 frames in the same TLS PDU to identify if - // coalescing is successful - unsigned int p = 0; - while (p < len) { - if (len - p >= 24 && 0 == memcmp(&buf[p], magic, 24)) { - p += 24; - continue; + dispatch_async( + dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + int sl = socket(AF_INET, SOCK_STREAM, 0); + GPR_ASSERT(sl >= 0); + struct sockaddr_in s_addr; + memset(&s_addr, 0, sizeof(s_addr)); + s_addr.sin_family = AF_INET; + s_addr.sin_addr.s_addr = htonl(INADDR_ANY); + s_addr.sin_port = htons(port); + GPR_ASSERT(0 == bind(sl, (struct sockaddr *)&s_addr, sizeof(s_addr))); + GPR_ASSERT(0 == listen(sl, 5)); + int s = accept(sl, NULL, NULL); + GPR_ASSERT(s >= 0); + struct timeval tv; + tv.tv_sec = 2; + tv.tv_usec = 0; + setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + + // Make an TLS endpoint to receive Cronet's transmission + SSL_CTX *ctx = SSL_CTX_new(TLSv1_2_server_method()); + init_ctx(ctx); + SSL *ssl = SSL_new(ctx); + SSL_set_fd(ssl, s); + SSL_accept(ssl); + + const char magic[] = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"; + + char buf[4096]; + long len; + bool coalesced = false; + while ((len = SSL_read(ssl, buf, sizeof(buf))) > 0) { + gpr_log(GPR_DEBUG, "Read len: %ld", len); + + // Analyze the HTTP/2 frames in the same TLS PDU to identify if + // coalescing is successful + unsigned int p = 0; + while (p < len) { + if (len - p >= 24 && 0 == memcmp(&buf[p], magic, 24)) { + p += 24; + continue; + } + + if (buf[p + 3] == 0 && // Type is DATA + parse_h2_length(&buf[p]) == 0x10 && // Length is correct + (buf[p + 4] & 1) != 0 && // EOS bit is set + 0 == memcmp("hello world", &buf[p + 14], + 11)) { // Message is correct + coalesced = true; + break; + } + p += (parse_h2_length(&buf[p]) + 9); + } + if (coalesced) { + break; + } } - if (buf[p+3] == 0 && // Type is DATA - parse_h2_length(&buf[p]) == 0x10 && // Length is correct - (buf[p+4] & 1) != 0 && // EOS bit is set - 0 == memcmp("hello world", &buf[p+14], 11)) { // Message is correct - coalesced = true; - break; - } - p += (parse_h2_length(&buf[p]) + 9); - } - if (coalesced) { - break; - } - } - - XCTAssert(coalesced == use_coalescing); - SSL_free(ssl); - SSL_CTX_free(ctx); - close(s); - close(sl); - }); - - CQ_EXPECT_COMPLETION(cqv, (void*)1, 1); + XCTAssert(coalesced == use_coalescing); + SSL_free(ssl); + SSL_CTX_free(ctx); + close(s); + close(sl); + }); + + CQ_EXPECT_COMPLETION(cqv, (void *)1, 1); cq_verify(cqv); - gpr_free(details); + grpc_slice_unref(details); grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv); grpc_metadata_array_destroy(&request_metadata_recv); @@ -431,7 +440,7 @@ unsigned int parse_h2_length(const char *field) { grpc_byte_buffer_destroy(request_payload); grpc_byte_buffer_destroy(response_payload_recv); - + grpc_channel_destroy(client); grpc_completion_queue_shutdown(cq); drain_cq(cq); From 4c94e52f003b9beb999b2a9b73386f4746f55ffc Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 1 Feb 2017 15:46:39 -0800 Subject: [PATCH 042/126] bug fix for creating Cronet transport context --- .../cronet/transport/cronet_transport.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 1be6550bd3a..fac0a7a234f 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -1287,13 +1287,15 @@ grpc_transport *grpc_create_cronet_transport(void *engine, const char *target, strcpy(ct->host, target); ct->use_packet_coalescing = true; - for (size_t i = 0; i < args->num_args; i++) { - if (0 == strcmp(args->args[i].key, GRPC_ARG_USE_CRONET_PACKET_COALESCING)) { - if (args->args[i].type != GRPC_ARG_INTEGER) { - gpr_log(GPR_ERROR, "%s ignored: it must be an integer", - GRPC_ARG_USE_CRONET_PACKET_COALESCING); - } else { - ct->use_packet_coalescing = (args->args[i].value.integer != 0); + if (args) { + for (size_t i = 0; i < args->num_args; i++) { + if (0 == strcmp(args->args[i].key, GRPC_ARG_USE_CRONET_PACKET_COALESCING)) { + if (args->args[i].type != GRPC_ARG_INTEGER) { + gpr_log(GPR_ERROR, "%s ignored: it must be an integer", + GRPC_ARG_USE_CRONET_PACKET_COALESCING); + } else { + ct->use_packet_coalescing = (args->args[i].value.integer != 0); + } } } } From 2ee9751cbbe57d2b4bfece8926d8b3112388c4eb Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 1 Feb 2017 16:00:50 -0800 Subject: [PATCH 043/126] clang-format --- .../cronet/transport/cronet_transport.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index fac0a7a234f..01a03533daf 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -425,8 +425,8 @@ static void on_stream_ready(bidirectional_stream *stream) { gpr_free(s->header_array.headers); s->header_array.headers = NULL; } -/* Send the initial metadata on wire if there is no SEND_MESSAGE or - * SEND_TRAILING_METADATA ops pending */ + /* Send the initial metadata on wire if there is no SEND_MESSAGE or + * SEND_TRAILING_METADATA ops pending */ if (t->use_packet_coalescing) { if (s->state.flush_cronet_when_ready) { CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_flush (%p)", s->cbs); @@ -868,8 +868,8 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, * on_failed */ GPR_ASSERT(s->cbs == NULL); GPR_ASSERT(!stream_state->state_op_done[OP_SEND_INITIAL_METADATA]); - s->cbs = bidirectional_stream_create(t->engine, s->curr_gs, - &cronet_callbacks); + s->cbs = + bidirectional_stream_create(t->engine, s->curr_gs, &cronet_callbacks); CRONET_LOG(GPR_DEBUG, "%p = bidirectional_stream_create()", s->cbs); if (t->use_packet_coalescing) { bidirectional_stream_disable_auto_flush(s->cbs, true); @@ -957,8 +957,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, result = NO_ACTION_POSSIBLE; CRONET_LOG(GPR_DEBUG, "Stream is either cancelled or failed."); } else { - CRONET_LOG(GPR_DEBUG, "bidirectional_stream_write (%p, 0)", - s->cbs); + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_write (%p, 0)", s->cbs); stream_state->state_callback_received[OP_SEND_MESSAGE] = false; bidirectional_stream_write(s->cbs, "", 0, true); if (t->use_packet_coalescing) { @@ -969,8 +968,8 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, } stream_state->state_op_done[OP_SEND_TRAILING_METADATA] = true; } else if (stream_op->recv_initial_metadata && - op_can_be_run(stream_op, s, &oas->state, - OP_RECV_INITIAL_METADATA)) { + op_can_be_run(stream_op, s, &oas->state, + 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(exec_ctx, stream_op->recv_initial_metadata_ready, @@ -980,10 +979,10 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, GRPC_ERROR_NONE); } else { grpc_chttp2_incoming_metadata_buffer_publish( - exec_ctx, &oas->s->state.rs.initial_metadata, - stream_op->recv_initial_metadata); + exec_ctx, &oas->s->state.rs.initial_metadata, + stream_op->recv_initial_metadata); grpc_closure_sched(exec_ctx, stream_op->recv_initial_metadata_ready, - GRPC_ERROR_NONE); + GRPC_ERROR_NONE); } stream_state->state_op_done[OP_RECV_INITIAL_METADATA] = true; result = ACTION_TAKEN_NO_CALLBACK; @@ -1052,7 +1051,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_state->state_op_done[OP_READ_REQ_MADE] = true; /* Indicates that at least one read request has been made */ bidirectional_stream_read(s->cbs, stream_state->rs.read_buffer, - stream_state->rs.remaining_bytes); + stream_state->rs.remaining_bytes); result = ACTION_TAKEN_NO_CALLBACK; } } else if (stream_state->rs.remaining_bytes == 0) { @@ -1289,7 +1288,8 @@ grpc_transport *grpc_create_cronet_transport(void *engine, const char *target, ct->use_packet_coalescing = true; if (args) { for (size_t i = 0; i < args->num_args; i++) { - if (0 == strcmp(args->args[i].key, GRPC_ARG_USE_CRONET_PACKET_COALESCING)) { + if (0 == + strcmp(args->args[i].key, GRPC_ARG_USE_CRONET_PACKET_COALESCING)) { if (args->args[i].type != GRPC_ARG_INTEGER) { gpr_log(GPR_ERROR, "%s ignored: it must be an integer", GRPC_ARG_USE_CRONET_PACKET_COALESCING); From d5923578c0c43a5716dd78c6467ccdd5199feff2 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 6 Feb 2017 11:25:59 -0800 Subject: [PATCH 044/126] nit fixes --- gRPC-Core.podspec | 1 + .../tests/CronetUnitTests/CronetUnitTests.m | 10 +++++----- templates/gRPC-Core.podspec.template | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 840d8132c66..0ef61442a4b 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -883,6 +883,7 @@ Pod::Spec.new do |s| 'test/core/end2end/end2end_test_utils.c', 'test/core/end2end/tests/*.{c,h}', 'test/core/end2end/data/*.{c,h}', + 'test/core/util/debugger_macros.c', 'test/core/util/test_config.{c,h}', 'test/core/util/port.h', 'test/core/util/port_posix.c', diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m index 9589926d8b5..408952a091b 100644 --- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m +++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m @@ -273,7 +273,7 @@ unsigned int parse_h2_length(const char *field) { grpc_completion_queue_destroy(cq); } -- (void)PacketCoalescing:(bool)use_coalescing { +- (void)packetCoalescing:(BOOL)use_coalescing { grpc_arg arg; arg.key = GRPC_ARG_USE_CRONET_PACKET_COALESCING; arg.type = GRPC_ARG_INTEGER; @@ -390,7 +390,7 @@ unsigned int parse_h2_length(const char *field) { char buf[4096]; long len; - bool coalesced = false; + BOOL coalesced = NO; while ((len = SSL_read(ssl, buf, sizeof(buf))) > 0) { gpr_log(GPR_DEBUG, "Read len: %ld", len); @@ -408,7 +408,7 @@ unsigned int parse_h2_length(const char *field) { (buf[p + 4] & 1) != 0 && // EOS bit is set 0 == memcmp("hello world", &buf[p + 14], 11)) { // Message is correct - coalesced = true; + coalesced = YES; break; } p += (parse_h2_length(&buf[p]) + 9); @@ -448,8 +448,8 @@ unsigned int parse_h2_length(const char *field) { } - (void)testPacketCoalescing { - [self PacketCoalescing:true]; - [self PacketCoalescing:false]; + [self packetCoalescing:YES]; + [self packetCoalescing:NO]; } @end diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 0738b7221b5..0c1ff64a002 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -179,6 +179,7 @@ 'test/core/end2end/end2end_test_utils.c', 'test/core/end2end/tests/*.{c,h}', 'test/core/end2end/data/*.{c,h}', + 'test/core/util/debugger_macros.c', 'test/core/util/test_config.{c,h}', 'test/core/util/port.h', 'test/core/util/port_posix.c', From e1cf1b691d3e82742214c8772a71e79e3209c2ce Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 6 Feb 2017 13:31:05 -0800 Subject: [PATCH 045/126] nit fix 2 --- src/objective-c/tests/CronetUnitTests/CronetUnitTests.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m index 408952a091b..b6237c950bf 100644 --- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m +++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m @@ -273,11 +273,11 @@ unsigned int parse_h2_length(const char *field) { grpc_completion_queue_destroy(cq); } -- (void)packetCoalescing:(BOOL)use_coalescing { +- (void)packetCoalescing:(BOOL)useCoalescing { grpc_arg arg; arg.key = GRPC_ARG_USE_CRONET_PACKET_COALESCING; arg.type = GRPC_ARG_INTEGER; - arg.value.integer = use_coalescing ? 1 : 0; + arg.value.integer = useCoalescing ? 1 : 0; grpc_channel_args *args = grpc_channel_args_copy_and_add(NULL, &arg, 1); grpc_call *c; grpc_slice request_payload_slice = @@ -418,7 +418,7 @@ unsigned int parse_h2_length(const char *field) { } } - XCTAssert(coalesced == use_coalescing); + XCTAssert(coalesced == useCoalescing); SSL_free(ssl); SSL_CTX_free(ctx); close(s); From 076bac017b200accb8071e569b471f118fc3ba32 Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 7 Feb 2017 13:50:36 -0800 Subject: [PATCH 046/126] Remove async --- .../grpc++/impl/codegen/server_interface.h | 7 +- include/grpc++/server.h | 4 - .../health/default_health_check_service.cc | 17 +-- .../health/default_health_check_service.h | 11 +- src/cpp/server/server_cc.cc | 140 ++---------------- .../end2end/health_service_end2end_test.cc | 11 +- 6 files changed, 28 insertions(+), 162 deletions(-) diff --git a/include/grpc++/impl/codegen/server_interface.h b/include/grpc++/impl/codegen/server_interface.h index 785568f19a1..bd1b36e8839 100644 --- a/include/grpc++/impl/codegen/server_interface.h +++ b/include/grpc++/impl/codegen/server_interface.h @@ -158,8 +158,7 @@ class ServerInterface : public CallHook { public: RegisteredAsyncRequest(ServerInterface* server, ServerContext* context, ServerAsyncStreamingInterface* stream, - CompletionQueue* call_cq, void* tag, - bool delete_on_finalize); + CompletionQueue* call_cq, void* tag); // uses BaseAsyncRequest::FinalizeResult @@ -175,7 +174,7 @@ class ServerInterface : public CallHook { ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, ServerCompletionQueue* notification_cq, void* tag) - : RegisteredAsyncRequest(server, context, stream, call_cq, tag, true) { + : RegisteredAsyncRequest(server, context, stream, call_cq, tag) { IssueRequest(registered_method, nullptr, notification_cq); } @@ -191,7 +190,7 @@ class ServerInterface : public CallHook { CompletionQueue* call_cq, ServerCompletionQueue* notification_cq, void* tag, Message* request) - : RegisteredAsyncRequest(server, context, stream, call_cq, tag, true), + : RegisteredAsyncRequest(server, context, stream, call_cq, tag), request_(request) { IssueRequest(registered_method, &payload_, notification_cq); } diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 3f205625ee7..e3e9174c9c2 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -119,10 +119,6 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen { class UnimplementedAsyncRequest; class UnimplementedAsyncResponse; - class HealthCheckAsyncRequestContext; - class HealthCheckAsyncRequest; - class HealthCheckAsyncResponse; - /// Server constructors. To be used by \a ServerBuilder only. /// /// \param max_message_size Maximum message length that the channel can diff --git a/src/cpp/server/health/default_health_check_service.cc b/src/cpp/server/health/default_health_check_service.cc index 9743bd5775e..46def70e8a3 100644 --- a/src/cpp/server/health/default_health_check_service.cc +++ b/src/cpp/server/health/default_health_check_service.cc @@ -49,14 +49,11 @@ const char kHealthCheckMethodName[] = "/grpc.health.v1.Health/Check"; } // namespace DefaultHealthCheckService::HealthCheckServiceImpl::HealthCheckServiceImpl( - DefaultHealthCheckService* service, bool sync) - : service_(service), method_(nullptr), sync_(sync) { - MethodHandler* handler = nullptr; - if (sync_) { - handler = - new RpcMethodHandler( - std::mem_fn(&HealthCheckServiceImpl::Check), this); - } + DefaultHealthCheckService* service) + : service_(service), method_(nullptr) { + MethodHandler* handler = + new RpcMethodHandler( + std::mem_fn(&HealthCheckServiceImpl::Check), this); method_ = new RpcServiceMethod(kHealthCheckMethodName, RpcMethod::NORMAL_RPC, handler); AddMethod(method_); @@ -160,9 +157,9 @@ DefaultHealthCheckService::GetServingStatus( } DefaultHealthCheckService::HealthCheckServiceImpl* -DefaultHealthCheckService::GetHealthCheckService(bool sync) { +DefaultHealthCheckService::GetHealthCheckService() { GPR_ASSERT(impl_ == nullptr); - impl_.reset(new HealthCheckServiceImpl(this, sync)); + impl_.reset(new HealthCheckServiceImpl(this)); return impl_.get(); } diff --git a/src/cpp/server/health/default_health_check_service.h b/src/cpp/server/health/default_health_check_service.h index 1ecb0a2ba94..5c0e2303423 100644 --- a/src/cpp/server/health/default_health_check_service.h +++ b/src/cpp/server/health/default_health_check_service.h @@ -49,21 +49,14 @@ class DefaultHealthCheckService final : public HealthCheckServiceInterface { // The service impl to register with the server. class HealthCheckServiceImpl : public Service { public: - HealthCheckServiceImpl(DefaultHealthCheckService* service, bool sync); + explicit HealthCheckServiceImpl(DefaultHealthCheckService* service); Status Check(ServerContext* context, const ByteBuffer* request, ByteBuffer* response); - bool sync() { return sync_; } - - // This is only useful for the async mode. It should be called after - // RegisterService returns. - void* server_tag() const { return method_->server_tag(); } - private: const DefaultHealthCheckService* const service_; RpcServiceMethod* method_; - const bool sync_; }; DefaultHealthCheckService(); @@ -72,7 +65,7 @@ class DefaultHealthCheckService final : public HealthCheckServiceInterface { void SetServingStatus(bool serving) override; enum ServingStatus { NOT_FOUND, SERVING, NOT_SERVING }; ServingStatus GetServingStatus(const grpc::string& service_name) const; - HealthCheckServiceImpl* GetHealthCheckService(bool sync); + HealthCheckServiceImpl* GetHealthCheckService(); private: mutable std::mutex mu_; diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 69e491dc96b..c377297ec00 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -119,79 +119,6 @@ class Server::UnimplementedAsyncResponse final UnimplementedAsyncRequest* const request_; }; -// This is a dummy implementation of the interface so that -// HealthCheckAsyncRequest can get Call from RegisteredAsyncRequest. It does not -// do any reading or writing. -class HealthCheckAsyncResponseWriter final - : public ServerAsyncStreamingInterface { - public: - HealthCheckAsyncResponseWriter() : call_(nullptr, nullptr, nullptr) {} - void SendInitialMetadata(void* tag) override { - abort(); // should not be called. - } - void BindCall(Call* call) override { call_ = *call; } - Call* call() { return &call_; } - - private: - Call call_; -}; - -class Server::HealthCheckAsyncRequestContext { - protected: - ServerContext server_context_; - HealthCheckAsyncResponseWriter rpc_; -}; - -class Server::HealthCheckAsyncRequest final - : public HealthCheckAsyncRequestContext, - public RegisteredAsyncRequest { - public: - HealthCheckAsyncRequest( - DefaultHealthCheckService::HealthCheckServiceImpl* service, - Server* server, ServerCompletionQueue* cq) - : RegisteredAsyncRequest(server, &server_context_, &rpc_, cq, this, - false), - service_(service), - server_(server), - cq_(cq) { - IssueRequest(service->server_tag(), &payload_, cq); - } - - bool FinalizeResult(void** tag, bool* status) override; - Call* call() { return rpc_.call(); } - ByteBuffer* response() { return &response_; } - Status* status() { return &status_; } - ServerContext* server_context() { return &server_context_; } - - private: - DefaultHealthCheckService::HealthCheckServiceImpl* service_; - Server* const server_; - ServerCompletionQueue* const cq_; - grpc_byte_buffer* payload_; - ByteBuffer request_; - ByteBuffer response_; - Status status_; -}; - -typedef SneakyCallOpSet - HealthCheckAsyncResponseOp; -class Server::HealthCheckAsyncResponse final - : public HealthCheckAsyncResponseOp { - public: - HealthCheckAsyncResponse(HealthCheckAsyncRequest* request); - ~HealthCheckAsyncResponse() { delete request_; } - - bool FinalizeResult(void** tag, bool* status) override { - HealthCheckAsyncResponseOp::FinalizeResult(tag, status); - delete this; - return false; - } - - private: - HealthCheckAsyncRequest* const request_; -}; - class ShutdownTag : public CompletionQueueTag { public: bool FinalizeResult(void** tag, bool* status) { return false; } @@ -572,14 +499,16 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { // Only create default health check service when user did not provide an // explicit one. - DefaultHealthCheckService::HealthCheckServiceImpl* health_service = nullptr; if (health_check_service_ == nullptr && !health_check_service_disabled_ && DefaultHealthCheckServiceEnabled()) { - auto* default_hc_service = new DefaultHealthCheckService; - health_check_service_.reset(default_hc_service); - health_service = - default_hc_service->GetHealthCheckService(!sync_server_cqs_->empty()); - RegisterService(nullptr, health_service); + if (sync_server_cqs_->empty()) { + gpr_log(GPR_ERROR, + "Default health check service disabled at async-only server."); + } else { + auto* default_hc_service = new DefaultHealthCheckService; + health_check_service_.reset(default_hc_service); + RegisterService(nullptr, default_hc_service->GetHealthCheckService()); + } } grpc_server_start(server_); @@ -596,14 +525,6 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { } } - if (health_service && !health_service->sync()) { - for (size_t i = 0; i < num_cqs; i++) { - if (cqs[i]->IsFrequentlyPolled()) { - new HealthCheckAsyncRequest(health_service, this, cqs[i]); - } - } - } - for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { (*it)->Start(); } @@ -715,10 +636,8 @@ bool ServerInterface::BaseAsyncRequest::FinalizeResult(void** tag, ServerInterface::RegisteredAsyncRequest::RegisteredAsyncRequest( ServerInterface* server, ServerContext* context, - ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag, - bool delete_on_finalize) - : BaseAsyncRequest(server, context, stream, call_cq, tag, - delete_on_finalize) {} + ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag) + : BaseAsyncRequest(server, context, stream, call_cq, tag, true) {} void ServerInterface::RegisteredAsyncRequest::IssueRequest( void* registered_method, grpc_byte_buffer** payload, @@ -776,45 +695,6 @@ Server::UnimplementedAsyncResponse::UnimplementedAsyncResponse( request_->stream()->call_.PerformOps(this); } -bool Server::HealthCheckAsyncRequest::FinalizeResult(void** tag, bool* status) { - bool serialization_status = - *status && payload_ && - SerializationTraits::Deserialize(payload_, &request_).ok(); - RegisteredAsyncRequest::FinalizeResult(tag, status); - *status = serialization_status && *status; - if (*status) { - new HealthCheckAsyncRequest(service_, server_, cq_); - status_ = service_->Check(&server_context_, &request_, &response_); - new HealthCheckAsyncResponse(this); - return false; - } else { - delete this; - return false; - } -} - -Server::HealthCheckAsyncResponse::HealthCheckAsyncResponse( - HealthCheckAsyncRequest* request) - : request_(request) { - ServerContext* context = request_->server_context(); - if (!context->sent_initial_metadata_) { - SendInitialMetadata(context->initial_metadata_, - context->initial_metadata_flags()); - if (context->compression_level_set()) { - set_compression_level(context->compression_level()); - } - context->sent_initial_metadata_ = true; - } - Status* status = request_->status(); - if (status->ok()) { - ServerSendStatus(context->trailing_metadata_, - SendMessage(*request_->response())); - } else { - ServerSendStatus(context->trailing_metadata_, *status); - } - request_->call()->PerformOps(this); -} - ServerInitializer* Server::initializer() { return server_initializer_.get(); } } // namespace grpc diff --git a/test/cpp/end2end/health_service_end2end_test.cc b/test/cpp/end2end/health_service_end2end_test.cc index 8a6a9886c9a..3d510078570 100644 --- a/test/cpp/end2end/health_service_end2end_test.cc +++ b/test/cpp/end2end/health_service_end2end_test.cc @@ -273,12 +273,13 @@ TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceAsyncOnly) { SetUpServer(false, true, false, nullptr); cq_thread_ = std::thread(LoopCompletionQueue, cq_.get()); - VerifyHealthCheckService(); + HealthCheckServiceInterface* default_service = + server_->GetHealthCheckService(); + EXPECT_TRUE(default_service == nullptr); - // The default service has a size limit of the service name. - const grpc::string kTooLongServiceName(201, 'x'); - SendHealthCheckRpc(kTooLongServiceName, - Status(StatusCode::INVALID_ARGUMENT, "")); + ResetStubs(); + + SendHealthCheckRpc("", Status(StatusCode::UNIMPLEMENTED, "")); } // Provide an empty service to disable the default service. From 3a5bba0a2034a2dffbfeb7a30281f8ac43d5ce59 Mon Sep 17 00:00:00 2001 From: Paul Marks Date: Tue, 7 Feb 2017 16:28:09 -0800 Subject: [PATCH 047/126] Connect to "localhost" from interop clients. This is for compatibility with IPv6-only environments; see the Google bug b/32531998. Note that InteropClient.cs and http2_client.cc don't appear to be tested by our internal branch, but I've included them for consistency. --- src/csharp/Grpc.IntegrationTesting/InteropClient.cs | 2 +- src/python/grpcio_tests/tests/interop/client.py | 2 +- test/cpp/interop/client.cc | 2 +- test/cpp/interop/http2_client.cc | 2 +- test/cpp/interop/reconnect_interop_client.cc | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 5ba83b143ed..68a8f4879b4 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -56,7 +56,7 @@ namespace Grpc.IntegrationTesting { private class ClientOptions { - [Option("server_host", Default = "127.0.0.1")] + [Option("server_host", Default = "localhost")] public string ServerHost { get; set; } [Option("server_host_override", Default = TestCredentials.DefaultHostOverride)] diff --git a/src/python/grpcio_tests/tests/interop/client.py b/src/python/grpcio_tests/tests/interop/client.py index 833818e6625..97f6843d3cb 100644 --- a/src/python/grpcio_tests/tests/interop/client.py +++ b/src/python/grpcio_tests/tests/interop/client.py @@ -45,7 +45,7 @@ def _args(): '--server_host', help='the host to which to connect', type=str, - default="127.0.0.1") + default="localhost") parser.add_argument( '--server_port', help='the port to which to connect', type=int) parser.add_argument( diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 8a00b61cef1..5688ab79716 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -51,7 +51,7 @@ DEFINE_bool(use_tls, false, "Whether to use tls."); DEFINE_string(custom_credentials_type, "", "User provided credentials type."); DEFINE_bool(use_test_ca, false, "False to use SSL roots for google"); DEFINE_int32(server_port, 0, "Server port."); -DEFINE_string(server_host, "127.0.0.1", "Server host to connect to"); +DEFINE_string(server_host, "localhost", "Server host to connect to"); DEFINE_string(server_host_override, "foo.test.google.fr", "Override the server host which is sent in HTTP header"); DEFINE_string( diff --git a/test/cpp/interop/http2_client.cc b/test/cpp/interop/http2_client.cc index 38aee43b26a..b96e9fac36e 100644 --- a/test/cpp/interop/http2_client.cc +++ b/test/cpp/interop/http2_client.cc @@ -223,7 +223,7 @@ bool Http2Client::DoMaxStreams() { } // namespace grpc DEFINE_int32(server_port, 0, "Server port."); -DEFINE_string(server_host, "127.0.0.1", "Server host to connect to"); +DEFINE_string(server_host, "localhost", "Server host to connect to"); DEFINE_string(test_case, "rst_after_header", "Configure different test cases. Valid options are:\n\n" "goaway\n" diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc index 797e52c744f..1c2f6066377 100644 --- a/test/cpp/interop/reconnect_interop_client.cc +++ b/test/cpp/interop/reconnect_interop_client.cc @@ -48,7 +48,7 @@ DEFINE_int32(server_control_port, 0, "Server port for control rpcs."); DEFINE_int32(server_retry_port, 0, "Server port for testing reconnection."); -DEFINE_string(server_host, "127.0.0.1", "Server host to connect to"); +DEFINE_string(server_host, "localhost", "Server host to connect to"); DEFINE_int32(max_reconnect_backoff_ms, 0, "Maximum backoff time, or 0 for default."); From 5f4264f9a6b891fd032784ef9811c53d4a70bcdd Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 8 Feb 2017 14:53:04 -0800 Subject: [PATCH 048/126] Signal that authority can be compressed in hpack: saves 1 allocation/rpc --- src/core/lib/surface/channel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/lib/surface/channel.c b/src/core/lib/surface/channel.c index 429dbad7c77..d6acd392c1a 100644 --- a/src/core/lib/surface/channel.c +++ b/src/core/lib/surface/channel.c @@ -128,7 +128,8 @@ grpc_channel *grpc_channel_create(grpc_exec_ctx *exec_ctx, const char *target, } channel->default_authority = grpc_mdelem_from_slices( exec_ctx, GRPC_MDSTR_AUTHORITY, - grpc_slice_from_copied_string(args->args[i].value.string)); + grpc_slice_intern( + grpc_slice_from_static_string(args->args[i].value.string))); } } else if (0 == strcmp(args->args[i].key, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG)) { @@ -144,7 +145,8 @@ grpc_channel *grpc_channel_create(grpc_exec_ctx *exec_ctx, const char *target, } else { channel->default_authority = grpc_mdelem_from_slices( exec_ctx, GRPC_MDSTR_AUTHORITY, - grpc_slice_from_copied_string(args->args[i].value.string)); + grpc_slice_intern( + grpc_slice_from_static_string(args->args[i].value.string))); } } } else if (0 == strcmp(args->args[i].key, From 5fcc5af0946fa0eb2b03146bb48afa91ceabe73c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 8 Feb 2017 15:22:05 -0800 Subject: [PATCH 049/126] Should only do host-->:authority if there is no :authority --- src/core/lib/channel/http_server_filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/lib/channel/http_server_filter.c b/src/core/lib/channel/http_server_filter.c index 3f992977c08..b475dd6b86d 100644 --- a/src/core/lib/channel/http_server_filter.c +++ b/src/core/lib/channel/http_server_filter.c @@ -198,10 +198,10 @@ static grpc_error *server_filter_incoming_metadata(grpc_exec_ctx *exec_ctx, GRPC_ERROR_STR_KEY, ":path")); } - if (b->idx.named.host != NULL) { + if (b->idx.named.host != NULL && b->idx.named.authority == NULL) { add_error( error_name, &error, - grpc_metadata_batch_substitute( + grpc_metadata_batch_add_head( exec_ctx, b, b->idx.named.host, grpc_mdelem_from_slices( exec_ctx, GRPC_MDSTR_AUTHORITY, From befafe64f9a010920c492956ee8df1257a6d4e77 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Feb 2017 11:30:54 -0800 Subject: [PATCH 050/126] Initial pass to remove mu_lock from client_channel: trickier cases remain --- src/core/ext/client_channel/client_channel.c | 291 ++++++++++--------- 1 file changed, 150 insertions(+), 141 deletions(-) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index 06038bb5ba9..2595acd8c42 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -51,6 +51,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/channel/deadline_filter.h" +#include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/polling_entity.h" #include "src/core/lib/profiling/timers.h" @@ -160,8 +161,8 @@ typedef struct client_channel_channel_data { /** client channel factory */ grpc_client_channel_factory *client_channel_factory; - /** mutex protecting all variables below in this data structure */ - gpr_mu mu; + /** combiner protecting all variables below in this data structure */ + grpc_combiner *combiner; /** currently active load balancer */ char *lb_policy_name; grpc_lb_policy *lb_policy; @@ -218,8 +219,8 @@ static void set_channel_connectivity_state_locked(grpc_exec_ctx *exec_ctx, } static void on_lb_policy_state_changed_locked(grpc_exec_ctx *exec_ctx, - lb_policy_connectivity_watcher *w, - grpc_error *error) { + void *arg, grpc_error *error) { + lb_policy_connectivity_watcher *w = arg; grpc_connectivity_state publish_state = w->state; /* check if the notification is for a stale policy */ if (w->lb_policy != w->chand->lb_policy) return; @@ -235,15 +236,6 @@ static void on_lb_policy_state_changed_locked(grpc_exec_ctx *exec_ctx, if (w->state != GRPC_CHANNEL_SHUTDOWN) { watch_lb_policy(exec_ctx, w->chand, w->lb_policy, w->state); } -} - -static void on_lb_policy_state_changed(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { - lb_policy_connectivity_watcher *w = arg; - - gpr_mu_lock(&w->chand->mu); - on_lb_policy_state_changed_locked(exec_ctx, w, error); - gpr_mu_unlock(&w->chand->mu); GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack, "watch_lb_policy"); gpr_free(w); @@ -256,16 +248,16 @@ static void watch_lb_policy(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, w, - grpc_schedule_on_exec_ctx); + grpc_closure_init(&w->on_changed, on_lb_policy_state_changed_locked, w, + grpc_combiner_scheduler(chand->combiner, false)); w->state = current_state; w->lb_policy = lb_policy; grpc_lb_policy_notify_on_state_change(exec_ctx, lb_policy, &w->state, &w->on_changed); } -static void on_resolver_result_changed(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { +static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, + void *arg, grpc_error *error) { channel_data *chand = arg; char *lb_policy_name = NULL; grpc_lb_policy *lb_policy = NULL; @@ -353,7 +345,6 @@ static void on_resolver_result_changed(grpc_exec_ctx *exec_ctx, void *arg, chand->interested_parties); } - gpr_mu_lock(&chand->mu); if (lb_policy_name != NULL) { gpr_free(chand->lb_policy_name); chand->lb_policy_name = lb_policy_name; @@ -391,7 +382,6 @@ static void on_resolver_result_changed(grpc_exec_ctx *exec_ctx, void *arg, GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver"); grpc_resolver_next(exec_ctx, chand->resolver, &chand->resolver_result, &chand->on_resolver_result_changed); - gpr_mu_unlock(&chand->mu); } else { if (chand->resolver != NULL) { grpc_resolver_shutdown(exec_ctx, chand->resolver); @@ -404,7 +394,6 @@ static void on_resolver_result_changed(grpc_exec_ctx *exec_ctx, void *arg, GRPC_ERROR_CREATE_REFERENCING("Got config after disconnection", refs, GPR_ARRAY_SIZE(refs)), "resolver_gone"); - gpr_mu_unlock(&chand->mu); } if (exit_idle) { @@ -426,20 +415,12 @@ static void on_resolver_result_changed(grpc_exec_ctx *exec_ctx, void *arg, GRPC_ERROR_UNREF(state_error); } -static void cc_start_transport_op(grpc_exec_ctx *exec_ctx, - grpc_channel_element *elem, - grpc_transport_op *op) { +static void cc_start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error_ignored) { + grpc_transport_op *op = arg; + grpc_channel_element *elem = op->transport_private.args[0]; channel_data *chand = elem->channel_data; - grpc_closure_sched(exec_ctx, op->on_consumed, GRPC_ERROR_NONE); - - GPR_ASSERT(op->set_accept_stream == false); - if (op->bind_pollset != NULL) { - grpc_pollset_set_add_pollset(exec_ctx, chand->interested_parties, - op->bind_pollset); - } - - gpr_mu_lock(&chand->mu); if (op->on_connectivity_state_change != NULL) { grpc_connectivity_state_notify_on_state_change( exec_ctx, &chand->state_tracker, op->connectivity_state, @@ -482,7 +463,28 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx, } GRPC_ERROR_UNREF(op->disconnect_with_error); } - gpr_mu_unlock(&chand->mu); +} + +static void cc_start_transport_op(grpc_exec_ctx *exec_ctx, + grpc_channel_element *elem, + grpc_transport_op *op) { + channel_data *chand = elem->channel_data; + + grpc_closure_sched(exec_ctx, op->on_consumed, GRPC_ERROR_NONE); + + GPR_ASSERT(op->set_accept_stream == false); + if (op->bind_pollset != NULL) { + grpc_pollset_set_add_pollset(exec_ctx, chand->interested_parties, + op->bind_pollset); + } + + op->transport_private.args[0] = elem; + grpc_closure_sched( + exec_ctx, + grpc_closure_init(&op->transport_private.closure, + cc_start_transport_op_locked, op, + grpc_combiner_scheduler(chand->combiner, false)), + GRPC_ERROR_NONE); } static void cc_get_channel_info(grpc_exec_ctx *exec_ctx, @@ -512,11 +514,11 @@ static grpc_error *cc_init_channel_elem(grpc_exec_ctx *exec_ctx, GPR_ASSERT(args->is_last); GPR_ASSERT(elem->filter == &grpc_client_channel_filter); // Initialize data members. - gpr_mu_init(&chand->mu); + chand->combiner = grpc_combiner_create(NULL); chand->owning_stack = args->channel_stack; grpc_closure_init(&chand->on_resolver_result_changed, - on_resolver_result_changed, chand, - grpc_schedule_on_exec_ctx); + on_resolver_result_changed_locked, chand, + grpc_combiner_scheduler(chand->combiner, false)); chand->interested_parties = grpc_pollset_set_create(); grpc_connectivity_state_init(&chand->state_tracker, GRPC_CHANNEL_IDLE, "client_channel"); @@ -572,7 +574,7 @@ static void cc_destroy_channel_elem(grpc_exec_ctx *exec_ctx, } grpc_connectivity_state_destroy(exec_ctx, &chand->state_tracker); grpc_pollset_set_destroy(chand->interested_parties); - gpr_mu_destroy(&chand->mu); + grpc_combiner_destroy(exec_ctx, chand->combiner); } /************************************************************************* @@ -615,8 +617,6 @@ typedef struct client_channel_call_data { grpc_subchannel_call */ gpr_atm subchannel_call; - gpr_mu mu; - subchannel_creation_phase creation_phase; grpc_connected_subchannel *connected_subchannel; grpc_polling_entity *pollent; @@ -701,12 +701,11 @@ static void retry_waiting_locked(grpc_exec_ctx *exec_ctx, call_data *calld) { GRPC_ERROR_NONE); } -static void subchannel_ready(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { +static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error) { grpc_call_element *elem = arg; call_data *calld = elem->call_data; channel_data *chand = elem->channel_data; - gpr_mu_lock(&calld->mu); GPR_ASSERT(calld->creation_phase == GRPC_SUBCHANNEL_CALL_HOLDER_PICKING_SUBCHANNEL); grpc_polling_entity_del_from_pollset_set(exec_ctx, calld->pollent, @@ -742,7 +741,6 @@ static void subchannel_ready(grpc_exec_ctx *exec_ctx, void *arg, (gpr_atm)(uintptr_t)subchannel_call); retry_waiting_locked(exec_ctx, calld); } - gpr_mu_unlock(&calld->mu); GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "pick_subchannel"); } @@ -768,37 +766,35 @@ typedef struct { /** 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(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_closure *on_ready, grpc_error *error); - -static void continue_picking(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *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_closure *on_ready, + grpc_error *error); + +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) { /* cancelled, do nothing */ } else if (error != GRPC_ERROR_NONE) { grpc_closure_sched(exec_ctx, cpa->on_ready, GRPC_ERROR_REF(error)); } else { - call_data *calld = cpa->elem->call_data; - gpr_mu_lock(&calld->mu); - if (pick_subchannel(exec_ctx, cpa->elem, cpa->initial_metadata, - cpa->initial_metadata_flags, cpa->connected_subchannel, - cpa->on_ready, GRPC_ERROR_NONE)) { + if (pick_subchannel_locked(exec_ctx, cpa->elem, cpa->initial_metadata, + cpa->initial_metadata_flags, + cpa->connected_subchannel, cpa->on_ready, + GRPC_ERROR_NONE)) { grpc_closure_sched(exec_ctx, cpa->on_ready, GRPC_ERROR_NONE); } - gpr_mu_unlock(&calld->mu); } gpr_free(cpa); } -static bool pick_subchannel(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_closure *on_ready, grpc_error *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_closure *on_ready, + grpc_error *error) { GPR_TIMER_BEGIN("pick_subchannel", 0); channel_data *chand = elem->channel_data; @@ -808,7 +804,6 @@ static bool pick_subchannel(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, GPR_ASSERT(connected_subchannel); - gpr_mu_lock(&chand->mu); if (initial_metadata == NULL) { if (chand->lb_policy != NULL) { grpc_lb_policy_cancel_pick(exec_ctx, chand->lb_policy, @@ -824,7 +819,6 @@ static bool pick_subchannel(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, GRPC_ERROR_CREATE_REFERENCING("Pick cancelled", &error, 1)); } } - gpr_mu_unlock(&chand->mu); GPR_TIMER_END("pick_subchannel", 0); GRPC_ERROR_UNREF(error); return true; @@ -833,7 +827,6 @@ static bool pick_subchannel(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, if (chand->lb_policy != NULL) { grpc_lb_policy *lb_policy = chand->lb_policy; GRPC_LB_POLICY_REF(lb_policy, "pick_subchannel"); - gpr_mu_unlock(&chand->mu); // If the application explicitly set wait_for_ready, use that. // Otherwise, if the service config specified a value for this // method, use that. @@ -872,59 +865,37 @@ static bool pick_subchannel(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, cpa->connected_subchannel = connected_subchannel; cpa->on_ready = on_ready; cpa->elem = elem; - grpc_closure_init(&cpa->closure, continue_picking, cpa, - grpc_schedule_on_exec_ctx); + grpc_closure_init(&cpa->closure, continue_picking_locked, cpa, + grpc_combiner_scheduler(chand->combiner, true)); grpc_closure_list_append(&chand->waiting_for_config_closures, &cpa->closure, GRPC_ERROR_NONE); } else { grpc_closure_sched(exec_ctx, on_ready, GRPC_ERROR_CREATE("Disconnected")); } - gpr_mu_unlock(&chand->mu); GPR_TIMER_END("pick_subchannel", 0); return false; } -// 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 -// the streaming case. -// TODO(ctiller): Explain this more thoroughly. -static void cc_start_transport_stream_op(grpc_exec_ctx *exec_ctx, - grpc_call_element *elem, - grpc_transport_stream_op *op) { +static void cc_start_transport_stream_op_locked(grpc_exec_ctx *exec_ctx, + void *arg, + grpc_error *error_ignored) { + grpc_transport_stream_op *op = arg; + grpc_call_element *elem = op->transport_private.args[0]; call_data *calld = elem->call_data; channel_data *chand = elem->channel_data; - GRPC_CALL_LOG_OP(GPR_INFO, elem, op); - grpc_deadline_state_client_start_transport_stream_op(exec_ctx, elem, op); - /* try to (atomically) get the call */ - grpc_subchannel_call *call = GET_CALL(calld); - GPR_TIMER_BEGIN("cc_start_transport_stream_op", 0); - if (call == CANCELLED_CALL) { - grpc_transport_stream_op_finish_with_failure( - exec_ctx, op, GRPC_ERROR_REF(calld->cancel_error)); - GPR_TIMER_END("cc_start_transport_stream_op", 0); - return; - } - if (call != NULL) { - grpc_subchannel_call_process_op(exec_ctx, call, op); - GPR_TIMER_END("cc_start_transport_stream_op", 0); - return; - } - /* we failed; lock and figure out what to do */ - gpr_mu_lock(&calld->mu); + grpc_subchannel_call *call; + retry: /* need to recheck that another thread hasn't set the call */ call = GET_CALL(calld); if (call == CANCELLED_CALL) { - gpr_mu_unlock(&calld->mu); grpc_transport_stream_op_finish_with_failure( exec_ctx, op, GRPC_ERROR_REF(calld->cancel_error)); GPR_TIMER_END("cc_start_transport_stream_op", 0); return; } if (call != NULL) { - gpr_mu_unlock(&calld->mu); grpc_subchannel_call_process_op(exec_ctx, call, op); GPR_TIMER_END("cc_start_transport_stream_op", 0); return; @@ -946,11 +917,11 @@ retry: fail_locked(exec_ctx, calld, GRPC_ERROR_REF(op->cancel_error)); break; case GRPC_SUBCHANNEL_CALL_HOLDER_PICKING_SUBCHANNEL: - pick_subchannel(exec_ctx, elem, NULL, 0, &calld->connected_subchannel, - NULL, GRPC_ERROR_REF(op->cancel_error)); + pick_subchannel_locked(exec_ctx, elem, NULL, 0, + &calld->connected_subchannel, NULL, + GRPC_ERROR_REF(op->cancel_error)); break; } - gpr_mu_unlock(&calld->mu); grpc_transport_stream_op_finish_with_failure( exec_ctx, op, GRPC_ERROR_REF(op->cancel_error)); GPR_TIMER_END("cc_start_transport_stream_op", 0); @@ -962,16 +933,16 @@ retry: calld->connected_subchannel == NULL && op->send_initial_metadata != NULL) { calld->creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_PICKING_SUBCHANNEL; - grpc_closure_init(&calld->next_step, subchannel_ready, elem, - grpc_schedule_on_exec_ctx); + grpc_closure_init(&calld->next_step, subchannel_ready_locked, elem, + grpc_combiner_scheduler(chand->combiner, true)); 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(exec_ctx, elem, op->send_initial_metadata, - op->send_initial_metadata_flags, - &calld->connected_subchannel, &calld->next_step, - GRPC_ERROR_NONE)) { + if (pick_subchannel_locked(exec_ctx, elem, op->send_initial_metadata, + op->send_initial_metadata_flags, + &calld->connected_subchannel, &calld->next_step, + GRPC_ERROR_NONE)) { calld->creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING; GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "pick_subchannel"); } else { @@ -998,27 +969,60 @@ retry: } /* nothing to be done but wait */ add_waiting_locked(calld, op); - gpr_mu_unlock(&calld->mu); GPR_TIMER_END("cc_start_transport_stream_op", 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 +// the streaming case. +// TODO(ctiller): Explain this more thoroughly. +static void cc_start_transport_stream_op(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem, + grpc_transport_stream_op *op) { + call_data *calld = elem->call_data; + channel_data *chand = elem->channel_data; + GRPC_CALL_LOG_OP(GPR_INFO, elem, op); + grpc_deadline_state_client_start_transport_stream_op(exec_ctx, elem, op); + /* try to (atomically) get the call */ + grpc_subchannel_call *call = GET_CALL(calld); + GPR_TIMER_BEGIN("cc_start_transport_stream_op", 0); + if (call == CANCELLED_CALL) { + grpc_transport_stream_op_finish_with_failure( + exec_ctx, op, GRPC_ERROR_REF(calld->cancel_error)); + GPR_TIMER_END("cc_start_transport_stream_op", 0); + return; + } + if (call != NULL) { + grpc_subchannel_call_process_op(exec_ctx, call, op); + GPR_TIMER_END("cc_start_transport_stream_op", 0); + return; + } + /* we failed; lock and figure out what to do */ + op->transport_private.args[0] = elem; + grpc_closure_sched( + exec_ctx, + grpc_closure_init(&op->transport_private.closure, + cc_start_transport_stream_op_locked, op, + grpc_combiner_scheduler(chand->combiner, false)), + GRPC_ERROR_NONE); +} + // Gets data from the service config. Invoked when the resolver returns // its initial result. -static void read_service_config(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { +static void read_service_config_locked(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error) { grpc_call_element *elem = arg; channel_data *chand = elem->channel_data; call_data *calld = elem->call_data; // If this is an error, there's no point in looking at the service config. if (error == GRPC_ERROR_NONE) { // Get the method config table from channel data. - gpr_mu_lock(&chand->mu); grpc_slice_hash_table *method_params_table = NULL; if (chand->method_params_table != NULL) { method_params_table = grpc_slice_hash_table_ref(chand->method_params_table); } - gpr_mu_unlock(&chand->mu); // If the method config table was present, use it. if (method_params_table != NULL) { const method_parameters *method_params = grpc_method_config_table_get( @@ -1028,7 +1032,6 @@ static void read_service_config(grpc_exec_ctx *exec_ctx, void *arg, gpr_time_cmp(method_params->timeout, gpr_time_0(GPR_TIMESPAN)) != 0; if (have_method_timeout || method_params->wait_for_ready != WAIT_FOR_READY_UNSET) { - gpr_mu_lock(&calld->mu); if (have_method_timeout) { const gpr_timespec per_method_deadline = gpr_time_add(calld->call_start_time, method_params->timeout); @@ -1042,7 +1045,6 @@ static void read_service_config(grpc_exec_ctx *exec_ctx, void *arg, calld->wait_for_ready_from_service_config = method_params->wait_for_ready; } - gpr_mu_unlock(&calld->mu); } } grpc_slice_hash_table_unref(exec_ctx, method_params_table); @@ -1051,43 +1053,25 @@ static void read_service_config(grpc_exec_ctx *exec_ctx, void *arg, GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "read_service_config"); } -/* Constructor for call_data */ -static grpc_error *cc_init_call_elem(grpc_exec_ctx *exec_ctx, - grpc_call_element *elem, - grpc_call_element_args *args) { +static void initial_read_service_config_locked(grpc_exec_ctx *exec_ctx, + void *arg, + grpc_error *error_ignored) { + grpc_call_element *elem = arg; channel_data *chand = elem->channel_data; call_data *calld = elem->call_data; - // Initialize data members. - grpc_deadline_state_init(exec_ctx, elem, args->call_stack); - calld->path = grpc_slice_ref_internal(args->path); - calld->call_start_time = args->start_time; - calld->deadline = gpr_convert_clock_type(args->deadline, GPR_CLOCK_MONOTONIC); - calld->wait_for_ready_from_service_config = WAIT_FOR_READY_UNSET; - calld->cancel_error = GRPC_ERROR_NONE; - gpr_atm_rel_store(&calld->subchannel_call, 0); - gpr_mu_init(&calld->mu); - calld->connected_subchannel = NULL; - calld->waiting_ops = NULL; - calld->waiting_ops_count = 0; - calld->waiting_ops_capacity = 0; - calld->creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING; - calld->owning_call = args->call_stack; - calld->pollent = NULL; // If the resolver has already returned results, then we can access // the service config parameters immediately. Otherwise, we need to // defer that work until the resolver returns an initial result. // TODO(roth): This code is almost but not quite identical to the code // in read_service_config() above. It would be nice to find a way to // combine them, to avoid having to maintain it twice. - gpr_mu_lock(&chand->mu); if (chand->lb_policy != NULL) { // We already have a resolver result, so check for service config. if (chand->method_params_table != NULL) { grpc_slice_hash_table *method_params_table = grpc_slice_hash_table_ref(chand->method_params_table); - gpr_mu_unlock(&chand->mu); method_parameters *method_params = grpc_method_config_table_get( - exec_ctx, method_params_table, args->path); + exec_ctx, method_params_table, calld->path); if (method_params != NULL) { if (gpr_time_cmp(method_params->timeout, gpr_time_0(GPR_CLOCK_MONOTONIC)) != 0) { @@ -1101,24 +1085,50 @@ static grpc_error *cc_init_call_elem(grpc_exec_ctx *exec_ctx, } } grpc_slice_hash_table_unref(exec_ctx, method_params_table); - } else { - gpr_mu_unlock(&chand->mu); } } else { // We don't yet have a resolver result, so register a callback to // get the service config data once the resolver returns. // Take a reference to the call stack to be owned by the callback. GRPC_CALL_STACK_REF(calld->owning_call, "read_service_config"); - grpc_closure_init(&calld->read_service_config, read_service_config, elem, - grpc_schedule_on_exec_ctx); + grpc_closure_init(&calld->read_service_config, read_service_config_locked, + elem, grpc_combiner_scheduler(chand->combiner, false)); grpc_closure_list_append(&chand->waiting_for_config_closures, &calld->read_service_config, GRPC_ERROR_NONE); - gpr_mu_unlock(&chand->mu); } // Start the deadline timer with the current deadline value. If we // do not yet have service config data, then the timer may be reset // later. grpc_deadline_state_start(exec_ctx, elem, calld->deadline); +} + +/* Constructor for call_data */ +static grpc_error *cc_init_call_elem(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem, + grpc_call_element_args *args) { + channel_data *chand = elem->channel_data; + call_data *calld = elem->call_data; + // Initialize data members. + grpc_deadline_state_init(exec_ctx, elem, args->call_stack); + calld->path = grpc_slice_ref_internal(args->path); + calld->call_start_time = args->start_time; + calld->deadline = gpr_convert_clock_type(args->deadline, GPR_CLOCK_MONOTONIC); + calld->wait_for_ready_from_service_config = WAIT_FOR_READY_UNSET; + calld->cancel_error = GRPC_ERROR_NONE; + gpr_atm_rel_store(&calld->subchannel_call, 0); + calld->connected_subchannel = NULL; + calld->waiting_ops = NULL; + calld->waiting_ops_count = 0; + calld->waiting_ops_capacity = 0; + calld->creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING; + calld->owning_call = args->call_stack; + calld->pollent = NULL; + grpc_closure_sched( + exec_ctx, + grpc_closure_init(&calld->read_service_config, + initial_read_service_config_locked, elem, + grpc_combiner_scheduler(chand->combiner, false)), + GRPC_ERROR_NONE); return GRPC_ERROR_NONE; } @@ -1136,7 +1146,6 @@ static void cc_destroy_call_elem(grpc_exec_ctx *exec_ctx, GRPC_SUBCHANNEL_CALL_UNREF(exec_ctx, call, "client_channel_destroy_call"); } GPR_ASSERT(calld->creation_phase == GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING); - gpr_mu_destroy(&calld->mu); GPR_ASSERT(calld->waiting_ops_count == 0); if (calld->connected_subchannel != NULL) { GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, calld->connected_subchannel, From 613dafa60ce3a22a5d7f1351b8054a3090b9deb1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Feb 2017 12:00:43 -0800 Subject: [PATCH 051/126] Convert connectivity_state, channel info into a combiner-compatible form --- src/core/ext/client_channel/client_channel.c | 100 +++++++++++------- src/core/ext/client_channel/subchannel.c | 2 +- src/core/ext/lb_policy/grpclb/grpclb.c | 9 +- .../ext/lb_policy/pick_first/pick_first.c | 2 +- .../ext/lb_policy/round_robin/round_robin.c | 2 +- src/core/lib/transport/connectivity_state.c | 42 +++++--- src/core/lib/transport/connectivity_state.h | 20 +++- test/core/transport/connectivity_state_test.c | 3 +- 8 files changed, 117 insertions(+), 63 deletions(-) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index 2595acd8c42..58504de87d2 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -164,10 +164,7 @@ typedef struct client_channel_channel_data { /** combiner protecting all variables below in this data structure */ grpc_combiner *combiner; /** currently active load balancer */ - char *lb_policy_name; grpc_lb_policy *lb_policy; - /** service config in JSON form */ - char *service_config_json; /** maps method names to method_parameters structs */ grpc_slice_hash_table *method_params_table; /** incoming resolver result - set by resolver.next() */ @@ -184,6 +181,13 @@ typedef struct client_channel_channel_data { grpc_channel_stack *owning_stack; /** interested parties (owned) */ grpc_pollset_set *interested_parties; + + /* the following properties are guarded by a mutex since API's require them + to be instantaniously available */ + gpr_mu info_mu; + char *info_lb_policy_name; + /** service config in JSON form */ + char *info_service_config_json; } channel_data; /** We create one watcher for each new lb_policy that is returned from a @@ -345,16 +349,18 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, chand->interested_parties); } + gpr_mu_lock(&chand->info_mu); if (lb_policy_name != NULL) { - gpr_free(chand->lb_policy_name); - chand->lb_policy_name = lb_policy_name; + gpr_free(chand->info_lb_policy_name); + chand->info_lb_policy_name = lb_policy_name; } old_lb_policy = chand->lb_policy; chand->lb_policy = lb_policy; if (service_config_json != NULL) { - gpr_free(chand->service_config_json); - chand->service_config_json = service_config_json; + gpr_free(chand->info_service_config_json); + chand->info_service_config_json = service_config_json; } + gpr_mu_unlock(&chand->info_mu); if (chand->method_params_table != NULL) { grpc_slice_hash_table_unref(exec_ctx, chand->method_params_table); } @@ -491,18 +497,19 @@ static void cc_get_channel_info(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, const grpc_channel_info *info) { channel_data *chand = elem->channel_data; - gpr_mu_lock(&chand->mu); + gpr_mu_lock(&chand->info_mu); if (info->lb_policy_name != NULL) { - *info->lb_policy_name = chand->lb_policy_name == NULL + *info->lb_policy_name = chand->info_lb_policy_name == NULL ? NULL - : gpr_strdup(chand->lb_policy_name); + : gpr_strdup(chand->info_lb_policy_name); } if (info->service_config_json != NULL) { - *info->service_config_json = chand->service_config_json == NULL - ? NULL - : gpr_strdup(chand->service_config_json); + *info->service_config_json = + chand->info_service_config_json == NULL + ? NULL + : gpr_strdup(chand->info_service_config_json); } - gpr_mu_unlock(&chand->mu); + gpr_mu_unlock(&chand->info_mu); } /* Constructor for channel_data */ @@ -567,8 +574,8 @@ static void cc_destroy_channel_elem(grpc_exec_ctx *exec_ctx, chand->interested_parties); GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "channel"); } - gpr_free(chand->lb_policy_name); - gpr_free(chand->service_config_json); + gpr_free(chand->info_lb_policy_name); + gpr_free(chand->info_service_config_json); if (chand->method_params_table != NULL) { grpc_slice_hash_table_unref(exec_ctx, chand->method_params_table); } @@ -1181,26 +1188,34 @@ const grpc_channel_filter grpc_client_channel_filter = { "client-channel", }; +static void try_to_connect_locked(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error_ignored) { + channel_data *chand = arg; + if (chand->lb_policy != NULL) { + grpc_lb_policy_exit_idle(exec_ctx, chand->lb_policy); + } else { + chand->exit_idle_when_lb_policy_arrives = true; + if (!chand->started_resolving && chand->resolver != NULL) { + GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver"); + chand->started_resolving = true; + grpc_resolver_next(exec_ctx, chand->resolver, &chand->resolver_result, + &chand->on_resolver_result_changed); + } + } +} + grpc_connectivity_state grpc_client_channel_check_connectivity_state( grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, int try_to_connect) { channel_data *chand = elem->channel_data; grpc_connectivity_state out; - gpr_mu_lock(&chand->mu); - out = grpc_connectivity_state_check(&chand->state_tracker, NULL); + out = grpc_connectivity_state_check(&chand->state_tracker); if (out == GRPC_CHANNEL_IDLE && try_to_connect) { - if (chand->lb_policy != NULL) { - grpc_lb_policy_exit_idle(exec_ctx, chand->lb_policy); - } else { - chand->exit_idle_when_lb_policy_arrives = true; - if (!chand->started_resolving && chand->resolver != NULL) { - GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver"); - chand->started_resolving = true; - grpc_resolver_next(exec_ctx, chand->resolver, &chand->resolver_result, - &chand->on_resolver_result_changed); - } - } + grpc_closure_sched( + exec_ctx, + grpc_closure_create(try_to_connect_locked, chand, + grpc_combiner_scheduler(chand->combiner, false)), + GRPC_ERROR_NONE); } - gpr_mu_unlock(&chand->mu); return out; } @@ -1208,6 +1223,7 @@ typedef struct { channel_data *chand; grpc_pollset *pollset; grpc_closure *on_complete; + grpc_connectivity_state *state; grpc_closure my_closure; } external_connectivity_watcher; @@ -1220,7 +1236,17 @@ static void on_external_watch_complete(grpc_exec_ctx *exec_ctx, void *arg, GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack, "external_connectivity_watcher"); gpr_free(w); - follow_up->cb(exec_ctx, follow_up->cb_arg, error); + grpc_closure_run(exec_ctx, follow_up, GRPC_ERROR_REF(error)); +} + +static void cc_watch_connectivity_state_locked(grpc_exec_ctx *exec_ctx, + void *arg, + grpc_error *error_ignored) { + external_connectivity_watcher *w = arg; + 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); } void grpc_client_channel_watch_connectivity_state( @@ -1231,13 +1257,13 @@ void grpc_client_channel_watch_connectivity_state( w->chand = chand; w->pollset = pollset; w->on_complete = on_complete; + w->state = state; grpc_pollset_set_add_pollset(exec_ctx, chand->interested_parties, pollset); - grpc_closure_init(&w->my_closure, on_external_watch_complete, w, - grpc_schedule_on_exec_ctx); GRPC_CHANNEL_STACK_REF(w->chand->owning_stack, "external_connectivity_watcher"); - gpr_mu_lock(&chand->mu); - grpc_connectivity_state_notify_on_state_change( - exec_ctx, &chand->state_tracker, state, &w->my_closure); - gpr_mu_unlock(&chand->mu); + grpc_closure_sched( + exec_ctx, + grpc_closure_init(&w->my_closure, cc_watch_connectivity_state_locked, w, + grpc_combiner_scheduler(chand->combiner, true)), + GRPC_ERROR_NONE); } diff --git a/src/core/ext/client_channel/subchannel.c b/src/core/ext/client_channel/subchannel.c index aa036e883ba..c37134fd5e7 100644 --- a/src/core/ext/client_channel/subchannel.c +++ b/src/core/ext/client_channel/subchannel.c @@ -419,7 +419,7 @@ grpc_connectivity_state grpc_subchannel_check_connectivity(grpc_subchannel *c, grpc_error **error) { grpc_connectivity_state state; gpr_mu_lock(&c->mu); - state = grpc_connectivity_state_check(&c->state_tracker, error); + state = grpc_connectivity_state_get(&c->state_tracker, error); gpr_mu_unlock(&c->mu); return state; } diff --git a/src/core/ext/lb_policy/grpclb/grpclb.c b/src/core/ext/lb_policy/grpclb/grpclb.c index ab62e5ed6a1..8a2af483283 100644 --- a/src/core/ext/lb_policy/grpclb/grpclb.c +++ b/src/core/ext/lb_policy/grpclb/grpclb.c @@ -492,9 +492,8 @@ static grpc_lb_addresses *process_serverlist_locked( static bool update_lb_connectivity_status_locked( grpc_exec_ctx *exec_ctx, glb_lb_policy *glb_policy, grpc_connectivity_state new_rr_state, grpc_error *new_rr_state_error) { - grpc_error *curr_state_error; - const grpc_connectivity_state curr_glb_state = grpc_connectivity_state_check( - &glb_policy->state_tracker, &curr_state_error); + const grpc_connectivity_state curr_glb_state = + grpc_connectivity_state_check(&glb_policy->state_tracker); /* The new connectivity status is a function of the previous one and the new * input coming from the status of the RR policy. @@ -1098,8 +1097,8 @@ static grpc_connectivity_state glb_check_connectivity( glb_lb_policy *glb_policy = (glb_lb_policy *)pol; grpc_connectivity_state st; gpr_mu_lock(&glb_policy->mu); - st = grpc_connectivity_state_check(&glb_policy->state_tracker, - connectivity_error); + st = grpc_connectivity_state_get(&glb_policy->state_tracker, + connectivity_error); gpr_mu_unlock(&glb_policy->mu); return st; } diff --git a/src/core/ext/lb_policy/pick_first/pick_first.c b/src/core/ext/lb_policy/pick_first/pick_first.c index 9f2aa461bed..1b965183f6b 100644 --- a/src/core/ext/lb_policy/pick_first/pick_first.c +++ b/src/core/ext/lb_policy/pick_first/pick_first.c @@ -398,7 +398,7 @@ static grpc_connectivity_state pf_check_connectivity(grpc_exec_ctx *exec_ctx, pick_first_lb_policy *p = (pick_first_lb_policy *)pol; grpc_connectivity_state st; gpr_mu_lock(&p->mu); - st = grpc_connectivity_state_check(&p->state_tracker, error); + st = grpc_connectivity_state_get(&p->state_tracker, error); gpr_mu_unlock(&p->mu); return st; } diff --git a/src/core/ext/lb_policy/round_robin/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c index 3e060d189ab..63e3d033adf 100644 --- a/src/core/ext/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/lb_policy/round_robin/round_robin.c @@ -655,7 +655,7 @@ static grpc_connectivity_state rr_check_connectivity(grpc_exec_ctx *exec_ctx, round_robin_lb_policy *p = (round_robin_lb_policy *)pol; grpc_connectivity_state st; gpr_mu_lock(&p->mu); - st = grpc_connectivity_state_check(&p->state_tracker, error); + st = grpc_connectivity_state_get(&p->state_tracker, error); gpr_mu_unlock(&p->mu); return st; } diff --git a/src/core/lib/transport/connectivity_state.c b/src/core/lib/transport/connectivity_state.c index 8fc5bf3e9a6..e884567240d 100644 --- a/src/core/lib/transport/connectivity_state.c +++ b/src/core/lib/transport/connectivity_state.c @@ -62,7 +62,7 @@ const char *grpc_connectivity_state_name(grpc_connectivity_state state) { void grpc_connectivity_state_init(grpc_connectivity_state_tracker *tracker, grpc_connectivity_state init_state, const char *name) { - tracker->current_state = init_state; + gpr_atm_no_barrier_store(&tracker->current_state_atm, init_state); tracker->current_error = GRPC_ERROR_NONE; tracker->watchers = NULL; tracker->name = gpr_strdup(name); @@ -89,15 +89,29 @@ void grpc_connectivity_state_destroy(grpc_exec_ctx *exec_ctx, } grpc_connectivity_state grpc_connectivity_state_check( + grpc_connectivity_state_tracker *tracker) { + grpc_connectivity_state cur = + (grpc_connectivity_state)gpr_atm_no_barrier_load( + &tracker->current_state_atm); + if (grpc_connectivity_state_trace) { + gpr_log(GPR_DEBUG, "CONWATCH: %p %s: get %s", tracker, tracker->name, + grpc_connectivity_state_name(cur)); + } + return cur; +} + +grpc_connectivity_state grpc_connectivity_state_get( grpc_connectivity_state_tracker *tracker, grpc_error **error) { + grpc_connectivity_state cur =(grpc_connectivity_state) + gpr_atm_no_barrier_load(&tracker->current_state_atm); if (grpc_connectivity_state_trace) { gpr_log(GPR_DEBUG, "CONWATCH: %p %s: get %s", tracker, tracker->name, - grpc_connectivity_state_name(tracker->current_state)); + grpc_connectivity_state_name(cur)); } if (error != NULL) { *error = GRPC_ERROR_REF(tracker->current_error); } - return tracker->current_state; + return cur; } bool grpc_connectivity_state_has_watchers( @@ -108,6 +122,8 @@ bool grpc_connectivity_state_has_watchers( bool grpc_connectivity_state_notify_on_state_change( grpc_exec_ctx *exec_ctx, grpc_connectivity_state_tracker *tracker, grpc_connectivity_state *current, grpc_closure *notify) { + grpc_connectivity_state cur =(grpc_connectivity_state) + gpr_atm_no_barrier_load(&tracker->current_state_atm); if (grpc_connectivity_state_trace) { if (current == NULL) { gpr_log(GPR_DEBUG, "CONWATCH: %p %s: unsubscribe notify=%p", tracker, @@ -115,7 +131,7 @@ bool grpc_connectivity_state_notify_on_state_change( } else { gpr_log(GPR_DEBUG, "CONWATCH: %p %s: from %s [cur=%s] notify=%p", tracker, tracker->name, grpc_connectivity_state_name(*current), - grpc_connectivity_state_name(tracker->current_state), notify); + grpc_connectivity_state_name(cur), notify); } } if (current == NULL) { @@ -138,8 +154,8 @@ bool grpc_connectivity_state_notify_on_state_change( } return false; } else { - if (tracker->current_state != *current) { - *current = tracker->current_state; + if (cur != *current) { + *current = cur; grpc_closure_sched(exec_ctx, notify, GRPC_ERROR_REF(tracker->current_error)); } else { @@ -149,7 +165,7 @@ bool grpc_connectivity_state_notify_on_state_change( w->next = tracker->watchers; tracker->watchers = w; } - return tracker->current_state == GRPC_CHANNEL_IDLE; + return cur == GRPC_CHANNEL_IDLE; } } @@ -157,11 +173,13 @@ void grpc_connectivity_state_set(grpc_exec_ctx *exec_ctx, grpc_connectivity_state_tracker *tracker, grpc_connectivity_state state, grpc_error *error, const char *reason) { + grpc_connectivity_state cur =(grpc_connectivity_state) + gpr_atm_no_barrier_load(&tracker->current_state_atm); grpc_connectivity_state_watcher *w; if (grpc_connectivity_state_trace) { const char *error_string = grpc_error_string(error); gpr_log(GPR_DEBUG, "SET: %p %s: %s --> %s [%s] error=%p %s", tracker, - tracker->name, grpc_connectivity_state_name(tracker->current_state), + tracker->name, grpc_connectivity_state_name(cur), grpc_connectivity_state_name(state), reason, error, error_string); } switch (state) { @@ -178,13 +196,13 @@ void grpc_connectivity_state_set(grpc_exec_ctx *exec_ctx, } GRPC_ERROR_UNREF(tracker->current_error); tracker->current_error = error; - if (tracker->current_state == state) { + if (cur == state) { return; } - GPR_ASSERT(tracker->current_state != GRPC_CHANNEL_SHUTDOWN); - tracker->current_state = state; + GPR_ASSERT(cur != GRPC_CHANNEL_SHUTDOWN); + gpr_atm_no_barrier_store(&tracker->current_state_atm, state); while ((w = tracker->watchers) != NULL) { - *w->current = tracker->current_state; + *w->current = state; tracker->watchers = w->next; if (grpc_connectivity_state_trace) { gpr_log(GPR_DEBUG, "NOTIFY: %p %s: %p", tracker, tracker->name, diff --git a/src/core/lib/transport/connectivity_state.h b/src/core/lib/transport/connectivity_state.h index 769c675b797..c9604c34dda 100644 --- a/src/core/lib/transport/connectivity_state.h +++ b/src/core/lib/transport/connectivity_state.h @@ -47,8 +47,8 @@ typedef struct grpc_connectivity_state_watcher { } grpc_connectivity_state_watcher; typedef struct { - /** current connectivity state */ - grpc_connectivity_state current_state; + /** current grpc_connectivity_state */ + gpr_atm current_state_atm; /** error associated with state */ grpc_error *current_error; /** all our watchers */ @@ -59,6 +59,7 @@ typedef struct { extern int grpc_connectivity_state_trace; +/** enum --> string conversion */ const char *grpc_connectivity_state_name(grpc_connectivity_state state); void grpc_connectivity_state_init(grpc_connectivity_state_tracker *tracker, @@ -68,22 +69,31 @@ void grpc_connectivity_state_destroy(grpc_exec_ctx *exec_ctx, grpc_connectivity_state_tracker *tracker); /** Set connectivity state; not thread safe; access must be serialized with an - * external lock */ + * external lock */ void grpc_connectivity_state_set(grpc_exec_ctx *exec_ctx, grpc_connectivity_state_tracker *tracker, grpc_connectivity_state state, grpc_error *associated_error, const char *reason); +/** Return true if this connectivity state has watchers. + Access must be serialized with an external lock. */ bool grpc_connectivity_state_has_watchers( grpc_connectivity_state_tracker *tracker); +/** Return the last seen connectivity state. No need to synchronize access. */ grpc_connectivity_state grpc_connectivity_state_check( - grpc_connectivity_state_tracker *tracker, grpc_error **current_error); + grpc_connectivity_state_tracker *tracker); + +/** Return the last seen connectivity state, and the associated error. + Access must be serialized with an external lock. */ +grpc_connectivity_state grpc_connectivity_state_get( + grpc_connectivity_state_tracker *tracker, grpc_error **error); /** Return 1 if the channel should start connecting, 0 otherwise. If current==NULL cancel notify if it is already queued (success==0 in that - case) */ + case). + Access must be serialized with an external lock. */ bool grpc_connectivity_state_notify_on_state_change( grpc_exec_ctx *exec_ctx, grpc_connectivity_state_tracker *tracker, grpc_connectivity_state *current, grpc_closure *notify); diff --git a/test/core/transport/connectivity_state_test.c b/test/core/transport/connectivity_state_test.c index 3520ef0a80d..8314a5f6190 100644 --- a/test/core/transport/connectivity_state_test.c +++ b/test/core/transport/connectivity_state_test.c @@ -77,8 +77,9 @@ static void test_check(void) { grpc_error *error; gpr_log(GPR_DEBUG, "test_check"); grpc_connectivity_state_init(&tracker, GRPC_CHANNEL_IDLE, "xxx"); - GPR_ASSERT(grpc_connectivity_state_check(&tracker, &error) == + GPR_ASSERT(grpc_connectivity_state_get(&tracker, &error) == GRPC_CHANNEL_IDLE); + GPR_ASSERT(grpc_connectivity_state_check(&tracker) == GRPC_CHANNEL_IDLE); GPR_ASSERT(error == GRPC_ERROR_NONE); grpc_connectivity_state_destroy(&exec_ctx, &tracker); grpc_exec_ctx_finish(&exec_ctx); From d85477515230c5161659175cbc60b684109aedbf Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Feb 2017 12:02:39 -0800 Subject: [PATCH 052/126] Init mutex --- src/core/ext/client_channel/client_channel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index 58504de87d2..a7dd967a51e 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -522,6 +522,7 @@ static grpc_error *cc_init_channel_elem(grpc_exec_ctx *exec_ctx, GPR_ASSERT(elem->filter == &grpc_client_channel_filter); // Initialize data members. chand->combiner = grpc_combiner_create(NULL); + gpr_mu_init(&chand->info_mu); chand->owning_stack = args->channel_stack; grpc_closure_init(&chand->on_resolver_result_changed, on_resolver_result_changed_locked, chand, @@ -582,6 +583,7 @@ static void cc_destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_connectivity_state_destroy(exec_ctx, &chand->state_tracker); grpc_pollset_set_destroy(chand->interested_parties); grpc_combiner_destroy(exec_ctx, chand->combiner); + gpr_mu_destroy(&chand->info_mu); } /************************************************************************* From d2e5cfc5bbe844ece808a843314458b798368748 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Feb 2017 13:02:20 -0800 Subject: [PATCH 053/126] Start fixing refcounting --- src/core/ext/client_channel/client_channel.c | 48 ++++++++------------ 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index a7dd967a51e..282913431f3 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -469,6 +469,9 @@ static void cc_start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg, } GRPC_ERROR_UNREF(op->disconnect_with_error); } + GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "start_transport_op"); + + grpc_closure_sched(exec_ctx, op->on_consumed, GRPC_ERROR_NONE); } static void cc_start_transport_op(grpc_exec_ctx *exec_ctx, @@ -476,8 +479,6 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx, grpc_transport_op *op) { channel_data *chand = elem->channel_data; - grpc_closure_sched(exec_ctx, op->on_consumed, GRPC_ERROR_NONE); - GPR_ASSERT(op->set_accept_stream == false); if (op->bind_pollset != NULL) { grpc_pollset_set_add_pollset(exec_ctx, chand->interested_parties, @@ -485,6 +486,7 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx, } op->transport_private.args[0] = elem; + GRPC_CHANNEL_STACK_REF(chand->owning_stack, "start_transport_op"); grpc_closure_sched( exec_ctx, grpc_closure_init(&op->transport_private.closure, @@ -670,44 +672,24 @@ static void fail_locked(grpc_exec_ctx *exec_ctx, call_data *calld, GRPC_ERROR_UNREF(error); } -typedef struct { - grpc_transport_stream_op **ops; - size_t nops; - grpc_subchannel_call *call; -} retry_ops_args; - -static void retry_ops(grpc_exec_ctx *exec_ctx, void *args, grpc_error *error) { - retry_ops_args *a = args; - size_t i; - for (i = 0; i < a->nops; i++) { - grpc_subchannel_call_process_op(exec_ctx, a->call, a->ops[i]); - } - GRPC_SUBCHANNEL_CALL_UNREF(exec_ctx, a->call, "retry_ops"); - gpr_free(a->ops); - gpr_free(a); -} - static void retry_waiting_locked(grpc_exec_ctx *exec_ctx, call_data *calld) { if (calld->waiting_ops_count == 0) { return; } - retry_ops_args *a = gpr_malloc(sizeof(*a)); - a->ops = calld->waiting_ops; - a->nops = calld->waiting_ops_count; - a->call = GET_CALL(calld); - if (a->call == CANCELLED_CALL) { - gpr_free(a); + grpc_subchannel_call *call = GET_CALL(calld); + grpc_transport_stream_op **ops = calld->waiting_ops; + size_t nops = calld->waiting_ops_count; + if (call == CANCELLED_CALL) { fail_locked(exec_ctx, calld, GRPC_ERROR_CANCELLED); return; } calld->waiting_ops = NULL; calld->waiting_ops_count = 0; calld->waiting_ops_capacity = 0; - GRPC_SUBCHANNEL_CALL_REF(a->call, "retry_ops"); - grpc_closure_sched( - exec_ctx, grpc_closure_create(retry_ops, a, grpc_schedule_on_exec_ctx), - GRPC_ERROR_NONE); + for (size_t i = 0; i < nops; i++) { + grpc_subchannel_call_process_op(exec_ctx, call, ops[i]); + } } static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, void *arg, @@ -978,6 +960,8 @@ retry: } /* nothing to be done but wait */ add_waiting_locked(calld, op); + GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, + "start_transport_stream_op"); GPR_TIMER_END("cc_start_transport_stream_op", 0); } @@ -1008,6 +992,7 @@ static void cc_start_transport_stream_op(grpc_exec_ctx *exec_ctx, return; } /* we failed; lock and figure out what to do */ + GRPC_CALL_STACK_REF(calld->owning_call, "start_transport_stream_op"); op->transport_private.args[0] = elem; grpc_closure_sched( exec_ctx, @@ -1109,6 +1094,8 @@ static void initial_read_service_config_locked(grpc_exec_ctx *exec_ctx, // do not yet have service config data, then the timer may be reset // later. grpc_deadline_state_start(exec_ctx, elem, calld->deadline); + GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, + "initial_read_service_config"); } /* Constructor for call_data */ @@ -1132,6 +1119,7 @@ static grpc_error *cc_init_call_elem(grpc_exec_ctx *exec_ctx, calld->creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING; calld->owning_call = args->call_stack; calld->pollent = NULL; + GRPC_CALL_STACK_REF(calld->owning_call, "initial_read_service_config"); grpc_closure_sched( exec_ctx, grpc_closure_init(&calld->read_service_config, @@ -1204,6 +1192,7 @@ static void try_to_connect_locked(grpc_exec_ctx *exec_ctx, void *arg, &chand->on_resolver_result_changed); } } + GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "try_to_connect"); } grpc_connectivity_state grpc_client_channel_check_connectivity_state( @@ -1212,6 +1201,7 @@ grpc_connectivity_state grpc_client_channel_check_connectivity_state( grpc_connectivity_state out; out = 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, From 9efea88d33132964b3eadcbdc43bd2bba38517ad Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Feb 2017 13:06:52 -0800 Subject: [PATCH 054/126] Fix waiting_ops leak --- src/core/ext/client_channel/client_channel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index 282913431f3..4bde9ec8054 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -690,6 +690,7 @@ static void retry_waiting_locked(grpc_exec_ctx *exec_ctx, call_data *calld) { for (size_t i = 0; i < nops; i++) { grpc_subchannel_call_process_op(exec_ctx, call, ops[i]); } + gpr_free(ops); } static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, void *arg, From 2b56dcc49ee44a9c30cb8397c0d0fdf0d42a5a65 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Feb 2017 13:13:05 -0800 Subject: [PATCH 055/126] Fix leak in client_channel --- src/core/ext/client_channel/client_channel.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index 4bde9ec8054..e62fdf3adb5 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -884,13 +884,11 @@ retry: if (call == CANCELLED_CALL) { grpc_transport_stream_op_finish_with_failure( exec_ctx, op, GRPC_ERROR_REF(calld->cancel_error)); - GPR_TIMER_END("cc_start_transport_stream_op", 0); - return; + goto done; } if (call != NULL) { grpc_subchannel_call_process_op(exec_ctx, call, op); - GPR_TIMER_END("cc_start_transport_stream_op", 0); - return; + goto done; } /* if this is a cancellation, then we can raise our cancelled flag */ if (op->cancel_error != GRPC_ERROR_NONE) { @@ -916,8 +914,7 @@ retry: } grpc_transport_stream_op_finish_with_failure( exec_ctx, op, GRPC_ERROR_REF(op->cancel_error)); - GPR_TIMER_END("cc_start_transport_stream_op", 0); - return; + goto done; } } /* if we don't have a subchannel, try to get one */ @@ -961,6 +958,7 @@ retry: } /* 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"); GPR_TIMER_END("cc_start_transport_stream_op", 0); From c5de83531ee88919da57cc37dbc8a2725c7b94ca Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Feb 2017 14:08:05 -0800 Subject: [PATCH 056/126] Fix leaks --- src/core/ext/client_channel/client_channel.c | 26 ++++++++++---------- src/core/lib/transport/connectivity_state.c | 15 ++++++----- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index e62fdf3adb5..907d81866dc 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -226,19 +226,19 @@ static void on_lb_policy_state_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { lb_policy_connectivity_watcher *w = arg; grpc_connectivity_state publish_state = w->state; - /* check if the notification is for a stale policy */ - if (w->lb_policy != w->chand->lb_policy) return; - - if (publish_state == GRPC_CHANNEL_SHUTDOWN && w->chand->resolver != NULL) { - publish_state = GRPC_CHANNEL_TRANSIENT_FAILURE; - grpc_resolver_channel_saw_error(exec_ctx, w->chand->resolver); - GRPC_LB_POLICY_UNREF(exec_ctx, w->chand->lb_policy, "channel"); - w->chand->lb_policy = NULL; - } - set_channel_connectivity_state_locked(exec_ctx, w->chand, publish_state, - GRPC_ERROR_REF(error), "lb_changed"); - if (w->state != GRPC_CHANNEL_SHUTDOWN) { - watch_lb_policy(exec_ctx, w->chand, w->lb_policy, w->state); + /* check if the notification is for the latest policy */ + if (w->lb_policy == w->chand->lb_policy) { + if (publish_state == GRPC_CHANNEL_SHUTDOWN && w->chand->resolver != NULL) { + publish_state = GRPC_CHANNEL_TRANSIENT_FAILURE; + grpc_resolver_channel_saw_error(exec_ctx, w->chand->resolver); + GRPC_LB_POLICY_UNREF(exec_ctx, w->chand->lb_policy, "channel"); + w->chand->lb_policy = NULL; + } + set_channel_connectivity_state_locked(exec_ctx, w->chand, publish_state, + GRPC_ERROR_REF(error), "lb_changed"); + if (w->state != GRPC_CHANNEL_SHUTDOWN) { + watch_lb_policy(exec_ctx, w->chand, w->lb_policy, w->state); + } } GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack, "watch_lb_policy"); diff --git a/src/core/lib/transport/connectivity_state.c b/src/core/lib/transport/connectivity_state.c index e884567240d..afe1f6164d7 100644 --- a/src/core/lib/transport/connectivity_state.c +++ b/src/core/lib/transport/connectivity_state.c @@ -102,8 +102,9 @@ grpc_connectivity_state grpc_connectivity_state_check( grpc_connectivity_state grpc_connectivity_state_get( grpc_connectivity_state_tracker *tracker, grpc_error **error) { - grpc_connectivity_state cur =(grpc_connectivity_state) - gpr_atm_no_barrier_load(&tracker->current_state_atm); + grpc_connectivity_state cur = + (grpc_connectivity_state)gpr_atm_no_barrier_load( + &tracker->current_state_atm); if (grpc_connectivity_state_trace) { gpr_log(GPR_DEBUG, "CONWATCH: %p %s: get %s", tracker, tracker->name, grpc_connectivity_state_name(cur)); @@ -122,8 +123,9 @@ bool grpc_connectivity_state_has_watchers( bool grpc_connectivity_state_notify_on_state_change( grpc_exec_ctx *exec_ctx, grpc_connectivity_state_tracker *tracker, grpc_connectivity_state *current, grpc_closure *notify) { - grpc_connectivity_state cur =(grpc_connectivity_state) - gpr_atm_no_barrier_load(&tracker->current_state_atm); + grpc_connectivity_state cur = + (grpc_connectivity_state)gpr_atm_no_barrier_load( + &tracker->current_state_atm); if (grpc_connectivity_state_trace) { if (current == NULL) { gpr_log(GPR_DEBUG, "CONWATCH: %p %s: unsubscribe notify=%p", tracker, @@ -173,8 +175,9 @@ void grpc_connectivity_state_set(grpc_exec_ctx *exec_ctx, grpc_connectivity_state_tracker *tracker, grpc_connectivity_state state, grpc_error *error, const char *reason) { - grpc_connectivity_state cur =(grpc_connectivity_state) - gpr_atm_no_barrier_load(&tracker->current_state_atm); + grpc_connectivity_state cur = + (grpc_connectivity_state)gpr_atm_no_barrier_load( + &tracker->current_state_atm); grpc_connectivity_state_watcher *w; if (grpc_connectivity_state_trace) { const char *error_string = grpc_error_string(error); From c15d25a9dbc44c26b0755bb5078920db57c8afd7 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Feb 2017 21:22:22 -0800 Subject: [PATCH 057/126] Fix substitution --- src/core/lib/channel/http_server_filter.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/lib/channel/http_server_filter.c b/src/core/lib/channel/http_server_filter.c index b475dd6b86d..bb185351a8e 100644 --- a/src/core/lib/channel/http_server_filter.c +++ b/src/core/lib/channel/http_server_filter.c @@ -199,13 +199,16 @@ static grpc_error *server_filter_incoming_metadata(grpc_exec_ctx *exec_ctx, } if (b->idx.named.host != NULL && b->idx.named.authority == NULL) { + grpc_linked_mdelem *el = b->idx.named.host; + grpc_mdelem md = GRPC_MDELEM_REF(el->md); + grpc_metadata_batch_remove(exec_ctx, b, el); add_error( error_name, &error, grpc_metadata_batch_add_head( - exec_ctx, b, b->idx.named.host, - grpc_mdelem_from_slices( - exec_ctx, GRPC_MDSTR_AUTHORITY, - grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.host->md))))); + exec_ctx, b, el, grpc_mdelem_from_slices( + exec_ctx, GRPC_MDSTR_AUTHORITY, + grpc_slice_ref_internal(GRPC_MDVALUE(md))))); + GRPC_MDELEM_UNREF(exec_ctx, md); } if (b->idx.named.authority == NULL) { From f1021678e4de35babec7b09e64a3f1ce2750a841 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Feb 2017 21:29:50 -0800 Subject: [PATCH 058/126] Merge fixup --- src/core/ext/client_channel/client_channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index 907d81866dc..43f7e619cfc 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -584,7 +584,7 @@ static void cc_destroy_channel_elem(grpc_exec_ctx *exec_ctx, } grpc_connectivity_state_destroy(exec_ctx, &chand->state_tracker); grpc_pollset_set_destroy(chand->interested_parties); - grpc_combiner_destroy(exec_ctx, chand->combiner); + GRPC_COMBINER_UNREF(exec_ctx, chand->combiner, "client_channel"); gpr_mu_destroy(&chand->info_mu); } From 07e8fb1775b51d178cb46f81da8518d190c4a066 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Feb 2017 21:36:24 -0800 Subject: [PATCH 059/126] Eliminate CQ freelist --- src/core/lib/iomgr/ev_epoll_linux.c | 11 ------ src/core/lib/iomgr/ev_poll_posix.c | 11 ------ src/core/lib/iomgr/ev_posix.c | 4 --- src/core/lib/iomgr/ev_posix.h | 1 - src/core/lib/iomgr/pollset.h | 3 -- src/core/lib/iomgr/pollset_uv.c | 5 --- src/core/lib/iomgr/pollset_windows.c | 10 ------ src/core/lib/surface/completion_queue.c | 46 +++++-------------------- src/core/lib/surface/completion_queue.h | 3 -- src/core/lib/surface/init.c | 2 -- test/core/internal_api_canaries/iomgr.c | 1 - 11 files changed, 9 insertions(+), 88 deletions(-) diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c index 51842fc2081..fc56843128e 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.c +++ b/src/core/lib/iomgr/ev_epoll_linux.c @@ -1405,16 +1405,6 @@ static void pollset_destroy(grpc_pollset *pollset) { gpr_mu_destroy(&pollset->po.mu); } -static void pollset_reset(grpc_pollset *pollset) { - GPR_ASSERT(pollset->shutting_down); - GPR_ASSERT(!pollset_has_workers(pollset)); - pollset->shutting_down = false; - pollset->finish_shutdown_called = false; - pollset->kicked_without_pollers = false; - pollset->shutdown_done = NULL; - GPR_ASSERT(pollset->po.pi == NULL); -} - static bool maybe_do_workqueue_work(grpc_exec_ctx *exec_ctx, polling_island *pi) { if (gpr_mu_trylock(&pi->workqueue_read_mu)) { @@ -1958,7 +1948,6 @@ static const grpc_event_engine_vtable vtable = { .pollset_init = pollset_init, .pollset_shutdown = pollset_shutdown, - .pollset_reset = pollset_reset, .pollset_destroy = pollset_destroy, .pollset_work = pollset_work, .pollset_kick = pollset_kick, diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index ca129322194..21eb62753ef 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -815,16 +815,6 @@ static void pollset_destroy(grpc_pollset *pollset) { gpr_mu_destroy(&pollset->mu); } -static void pollset_reset(grpc_pollset *pollset) { - GPR_ASSERT(pollset->shutting_down); - GPR_ASSERT(!pollset_has_workers(pollset)); - GPR_ASSERT(pollset->idle_jobs.head == pollset->idle_jobs.tail); - GPR_ASSERT(pollset->fd_count == 0); - pollset->shutting_down = 0; - pollset->called_shutdown = 0; - pollset->kicked_without_pollers = 0; -} - static void pollset_add_fd(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_fd *fd) { gpr_mu_lock(&pollset->mu); @@ -1514,7 +1504,6 @@ static const grpc_event_engine_vtable vtable = { .pollset_init = pollset_init, .pollset_shutdown = pollset_shutdown, - .pollset_reset = pollset_reset, .pollset_destroy = pollset_destroy, .pollset_work = pollset_work, .pollset_kick = pollset_kick, diff --git a/src/core/lib/iomgr/ev_posix.c b/src/core/lib/iomgr/ev_posix.c index 5bb55631d69..95b1d99d757 100644 --- a/src/core/lib/iomgr/ev_posix.c +++ b/src/core/lib/iomgr/ev_posix.c @@ -191,10 +191,6 @@ void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, g_event_engine->pollset_shutdown(exec_ctx, pollset, closure); } -void grpc_pollset_reset(grpc_pollset *pollset) { - g_event_engine->pollset_reset(pollset); -} - void grpc_pollset_destroy(grpc_pollset *pollset) { g_event_engine->pollset_destroy(pollset); } diff --git a/src/core/lib/iomgr/ev_posix.h b/src/core/lib/iomgr/ev_posix.h index a589efdeece..1aea7d61f32 100644 --- a/src/core/lib/iomgr/ev_posix.h +++ b/src/core/lib/iomgr/ev_posix.h @@ -64,7 +64,6 @@ typedef struct grpc_event_engine_vtable { void (*pollset_init)(grpc_pollset *pollset, gpr_mu **mu); void (*pollset_shutdown)(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_closure *closure); - void (*pollset_reset)(grpc_pollset *pollset); void (*pollset_destroy)(grpc_pollset *pollset); grpc_error *(*pollset_work)(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker **worker, gpr_timespec now, diff --git a/src/core/lib/iomgr/pollset.h b/src/core/lib/iomgr/pollset.h index 8d9edc8406b..c4b62a27904 100644 --- a/src/core/lib/iomgr/pollset.h +++ b/src/core/lib/iomgr/pollset.h @@ -58,9 +58,6 @@ void grpc_pollset_init(grpc_pollset *pollset, gpr_mu **mu); * pollset's mutex must be held */ void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_closure *closure); -/** Reset the pollset to its initial state (perhaps with some cached objects); - * must have been previously shutdown */ -void grpc_pollset_reset(grpc_pollset *pollset); void grpc_pollset_destroy(grpc_pollset *pollset); /* Do some work on a pollset. diff --git a/src/core/lib/iomgr/pollset_uv.c b/src/core/lib/iomgr/pollset_uv.c index ed3edeee949..5847771108a 100644 --- a/src/core/lib/iomgr/pollset_uv.c +++ b/src/core/lib/iomgr/pollset_uv.c @@ -97,11 +97,6 @@ void grpc_pollset_destroy(grpc_pollset *pollset) { } } -void grpc_pollset_reset(grpc_pollset *pollset) { - GPR_ASSERT(pollset->shutting_down); - pollset->shutting_down = 0; -} - static void timer_run_cb(uv_timer_t *timer) {} grpc_error *grpc_pollset_work(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 2a45e708df6..9be73a7ce8e 100644 --- a/src/core/lib/iomgr/pollset_windows.c +++ b/src/core/lib/iomgr/pollset_windows.c @@ -117,16 +117,6 @@ void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, void grpc_pollset_destroy(grpc_pollset *pollset) {} -void grpc_pollset_reset(grpc_pollset *pollset) { - GPR_ASSERT(pollset->shutting_down); - GPR_ASSERT( - !has_workers(&pollset->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET)); - pollset->shutting_down = 0; - pollset->is_iocp_worker = 0; - pollset->kicked_without_pollers = 0; - pollset->on_shutdown = NULL; -} - grpc_error *grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker **worker_hdl, gpr_timespec now, gpr_timespec deadline) { diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index 1830842d00b..b80656aa8de 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -96,9 +96,6 @@ struct grpc_completion_queue { #define POLLSET_FROM_CQ(cq) ((grpc_pollset *)(cq + 1)) #define CQ_FROM_POLLSET(ps) (((grpc_completion_queue *)ps) - 1) -static gpr_mu g_freelist_mu; -static grpc_completion_queue *g_freelist; - int grpc_cq_pluck_trace; int grpc_cq_event_timeout_trace; @@ -113,21 +110,6 @@ int grpc_cq_event_timeout_trace; static void on_pollset_shutdown_done(grpc_exec_ctx *exec_ctx, void *cc, grpc_error *error); -void grpc_cq_global_init(void) { gpr_mu_init(&g_freelist_mu); } - -void grpc_cq_global_shutdown(void) { - gpr_mu_destroy(&g_freelist_mu); - while (g_freelist) { - grpc_completion_queue *next = g_freelist->next_free; - grpc_pollset_destroy(POLLSET_FROM_CQ(g_freelist)); -#ifndef NDEBUG - gpr_free(g_freelist->outstanding_tags); -#endif - gpr_free(g_freelist); - g_freelist = next; - } -} - grpc_completion_queue *grpc_completion_queue_create(void *reserved) { grpc_completion_queue *cc; GPR_ASSERT(!reserved); @@ -136,22 +118,12 @@ grpc_completion_queue *grpc_completion_queue_create(void *reserved) { GRPC_API_TRACE("grpc_completion_queue_create(reserved=%p)", 1, (reserved)); - gpr_mu_lock(&g_freelist_mu); - if (g_freelist == NULL) { - gpr_mu_unlock(&g_freelist_mu); - - cc = gpr_malloc(sizeof(grpc_completion_queue) + grpc_pollset_size()); - grpc_pollset_init(POLLSET_FROM_CQ(cc), &cc->mu); + cc = gpr_malloc(sizeof(grpc_completion_queue) + grpc_pollset_size()); + grpc_pollset_init(POLLSET_FROM_CQ(cc), &cc->mu); #ifndef NDEBUG - cc->outstanding_tags = NULL; - cc->outstanding_tag_capacity = 0; + cc->outstanding_tags = NULL; + cc->outstanding_tag_capacity = 0; #endif - } else { - cc = g_freelist; - g_freelist = g_freelist->next_free; - gpr_mu_unlock(&g_freelist_mu); - /* pollset already initialized */ - } /* Initial ref is dropped by grpc_completion_queue_shutdown */ gpr_ref_init(&cc->pending_events, 1); @@ -203,11 +175,11 @@ void grpc_cq_internal_unref(grpc_completion_queue *cc) { #endif if (gpr_unref(&cc->owning_refs)) { GPR_ASSERT(cc->completed_head.next == (uintptr_t)&cc->completed_head); - grpc_pollset_reset(POLLSET_FROM_CQ(cc)); - gpr_mu_lock(&g_freelist_mu); - cc->next_free = g_freelist; - g_freelist = cc; - gpr_mu_unlock(&g_freelist_mu); + grpc_pollset_destroy(POLLSET_FROM_CQ(cc)); +#ifndef NDEBUG + gpr_free(cc->outstanding_tags); +#endif + gpr_free(cc); } } diff --git a/src/core/lib/surface/completion_queue.h b/src/core/lib/surface/completion_queue.h index c1cafba5f2c..5d73dd7216e 100644 --- a/src/core/lib/surface/completion_queue.h +++ b/src/core/lib/surface/completion_queue.h @@ -99,7 +99,4 @@ bool grpc_cq_is_non_listening_server_cq(grpc_completion_queue *cc); void grpc_cq_mark_server_cq(grpc_completion_queue *cc); int grpc_cq_is_server_cq(grpc_completion_queue *cc); -void grpc_cq_global_init(void); -void grpc_cq_global_shutdown(void); - #endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H */ diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index b338ac4c486..91bd014a0e5 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -209,7 +209,6 @@ void grpc_init(void) { grpc_iomgr_init(); grpc_executor_init(); gpr_timers_global_init(); - grpc_cq_global_init(); grpc_handshaker_factory_registry_init(); grpc_security_init(); for (i = 0; i < g_number_of_plugins; i++) { @@ -236,7 +235,6 @@ void grpc_shutdown(void) { gpr_mu_lock(&g_init_mu); if (--g_initializations == 0) { grpc_executor_shutdown(&exec_ctx); - grpc_cq_global_shutdown(); grpc_iomgr_shutdown(&exec_ctx); gpr_timers_global_destroy(); grpc_tracer_shutdown(); diff --git a/test/core/internal_api_canaries/iomgr.c b/test/core/internal_api_canaries/iomgr.c index d73d5c175c9..6fdaf1f9806 100644 --- a/test/core/internal_api_canaries/iomgr.c +++ b/test/core/internal_api_canaries/iomgr.c @@ -105,7 +105,6 @@ static void test_code(void) { grpc_pollset_size(); grpc_pollset_init(NULL, NULL); grpc_pollset_shutdown(NULL, NULL, NULL); - grpc_pollset_reset(NULL); grpc_pollset_destroy(NULL); GRPC_ERROR_UNREF(grpc_pollset_work(NULL, NULL, NULL, gpr_now(GPR_CLOCK_REALTIME), From e7c60e62821bdf8cf980328a36499614458fd052 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 13 Feb 2017 08:56:36 -0800 Subject: [PATCH 060/126] Make latency traces more useful --- test/cpp/microbenchmarks/bm_fullstack.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/test/cpp/microbenchmarks/bm_fullstack.cc b/test/cpp/microbenchmarks/bm_fullstack.cc index 9d883e68d7f..549fdb5bc77 100644 --- a/test/cpp/microbenchmarks/bm_fullstack.cc +++ b/test/cpp/microbenchmarks/bm_fullstack.cc @@ -620,6 +620,7 @@ static void BM_StreamingPingPongMsgs(benchmark::State& state) { } while (state.KeepRunning()) { + GPR_TIMER_SCOPE("BenchmarkCycle", 0); request_rw->Write(send_request, tag(0)); // Start client send response_rw.Read(&recv_request, tag(1)); // Start server recv request_rw->Read(&recv_response, tag(2)); // Start client recv From b3f34b6c2b24cbe3deac6c4efef0978fc9dc7c73 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 13 Feb 2017 10:29:33 -0800 Subject: [PATCH 061/126] Add benchmarks of closures, combiners, exec_ctx primitives --- CMakeLists.txt | 39 ++ Makefile | 48 +++ build.yaml | 17 + test/cpp/microbenchmarks/bm_closure.cc | 341 ++++++++++++++++++ .../generated/sources_and_headers.json | 18 + tools/run_tests/generated/tests.json | 22 ++ 6 files changed, 485 insertions(+) create mode 100644 test/cpp/microbenchmarks/bm_closure.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 101f0ad2ef9..f2ff350e860 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -570,6 +570,9 @@ add_dependencies(buildtests_cxx alarm_cpp_test) add_dependencies(buildtests_cxx async_end2end_test) add_dependencies(buildtests_cxx auth_property_iterator_test) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) +add_dependencies(buildtests_cxx bm_closure) +endif() +if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_cxx bm_fullstack) endif() add_dependencies(buildtests_cxx channel_arguments_test) @@ -7445,6 +7448,42 @@ endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) +add_executable(bm_closure + test/cpp/microbenchmarks/bm_closure.cc + third_party/googletest/src/gtest-all.cc +) + + +target_include_directories(bm_closure + 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 ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(bm_closure + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + benchmark + grpc_test_util + grpc + gpr_test_util + gpr + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif() +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) +if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) + add_executable(bm_fullstack test/cpp/microbenchmarks/bm_fullstack.cc third_party/googletest/src/gtest-all.cc diff --git a/Makefile b/Makefile index 5dde577cca8..d9af4099a30 100644 --- a/Makefile +++ b/Makefile @@ -1043,6 +1043,7 @@ wakeup_fd_cv_test: $(BINDIR)/$(CONFIG)/wakeup_fd_cv_test alarm_cpp_test: $(BINDIR)/$(CONFIG)/alarm_cpp_test async_end2end_test: $(BINDIR)/$(CONFIG)/async_end2end_test auth_property_iterator_test: $(BINDIR)/$(CONFIG)/auth_property_iterator_test +bm_closure: $(BINDIR)/$(CONFIG)/bm_closure bm_fullstack: $(BINDIR)/$(CONFIG)/bm_fullstack channel_arguments_test: $(BINDIR)/$(CONFIG)/channel_arguments_test channel_filter_test: $(BINDIR)/$(CONFIG)/channel_filter_test @@ -1449,6 +1450,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/alarm_cpp_test \ $(BINDIR)/$(CONFIG)/async_end2end_test \ $(BINDIR)/$(CONFIG)/auth_property_iterator_test \ + $(BINDIR)/$(CONFIG)/bm_closure \ $(BINDIR)/$(CONFIG)/bm_fullstack \ $(BINDIR)/$(CONFIG)/channel_arguments_test \ $(BINDIR)/$(CONFIG)/channel_filter_test \ @@ -1553,6 +1555,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/alarm_cpp_test \ $(BINDIR)/$(CONFIG)/async_end2end_test \ $(BINDIR)/$(CONFIG)/auth_property_iterator_test \ + $(BINDIR)/$(CONFIG)/bm_closure \ $(BINDIR)/$(CONFIG)/bm_fullstack \ $(BINDIR)/$(CONFIG)/channel_arguments_test \ $(BINDIR)/$(CONFIG)/channel_filter_test \ @@ -1870,6 +1873,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/async_end2end_test || ( echo test async_end2end_test failed ; exit 1 ) $(E) "[RUN] Testing auth_property_iterator_test" $(Q) $(BINDIR)/$(CONFIG)/auth_property_iterator_test || ( echo test auth_property_iterator_test failed ; exit 1 ) + $(E) "[RUN] Testing bm_closure" + $(Q) $(BINDIR)/$(CONFIG)/bm_closure || ( echo test bm_closure failed ; exit 1 ) $(E) "[RUN] Testing bm_fullstack" $(Q) $(BINDIR)/$(CONFIG)/bm_fullstack || ( echo test bm_fullstack failed ; exit 1 ) $(E) "[RUN] Testing channel_arguments_test" @@ -12389,6 +12394,49 @@ endif endif +BM_CLOSURE_SRC = \ + test/cpp/microbenchmarks/bm_closure.cc \ + +BM_CLOSURE_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(BM_CLOSURE_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/bm_closure: openssl_dep_error + +else + + + + +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)/bm_closure: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/bm_closure: $(PROTOBUF_DEP) $(BM_CLOSURE_OBJS) $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(BM_CLOSURE_OBJS) $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/bm_closure + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/cpp/microbenchmarks/bm_closure.o: $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_bm_closure: $(BM_CLOSURE_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(BM_CLOSURE_OBJS:.o=.dep) +endif +endif + + BM_FULLSTACK_SRC = \ test/cpp/microbenchmarks/bm_fullstack.cc \ diff --git a/build.yaml b/build.yaml index 2fbaa2e2262..42e599e1ada 100644 --- a/build.yaml +++ b/build.yaml @@ -2984,6 +2984,23 @@ targets: - grpc - gpr_test_util - gpr +- name: bm_closure + build: test + language: c++ + src: + - test/cpp/microbenchmarks/bm_closure.cc + deps: + - benchmark + - grpc_test_util + - grpc + - gpr_test_util + - gpr + args: + - --benchmark_min_time=0 + platforms: + - mac + - linux + - posix - name: bm_fullstack build: test language: c++ diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc new file mode 100644 index 00000000000..de354410e52 --- /dev/null +++ b/test/cpp/microbenchmarks/bm_closure.cc @@ -0,0 +1,341 @@ +/* + * + * Copyright 2015, 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. + * + */ + +/* Test various closure related operations */ + +#include + +extern "C" { +#include "src/core/lib/iomgr/closure.h" +#include "src/core/lib/iomgr/combiner.h" +#include "src/core/lib/iomgr/exec_ctx.h" +} + +#include "third_party/benchmark/include/benchmark/benchmark.h" + +static class InitializeStuff { + public: + InitializeStuff() { grpc_init(); } + ~InitializeStuff() { grpc_shutdown(); } +} initialize_stuff; + +static void BM_NoOpExecCtx(benchmark::State& state) { + while (state.KeepRunning()) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_exec_ctx_finish(&exec_ctx); + } +} +BENCHMARK(BM_NoOpExecCtx); + +static void BM_WellFlushed(benchmark::State& state) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + while (state.KeepRunning()) { + grpc_exec_ctx_flush(&exec_ctx); + } + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_WellFlushed); + +static void DoNothing(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {} + +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)); + } +} +BENCHMARK(BM_ClosureInitAgainstExecCtx); + +static void BM_ClosureInitAgainstCombiner(benchmark::State& state) { + grpc_combiner* combiner = grpc_combiner_create(NULL); + grpc_closure c; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + while (state.KeepRunning()) { + benchmark::DoNotOptimize(grpc_closure_init( + &c, DoNothing, NULL, grpc_combiner_scheduler(combiner, false))); + } + GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureInitAgainstCombiner); + +static void BM_ClosureRunOnExecCtx(benchmark::State& state) { + grpc_closure c; + 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_exec_ctx_flush(&exec_ctx); + } + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureRunOnExecCtx); + +static void BM_ClosureCreateAndRun(benchmark::State& state) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + while (state.KeepRunning()) { + grpc_closure_run(&exec_ctx, grpc_closure_create(DoNothing, NULL, + grpc_schedule_on_exec_ctx), + GRPC_ERROR_NONE); + } + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureCreateAndRun); + +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_schedule_on_exec_ctx), + GRPC_ERROR_NONE); + } + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureInitAndRun); + +static void BM_ClosureSchedOnExecCtx(benchmark::State& state) { + grpc_closure c; + 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_exec_ctx_flush(&exec_ctx); + } + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureSchedOnExecCtx); + +static void BM_ClosureSched2OnExecCtx(benchmark::State& state) { + 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_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_exec_ctx_flush(&exec_ctx); + } + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureSched2OnExecCtx); + +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_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_exec_ctx_flush(&exec_ctx); + } + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureSched3OnExecCtx); + +static void BM_ClosureSchedOnCombiner(benchmark::State& state) { + grpc_combiner* combiner = grpc_combiner_create(NULL); + grpc_closure c; + grpc_closure_init(&c, DoNothing, NULL, + grpc_combiner_scheduler(combiner, false)); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + while (state.KeepRunning()) { + grpc_closure_sched(&exec_ctx, &c, GRPC_ERROR_NONE); + grpc_exec_ctx_flush(&exec_ctx); + } + GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureSchedOnCombiner); + +static void BM_ClosureSched2OnCombiner(benchmark::State& state) { + grpc_combiner* combiner = grpc_combiner_create(NULL); + grpc_closure c1; + grpc_closure c2; + grpc_closure_init(&c1, DoNothing, NULL, + grpc_combiner_scheduler(combiner, false)); + grpc_closure_init(&c2, DoNothing, NULL, + grpc_combiner_scheduler(combiner, false)); + 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_exec_ctx_flush(&exec_ctx); + } + GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureSched2OnCombiner); + +static void BM_ClosureSched3OnCombiner(benchmark::State& state) { + grpc_combiner* combiner = grpc_combiner_create(NULL); + grpc_closure c1; + grpc_closure c2; + grpc_closure c3; + grpc_closure_init(&c1, DoNothing, NULL, + grpc_combiner_scheduler(combiner, false)); + grpc_closure_init(&c2, DoNothing, NULL, + grpc_combiner_scheduler(combiner, false)); + grpc_closure_init(&c3, DoNothing, NULL, + grpc_combiner_scheduler(combiner, false)); + 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_exec_ctx_flush(&exec_ctx); + } + GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureSched3OnCombiner); + +static void BM_ClosureSched2OnTwoCombiners(benchmark::State& state) { + grpc_combiner* combiner1 = grpc_combiner_create(NULL); + grpc_combiner* combiner2 = grpc_combiner_create(NULL); + grpc_closure c1; + grpc_closure c2; + grpc_closure_init(&c1, DoNothing, NULL, + grpc_combiner_scheduler(combiner1, false)); + grpc_closure_init(&c2, DoNothing, NULL, + grpc_combiner_scheduler(combiner2, false)); + 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_exec_ctx_flush(&exec_ctx); + } + GRPC_COMBINER_UNREF(&exec_ctx, combiner1, "finished"); + GRPC_COMBINER_UNREF(&exec_ctx, combiner2, "finished"); + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureSched2OnTwoCombiners); + +static void BM_ClosureSched4OnTwoCombiners(benchmark::State& state) { + grpc_combiner* combiner1 = grpc_combiner_create(NULL); + grpc_combiner* combiner2 = grpc_combiner_create(NULL); + grpc_closure c1; + grpc_closure c2; + grpc_closure c3; + grpc_closure c4; + grpc_closure_init(&c1, DoNothing, NULL, + grpc_combiner_scheduler(combiner1, false)); + grpc_closure_init(&c2, DoNothing, NULL, + grpc_combiner_scheduler(combiner2, false)); + grpc_closure_init(&c3, DoNothing, NULL, + grpc_combiner_scheduler(combiner1, false)); + grpc_closure_init(&c4, DoNothing, NULL, + grpc_combiner_scheduler(combiner2, false)); + 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_exec_ctx_flush(&exec_ctx); + } + GRPC_COMBINER_UNREF(&exec_ctx, combiner1, "finished"); + GRPC_COMBINER_UNREF(&exec_ctx, combiner2, "finished"); + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureSched4OnTwoCombiners); + +// Helper that continuously reschedules the same closure against something until +// the benchmark is complete +class Rescheduler { + public: + Rescheduler(benchmark::State& state, grpc_closure_scheduler* scheduler) + : state_(state) { + grpc_closure_init(&closure_, Step, this, scheduler); + } + + void ScheduleFirst(grpc_exec_ctx* exec_ctx) { + 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_ERROR_NONE); + } + + private: + benchmark::State& state_; + grpc_closure closure_; + + 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); + } + } +}; + +static void BM_ClosureReschedOnExecCtx(benchmark::State& state) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + Rescheduler(state, grpc_schedule_on_exec_ctx).ScheduleFirst(&exec_ctx); + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureReschedOnExecCtx); + +static void BM_ClosureReschedOnCombiner(benchmark::State& state) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_combiner* combiner = grpc_combiner_create(NULL); + Rescheduler(state, grpc_combiner_scheduler(combiner, false)) + .ScheduleFirst(&exec_ctx); + grpc_exec_ctx_flush(&exec_ctx); + GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureReschedOnCombiner); + +static void BM_ClosureReschedOnCombinerFinally(benchmark::State& state) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_combiner* combiner = grpc_combiner_create(NULL); + Rescheduler(state, grpc_combiner_finally_scheduler(combiner, false)) + .ScheduleFirstAgainstDifferentScheduler( + &exec_ctx, grpc_combiner_scheduler(combiner, false)); + grpc_exec_ctx_flush(&exec_ctx); + GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_ClosureReschedOnCombinerFinally); + +BENCHMARK_MAIN(); diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 0d5aeb233c4..77799074da4 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -2363,6 +2363,24 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "benchmark", + "gpr", + "gpr_test_util", + "grpc", + "grpc_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "bm_closure", + "src": [ + "test/cpp/microbenchmarks/bm_closure.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "benchmark", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index c193caa26f0..a161e8a670e 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -2469,6 +2469,28 @@ "windows" ] }, + { + "args": [ + "--benchmark_min_time=0" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": false, + "language": "c++", + "name": "bm_closure", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, { "args": [ "--benchmark_min_time=0" From 96f8728b06740dd6b63ab463319b4795209dbec4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 13 Feb 2017 12:39:12 -0800 Subject: [PATCH 062/126] Add a comparison benchmark of acquiring a mutex --- test/cpp/microbenchmarks/bm_closure.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc index de354410e52..dac7d9c6779 100644 --- a/test/cpp/microbenchmarks/bm_closure.cc +++ b/test/cpp/microbenchmarks/bm_closure.cc @@ -170,6 +170,20 @@ static void BM_ClosureSched3OnExecCtx(benchmark::State& state) { } BENCHMARK(BM_ClosureSched3OnExecCtx); +static void BM_AcquireMutex(benchmark::State& state) { + // for comparison with the combiner stuff below + gpr_mu mu; + gpr_mu_init(&mu); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + while (state.KeepRunning()) { + gpr_mu_lock(&mu); + DoNothing(&exec_ctx, NULL, GRPC_ERROR_NONE); + gpr_mu_unlock(&mu); + } + grpc_exec_ctx_finish(&exec_ctx); +} +BENCHMARK(BM_AcquireMutex); + static void BM_ClosureSchedOnCombiner(benchmark::State& state) { grpc_combiner* combiner = grpc_combiner_create(NULL); grpc_closure c; From 4dde8b277d5196962f5c08afd39db94f50242c29 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 13 Feb 2017 12:44:14 -0800 Subject: [PATCH 063/126] Fix stack corruption --- test/cpp/microbenchmarks/bm_closure.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc index dac7d9c6779..80d6610e13b 100644 --- a/test/cpp/microbenchmarks/bm_closure.cc +++ b/test/cpp/microbenchmarks/bm_closure.cc @@ -324,7 +324,8 @@ class Rescheduler { static void BM_ClosureReschedOnExecCtx(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - Rescheduler(state, grpc_schedule_on_exec_ctx).ScheduleFirst(&exec_ctx); + Rescheduler r(state, grpc_schedule_on_exec_ctx); + r.ScheduleFirst(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx); } BENCHMARK(BM_ClosureReschedOnExecCtx); @@ -332,8 +333,8 @@ BENCHMARK(BM_ClosureReschedOnExecCtx); static void BM_ClosureReschedOnCombiner(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_combiner* combiner = grpc_combiner_create(NULL); - Rescheduler(state, grpc_combiner_scheduler(combiner, false)) - .ScheduleFirst(&exec_ctx); + Rescheduler r(state, grpc_combiner_scheduler(combiner, false)); + r.ScheduleFirst(&exec_ctx); grpc_exec_ctx_flush(&exec_ctx); GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); grpc_exec_ctx_finish(&exec_ctx); @@ -343,9 +344,9 @@ BENCHMARK(BM_ClosureReschedOnCombiner); static void BM_ClosureReschedOnCombinerFinally(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_combiner* combiner = grpc_combiner_create(NULL); - Rescheduler(state, grpc_combiner_finally_scheduler(combiner, false)) - .ScheduleFirstAgainstDifferentScheduler( - &exec_ctx, grpc_combiner_scheduler(combiner, false)); + Rescheduler r(state, grpc_combiner_finally_scheduler(combiner, false)); + r.ScheduleFirstAgainstDifferentScheduler( + &exec_ctx, grpc_combiner_scheduler(combiner, false)); grpc_exec_ctx_flush(&exec_ctx); GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); grpc_exec_ctx_finish(&exec_ctx); From f31f0962740cd263dffe383f6bf1b8a56c4ddbdb Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 10 Feb 2017 14:53:58 -0800 Subject: [PATCH 064/126] Use call context to propagare LR costs --- CMakeLists.txt | 46 +- Makefile | 65 +- build.yaml | 19 +- gRPC-Core.podspec | 1 + grpc.def | 1 + grpc.gemspec | 1 + include/grpc++/impl/codegen/server_context.h | 9 +- .../grpc++/test/server_context_test_spouse.h | 14 +- include/grpc/grpc.h | 10 +- .../grpc/load_reporting.h | 44 +- package.xml | 1 + src/core/ext/load_reporting/load_reporting.c | 20 + src/core/ext/load_reporting/load_reporting.h | 17 +- .../load_reporting/load_reporting_filter.c | 18 +- src/core/lib/channel/context.h | 3 + src/core/lib/transport/static_metadata.c | 763 +++++++++--------- src/core/lib/transport/static_metadata.h | 221 +++-- src/cpp/server/server_context.cc | 16 + src/ruby/ext/grpc/rb_grpc_imports.generated.c | 2 + src/ruby/ext/grpc/rb_grpc_imports.generated.h | 3 + test/core/end2end/fuzzers/hpack.dictionary | 2 - test/core/end2end/tests/load_reporting_hook.c | 29 +- .../core/surface/public_headers_must_be_c89.c | 1 + tools/codegen/core/gen_static_metadata.py | 2 - tools/doxygen/Doxyfile.core | 1 + tools/doxygen/Doxyfile.core.internal | 1 + .../generated/sources_and_headers.json | 35 +- .../vcxproj/grpc++_test/grpc++_test.vcxproj | 170 ---- .../grpc++_test/grpc++_test.vcxproj.filters | 35 - vsprojects/vcxproj/grpc/grpc.vcxproj | 1 + vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 3 + .../grpc_test_util/grpc_test_util.vcxproj | 1 + .../grpc_test_util.vcxproj.filters | 3 + .../grpc_unsecure/grpc_unsecure.vcxproj | 1 + .../grpc_unsecure.vcxproj.filters | 3 + .../server_context_test_spouse_test.vcxproj | 3 - 36 files changed, 663 insertions(+), 902 deletions(-) rename src/cpp/test/server_context_test_spouse.cc => include/grpc/load_reporting.h (63%) delete mode 100644 vsprojects/vcxproj/grpc++_test/grpc++_test.vcxproj delete mode 100644 vsprojects/vcxproj/grpc++_test/grpc++_test.vcxproj.filters diff --git a/CMakeLists.txt b/CMakeLists.txt index 51e512c85c4..d232a7cc779 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1086,6 +1086,7 @@ foreach(_hdr include/grpc/grpc.h include/grpc/grpc_posix.h include/grpc/grpc_security_constants.h + include/grpc/load_reporting.h include/grpc/slice.h include/grpc/slice_buffer.h include/grpc/status.h @@ -1363,6 +1364,7 @@ foreach(_hdr include/grpc/grpc.h include/grpc/grpc_posix.h include/grpc/grpc_security_constants.h + include/grpc/load_reporting.h include/grpc/slice.h include/grpc/slice_buffer.h include/grpc/status.h @@ -1585,6 +1587,7 @@ foreach(_hdr include/grpc/grpc.h include/grpc/grpc_posix.h include/grpc/grpc_security_constants.h + include/grpc/load_reporting.h include/grpc/slice.h include/grpc/slice_buffer.h include/grpc/status.h @@ -1906,6 +1909,7 @@ foreach(_hdr include/grpc/grpc.h include/grpc/grpc_posix.h include/grpc/grpc_security_constants.h + include/grpc/load_reporting.h include/grpc/slice.h include/grpc/slice_buffer.h include/grpc/status.h @@ -2558,6 +2562,7 @@ foreach(_hdr include/grpc/grpc.h include/grpc/grpc_posix.h include/grpc/grpc_security_constants.h + include/grpc/load_reporting.h include/grpc/slice.h include/grpc/slice_buffer.h include/grpc/status.h @@ -2699,46 +2704,6 @@ endif() if (gRPC_BUILD_TESTS) -add_library(grpc++_test - src/cpp/test/server_context_test_spouse.cc -) - -if(WIN32 AND MSVC) - set_target_properties(grpc++_test PROPERTIES COMPILE_PDB_NAME "grpc++_test" - COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" - ) - if (gRPC_INSTALL) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_test.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL - ) - endif() -endif() - - -target_include_directories(grpc++_test - 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} - PRIVATE ${BENCHMARK}/include - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest - PRIVATE ${_gRPC_PROTO_GENS_DIR} -) - -target_link_libraries(grpc++_test - ${_gRPC_PROTOBUF_LIBRARIES} - ${_gRPC_ALLTARGETS_LIBRARIES} - grpc++ -) - - -endif (gRPC_BUILD_TESTS) -if (gRPC_BUILD_TESTS) - add_library(grpc++_test_config test/cpp/util/test_config_cc.cc ) @@ -9330,7 +9295,6 @@ target_link_libraries(server_context_test_spouse_test ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} grpc_test_util - grpc++_test grpc++ grpc gpr_test_util diff --git a/Makefile b/Makefile index 125512307c2..4f0797dab69 100644 --- a/Makefile +++ b/Makefile @@ -1257,9 +1257,9 @@ 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.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_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 else -privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_proto_reflection_desc_db.a $(LIBDIR)/$(CONFIG)/libgrpc++_test.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 +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 @@ -2882,6 +2882,7 @@ PUBLIC_HEADERS_C += \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security_constants.h \ + include/grpc/load_reporting.h \ include/grpc/slice.h \ include/grpc/slice_buffer.h \ include/grpc/status.h \ @@ -3163,6 +3164,7 @@ PUBLIC_HEADERS_C += \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security_constants.h \ + include/grpc/load_reporting.h \ include/grpc/slice.h \ include/grpc/slice_buffer.h \ include/grpc/status.h \ @@ -3388,6 +3390,7 @@ PUBLIC_HEADERS_C += \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security_constants.h \ + include/grpc/load_reporting.h \ include/grpc/slice.h \ include/grpc/slice_buffer.h \ include/grpc/status.h \ @@ -3690,6 +3693,7 @@ PUBLIC_HEADERS_C += \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security_constants.h \ + include/grpc/load_reporting.h \ include/grpc/slice.h \ include/grpc/slice_buffer.h \ include/grpc/status.h \ @@ -4340,6 +4344,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security_constants.h \ + include/grpc/load_reporting.h \ include/grpc/slice.h \ include/grpc/slice_buffer.h \ include/grpc/status.h \ @@ -4533,55 +4538,6 @@ $(OBJDIR)/$(CONFIG)/src/cpp/ext/proto_server_reflection.o: $(GENDIR)/src/proto/g $(OBJDIR)/$(CONFIG)/src/cpp/ext/proto_server_reflection_plugin.o: $(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.pb.cc $(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc -LIBGRPC++_TEST_SRC = \ - src/cpp/test/server_context_test_spouse.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBGRPC++_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_TEST_SRC)))) - - -ifeq ($(NO_SECURE),true) - -# You can't build secure libraries if you don't have OpenSSL. - -$(LIBDIR)/$(CONFIG)/libgrpc++_test.a: openssl_dep_error - - -else - -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)/libgrpc++_test.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libgrpc++_test.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(PROTOBUF_DEP) $(LIBGRPC++_TEST_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc++_test.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libgrpc++_test.a $(LIBGRPC++_TEST_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libgrpc++_test.a -endif - - - - -endif - -endif - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(LIBGRPC++_TEST_OBJS:.o=.dep) -endif -endif - - LIBGRPC++_TEST_CONFIG_SRC = \ test/cpp/util/test_config_cc.cc \ @@ -14476,16 +14432,16 @@ $(BINDIR)/$(CONFIG)/server_context_test_spouse_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/server_context_test_spouse_test: $(PROTOBUF_DEP) $(SERVER_CONTEXT_TEST_SPOUSE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++_test.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(BINDIR)/$(CONFIG)/server_context_test_spouse_test: $(PROTOBUF_DEP) $(SERVER_CONTEXT_TEST_SPOUSE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(SERVER_CONTEXT_TEST_SPOUSE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++_test.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/server_context_test_spouse_test + $(Q) $(LDXX) $(LDFLAGS) $(SERVER_CONTEXT_TEST_SPOUSE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/server_context_test_spouse_test endif endif -$(OBJDIR)/$(CONFIG)/test/cpp/test/server_context_test_spouse_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++_test.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(OBJDIR)/$(CONFIG)/test/cpp/test/server_context_test_spouse_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a deps_server_context_test_spouse_test: $(SERVER_CONTEXT_TEST_SPOUSE_TEST_OBJS:.o=.dep) @@ -17798,7 +17754,6 @@ src/cpp/common/secure_create_auth_context.cc: $(OPENSSL_DEP) src/cpp/ext/proto_server_reflection.cc: $(OPENSSL_DEP) src/cpp/ext/proto_server_reflection_plugin.cc: $(OPENSSL_DEP) src/cpp/server/secure_server_credentials.cc: $(OPENSSL_DEP) -src/cpp/test/server_context_test_spouse.cc: $(OPENSSL_DEP) src/csharp/ext/grpc_csharp_ext.c: $(OPENSSL_DEP) test/core/bad_client/bad_client.c: $(OPENSSL_DEP) test/core/bad_ssl/server_common.c: $(OPENSSL_DEP) diff --git a/build.yaml b/build.yaml index 62321fafc26..750bb696d30 100644 --- a/build.yaml +++ b/build.yaml @@ -165,6 +165,7 @@ filegroups: - include/grpc/grpc.h - include/grpc/grpc_posix.h - include/grpc/grpc_security_constants.h + - include/grpc/load_reporting.h - include/grpc/slice.h - include/grpc/slice_buffer.h - include/grpc/status.h @@ -894,6 +895,12 @@ filegroups: language: c++ src: - src/proto/grpc/reflection/v1alpha/reflection.proto +- name: grpc++_test + language: c++ + public_headers: + - include/grpc++/test/server_context_test_spouse.h + deps: + - grpc++ - name: thrift_util language: c++ public_headers: @@ -1140,15 +1147,6 @@ libs: - grpc++ filegroups: - grpc++_reflection_proto -- name: grpc++_test - build: private - language: c++ - headers: - - include/grpc++/test/server_context_test_spouse.h - src: - - src/cpp/test/server_context_test_spouse.cc - deps: - - grpc++ - name: grpc++_test_config build: private language: c++ @@ -3663,11 +3661,12 @@ targets: - test/cpp/test/server_context_test_spouse_test.cc deps: - grpc_test_util - - grpc++_test - grpc++ - grpc - gpr_test_util - gpr + uses: + - grpc++_test - name: server_crash_test gtest: true cpu_cost: 0.1 diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 07b3b2bad53..384ef094f19 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -162,6 +162,7 @@ Pod::Spec.new do |s| 'include/grpc/grpc.h', 'include/grpc/grpc_posix.h', 'include/grpc/grpc_security_constants.h', + 'include/grpc/load_reporting.h', 'include/grpc/slice.h', 'include/grpc/slice_buffer.h', 'include/grpc/status.h', diff --git a/grpc.def b/grpc.def index 5ef59ab9561..e387c8b7125 100644 --- a/grpc.def +++ b/grpc.def @@ -69,6 +69,7 @@ EXPORTS grpc_channel_create_registered_call grpc_call_start_batch grpc_call_get_peer + grpc_call_set_load_reporting_cost_context grpc_census_call_set_context grpc_census_call_get_context grpc_channel_get_target diff --git a/grpc.gemspec b/grpc.gemspec index 335021fdc83..82c9d680801 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -143,6 +143,7 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/grpc.h ) s.files += %w( include/grpc/grpc_posix.h ) s.files += %w( include/grpc/grpc_security_constants.h ) + s.files += %w( include/grpc/load_reporting.h ) s.files += %w( include/grpc/slice.h ) s.files += %w( include/grpc/slice_buffer.h ) s.files += %w( include/grpc/status.h ) diff --git a/include/grpc++/impl/codegen/server_context.h b/include/grpc++/impl/codegen/server_context.h index 8c7fe0809ea..43bbff6ce9c 100644 --- a/include/grpc++/impl/codegen/server_context.h +++ b/include/grpc++/impl/codegen/server_context.h @@ -36,6 +36,10 @@ #include #include +#include + +#include +#include #include #include @@ -43,14 +47,12 @@ #include #include #include -#include struct grpc_metadata; struct grpc_call; struct census_context; namespace grpc { - class ClientContext; template class ServerAsyncReader; @@ -143,6 +145,9 @@ class ServerContext { } void set_compression_algorithm(grpc_compression_algorithm algorithm); + // Set the load reporting costs in \a cost_data for the call. + void SetLoadReportingCosts(const std::vector& cost_data); + std::shared_ptr auth_context() const { if (auth_context_.get() == nullptr) { auth_context_ = CreateAuthContext(call_); diff --git a/include/grpc++/test/server_context_test_spouse.h b/include/grpc++/test/server_context_test_spouse.h index b2482854b50..4cb84e77c19 100644 --- a/include/grpc++/test/server_context_test_spouse.h +++ b/include/grpc++/test/server_context_test_spouse.h @@ -48,10 +48,22 @@ class ServerContextTestSpouse { // Inject client metadata to the ServerContext for the test. The test spouse // must be alive when ServerContext::client_metadata is called. - void AddClientMetadata(const grpc::string& key, const grpc::string& value); + void AddClientMetadata(const grpc::string& key, const grpc::string& value) { + client_metadata_storage_.insert( + std::pair(key, value)); + ctx_->client_metadata_.map()->clear(); + for (auto iter = client_metadata_storage_.begin(); + iter != client_metadata_storage_.end(); ++iter) { + ctx_->client_metadata_.map()->insert( + std::pair(iter->first.c_str(), + iter->second.c_str())); + } + } + std::multimap GetInitialMetadata() const { return ctx_->initial_metadata_; } + std::multimap GetTrailingMetadata() const { return ctx_->trailing_metadata_; } diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 37b823ae1e9..1b33d48c023 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -229,14 +229,20 @@ GRPCAPI grpc_call_error grpc_call_start_batch(grpc_call *call, functionality. Instead, use grpc_auth_context. */ GRPCAPI char *grpc_call_get_peer(grpc_call *call); +struct grpc_load_reporting_cost_context; + +/* Associate costs contained in \a cost_context to \a call. */ +GRPCAPI void grpc_call_set_load_reporting_cost_context( + grpc_call *call, struct grpc_load_reporting_cost_context *context); + struct census_context; -/* Set census context for a call; Must be called before first call to +/** Set census context for a call; Must be called before first call to grpc_call_start_batch(). */ GRPCAPI void grpc_census_call_set_context(grpc_call *call, struct census_context *context); -/* Retrieve the calls current census context. */ +/** Retrieve the calls current census context. */ GRPCAPI struct census_context *grpc_census_call_get_context(grpc_call *call); /** Return a newly allocated string representing the target a channel was diff --git a/src/cpp/test/server_context_test_spouse.cc b/include/grpc/load_reporting.h similarity index 63% rename from src/cpp/test/server_context_test_spouse.cc rename to include/grpc/load_reporting.h index b812d169a52..c833ce5c63b 100644 --- a/src/cpp/test/server_context_test_spouse.cc +++ b/include/grpc/load_reporting.h @@ -1,6 +1,6 @@ /* * - * Copyright 2016, Google Inc. + * Copyright 2017, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,23 +31,33 @@ * */ -#include +#ifndef GRPC_LOAD_REPORTING_H +#define GRPC_LOAD_REPORTING_H -namespace grpc { -namespace testing { +#include +#include -void ServerContextTestSpouse::AddClientMetadata(const grpc::string& key, - const grpc::string& value) { - client_metadata_storage_.insert( - std::pair(key, value)); - ctx_->client_metadata_.map()->clear(); - for (auto iter = client_metadata_storage_.begin(); - iter != client_metadata_storage_.end(); ++iter) { - ctx_->client_metadata_.map()->insert( - std::pair(iter->first.c_str(), - iter->second.c_str())); - } +#ifdef __cplusplus +extern "C" { +#endif + +/** Metadata key for the gRPC LB load balancer token. + * + * The value corresponding to this key is an opaque token that is given to the + * frontend as part of each pick; the frontend sends this token to the backend + * in each request it sends when using that pick. The token is used by the + * backend to verify the request and to allow the backend to report load to the + * gRPC LB system. */ +#define GRPC_LB_TOKEN_MD_KEY "lb-token" + +/** A sequence of values for load reporting purposes */ +typedef struct grpc_load_reporting_cost_context { + grpc_slice *values; + size_t values_count; +} grpc_load_reporting_cost_context; + +#ifdef __cplusplus } +#endif -} // namespace testing -} // namespace grpc +#endif /* GRPC_LOAD_REPORTING_H */ diff --git a/package.xml b/package.xml index 6250c78ddc9..e4db6a7d2e5 100644 --- a/package.xml +++ b/package.xml @@ -152,6 +152,7 @@ + diff --git a/src/core/ext/load_reporting/load_reporting.c b/src/core/ext/load_reporting/load_reporting.c index 37b06a737fb..942aea4fd1c 100644 --- a/src/core/ext/load_reporting/load_reporting.c +++ b/src/core/ext/load_reporting/load_reporting.c @@ -34,14 +34,34 @@ #include #include +#include #include #include #include "src/core/ext/load_reporting/load_reporting.h" #include "src/core/ext/load_reporting/load_reporting_filter.h" #include "src/core/lib/channel/channel_stack_builder.h" +#include "src/core/lib/slice/slice_internal.h" +#include "src/core/lib/surface/call.h" #include "src/core/lib/surface/channel_init.h" +static void destroy_lr_cost_context(void *c) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_load_reporting_cost_context *cost_ctx = c; + for (size_t i = 0; i < cost_ctx->values_count; ++i) { + grpc_slice_unref_internal(&exec_ctx, cost_ctx->values[i]); + } + grpc_exec_ctx_finish(&exec_ctx); + gpr_free(cost_ctx->values); + gpr_free(cost_ctx); +} + +void grpc_call_set_load_reporting_cost_context( + grpc_call *call, grpc_load_reporting_cost_context *ctx) { + grpc_call_context_set(call, GRPC_CONTEXT_LR_COST, ctx, + destroy_lr_cost_context); +} + static bool is_load_reporting_enabled(const grpc_channel_args *a) { if (a == NULL) return false; for (size_t i = 0; i < a->num_args; i++) { diff --git a/src/core/ext/load_reporting/load_reporting.h b/src/core/ext/load_reporting/load_reporting.h index a157844734e..22859a599a7 100644 --- a/src/core/ext/load_reporting/load_reporting.h +++ b/src/core/ext/load_reporting/load_reporting.h @@ -35,23 +35,8 @@ #define GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_H #include -#include "src/core/lib/channel/channel_stack.h" - -/** Metadata key for the gRPC LB load balancer token. - * - * The value corresponding to this key is an opaque token that is given to the - * frontend as part of each pick; the frontend sends this token to the backend - * in each request it sends when using that pick. The token is used by the - * backend to verify the request and to allow the backend to report load to the - * gRPC LB system. */ -#define GRPC_LB_TOKEN_MD_KEY "lb-token" -/** Metadata key for gRPC LB cost reporting. - * - * The value corresponding to this key is an opaque binary blob reported by the - * backend as part of its trailing metadata containing cost information for the - * call. */ -#define GRPC_LB_COST_MD_KEY "lb-cost-bin" +#include "src/core/lib/channel/channel_stack.h" /** Identifiers for the invocation point of the users LR callback */ typedef enum grpc_load_reporting_source { diff --git a/src/core/ext/load_reporting/load_reporting_filter.c b/src/core/ext/load_reporting/load_reporting_filter.c index 8af6191c3b8..7fc88db603a 100644 --- a/src/core/ext/load_reporting/load_reporting_filter.c +++ b/src/core/ext/load_reporting/load_reporting_filter.c @@ -31,11 +31,13 @@ * */ +#include + +#include #include #include #include #include -#include #include "src/core/ext/load_reporting/load_reporting.h" #include "src/core/ext/load_reporting/load_reporting_filter.h" @@ -46,8 +48,6 @@ typedef struct call_data { intptr_t id; /**< an id unique to the call */ - bool have_trailing_md_string; - grpc_slice trailing_md_string; bool have_initial_md_string; grpc_slice initial_md_string; bool have_service_method; @@ -142,9 +142,6 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, if (calld->have_initial_md_string) { grpc_slice_unref_internal(exec_ctx, calld->initial_md_string); } - if (calld->have_trailing_md_string) { - grpc_slice_unref_internal(exec_ctx, calld->trailing_md_string); - } if (calld->have_service_method) { grpc_slice_unref_internal(exec_ctx, calld->service_method); } @@ -201,15 +198,6 @@ static void lr_start_transport_stream_op(grpc_exec_ctx *exec_ctx, /* substitute our callback for the higher callback */ calld->ops_recv_initial_metadata_ready = op->recv_initial_metadata_ready; op->recv_initial_metadata_ready = &calld->on_initial_md_ready; - } else if (op->send_trailing_metadata) { - if (op->send_trailing_metadata->idx.named.lb_cost_bin != NULL) { - calld->trailing_md_string = grpc_slice_ref_internal( - GRPC_MDVALUE(op->send_trailing_metadata->idx.named.lb_cost_bin->md)); - calld->have_trailing_md_string = true; - grpc_metadata_batch_remove( - exec_ctx, op->send_trailing_metadata, - op->send_trailing_metadata->idx.named.lb_cost_bin); - } } grpc_call_next_op(exec_ctx, elem, op); diff --git a/src/core/lib/channel/context.h b/src/core/lib/channel/context.h index 6c931ad28ae..2c1174ce7a1 100644 --- a/src/core/lib/channel/context.h +++ b/src/core/lib/channel/context.h @@ -50,6 +50,9 @@ typedef enum { /// Reserved for traffic_class_context. GRPC_CONTEXT_TRAFFIC, + /// Costs for Load Reporting. + GRPC_CONTEXT_LR_COST, + GRPC_CONTEXT_COUNT } grpc_context_index; diff --git a/src/core/lib/transport/static_metadata.c b/src/core/lib/transport/static_metadata.c index 750711befd7..c13ba230b32 100644 --- a/src/core/lib/transport/static_metadata.c +++ b/src/core/lib/transport/static_metadata.c @@ -55,64 +55,63 @@ static uint8_t g_bytes[] = { 112, 101, 103, 114, 112, 99, 45, 105, 110, 116, 101, 114, 110, 97, 108, 45, 101, 110, 99, 111, 100, 105, 110, 103, 45, 114, 101, 113, 117, 101, 115, 116, 117, 115, 101, 114, 45, 97, 103, 101, 110, 116, 104, 111, 115, - 116, 108, 98, 45, 116, 111, 107, 101, 110, 108, 98, 45, 99, 111, 115, - 116, 45, 98, 105, 110, 103, 114, 112, 99, 45, 116, 105, 109, 101, 111, - 117, 116, 103, 114, 112, 99, 45, 116, 114, 97, 99, 105, 110, 103, 45, - 98, 105, 110, 103, 114, 112, 99, 45, 115, 116, 97, 116, 115, 45, 98, - 105, 110, 103, 114, 112, 99, 46, 119, 97, 105, 116, 95, 102, 111, 114, - 95, 114, 101, 97, 100, 121, 103, 114, 112, 99, 46, 116, 105, 109, 101, - 111, 117, 116, 103, 114, 112, 99, 46, 109, 97, 120, 95, 114, 101, 113, - 117, 101, 115, 116, 95, 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, - 116, 101, 115, 103, 114, 112, 99, 46, 109, 97, 120, 95, 114, 101, 115, - 112, 111, 110, 115, 101, 95, 109, 101, 115, 115, 97, 103, 101, 95, 98, - 121, 116, 101, 115, 47, 103, 114, 112, 99, 46, 108, 98, 46, 118, 49, - 46, 76, 111, 97, 100, 66, 97, 108, 97, 110, 99, 101, 114, 47, 66, - 97, 108, 97, 110, 99, 101, 76, 111, 97, 100, 48, 49, 50, 105, 100, - 101, 110, 116, 105, 116, 121, 103, 122, 105, 112, 100, 101, 102, 108, 97, - 116, 101, 116, 114, 97, 105, 108, 101, 114, 115, 97, 112, 112, 108, 105, - 99, 97, 116, 105, 111, 110, 47, 103, 114, 112, 99, 80, 79, 83, 84, - 50, 48, 48, 52, 48, 52, 104, 116, 116, 112, 104, 116, 116, 112, 115, - 103, 114, 112, 99, 71, 69, 84, 80, 85, 84, 47, 47, 105, 110, 100, - 101, 120, 46, 104, 116, 109, 108, 50, 48, 52, 50, 48, 54, 51, 48, - 52, 52, 48, 48, 53, 48, 48, 97, 99, 99, 101, 112, 116, 45, 99, - 104, 97, 114, 115, 101, 116, 97, 99, 99, 101, 112, 116, 45, 101, 110, - 99, 111, 100, 105, 110, 103, 103, 122, 105, 112, 44, 32, 100, 101, 102, - 108, 97, 116, 101, 97, 99, 99, 101, 112, 116, 45, 108, 97, 110, 103, - 117, 97, 103, 101, 97, 99, 99, 101, 112, 116, 45, 114, 97, 110, 103, - 101, 115, 97, 99, 99, 101, 112, 116, 97, 99, 99, 101, 115, 115, 45, - 99, 111, 110, 116, 114, 111, 108, 45, 97, 108, 108, 111, 119, 45, 111, - 114, 105, 103, 105, 110, 97, 103, 101, 97, 108, 108, 111, 119, 97, 117, - 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 99, 97, 99, 104, - 101, 45, 99, 111, 110, 116, 114, 111, 108, 99, 111, 110, 116, 101, 110, - 116, 45, 100, 105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 99, 111, - 110, 116, 101, 110, 116, 45, 101, 110, 99, 111, 100, 105, 110, 103, 99, - 111, 110, 116, 101, 110, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, - 99, 111, 110, 116, 101, 110, 116, 45, 108, 101, 110, 103, 116, 104, 99, - 111, 110, 116, 101, 110, 116, 45, 108, 111, 99, 97, 116, 105, 111, 110, - 99, 111, 110, 116, 101, 110, 116, 45, 114, 97, 110, 103, 101, 99, 111, - 111, 107, 105, 101, 100, 97, 116, 101, 101, 116, 97, 103, 101, 120, 112, - 101, 99, 116, 101, 120, 112, 105, 114, 101, 115, 102, 114, 111, 109, 105, - 102, 45, 109, 97, 116, 99, 104, 105, 102, 45, 109, 111, 100, 105, 102, - 105, 101, 100, 45, 115, 105, 110, 99, 101, 105, 102, 45, 110, 111, 110, - 101, 45, 109, 97, 116, 99, 104, 105, 102, 45, 114, 97, 110, 103, 101, - 105, 102, 45, 117, 110, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, - 105, 110, 99, 101, 108, 97, 115, 116, 45, 109, 111, 100, 105, 102, 105, - 101, 100, 108, 105, 110, 107, 108, 111, 99, 97, 116, 105, 111, 110, 109, - 97, 120, 45, 102, 111, 114, 119, 97, 114, 100, 115, 112, 114, 111, 120, - 121, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 112, - 114, 111, 120, 121, 45, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, - 105, 111, 110, 114, 97, 110, 103, 101, 114, 101, 102, 101, 114, 101, 114, - 114, 101, 102, 114, 101, 115, 104, 114, 101, 116, 114, 121, 45, 97, 102, - 116, 101, 114, 115, 101, 114, 118, 101, 114, 115, 101, 116, 45, 99, 111, - 111, 107, 105, 101, 115, 116, 114, 105, 99, 116, 45, 116, 114, 97, 110, - 115, 112, 111, 114, 116, 45, 115, 101, 99, 117, 114, 105, 116, 121, 116, - 114, 97, 110, 115, 102, 101, 114, 45, 101, 110, 99, 111, 100, 105, 110, - 103, 118, 97, 114, 121, 118, 105, 97, 119, 119, 119, 45, 97, 117, 116, - 104, 101, 110, 116, 105, 99, 97, 116, 101, 105, 100, 101, 110, 116, 105, - 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, 100, 101, 110, 116, - 105, 116, 121, 44, 103, 122, 105, 112, 100, 101, 102, 108, 97, 116, 101, - 44, 103, 122, 105, 112, 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, - 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112}; + 116, 108, 98, 45, 116, 111, 107, 101, 110, 103, 114, 112, 99, 45, 116, + 105, 109, 101, 111, 117, 116, 103, 114, 112, 99, 45, 116, 114, 97, 99, + 105, 110, 103, 45, 98, 105, 110, 103, 114, 112, 99, 45, 115, 116, 97, + 116, 115, 45, 98, 105, 110, 103, 114, 112, 99, 46, 119, 97, 105, 116, + 95, 102, 111, 114, 95, 114, 101, 97, 100, 121, 103, 114, 112, 99, 46, + 116, 105, 109, 101, 111, 117, 116, 103, 114, 112, 99, 46, 109, 97, 120, + 95, 114, 101, 113, 117, 101, 115, 116, 95, 109, 101, 115, 115, 97, 103, + 101, 95, 98, 121, 116, 101, 115, 103, 114, 112, 99, 46, 109, 97, 120, + 95, 114, 101, 115, 112, 111, 110, 115, 101, 95, 109, 101, 115, 115, 97, + 103, 101, 95, 98, 121, 116, 101, 115, 47, 103, 114, 112, 99, 46, 108, + 98, 46, 118, 49, 46, 76, 111, 97, 100, 66, 97, 108, 97, 110, 99, + 101, 114, 47, 66, 97, 108, 97, 110, 99, 101, 76, 111, 97, 100, 48, + 49, 50, 105, 100, 101, 110, 116, 105, 116, 121, 103, 122, 105, 112, 100, + 101, 102, 108, 97, 116, 101, 116, 114, 97, 105, 108, 101, 114, 115, 97, + 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 103, 114, 112, 99, + 80, 79, 83, 84, 50, 48, 48, 52, 48, 52, 104, 116, 116, 112, 104, + 116, 116, 112, 115, 103, 114, 112, 99, 71, 69, 84, 80, 85, 84, 47, + 47, 105, 110, 100, 101, 120, 46, 104, 116, 109, 108, 50, 48, 52, 50, + 48, 54, 51, 48, 52, 52, 48, 48, 53, 48, 48, 97, 99, 99, 101, + 112, 116, 45, 99, 104, 97, 114, 115, 101, 116, 97, 99, 99, 101, 112, + 116, 45, 101, 110, 99, 111, 100, 105, 110, 103, 103, 122, 105, 112, 44, + 32, 100, 101, 102, 108, 97, 116, 101, 97, 99, 99, 101, 112, 116, 45, + 108, 97, 110, 103, 117, 97, 103, 101, 97, 99, 99, 101, 112, 116, 45, + 114, 97, 110, 103, 101, 115, 97, 99, 99, 101, 112, 116, 97, 99, 99, + 101, 115, 115, 45, 99, 111, 110, 116, 114, 111, 108, 45, 97, 108, 108, + 111, 119, 45, 111, 114, 105, 103, 105, 110, 97, 103, 101, 97, 108, 108, + 111, 119, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, + 99, 97, 99, 104, 101, 45, 99, 111, 110, 116, 114, 111, 108, 99, 111, + 110, 116, 101, 110, 116, 45, 100, 105, 115, 112, 111, 115, 105, 116, 105, + 111, 110, 99, 111, 110, 116, 101, 110, 116, 45, 101, 110, 99, 111, 100, + 105, 110, 103, 99, 111, 110, 116, 101, 110, 116, 45, 108, 97, 110, 103, + 117, 97, 103, 101, 99, 111, 110, 116, 101, 110, 116, 45, 108, 101, 110, + 103, 116, 104, 99, 111, 110, 116, 101, 110, 116, 45, 108, 111, 99, 97, + 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, 45, 114, 97, 110, + 103, 101, 99, 111, 111, 107, 105, 101, 100, 97, 116, 101, 101, 116, 97, + 103, 101, 120, 112, 101, 99, 116, 101, 120, 112, 105, 114, 101, 115, 102, + 114, 111, 109, 105, 102, 45, 109, 97, 116, 99, 104, 105, 102, 45, 109, + 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 105, 102, + 45, 110, 111, 110, 101, 45, 109, 97, 116, 99, 104, 105, 102, 45, 114, + 97, 110, 103, 101, 105, 102, 45, 117, 110, 109, 111, 100, 105, 102, 105, + 101, 100, 45, 115, 105, 110, 99, 101, 108, 97, 115, 116, 45, 109, 111, + 100, 105, 102, 105, 101, 100, 108, 105, 110, 107, 108, 111, 99, 97, 116, + 105, 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, 114, 100, 115, + 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, + 97, 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 111, 114, + 105, 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, 101, 114, 101, 102, + 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, 114, 101, 116, 114, + 121, 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, 101, 114, 115, 101, + 116, 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, 105, 99, 116, 45, + 116, 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, 101, 99, 117, 114, + 105, 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, 45, 101, 110, 99, + 111, 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, 97, 119, 119, 119, + 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 105, 100, + 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, + 100, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100, 101, 102, + 108, 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, 116, 105, + 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112}; static void static_ref(void *unused) {} static void static_unref(grpc_exec_ctx *exec_ctx, void *unused) {} @@ -221,7 +220,6 @@ grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = { {&grpc_static_metadata_vtable, &static_sub_refcnt}, {&grpc_static_metadata_vtable, &static_sub_refcnt}, {&grpc_static_metadata_vtable, &static_sub_refcnt}, - {&grpc_static_metadata_vtable, &static_sub_refcnt}, }; const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { @@ -258,188 +256,186 @@ const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { {.refcount = &grpc_static_metadata_refcounts[15], .data.refcounted = {g_bytes + 166, 8}}, {.refcount = &grpc_static_metadata_refcounts[16], - .data.refcounted = {g_bytes + 174, 11}}, + .data.refcounted = {g_bytes + 174, 12}}, {.refcount = &grpc_static_metadata_refcounts[17], - .data.refcounted = {g_bytes + 185, 12}}, + .data.refcounted = {g_bytes + 186, 16}}, {.refcount = &grpc_static_metadata_refcounts[18], - .data.refcounted = {g_bytes + 197, 16}}, + .data.refcounted = {g_bytes + 202, 14}}, {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 213, 14}}, + .data.refcounted = {g_bytes + 216, 0}}, {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}, + .data.refcounted = {g_bytes + 216, 19}}, {.refcount = &grpc_static_metadata_refcounts[21], - .data.refcounted = {g_bytes + 227, 19}}, + .data.refcounted = {g_bytes + 235, 12}}, {.refcount = &grpc_static_metadata_refcounts[22], - .data.refcounted = {g_bytes + 246, 12}}, + .data.refcounted = {g_bytes + 247, 30}}, {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 258, 30}}, + .data.refcounted = {g_bytes + 277, 31}}, {.refcount = &grpc_static_metadata_refcounts[24], - .data.refcounted = {g_bytes + 288, 31}}, + .data.refcounted = {g_bytes + 308, 36}}, {.refcount = &grpc_static_metadata_refcounts[25], - .data.refcounted = {g_bytes + 319, 36}}, + .data.refcounted = {g_bytes + 344, 1}}, {.refcount = &grpc_static_metadata_refcounts[26], - .data.refcounted = {g_bytes + 355, 1}}, + .data.refcounted = {g_bytes + 345, 1}}, {.refcount = &grpc_static_metadata_refcounts[27], - .data.refcounted = {g_bytes + 356, 1}}, + .data.refcounted = {g_bytes + 346, 1}}, {.refcount = &grpc_static_metadata_refcounts[28], - .data.refcounted = {g_bytes + 357, 1}}, + .data.refcounted = {g_bytes + 347, 8}}, {.refcount = &grpc_static_metadata_refcounts[29], - .data.refcounted = {g_bytes + 358, 8}}, + .data.refcounted = {g_bytes + 355, 4}}, {.refcount = &grpc_static_metadata_refcounts[30], - .data.refcounted = {g_bytes + 366, 4}}, + .data.refcounted = {g_bytes + 359, 7}}, {.refcount = &grpc_static_metadata_refcounts[31], - .data.refcounted = {g_bytes + 370, 7}}, + .data.refcounted = {g_bytes + 366, 8}}, {.refcount = &grpc_static_metadata_refcounts[32], - .data.refcounted = {g_bytes + 377, 8}}, + .data.refcounted = {g_bytes + 374, 16}}, {.refcount = &grpc_static_metadata_refcounts[33], - .data.refcounted = {g_bytes + 385, 16}}, + .data.refcounted = {g_bytes + 390, 4}}, {.refcount = &grpc_static_metadata_refcounts[34], - .data.refcounted = {g_bytes + 401, 4}}, + .data.refcounted = {g_bytes + 394, 3}}, {.refcount = &grpc_static_metadata_refcounts[35], - .data.refcounted = {g_bytes + 405, 3}}, + .data.refcounted = {g_bytes + 397, 3}}, {.refcount = &grpc_static_metadata_refcounts[36], - .data.refcounted = {g_bytes + 408, 3}}, + .data.refcounted = {g_bytes + 400, 4}}, {.refcount = &grpc_static_metadata_refcounts[37], - .data.refcounted = {g_bytes + 411, 4}}, + .data.refcounted = {g_bytes + 404, 5}}, {.refcount = &grpc_static_metadata_refcounts[38], - .data.refcounted = {g_bytes + 415, 5}}, + .data.refcounted = {g_bytes + 409, 4}}, {.refcount = &grpc_static_metadata_refcounts[39], - .data.refcounted = {g_bytes + 420, 4}}, + .data.refcounted = {g_bytes + 413, 3}}, {.refcount = &grpc_static_metadata_refcounts[40], - .data.refcounted = {g_bytes + 424, 3}}, + .data.refcounted = {g_bytes + 416, 3}}, {.refcount = &grpc_static_metadata_refcounts[41], - .data.refcounted = {g_bytes + 427, 3}}, + .data.refcounted = {g_bytes + 419, 1}}, {.refcount = &grpc_static_metadata_refcounts[42], - .data.refcounted = {g_bytes + 430, 1}}, + .data.refcounted = {g_bytes + 420, 11}}, {.refcount = &grpc_static_metadata_refcounts[43], - .data.refcounted = {g_bytes + 431, 11}}, + .data.refcounted = {g_bytes + 431, 3}}, {.refcount = &grpc_static_metadata_refcounts[44], - .data.refcounted = {g_bytes + 442, 3}}, + .data.refcounted = {g_bytes + 434, 3}}, {.refcount = &grpc_static_metadata_refcounts[45], - .data.refcounted = {g_bytes + 445, 3}}, + .data.refcounted = {g_bytes + 437, 3}}, {.refcount = &grpc_static_metadata_refcounts[46], - .data.refcounted = {g_bytes + 448, 3}}, + .data.refcounted = {g_bytes + 440, 3}}, {.refcount = &grpc_static_metadata_refcounts[47], - .data.refcounted = {g_bytes + 451, 3}}, + .data.refcounted = {g_bytes + 443, 3}}, {.refcount = &grpc_static_metadata_refcounts[48], - .data.refcounted = {g_bytes + 454, 3}}, + .data.refcounted = {g_bytes + 446, 14}}, {.refcount = &grpc_static_metadata_refcounts[49], - .data.refcounted = {g_bytes + 457, 14}}, + .data.refcounted = {g_bytes + 460, 15}}, {.refcount = &grpc_static_metadata_refcounts[50], - .data.refcounted = {g_bytes + 471, 15}}, + .data.refcounted = {g_bytes + 475, 13}}, {.refcount = &grpc_static_metadata_refcounts[51], - .data.refcounted = {g_bytes + 486, 13}}, + .data.refcounted = {g_bytes + 488, 15}}, {.refcount = &grpc_static_metadata_refcounts[52], - .data.refcounted = {g_bytes + 499, 15}}, + .data.refcounted = {g_bytes + 503, 13}}, {.refcount = &grpc_static_metadata_refcounts[53], - .data.refcounted = {g_bytes + 514, 13}}, + .data.refcounted = {g_bytes + 516, 6}}, {.refcount = &grpc_static_metadata_refcounts[54], - .data.refcounted = {g_bytes + 527, 6}}, + .data.refcounted = {g_bytes + 522, 27}}, {.refcount = &grpc_static_metadata_refcounts[55], - .data.refcounted = {g_bytes + 533, 27}}, + .data.refcounted = {g_bytes + 549, 3}}, {.refcount = &grpc_static_metadata_refcounts[56], - .data.refcounted = {g_bytes + 560, 3}}, + .data.refcounted = {g_bytes + 552, 5}}, {.refcount = &grpc_static_metadata_refcounts[57], - .data.refcounted = {g_bytes + 563, 5}}, + .data.refcounted = {g_bytes + 557, 13}}, {.refcount = &grpc_static_metadata_refcounts[58], - .data.refcounted = {g_bytes + 568, 13}}, + .data.refcounted = {g_bytes + 570, 13}}, {.refcount = &grpc_static_metadata_refcounts[59], - .data.refcounted = {g_bytes + 581, 13}}, + .data.refcounted = {g_bytes + 583, 19}}, {.refcount = &grpc_static_metadata_refcounts[60], - .data.refcounted = {g_bytes + 594, 19}}, + .data.refcounted = {g_bytes + 602, 16}}, {.refcount = &grpc_static_metadata_refcounts[61], - .data.refcounted = {g_bytes + 613, 16}}, + .data.refcounted = {g_bytes + 618, 16}}, {.refcount = &grpc_static_metadata_refcounts[62], - .data.refcounted = {g_bytes + 629, 16}}, + .data.refcounted = {g_bytes + 634, 14}}, {.refcount = &grpc_static_metadata_refcounts[63], - .data.refcounted = {g_bytes + 645, 14}}, + .data.refcounted = {g_bytes + 648, 16}}, {.refcount = &grpc_static_metadata_refcounts[64], - .data.refcounted = {g_bytes + 659, 16}}, + .data.refcounted = {g_bytes + 664, 13}}, {.refcount = &grpc_static_metadata_refcounts[65], - .data.refcounted = {g_bytes + 675, 13}}, + .data.refcounted = {g_bytes + 677, 6}}, {.refcount = &grpc_static_metadata_refcounts[66], - .data.refcounted = {g_bytes + 688, 6}}, + .data.refcounted = {g_bytes + 683, 4}}, {.refcount = &grpc_static_metadata_refcounts[67], - .data.refcounted = {g_bytes + 694, 4}}, + .data.refcounted = {g_bytes + 687, 4}}, {.refcount = &grpc_static_metadata_refcounts[68], - .data.refcounted = {g_bytes + 698, 4}}, + .data.refcounted = {g_bytes + 691, 6}}, {.refcount = &grpc_static_metadata_refcounts[69], - .data.refcounted = {g_bytes + 702, 6}}, + .data.refcounted = {g_bytes + 697, 7}}, {.refcount = &grpc_static_metadata_refcounts[70], - .data.refcounted = {g_bytes + 708, 7}}, + .data.refcounted = {g_bytes + 704, 4}}, {.refcount = &grpc_static_metadata_refcounts[71], - .data.refcounted = {g_bytes + 715, 4}}, + .data.refcounted = {g_bytes + 708, 8}}, {.refcount = &grpc_static_metadata_refcounts[72], - .data.refcounted = {g_bytes + 719, 8}}, + .data.refcounted = {g_bytes + 716, 17}}, {.refcount = &grpc_static_metadata_refcounts[73], - .data.refcounted = {g_bytes + 727, 17}}, + .data.refcounted = {g_bytes + 733, 13}}, {.refcount = &grpc_static_metadata_refcounts[74], - .data.refcounted = {g_bytes + 744, 13}}, + .data.refcounted = {g_bytes + 746, 8}}, {.refcount = &grpc_static_metadata_refcounts[75], - .data.refcounted = {g_bytes + 757, 8}}, + .data.refcounted = {g_bytes + 754, 19}}, {.refcount = &grpc_static_metadata_refcounts[76], - .data.refcounted = {g_bytes + 765, 19}}, + .data.refcounted = {g_bytes + 773, 13}}, {.refcount = &grpc_static_metadata_refcounts[77], - .data.refcounted = {g_bytes + 784, 13}}, + .data.refcounted = {g_bytes + 786, 4}}, {.refcount = &grpc_static_metadata_refcounts[78], - .data.refcounted = {g_bytes + 797, 4}}, + .data.refcounted = {g_bytes + 790, 8}}, {.refcount = &grpc_static_metadata_refcounts[79], - .data.refcounted = {g_bytes + 801, 8}}, + .data.refcounted = {g_bytes + 798, 12}}, {.refcount = &grpc_static_metadata_refcounts[80], - .data.refcounted = {g_bytes + 809, 12}}, + .data.refcounted = {g_bytes + 810, 18}}, {.refcount = &grpc_static_metadata_refcounts[81], - .data.refcounted = {g_bytes + 821, 18}}, + .data.refcounted = {g_bytes + 828, 19}}, {.refcount = &grpc_static_metadata_refcounts[82], - .data.refcounted = {g_bytes + 839, 19}}, + .data.refcounted = {g_bytes + 847, 5}}, {.refcount = &grpc_static_metadata_refcounts[83], - .data.refcounted = {g_bytes + 858, 5}}, + .data.refcounted = {g_bytes + 852, 7}}, {.refcount = &grpc_static_metadata_refcounts[84], - .data.refcounted = {g_bytes + 863, 7}}, + .data.refcounted = {g_bytes + 859, 7}}, {.refcount = &grpc_static_metadata_refcounts[85], - .data.refcounted = {g_bytes + 870, 7}}, + .data.refcounted = {g_bytes + 866, 11}}, {.refcount = &grpc_static_metadata_refcounts[86], - .data.refcounted = {g_bytes + 877, 11}}, + .data.refcounted = {g_bytes + 877, 6}}, {.refcount = &grpc_static_metadata_refcounts[87], - .data.refcounted = {g_bytes + 888, 6}}, + .data.refcounted = {g_bytes + 883, 10}}, {.refcount = &grpc_static_metadata_refcounts[88], - .data.refcounted = {g_bytes + 894, 10}}, + .data.refcounted = {g_bytes + 893, 25}}, {.refcount = &grpc_static_metadata_refcounts[89], - .data.refcounted = {g_bytes + 904, 25}}, + .data.refcounted = {g_bytes + 918, 17}}, {.refcount = &grpc_static_metadata_refcounts[90], - .data.refcounted = {g_bytes + 929, 17}}, + .data.refcounted = {g_bytes + 935, 4}}, {.refcount = &grpc_static_metadata_refcounts[91], - .data.refcounted = {g_bytes + 946, 4}}, + .data.refcounted = {g_bytes + 939, 3}}, {.refcount = &grpc_static_metadata_refcounts[92], - .data.refcounted = {g_bytes + 950, 3}}, + .data.refcounted = {g_bytes + 942, 16}}, {.refcount = &grpc_static_metadata_refcounts[93], - .data.refcounted = {g_bytes + 953, 16}}, + .data.refcounted = {g_bytes + 958, 16}}, {.refcount = &grpc_static_metadata_refcounts[94], - .data.refcounted = {g_bytes + 969, 16}}, + .data.refcounted = {g_bytes + 974, 13}}, {.refcount = &grpc_static_metadata_refcounts[95], - .data.refcounted = {g_bytes + 985, 13}}, + .data.refcounted = {g_bytes + 987, 12}}, {.refcount = &grpc_static_metadata_refcounts[96], - .data.refcounted = {g_bytes + 998, 12}}, - {.refcount = &grpc_static_metadata_refcounts[97], - .data.refcounted = {g_bytes + 1010, 21}}, + .data.refcounted = {g_bytes + 999, 21}}, }; uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8}; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8}; static const int8_t elems_r[] = { - 10, 8, -3, 0, 9, 21, -76, 22, 0, 10, -7, 20, 0, 19, 18, 17, - 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -49, -50, 16, -52, -53, -54, -54, -55, -56, -57, 0, 38, 37, 36, 35, - 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, - 18, 17, 16, 15, 14, 13, 12, 15, 14, 13, 12, 11, 10, 9, 8, 0}; + 10, 8, -3, 0, 9, 21, -75, 22, 0, 10, -7, 20, 0, 19, 18, 17, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -48, -49, 16, -51, -52, -53, -54, -54, -55, -56, -57, 0, 37, 36, 35, 34, + 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, + 17, 16, 15, 14, 13, 12, 11, 14, 13, 12, 11, 10, 9, 8, 0}; static uint32_t elems_phash(uint32_t i) { - i -= 42; - uint32_t x = i % 96; - uint32_t y = i / 96; + i -= 41; + uint32_t x = i % 95; + uint32_t y = i / 95; uint32_t h = x; if (y < GPR_ARRAY_SIZE(elems_r)) { uint32_t delta = (uint32_t)elems_r[y]; @@ -449,30 +445,29 @@ static uint32_t elems_phash(uint32_t i) { } static const uint16_t elem_keys[] = { - 1009, 1010, 1011, 240, 241, 242, 243, 244, 138, 139, 42, 43, - 429, 430, 431, 911, 912, 913, 712, 713, 1098, 522, 714, 1294, - 1392, 1490, 1588, 4822, 4920, 4951, 5116, 5214, 5312, 1111, 5410, 5508, - 5606, 5704, 5802, 5900, 5998, 6096, 6194, 6292, 6390, 6488, 6586, 6684, - 6782, 6880, 6978, 7076, 7174, 7272, 7370, 7468, 7566, 7664, 7762, 7860, - 7958, 8056, 8154, 8252, 8350, 1074, 1075, 1076, 1077, 8448, 8546, 8644, - 8742, 8840, 8938, 9036, 9134, 314, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 132, 231, 232, 0, 0, 0, 0, 0, + 998, 999, 1000, 237, 238, 239, 240, 241, 136, 137, 41, 42, + 424, 425, 426, 901, 902, 903, 704, 705, 1086, 516, 706, 1280, + 1377, 1474, 4675, 4772, 4803, 4966, 5063, 5160, 5257, 1099, 5354, 5451, + 5548, 5645, 5742, 5839, 5936, 6033, 6130, 6227, 6324, 6421, 6518, 6615, + 6712, 6809, 6906, 7003, 7100, 7197, 7294, 7391, 7488, 7585, 7682, 7779, + 7876, 7973, 8070, 8167, 8264, 1063, 1064, 1065, 1066, 8361, 8458, 8555, + 8652, 8749, 8846, 8943, 310, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 130, 228, 229, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0}; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static const uint8_t elem_idxs[] = { - 74, 77, 75, 19, 20, 21, 22, 23, 15, 16, 17, 18, 11, 12, 13, - 3, 4, 5, 0, 1, 41, 6, 2, 70, 48, 55, 56, 24, 25, 26, - 27, 28, 29, 7, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 57, 58, 59, - 60, 61, 62, 63, 64, 76, 78, 79, 80, 65, 66, 67, 68, 69, 71, - 72, 73, 14, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 8, 9, 10}; + 73, 76, 74, 19, 20, 21, 22, 23, 15, 16, 17, 18, 11, 12, 13, + 3, 4, 5, 0, 1, 41, 6, 2, 69, 48, 55, 24, 25, 26, 27, + 28, 29, 30, 7, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, + 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 75, 77, 78, 79, 65, 66, 67, 68, 70, 71, + 72, 14, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 8, 9, 10}; grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) { if (a == -1 || b == -1) return GRPC_MDNULL; - uint32_t k = (uint32_t)(a * 98 + b); + uint32_t k = (uint32_t)(a * 97 + b); uint32_t h = elems_phash(k); return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k ? GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[elem_idxs[h]], @@ -483,328 +478,324 @@ grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) { grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { {{.refcount = &grpc_static_metadata_refcounts[7], .data.refcounted = {g_bytes + 50, 11}}, - {.refcount = &grpc_static_metadata_refcounts[26], - .data.refcounted = {g_bytes + 355, 1}}}, + {.refcount = &grpc_static_metadata_refcounts[25], + .data.refcounted = {g_bytes + 344, 1}}}, {{.refcount = &grpc_static_metadata_refcounts[7], .data.refcounted = {g_bytes + 50, 11}}, - {.refcount = &grpc_static_metadata_refcounts[27], - .data.refcounted = {g_bytes + 356, 1}}}, + {.refcount = &grpc_static_metadata_refcounts[26], + .data.refcounted = {g_bytes + 345, 1}}}, {{.refcount = &grpc_static_metadata_refcounts[7], .data.refcounted = {g_bytes + 50, 11}}, + {.refcount = &grpc_static_metadata_refcounts[27], + .data.refcounted = {g_bytes + 346, 1}}}, + {{.refcount = &grpc_static_metadata_refcounts[9], + .data.refcounted = {g_bytes + 77, 13}}, {.refcount = &grpc_static_metadata_refcounts[28], - .data.refcounted = {g_bytes + 357, 1}}}, + .data.refcounted = {g_bytes + 347, 8}}}, {{.refcount = &grpc_static_metadata_refcounts[9], .data.refcounted = {g_bytes + 77, 13}}, {.refcount = &grpc_static_metadata_refcounts[29], - .data.refcounted = {g_bytes + 358, 8}}}, + .data.refcounted = {g_bytes + 355, 4}}}, {{.refcount = &grpc_static_metadata_refcounts[9], .data.refcounted = {g_bytes + 77, 13}}, {.refcount = &grpc_static_metadata_refcounts[30], - .data.refcounted = {g_bytes + 366, 4}}}, - {{.refcount = &grpc_static_metadata_refcounts[9], - .data.refcounted = {g_bytes + 77, 13}}, - {.refcount = &grpc_static_metadata_refcounts[31], - .data.refcounted = {g_bytes + 370, 7}}}, + .data.refcounted = {g_bytes + 359, 7}}}, {{.refcount = &grpc_static_metadata_refcounts[5], .data.refcounted = {g_bytes + 36, 2}}, - {.refcount = &grpc_static_metadata_refcounts[32], - .data.refcounted = {g_bytes + 377, 8}}}, + {.refcount = &grpc_static_metadata_refcounts[31], + .data.refcounted = {g_bytes + 366, 8}}}, {{.refcount = &grpc_static_metadata_refcounts[11], .data.refcounted = {g_bytes + 110, 12}}, - {.refcount = &grpc_static_metadata_refcounts[33], - .data.refcounted = {g_bytes + 385, 16}}}, + {.refcount = &grpc_static_metadata_refcounts[32], + .data.refcounted = {g_bytes + 374, 16}}}, {{.refcount = &grpc_static_metadata_refcounts[1], .data.refcounted = {g_bytes + 5, 7}}, - {.refcount = &grpc_static_metadata_refcounts[34], - .data.refcounted = {g_bytes + 401, 4}}}, + {.refcount = &grpc_static_metadata_refcounts[33], + .data.refcounted = {g_bytes + 390, 4}}}, {{.refcount = &grpc_static_metadata_refcounts[2], .data.refcounted = {g_bytes + 12, 7}}, - {.refcount = &grpc_static_metadata_refcounts[35], - .data.refcounted = {g_bytes + 405, 3}}}, + {.refcount = &grpc_static_metadata_refcounts[34], + .data.refcounted = {g_bytes + 394, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[2], .data.refcounted = {g_bytes + 12, 7}}, + {.refcount = &grpc_static_metadata_refcounts[35], + .data.refcounted = {g_bytes + 397, 3}}}, + {{.refcount = &grpc_static_metadata_refcounts[4], + .data.refcounted = {g_bytes + 29, 7}}, {.refcount = &grpc_static_metadata_refcounts[36], - .data.refcounted = {g_bytes + 408, 3}}}, + .data.refcounted = {g_bytes + 400, 4}}}, {{.refcount = &grpc_static_metadata_refcounts[4], .data.refcounted = {g_bytes + 29, 7}}, {.refcount = &grpc_static_metadata_refcounts[37], - .data.refcounted = {g_bytes + 411, 4}}}, + .data.refcounted = {g_bytes + 404, 5}}}, {{.refcount = &grpc_static_metadata_refcounts[4], .data.refcounted = {g_bytes + 29, 7}}, {.refcount = &grpc_static_metadata_refcounts[38], - .data.refcounted = {g_bytes + 415, 5}}}, - {{.refcount = &grpc_static_metadata_refcounts[4], - .data.refcounted = {g_bytes + 29, 7}}, - {.refcount = &grpc_static_metadata_refcounts[39], - .data.refcounted = {g_bytes + 420, 4}}}, + .data.refcounted = {g_bytes + 409, 4}}}, {{.refcount = &grpc_static_metadata_refcounts[3], .data.refcounted = {g_bytes + 19, 10}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[1], .data.refcounted = {g_bytes + 5, 7}}, - {.refcount = &grpc_static_metadata_refcounts[40], - .data.refcounted = {g_bytes + 424, 3}}}, + {.refcount = &grpc_static_metadata_refcounts[39], + .data.refcounted = {g_bytes + 413, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[1], .data.refcounted = {g_bytes + 5, 7}}, - {.refcount = &grpc_static_metadata_refcounts[41], - .data.refcounted = {g_bytes + 427, 3}}}, + {.refcount = &grpc_static_metadata_refcounts[40], + .data.refcounted = {g_bytes + 416, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[0], .data.refcounted = {g_bytes + 0, 5}}, - {.refcount = &grpc_static_metadata_refcounts[42], - .data.refcounted = {g_bytes + 430, 1}}}, + {.refcount = &grpc_static_metadata_refcounts[41], + .data.refcounted = {g_bytes + 419, 1}}}, {{.refcount = &grpc_static_metadata_refcounts[0], .data.refcounted = {g_bytes + 0, 5}}, + {.refcount = &grpc_static_metadata_refcounts[42], + .data.refcounted = {g_bytes + 420, 11}}}, + {{.refcount = &grpc_static_metadata_refcounts[2], + .data.refcounted = {g_bytes + 12, 7}}, {.refcount = &grpc_static_metadata_refcounts[43], - .data.refcounted = {g_bytes + 431, 11}}}, + .data.refcounted = {g_bytes + 431, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[2], .data.refcounted = {g_bytes + 12, 7}}, {.refcount = &grpc_static_metadata_refcounts[44], - .data.refcounted = {g_bytes + 442, 3}}}, + .data.refcounted = {g_bytes + 434, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[2], .data.refcounted = {g_bytes + 12, 7}}, {.refcount = &grpc_static_metadata_refcounts[45], - .data.refcounted = {g_bytes + 445, 3}}}, + .data.refcounted = {g_bytes + 437, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[2], .data.refcounted = {g_bytes + 12, 7}}, {.refcount = &grpc_static_metadata_refcounts[46], - .data.refcounted = {g_bytes + 448, 3}}}, + .data.refcounted = {g_bytes + 440, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[2], .data.refcounted = {g_bytes + 12, 7}}, {.refcount = &grpc_static_metadata_refcounts[47], - .data.refcounted = {g_bytes + 451, 3}}}, - {{.refcount = &grpc_static_metadata_refcounts[2], - .data.refcounted = {g_bytes + 12, 7}}, - {.refcount = &grpc_static_metadata_refcounts[48], - .data.refcounted = {g_bytes + 454, 3}}}, + .data.refcounted = {g_bytes + 443, 3}}}, + {{.refcount = &grpc_static_metadata_refcounts[48], + .data.refcounted = {g_bytes + 446, 14}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[49], - .data.refcounted = {g_bytes + 457, 14}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[50], - .data.refcounted = {g_bytes + 471, 15}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[50], - .data.refcounted = {g_bytes + 471, 15}}, - {.refcount = &grpc_static_metadata_refcounts[51], - .data.refcounted = {g_bytes + 486, 13}}}, + .data.refcounted = {g_bytes + 460, 15}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, + {{.refcount = &grpc_static_metadata_refcounts[49], + .data.refcounted = {g_bytes + 460, 15}}, + {.refcount = &grpc_static_metadata_refcounts[50], + .data.refcounted = {g_bytes + 475, 13}}}, + {{.refcount = &grpc_static_metadata_refcounts[51], + .data.refcounted = {g_bytes + 488, 15}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[52], - .data.refcounted = {g_bytes + 499, 15}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 503, 13}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[53], - .data.refcounted = {g_bytes + 514, 13}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 516, 6}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[54], - .data.refcounted = {g_bytes + 527, 6}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 522, 27}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[55], - .data.refcounted = {g_bytes + 533, 27}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 549, 3}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[56], - .data.refcounted = {g_bytes + 560, 3}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 552, 5}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[57], - .data.refcounted = {g_bytes + 563, 5}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 557, 13}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[58], - .data.refcounted = {g_bytes + 568, 13}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 570, 13}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[59], - .data.refcounted = {g_bytes + 581, 13}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 583, 19}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[60], - .data.refcounted = {g_bytes + 594, 19}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 602, 16}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[61], - .data.refcounted = {g_bytes + 613, 16}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 618, 16}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[62], - .data.refcounted = {g_bytes + 629, 16}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 634, 14}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[63], - .data.refcounted = {g_bytes + 645, 14}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 648, 16}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[64], - .data.refcounted = {g_bytes + 659, 16}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[65], - .data.refcounted = {g_bytes + 675, 13}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 664, 13}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[11], .data.refcounted = {g_bytes + 110, 12}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, + {{.refcount = &grpc_static_metadata_refcounts[65], + .data.refcounted = {g_bytes + 677, 6}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[66], - .data.refcounted = {g_bytes + 688, 6}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 683, 4}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[67], - .data.refcounted = {g_bytes + 694, 4}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 687, 4}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[68], - .data.refcounted = {g_bytes + 698, 4}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 691, 6}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[69], - .data.refcounted = {g_bytes + 702, 6}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 697, 7}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[70], - .data.refcounted = {g_bytes + 708, 7}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[71], - .data.refcounted = {g_bytes + 715, 4}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 704, 4}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[14], .data.refcounted = {g_bytes + 162, 4}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, + {{.refcount = &grpc_static_metadata_refcounts[71], + .data.refcounted = {g_bytes + 708, 8}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[72], - .data.refcounted = {g_bytes + 719, 8}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 716, 17}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[73], - .data.refcounted = {g_bytes + 727, 17}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 733, 13}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[74], - .data.refcounted = {g_bytes + 744, 13}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 746, 8}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[75], - .data.refcounted = {g_bytes + 757, 8}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 754, 19}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[76], - .data.refcounted = {g_bytes + 765, 19}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[77], - .data.refcounted = {g_bytes + 784, 13}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 773, 13}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[15], .data.refcounted = {g_bytes + 166, 8}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[16], - .data.refcounted = {g_bytes + 174, 11}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, + {{.refcount = &grpc_static_metadata_refcounts[77], + .data.refcounted = {g_bytes + 786, 4}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[78], - .data.refcounted = {g_bytes + 797, 4}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 790, 8}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[79], - .data.refcounted = {g_bytes + 801, 8}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 798, 12}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[80], - .data.refcounted = {g_bytes + 809, 12}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 810, 18}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[81], - .data.refcounted = {g_bytes + 821, 18}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 828, 19}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[82], - .data.refcounted = {g_bytes + 839, 19}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 847, 5}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[83], - .data.refcounted = {g_bytes + 858, 5}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 852, 7}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[84], - .data.refcounted = {g_bytes + 863, 7}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 859, 7}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[85], - .data.refcounted = {g_bytes + 870, 7}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 866, 11}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[86], - .data.refcounted = {g_bytes + 877, 11}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 877, 6}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[87], - .data.refcounted = {g_bytes + 888, 6}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 883, 10}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[88], - .data.refcounted = {g_bytes + 894, 10}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 893, 25}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[89], - .data.refcounted = {g_bytes + 904, 25}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[90], - .data.refcounted = {g_bytes + 929, 17}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 918, 17}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[13], .data.refcounted = {g_bytes + 152, 10}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, + {{.refcount = &grpc_static_metadata_refcounts[90], + .data.refcounted = {g_bytes + 935, 4}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[91], - .data.refcounted = {g_bytes + 946, 4}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 939, 3}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[92], - .data.refcounted = {g_bytes + 950, 3}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[93], - .data.refcounted = {g_bytes + 953, 16}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 227, 0}}}, + .data.refcounted = {g_bytes + 942, 16}}, + {.refcount = &grpc_static_metadata_refcounts[19], + .data.refcounted = {g_bytes + 216, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[29], - .data.refcounted = {g_bytes + 358, 8}}}, + {.refcount = &grpc_static_metadata_refcounts[28], + .data.refcounted = {g_bytes + 347, 8}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[31], - .data.refcounted = {g_bytes + 370, 7}}}, + {.refcount = &grpc_static_metadata_refcounts[30], + .data.refcounted = {g_bytes + 359, 7}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[94], - .data.refcounted = {g_bytes + 969, 16}}}, + {.refcount = &grpc_static_metadata_refcounts[93], + .data.refcounted = {g_bytes + 958, 16}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[30], - .data.refcounted = {g_bytes + 366, 4}}}, + {.refcount = &grpc_static_metadata_refcounts[29], + .data.refcounted = {g_bytes + 355, 4}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[95], - .data.refcounted = {g_bytes + 985, 13}}}, + {.refcount = &grpc_static_metadata_refcounts[94], + .data.refcounted = {g_bytes + 974, 13}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[96], - .data.refcounted = {g_bytes + 998, 12}}}, + {.refcount = &grpc_static_metadata_refcounts[95], + .data.refcounted = {g_bytes + 987, 12}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[97], - .data.refcounted = {g_bytes + 1010, 21}}}, + {.refcount = &grpc_static_metadata_refcounts[96], + .data.refcounted = {g_bytes + 999, 21}}}, }; -const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 74, 75, 76, - 77, 78, 79, 80}; +const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 73, 74, 75, + 76, 77, 78, 79}; diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index 7649ccd5d2d..f9600ee2e4e 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -44,7 +44,7 @@ #include "src/core/lib/transport/metadata.h" -#define GRPC_STATIC_MDSTR_COUNT 98 +#define GRPC_STATIC_MDSTR_COUNT 97 extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; /* ":path" */ #define GRPC_MDSTR_PATH (grpc_static_slice_table[0]) @@ -78,174 +78,172 @@ extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; #define GRPC_MDSTR_HOST (grpc_static_slice_table[14]) /* "lb-token" */ #define GRPC_MDSTR_LB_TOKEN (grpc_static_slice_table[15]) -/* "lb-cost-bin" */ -#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[16]) /* "grpc-timeout" */ -#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table[17]) +#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table[16]) /* "grpc-tracing-bin" */ -#define GRPC_MDSTR_GRPC_TRACING_BIN (grpc_static_slice_table[18]) +#define GRPC_MDSTR_GRPC_TRACING_BIN (grpc_static_slice_table[17]) /* "grpc-stats-bin" */ -#define GRPC_MDSTR_GRPC_STATS_BIN (grpc_static_slice_table[19]) +#define GRPC_MDSTR_GRPC_STATS_BIN (grpc_static_slice_table[18]) /* "" */ -#define GRPC_MDSTR_EMPTY (grpc_static_slice_table[20]) +#define GRPC_MDSTR_EMPTY (grpc_static_slice_table[19]) /* "grpc.wait_for_ready" */ -#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table[21]) +#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table[20]) /* "grpc.timeout" */ -#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table[22]) +#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table[21]) /* "grpc.max_request_message_bytes" */ #define GRPC_MDSTR_GRPC_DOT_MAX_REQUEST_MESSAGE_BYTES \ - (grpc_static_slice_table[23]) + (grpc_static_slice_table[22]) /* "grpc.max_response_message_bytes" */ #define GRPC_MDSTR_GRPC_DOT_MAX_RESPONSE_MESSAGE_BYTES \ - (grpc_static_slice_table[24]) + (grpc_static_slice_table[23]) /* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \ - (grpc_static_slice_table[25]) + (grpc_static_slice_table[24]) /* "0" */ -#define GRPC_MDSTR_0 (grpc_static_slice_table[26]) +#define GRPC_MDSTR_0 (grpc_static_slice_table[25]) /* "1" */ -#define GRPC_MDSTR_1 (grpc_static_slice_table[27]) +#define GRPC_MDSTR_1 (grpc_static_slice_table[26]) /* "2" */ -#define GRPC_MDSTR_2 (grpc_static_slice_table[28]) +#define GRPC_MDSTR_2 (grpc_static_slice_table[27]) /* "identity" */ -#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[29]) +#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[28]) /* "gzip" */ -#define GRPC_MDSTR_GZIP (grpc_static_slice_table[30]) +#define GRPC_MDSTR_GZIP (grpc_static_slice_table[29]) /* "deflate" */ -#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[31]) +#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[30]) /* "trailers" */ -#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[32]) +#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[31]) /* "application/grpc" */ -#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[33]) +#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[32]) /* "POST" */ -#define GRPC_MDSTR_POST (grpc_static_slice_table[34]) +#define GRPC_MDSTR_POST (grpc_static_slice_table[33]) /* "200" */ -#define GRPC_MDSTR_200 (grpc_static_slice_table[35]) +#define GRPC_MDSTR_200 (grpc_static_slice_table[34]) /* "404" */ -#define GRPC_MDSTR_404 (grpc_static_slice_table[36]) +#define GRPC_MDSTR_404 (grpc_static_slice_table[35]) /* "http" */ -#define GRPC_MDSTR_HTTP (grpc_static_slice_table[37]) +#define GRPC_MDSTR_HTTP (grpc_static_slice_table[36]) /* "https" */ -#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[38]) +#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[37]) /* "grpc" */ -#define GRPC_MDSTR_GRPC (grpc_static_slice_table[39]) +#define GRPC_MDSTR_GRPC (grpc_static_slice_table[38]) /* "GET" */ -#define GRPC_MDSTR_GET (grpc_static_slice_table[40]) +#define GRPC_MDSTR_GET (grpc_static_slice_table[39]) /* "PUT" */ -#define GRPC_MDSTR_PUT (grpc_static_slice_table[41]) +#define GRPC_MDSTR_PUT (grpc_static_slice_table[40]) /* "/" */ -#define GRPC_MDSTR_SLASH (grpc_static_slice_table[42]) +#define GRPC_MDSTR_SLASH (grpc_static_slice_table[41]) /* "/index.html" */ -#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[43]) +#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[42]) /* "204" */ -#define GRPC_MDSTR_204 (grpc_static_slice_table[44]) +#define GRPC_MDSTR_204 (grpc_static_slice_table[43]) /* "206" */ -#define GRPC_MDSTR_206 (grpc_static_slice_table[45]) +#define GRPC_MDSTR_206 (grpc_static_slice_table[44]) /* "304" */ -#define GRPC_MDSTR_304 (grpc_static_slice_table[46]) +#define GRPC_MDSTR_304 (grpc_static_slice_table[45]) /* "400" */ -#define GRPC_MDSTR_400 (grpc_static_slice_table[47]) +#define GRPC_MDSTR_400 (grpc_static_slice_table[46]) /* "500" */ -#define GRPC_MDSTR_500 (grpc_static_slice_table[48]) +#define GRPC_MDSTR_500 (grpc_static_slice_table[47]) /* "accept-charset" */ -#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[49]) +#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[48]) /* "accept-encoding" */ -#define GRPC_MDSTR_ACCEPT_ENCODING (grpc_static_slice_table[50]) +#define GRPC_MDSTR_ACCEPT_ENCODING (grpc_static_slice_table[49]) /* "gzip, deflate" */ -#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[51]) +#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[50]) /* "accept-language" */ -#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[52]) +#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[51]) /* "accept-ranges" */ -#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[53]) +#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[52]) /* "accept" */ -#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[54]) +#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[53]) /* "access-control-allow-origin" */ -#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[55]) +#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[54]) /* "age" */ -#define GRPC_MDSTR_AGE (grpc_static_slice_table[56]) +#define GRPC_MDSTR_AGE (grpc_static_slice_table[55]) /* "allow" */ -#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[57]) +#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[56]) /* "authorization" */ -#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[58]) +#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[57]) /* "cache-control" */ -#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[59]) +#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[58]) /* "content-disposition" */ -#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[60]) +#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[59]) /* "content-encoding" */ -#define GRPC_MDSTR_CONTENT_ENCODING (grpc_static_slice_table[61]) +#define GRPC_MDSTR_CONTENT_ENCODING (grpc_static_slice_table[60]) /* "content-language" */ -#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[62]) +#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[61]) /* "content-length" */ -#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[63]) +#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[62]) /* "content-location" */ -#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[64]) +#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[63]) /* "content-range" */ -#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[65]) +#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[64]) /* "cookie" */ -#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[66]) +#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[65]) /* "date" */ -#define GRPC_MDSTR_DATE (grpc_static_slice_table[67]) +#define GRPC_MDSTR_DATE (grpc_static_slice_table[66]) /* "etag" */ -#define GRPC_MDSTR_ETAG (grpc_static_slice_table[68]) +#define GRPC_MDSTR_ETAG (grpc_static_slice_table[67]) /* "expect" */ -#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[69]) +#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[68]) /* "expires" */ -#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[70]) +#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[69]) /* "from" */ -#define GRPC_MDSTR_FROM (grpc_static_slice_table[71]) +#define GRPC_MDSTR_FROM (grpc_static_slice_table[70]) /* "if-match" */ -#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[72]) +#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[71]) /* "if-modified-since" */ -#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[73]) +#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[72]) /* "if-none-match" */ -#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[74]) +#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[73]) /* "if-range" */ -#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[75]) +#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[74]) /* "if-unmodified-since" */ -#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[76]) +#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[75]) /* "last-modified" */ -#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[77]) +#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[76]) /* "link" */ -#define GRPC_MDSTR_LINK (grpc_static_slice_table[78]) +#define GRPC_MDSTR_LINK (grpc_static_slice_table[77]) /* "location" */ -#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[79]) +#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[78]) /* "max-forwards" */ -#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[80]) +#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[79]) /* "proxy-authenticate" */ -#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[81]) +#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[80]) /* "proxy-authorization" */ -#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[82]) +#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[81]) /* "range" */ -#define GRPC_MDSTR_RANGE (grpc_static_slice_table[83]) +#define GRPC_MDSTR_RANGE (grpc_static_slice_table[82]) /* "referer" */ -#define GRPC_MDSTR_REFERER (grpc_static_slice_table[84]) +#define GRPC_MDSTR_REFERER (grpc_static_slice_table[83]) /* "refresh" */ -#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[85]) +#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[84]) /* "retry-after" */ -#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[86]) +#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[85]) /* "server" */ -#define GRPC_MDSTR_SERVER (grpc_static_slice_table[87]) +#define GRPC_MDSTR_SERVER (grpc_static_slice_table[86]) /* "set-cookie" */ -#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[88]) +#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[87]) /* "strict-transport-security" */ -#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[89]) +#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[88]) /* "transfer-encoding" */ -#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[90]) +#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[89]) /* "vary" */ -#define GRPC_MDSTR_VARY (grpc_static_slice_table[91]) +#define GRPC_MDSTR_VARY (grpc_static_slice_table[90]) /* "via" */ -#define GRPC_MDSTR_VIA (grpc_static_slice_table[92]) +#define GRPC_MDSTR_VIA (grpc_static_slice_table[91]) /* "www-authenticate" */ -#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[93]) +#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[92]) /* "identity,deflate" */ -#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[94]) +#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[93]) /* "identity,gzip" */ -#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[95]) +#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[94]) /* "deflate,gzip" */ -#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[96]) +#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[95]) /* "identity,deflate,gzip" */ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (grpc_static_slice_table[97]) + (grpc_static_slice_table[96]) extern const grpc_slice_refcount_vtable grpc_static_metadata_vtable; extern grpc_slice_refcount @@ -257,7 +255,7 @@ extern grpc_slice_refcount #define GRPC_STATIC_METADATA_INDEX(static_slice) \ ((int)((static_slice).refcount - grpc_static_metadata_refcounts)) -#define GRPC_STATIC_MDELEM_COUNT 81 +#define GRPC_STATIC_MDELEM_COUNT 80 extern grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT]; /* "grpc-status": "0" */ @@ -428,81 +426,78 @@ extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT]; /* "lb-token": "" */ #define GRPC_MDELEM_LB_TOKEN_EMPTY \ (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[55], GRPC_MDELEM_STORAGE_STATIC)) -/* "lb-cost-bin": "" */ -#define GRPC_MDELEM_LB_COST_BIN_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[56], GRPC_MDELEM_STORAGE_STATIC)) /* "link": "" */ #define GRPC_MDELEM_LINK_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[57], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[56], GRPC_MDELEM_STORAGE_STATIC)) /* "location": "" */ #define GRPC_MDELEM_LOCATION_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[58], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[57], GRPC_MDELEM_STORAGE_STATIC)) /* "max-forwards": "" */ #define GRPC_MDELEM_MAX_FORWARDS_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[59], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[58], GRPC_MDELEM_STORAGE_STATIC)) /* "proxy-authenticate": "" */ #define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[60], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[59], GRPC_MDELEM_STORAGE_STATIC)) /* "proxy-authorization": "" */ #define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[61], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[60], GRPC_MDELEM_STORAGE_STATIC)) /* "range": "" */ #define GRPC_MDELEM_RANGE_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[62], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[61], GRPC_MDELEM_STORAGE_STATIC)) /* "referer": "" */ #define GRPC_MDELEM_REFERER_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[63], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[62], GRPC_MDELEM_STORAGE_STATIC)) /* "refresh": "" */ #define GRPC_MDELEM_REFRESH_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[64], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[63], GRPC_MDELEM_STORAGE_STATIC)) /* "retry-after": "" */ #define GRPC_MDELEM_RETRY_AFTER_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[65], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[64], GRPC_MDELEM_STORAGE_STATIC)) /* "server": "" */ #define GRPC_MDELEM_SERVER_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[66], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[65], GRPC_MDELEM_STORAGE_STATIC)) /* "set-cookie": "" */ #define GRPC_MDELEM_SET_COOKIE_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[67], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[66], GRPC_MDELEM_STORAGE_STATIC)) /* "strict-transport-security": "" */ #define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[68], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[67], GRPC_MDELEM_STORAGE_STATIC)) /* "transfer-encoding": "" */ #define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[69], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[68], GRPC_MDELEM_STORAGE_STATIC)) /* "user-agent": "" */ #define GRPC_MDELEM_USER_AGENT_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[70], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[69], GRPC_MDELEM_STORAGE_STATIC)) /* "vary": "" */ #define GRPC_MDELEM_VARY_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[71], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[70], GRPC_MDELEM_STORAGE_STATIC)) /* "via": "" */ #define GRPC_MDELEM_VIA_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[72], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[71], GRPC_MDELEM_STORAGE_STATIC)) /* "www-authenticate": "" */ #define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[73], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[72], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "identity" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[74], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[73], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "deflate" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[75], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[74], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "identity,deflate" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[76], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[75], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[77], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[76], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "identity,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[78], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[77], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "deflate,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[79], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[78], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "identity,deflate,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[80], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[79], GRPC_MDELEM_STORAGE_STATIC)) grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b); typedef enum { @@ -522,7 +517,6 @@ typedef enum { GRPC_BATCH_USER_AGENT, GRPC_BATCH_HOST, GRPC_BATCH_LB_TOKEN, - GRPC_BATCH_LB_COST_BIN, GRPC_BATCH_CALLOUTS_COUNT } grpc_metadata_batch_callouts_index; @@ -545,7 +539,6 @@ typedef union { struct grpc_linked_mdelem *user_agent; struct grpc_linked_mdelem *host; struct grpc_linked_mdelem *lb_token; - struct grpc_linked_mdelem *lb_cost_bin; } named; } grpc_metadata_batch_callouts; diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index a7aaa255724..6edbc909277 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -224,4 +224,20 @@ const struct census_context* ServerContext::census_context() const { return grpc_census_call_get_context(call_); } +void ServerContext::SetLoadReportingCosts( + const std::vector& cost_data) { + if (call_ == nullptr) return; + grpc_load_reporting_cost_context* cost_ctx = + static_cast( + gpr_malloc(sizeof(*cost_ctx))); + cost_ctx->values_count = cost_data.size(); + cost_ctx->values = static_cast( + gpr_malloc(sizeof(*cost_ctx->values) * cost_ctx->values_count)); + for (size_t i = 0; i < cost_ctx->values_count; ++i) { + cost_ctx->values[i] = + grpc_slice_from_copied_buffer(cost_data[i].data(), cost_data[i].size()); + } + grpc_call_set_load_reporting_cost_context(call_, cost_ctx); +} + } // namespace grpc diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index d8d76cc1c53..b8af8008336 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -107,6 +107,7 @@ grpc_channel_register_call_type grpc_channel_register_call_import; grpc_channel_create_registered_call_type grpc_channel_create_registered_call_import; grpc_call_start_batch_type grpc_call_start_batch_import; grpc_call_get_peer_type grpc_call_get_peer_import; +grpc_call_set_load_reporting_cost_context_type grpc_call_set_load_reporting_cost_context_import; grpc_census_call_set_context_type grpc_census_call_set_context_import; grpc_census_call_get_context_type grpc_census_call_get_context_import; grpc_channel_get_target_type grpc_channel_get_target_import; @@ -398,6 +399,7 @@ void grpc_rb_load_imports(HMODULE library) { grpc_channel_create_registered_call_import = (grpc_channel_create_registered_call_type) GetProcAddress(library, "grpc_channel_create_registered_call"); grpc_call_start_batch_import = (grpc_call_start_batch_type) GetProcAddress(library, "grpc_call_start_batch"); grpc_call_get_peer_import = (grpc_call_get_peer_type) GetProcAddress(library, "grpc_call_get_peer"); + grpc_call_set_load_reporting_cost_context_import = (grpc_call_set_load_reporting_cost_context_type) GetProcAddress(library, "grpc_call_set_load_reporting_cost_context"); grpc_census_call_set_context_import = (grpc_census_call_set_context_type) GetProcAddress(library, "grpc_census_call_set_context"); grpc_census_call_get_context_import = (grpc_census_call_get_context_type) GetProcAddress(library, "grpc_census_call_get_context"); grpc_channel_get_target_import = (grpc_channel_get_target_type) GetProcAddress(library, "grpc_channel_get_target"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index 4eab9639ea7..3229e2a77dc 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -272,6 +272,9 @@ extern grpc_call_start_batch_type grpc_call_start_batch_import; typedef char *(*grpc_call_get_peer_type)(grpc_call *call); extern grpc_call_get_peer_type grpc_call_get_peer_import; #define grpc_call_get_peer grpc_call_get_peer_import +typedef void(*grpc_call_set_load_reporting_cost_context_type)(grpc_call *call, struct grpc_load_reporting_cost_context *context); +extern grpc_call_set_load_reporting_cost_context_type grpc_call_set_load_reporting_cost_context_import; +#define grpc_call_set_load_reporting_cost_context grpc_call_set_load_reporting_cost_context_import typedef void(*grpc_census_call_set_context_type)(grpc_call *call, struct census_context *context); extern grpc_census_call_set_context_type grpc_census_call_set_context_import; #define grpc_census_call_set_context grpc_census_call_set_context_import diff --git a/test/core/end2end/fuzzers/hpack.dictionary b/test/core/end2end/fuzzers/hpack.dictionary index 81a2419d120..6b967854191 100644 --- a/test/core/end2end/fuzzers/hpack.dictionary +++ b/test/core/end2end/fuzzers/hpack.dictionary @@ -15,7 +15,6 @@ "\x0Auser-agent" "\x04host" "\x08lb-token" -"\x0Blb-cost-bin" "\x0Cgrpc-timeout" "\x10grpc-tracing-bin" "\x0Egrpc-stats-bin" @@ -153,7 +152,6 @@ "\x00\x13if-unmodified-since\x00" "\x00\x0Dlast-modified\x00" "\x00\x08lb-token\x00" -"\x00\x0Blb-cost-bin\x00" "\x00\x04link\x00" "\x00\x08location\x00" "\x00\x0Cmax-forwards\x00" diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c index 085a563fb8f..d1ee26fe502 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.c @@ -31,23 +31,24 @@ * */ -#include "test/core/end2end/end2end_tests.h" - #include #include +#include #include #include #include #include #include -#include "test/core/end2end/cq_verifier.h" #include "src/core/ext/load_reporting/load_reporting.h" #include "src/core/ext/load_reporting/load_reporting_filter.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/transport/static_metadata.h" +#include "test/core/end2end/cq_verifier.h" +#include "test/core/end2end/end2end_tests.h" + enum { TIMEOUT = 200000 }; static void *tag(intptr_t t) { return (void *)t; } @@ -124,7 +125,8 @@ static void end_test(grpc_end2end_test_fixture *f) { static void request_response_with_payload( grpc_end2end_test_config config, grpc_end2end_test_fixture f, const char *method_name, const char *request_msg, const char *response_msg, - grpc_metadata *initial_lr_metadata, grpc_metadata *trailing_lr_metadata) { + grpc_metadata *initial_lr_metadata, + grpc_load_reporting_cost_context *cost_ctx) { grpc_slice request_payload_slice = grpc_slice_from_static_string(request_msg); grpc_slice response_payload_slice = grpc_slice_from_static_string(response_msg); @@ -237,9 +239,8 @@ static void request_response_with_payload( op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; - GPR_ASSERT(trailing_lr_metadata != NULL); - op->data.send_status_from_server.trailing_metadata_count = 1; - op->data.send_status_from_server.trailing_metadata = trailing_lr_metadata; + GPR_ASSERT(cost_ctx != NULL); + grpc_call_set_load_reporting_cost_context(s, cost_ctx); op->data.send_status_from_server.status = GRPC_STATUS_OK; grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; @@ -293,21 +294,21 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) { const char *response_msg = "... and the response from the server"; grpc_metadata initial_lr_metadata; - grpc_metadata trailing_lr_metadata; initial_lr_metadata.key = GRPC_MDSTR_LB_TOKEN; initial_lr_metadata.value = grpc_slice_from_static_string("client-token"); memset(&initial_lr_metadata.internal_data, 0, sizeof(initial_lr_metadata.internal_data)); - trailing_lr_metadata.key = GRPC_MDSTR_LB_COST_BIN; - trailing_lr_metadata.value = grpc_slice_from_static_string("server-token"); - memset(&trailing_lr_metadata.internal_data, 0, - sizeof(trailing_lr_metadata.internal_data)); + grpc_load_reporting_cost_context *cost_ctx = gpr_malloc(sizeof(*cost_ctx)); + memset(cost_ctx, 0, sizeof(*cost_ctx)); + cost_ctx->values_count = 1; + cost_ctx->values = + gpr_malloc(sizeof(*cost_ctx->values) * cost_ctx->values_count); + cost_ctx->values[0] = grpc_slice_from_static_string("cost-token"); request_response_with_payload(config, f, method_name, request_msg, - response_msg, &initial_lr_metadata, - &trailing_lr_metadata); + response_msg, &initial_lr_metadata, cost_ctx); end_test(&f); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c index e0a2c94216d..330da468490 100644 --- a/test/core/surface/public_headers_must_be_c89.c +++ b/test/core/surface/public_headers_must_be_c89.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index 4703708aaa2..109701f740b 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -123,7 +123,6 @@ CONFIG = [ ('if-unmodified-since', ''), ('last-modified', ''), ('lb-token', ''), - ('lb-cost-bin', ''), ('link', ''), ('location', ''), ('max-forwards', ''), @@ -160,7 +159,6 @@ METADATA_BATCH_CALLOUTS = [ 'user-agent', 'host', 'lb-token', - 'lb-cost-bin', ] COMPRESSION_ALGORITHMS = [ diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index 060e09869d9..896ee0213b3 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -827,6 +827,7 @@ include/grpc/impl/codegen/sync_posix.h \ include/grpc/impl/codegen/sync_posix.h \ include/grpc/impl/codegen/sync_windows.h \ include/grpc/impl/codegen/sync_windows.h \ +include/grpc/load_reporting.h \ include/grpc/slice.h \ include/grpc/slice_buffer.h \ include/grpc/status.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index ce7e1036478..10801254ef9 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -827,6 +827,7 @@ include/grpc/impl/codegen/sync_posix.h \ include/grpc/impl/codegen/sync_posix.h \ include/grpc/impl/codegen/sync_windows.h \ include/grpc/impl/codegen/sync_windows.h \ +include/grpc/load_reporting.h \ include/grpc/slice.h \ include/grpc/slice_buffer.h \ include/grpc/status.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 046076bd105..cd96e051698 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -5472,23 +5472,6 @@ "third_party": false, "type": "lib" }, - { - "deps": [ - "grpc++" - ], - "headers": [ - "include/grpc++/test/server_context_test_spouse.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc++_test", - "src": [ - "include/grpc++/test/server_context_test_spouse.h", - "src/cpp/test/server_context_test_spouse.cc" - ], - "third_party": false, - "type": "lib" - }, { "deps": [], "headers": [ @@ -7081,6 +7064,7 @@ "include/grpc/grpc.h", "include/grpc/grpc_posix.h", "include/grpc/grpc_security_constants.h", + "include/grpc/load_reporting.h", "include/grpc/slice.h", "include/grpc/slice_buffer.h", "include/grpc/status.h", @@ -7201,6 +7185,7 @@ "include/grpc/grpc.h", "include/grpc/grpc_posix.h", "include/grpc/grpc_security_constants.h", + "include/grpc/load_reporting.h", "include/grpc/slice.h", "include/grpc/slice_buffer.h", "include/grpc/status.h", @@ -8354,6 +8339,22 @@ "third_party": false, "type": "filegroup" }, + { + "deps": [ + "grpc++" + ], + "headers": [ + "include/grpc++/test/server_context_test_spouse.h" + ], + "is_filegroup": true, + "language": "c++", + "name": "grpc++_test", + "src": [ + "include/grpc++/test/server_context_test_spouse.h" + ], + "third_party": false, + "type": "filegroup" + }, { "deps": [ "grpc++_codegen_base" diff --git a/vsprojects/vcxproj/grpc++_test/grpc++_test.vcxproj b/vsprojects/vcxproj/grpc++_test/grpc++_test.vcxproj deleted file mode 100644 index cd3e406f9dc..00000000000 --- a/vsprojects/vcxproj/grpc++_test/grpc++_test.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {3D3EAEA9-76C4-0CFE-4718-5A1F6B7F72C8} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - grpc++_test - - - grpc++_test - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - true - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - true - None - false - - - Windows - true - false - true - true - - - - - - - - - - - - - {C187A093-A0FE-489D-A40A-6E33DE0F9FEB} - - - - - - - - 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/grpc++_test/grpc++_test.vcxproj.filters b/vsprojects/vcxproj/grpc++_test/grpc++_test.vcxproj.filters deleted file mode 100644 index e1d8fe1ef32..00000000000 --- a/vsprojects/vcxproj/grpc++_test/grpc++_test.vcxproj.filters +++ /dev/null @@ -1,35 +0,0 @@ - - - - - src\cpp\test - - - - - include\grpc++\test - - - - - - {418e2be9-9a04-af8a-8878-956543c507a1} - - - {bcaf3a2d-e884-bfbd-477b-09634054bcc5} - - - {3a14b66f-1d31-2d06-e9a1-c6d1199ab04d} - - - {bc08c75b-ee7e-85a0-fb0f-7586bbd33c6f} - - - {9797a57d-93ac-ff9c-5ac6-fd335777d782} - - - {58d4b4e0-5617-abf4-48a6-f1264d127b27} - - - - diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 73d511ef7ce..fde60be3e20 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -273,6 +273,7 @@ + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index dae55041a0b..8edbbc22bed 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -696,6 +696,9 @@ include\grpc + + include\grpc + include\grpc diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj index 57cbb2c496b..17fb026cf07 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj @@ -153,6 +153,7 @@ + diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters index 620649a06c4..5331ede4eaa 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters @@ -438,6 +438,9 @@ include\grpc + + include\grpc + include\grpc diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 5bdbff9a6ac..22f4740b8fa 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -264,6 +264,7 @@ + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index b2b46b052b7..5021cb47d8d 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -609,6 +609,9 @@ include\grpc + + include\grpc + include\grpc diff --git a/vsprojects/vcxproj/test/server_context_test_spouse_test/server_context_test_spouse_test.vcxproj b/vsprojects/vcxproj/test/server_context_test_spouse_test/server_context_test_spouse_test.vcxproj index 9e586c647c7..fe2b1abc152 100644 --- a/vsprojects/vcxproj/test/server_context_test_spouse_test/server_context_test_spouse_test.vcxproj +++ b/vsprojects/vcxproj/test/server_context_test_spouse_test/server_context_test_spouse_test.vcxproj @@ -167,9 +167,6 @@ {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} - - {3D3EAEA9-76C4-0CFE-4718-5A1F6B7F72C8} - {C187A093-A0FE-489D-A40A-6E33DE0F9FEB} From fe5f497f77b1800f837e79c595aeedb62e0719b7 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 13 Feb 2017 16:26:27 -0800 Subject: [PATCH 065/126] Add a test that measures flow control stalls in a deterministic way --- CMakeLists.txt | 2 + Makefile | 2 + build.yaml | 2 + .../chttp2/transport/frame_settings.h | 2 +- test/core/util/trickle_endpoint.c | 178 +++++++++++++++++ test/core/util/trickle_endpoint.h | 45 +++++ test/cpp/microbenchmarks/bm_fullstack.cc | 180 +++++++++++++++++- .../generated/sources_and_headers.json | 7 +- .../grpc_test_util/grpc_test_util.vcxproj | 3 + .../grpc_test_util.vcxproj.filters | 6 + .../grpc_test_util_unsecure.vcxproj | 3 + .../grpc_test_util_unsecure.vcxproj.filters | 6 + 12 files changed, 423 insertions(+), 13 deletions(-) create mode 100644 test/core/util/trickle_endpoint.c create mode 100644 test/core/util/trickle_endpoint.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 101f0ad2ef9..8edc29e9cc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1428,6 +1428,7 @@ add_library(grpc_test_util test/core/util/port_uv.c test/core/util/port_windows.c test/core/util/slice_splitter.c + test/core/util/trickle_endpoint.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c @@ -1635,6 +1636,7 @@ add_library(grpc_test_util_unsecure test/core/util/port_uv.c test/core/util/port_windows.c test/core/util/slice_splitter.c + test/core/util/trickle_endpoint.c ) if(WIN32 AND MSVC) diff --git a/Makefile b/Makefile index 5dde577cca8..9bae21dc455 100644 --- a/Makefile +++ b/Makefile @@ -3262,6 +3262,7 @@ LIBGRPC_TEST_UTIL_SRC = \ test/core/util/port_uv.c \ test/core/util/port_windows.c \ test/core/util/slice_splitter.c \ + test/core/util/trickle_endpoint.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ @@ -3462,6 +3463,7 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ test/core/util/port_uv.c \ test/core/util/port_windows.c \ test/core/util/slice_splitter.c \ + test/core/util/trickle_endpoint.c \ PUBLIC_HEADERS_C += \ diff --git a/build.yaml b/build.yaml index 2fbaa2e2262..2f390b93198 100644 --- a/build.yaml +++ b/build.yaml @@ -596,6 +596,7 @@ filegroups: - test/core/util/port.h - test/core/util/port_server_client.h - test/core/util/slice_splitter.h + - test/core/util/trickle_endpoint.h src: - test/core/end2end/cq_verifier.c - test/core/end2end/fake_resolver.c @@ -613,6 +614,7 @@ filegroups: - test/core/util/port_uv.c - test/core/util/port_windows.c - test/core/util/slice_splitter.c + - test/core/util/trickle_endpoint.c deps: - grpc - gpr_test_util diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.h b/src/core/ext/transport/chttp2/transport/frame_settings.h index a29dc821060..44137798c06 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.h +++ b/src/core/ext/transport/chttp2/transport/frame_settings.h @@ -87,7 +87,7 @@ extern const grpc_chttp2_setting_parameters grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS]; /* Create a settings frame by diffing old & new, and updating old to be new */ -grpc_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *new, +grpc_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *newval, uint32_t force_mask, size_t count); /* Create an ack settings frame */ grpc_slice grpc_chttp2_settings_ack_create(void); diff --git a/test/core/util/trickle_endpoint.c b/test/core/util/trickle_endpoint.c new file mode 100644 index 00000000000..8d661e04c69 --- /dev/null +++ b/test/core/util/trickle_endpoint.c @@ -0,0 +1,178 @@ +/* + * + * 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 "test/core/util/passthru_endpoint.h" + +#include +#include + +#include +#include +#include +#include + +#include "src/core/lib/iomgr/sockaddr.h" + +#include "src/core/lib/slice/slice_internal.h" + +typedef struct { + grpc_endpoint base; + grpc_endpoint *wrapped; + + gpr_mu mu; + grpc_slice_buffer write_buffer; + grpc_slice_buffer writing_buffer; + grpc_error *error; + bool writing; +} trickle_endpoint; + +static void te_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, + grpc_slice_buffer *slices, grpc_closure *cb) { + trickle_endpoint *te = (trickle_endpoint *)ep; + grpc_endpoint_read(exec_ctx, te->wrapped, slices, cb); +} + +static void te_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, + grpc_slice_buffer *slices, grpc_closure *cb) { + trickle_endpoint *te = (trickle_endpoint *)ep; + for (size_t i = 0; i < slices->count; i++) { + grpc_slice_ref_internal(slices->slices[i]); + } + grpc_slice_buffer_addn(&te->write_buffer, slices->slices, slices->count); + gpr_mu_lock(&te->mu); + grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_REF(te->error)); + gpr_mu_unlock(&te->mu); +} + +static grpc_workqueue *te_get_workqueue(grpc_endpoint *ep) { + trickle_endpoint *te = (trickle_endpoint *)ep; + return grpc_endpoint_get_workqueue(te->wrapped); +} + +static void te_add_to_pollset(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, + grpc_pollset *pollset) { + trickle_endpoint *te = (trickle_endpoint *)ep; + grpc_endpoint_add_to_pollset(exec_ctx, te->wrapped, pollset); +} + +static void te_add_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, + grpc_pollset_set *pollset_set) { + trickle_endpoint *te = (trickle_endpoint *)ep; + grpc_endpoint_add_to_pollset_set(exec_ctx, te->wrapped, pollset_set); +} + +static void te_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, + grpc_error *why) { + trickle_endpoint *te = (trickle_endpoint *)ep; + gpr_mu_lock(&te->mu); + if (te->error == GRPC_ERROR_NONE) { + te->error = GRPC_ERROR_REF(why); + } + gpr_mu_unlock(&te->mu); + grpc_endpoint_shutdown(exec_ctx, te->wrapped, why); +} + +static void te_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { + trickle_endpoint *te = (trickle_endpoint *)ep; + grpc_endpoint_destroy(exec_ctx, te->wrapped); + gpr_mu_destroy(&te->mu); + grpc_slice_buffer_destroy_internal(exec_ctx, &te->write_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &te->writing_buffer); + GRPC_ERROR_UNREF(te->error); + gpr_free(te); +} + +static grpc_resource_user *te_get_resource_user(grpc_endpoint *ep) { + trickle_endpoint *te = (trickle_endpoint *)ep; + return grpc_endpoint_get_resource_user(te->wrapped); +} + +static char *te_get_peer(grpc_endpoint *ep) { + trickle_endpoint *te = (trickle_endpoint *)ep; + return grpc_endpoint_get_peer(te->wrapped); +} + +static int te_get_fd(grpc_endpoint *ep) { + trickle_endpoint *te = (trickle_endpoint *)ep; + return grpc_endpoint_get_fd(te->wrapped); +} + +static void te_finish_write(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error) { + trickle_endpoint *te = arg; + gpr_mu_lock(&te->mu); + te->writing = false; + grpc_slice_buffer_reset_and_unref(&te->writing_buffer); + gpr_mu_unlock(&te->mu); +} + +static const grpc_endpoint_vtable vtable = {te_read, + te_write, + te_get_workqueue, + te_add_to_pollset, + te_add_to_pollset_set, + te_shutdown, + te_destroy, + te_get_resource_user, + te_get_peer, + te_get_fd}; + +grpc_endpoint *grpc_trickle_endpoint_create(grpc_endpoint *wrap) { + trickle_endpoint *te = gpr_malloc(sizeof(*te)); + te->base.vtable = &vtable; + te->wrapped = wrap; + gpr_mu_init(&te->mu); + grpc_slice_buffer_init(&te->write_buffer); + grpc_slice_buffer_init(&te->writing_buffer); + te->error = GRPC_ERROR_NONE; + te->writing = false; + return &te->base; +} + +size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, + size_t bytes) { + trickle_endpoint *te = (trickle_endpoint *)ep; + gpr_mu_lock(&te->mu); + if (bytes > 0 && !te->writing) { + grpc_slice_buffer_move_first(&te->write_buffer, + GPR_MIN(bytes, te->write_buffer.length), + &te->writing_buffer); + te->writing = true; + grpc_endpoint_write( + exec_ctx, te->wrapped, &te->writing_buffer, + grpc_closure_create(te_finish_write, te, grpc_schedule_on_exec_ctx)); + } + size_t backlog = te->write_buffer.length; + gpr_mu_unlock(&te->mu); + return backlog; +} diff --git a/test/core/util/trickle_endpoint.h b/test/core/util/trickle_endpoint.h new file mode 100644 index 00000000000..5f16818ebb7 --- /dev/null +++ b/test/core/util/trickle_endpoint.h @@ -0,0 +1,45 @@ +/* + * + * 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. + * + */ + +#ifndef TRICKLE_ENDPOINT_H +#define TRICKLE_ENDPOINT_H + +#include "src/core/lib/iomgr/endpoint.h" + +grpc_endpoint *grpc_trickle_endpoint_create(grpc_endpoint *wrap); + +/* Allow up to \a bytes through the endpoint. Returns the new backlog. */ +size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx *exec_ctx, + grpc_endpoint *endpoint, size_t bytes); + +#endif diff --git a/test/cpp/microbenchmarks/bm_fullstack.cc b/test/cpp/microbenchmarks/bm_fullstack.cc index 9d883e68d7f..f83c3599616 100644 --- a/test/cpp/microbenchmarks/bm_fullstack.cc +++ b/test/cpp/microbenchmarks/bm_fullstack.cc @@ -46,6 +46,7 @@ extern "C" { #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" +#include "src/core/ext/transport/chttp2/transport/internal.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/endpoint_pair.h" @@ -57,6 +58,7 @@ extern "C" { #include "test/core/util/memory_counters.h" #include "test/core/util/passthru_endpoint.h" #include "test/core/util/port.h" +#include "test/core/util/trickle_endpoint.h" } #include "src/core/lib/profiling/timers.h" #include "src/cpp/client/create_channel_internal.h" @@ -197,7 +199,8 @@ class UDS : public FullstackFixture { class EndpointPairFixture : public BaseFixture { public: - EndpointPairFixture(Service* service, grpc_endpoint_pair endpoints) { + EndpointPairFixture(Service* service, grpc_endpoint_pair endpoints) + : endpoint_pair_(endpoints) { ServerBuilder b; cq_ = b.AddCompletionQueue(true); b.RegisterService(service); @@ -210,7 +213,7 @@ class EndpointPairFixture : public BaseFixture { { const grpc_channel_args* server_args = grpc_server_get_channel_args(server_->c_server()); - grpc_transport* transport = grpc_create_chttp2_transport( + server_transport_ = grpc_create_chttp2_transport( &exec_ctx, server_args, endpoints.server, 0 /* is_client */); grpc_pollset** pollsets; @@ -221,9 +224,9 @@ class EndpointPairFixture : public BaseFixture { grpc_endpoint_add_to_pollset(&exec_ctx, endpoints.server, pollsets[i]); } - grpc_server_setup_transport(&exec_ctx, server_->c_server(), transport, - NULL, server_args); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + grpc_server_setup_transport(&exec_ctx, server_->c_server(), + server_transport_, NULL, server_args); + grpc_chttp2_transport_start_reading(&exec_ctx, server_transport_, NULL); } /* create channel */ @@ -233,12 +236,13 @@ class EndpointPairFixture : public BaseFixture { ApplyCommonChannelArguments(&args); grpc_channel_args c_args = args.c_channel_args(); - grpc_transport* transport = + client_transport_ = grpc_create_chttp2_transport(&exec_ctx, &c_args, endpoints.client, 1); - GPR_ASSERT(transport); - grpc_channel* channel = grpc_channel_create( - &exec_ctx, "target", &c_args, GRPC_CLIENT_DIRECT_CHANNEL, transport); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + GPR_ASSERT(client_transport_); + grpc_channel* channel = + grpc_channel_create(&exec_ctx, "target", &c_args, + GRPC_CLIENT_DIRECT_CHANNEL, client_transport_); + grpc_chttp2_transport_start_reading(&exec_ctx, client_transport_, NULL); channel_ = CreateChannelInternal("", channel); } @@ -258,6 +262,11 @@ class EndpointPairFixture : public BaseFixture { ServerCompletionQueue* cq() { return cq_.get(); } std::shared_ptr channel() { return channel_; } + protected: + grpc_endpoint_pair endpoint_pair_; + grpc_transport* client_transport_; + grpc_transport* server_transport_; + private: std::unique_ptr server_; std::unique_ptr cq_; @@ -295,6 +304,74 @@ class InProcessCHTTP2 : public EndpointPairFixture { } }; +class TrickledCHTTP2 : public EndpointPairFixture { + public: + TrickledCHTTP2(Service* service) + : EndpointPairFixture(service, MakeEndpoints()) {} + + void AddToLabel(std::ostream& out, benchmark::State& state) { + out << " writes/iter:" + << ((double)stats_.num_writes / (double)state.iterations()) + << " cli-transport-stalls/iter:" + << ((double) + client_stats_.streams_stalled_due_to_transport_flow_control / + (double)state.iterations()) + << " cli-stream-stalls/iter:" + << ((double)client_stats_.streams_stalled_due_to_stream_flow_control / + (double)state.iterations()) + << " svr-transport-stalls/iter:" + << ((double) + server_stats_.streams_stalled_due_to_transport_flow_control / + (double)state.iterations()) + << " svr-stream-stalls/iter:" + << ((double)server_stats_.streams_stalled_due_to_stream_flow_control / + (double)state.iterations()); + } + + void Step(size_t write_size) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + size_t client_backlog = grpc_trickle_endpoint_trickle( + &exec_ctx, endpoint_pair_.client, write_size); + size_t server_backlog = grpc_trickle_endpoint_trickle( + &exec_ctx, endpoint_pair_.server, write_size); + grpc_exec_ctx_finish(&exec_ctx); + + UpdateStats((grpc_chttp2_transport*)client_transport_, &client_stats_, + client_backlog); + UpdateStats((grpc_chttp2_transport*)server_transport_, &server_stats_, + server_backlog); + } + + private: + grpc_passthru_endpoint_stats stats_; + struct Stats { + int streams_stalled_due_to_stream_flow_control = 0; + int streams_stalled_due_to_transport_flow_control = 0; + }; + Stats client_stats_; + Stats server_stats_; + + grpc_endpoint_pair MakeEndpoints() { + grpc_endpoint_pair p; + grpc_passthru_endpoint_create(&p.client, &p.server, initialize_stuff.rq(), + &stats_); + p.client = grpc_trickle_endpoint_create(p.client); + p.server = grpc_trickle_endpoint_create(p.server); + return p; + } + + void UpdateStats(grpc_chttp2_transport* t, Stats* s, size_t backlog) { + if (backlog == 0) { + if (t->lists[GRPC_CHTTP2_LIST_STALLED_BY_STREAM].head != NULL) { + s->streams_stalled_due_to_stream_flow_control++; + } + if (t->lists[GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT].head != NULL) { + s->streams_stalled_due_to_transport_flow_control++; + } + } + } +}; + /******************************************************************************* * CONTEXT MUTATORS */ @@ -777,6 +854,79 @@ static void BM_PumpStreamServerToClient(benchmark::State& state) { state.SetBytesProcessed(state.range(0) * state.iterations()); } +static void TrickleCQNext(TrickledCHTTP2* fixture, void** t, bool* ok, + size_t size) { + while (true) { + switch (fixture->cq()->AsyncNext(t, ok, gpr_now(GPR_CLOCK_MONOTONIC))) { + case CompletionQueue::TIMEOUT: + fixture->Step(size); + break; + case CompletionQueue::SHUTDOWN: + GPR_ASSERT(false); + break; + case CompletionQueue::GOT_EVENT: + return; + } + } +} + +static void BM_PumpStreamServerToClient_Trickle(benchmark::State& state) { + EchoTestService::AsyncService service; + std::unique_ptr fixture(new TrickledCHTTP2(&service)); + { + EchoResponse send_response; + EchoResponse recv_response; + if (state.range(0) > 0) { + send_response.set_message(std::string(state.range(0), 'a')); + } + Status recv_status; + ServerContext svr_ctx; + ServerAsyncReaderWriter response_rw(&svr_ctx); + service.RequestBidiStream(&svr_ctx, &response_rw, fixture->cq(), + fixture->cq(), tag(0)); + std::unique_ptr stub( + EchoTestService::NewStub(fixture->channel())); + ClientContext cli_ctx; + auto request_rw = stub->AsyncBidiStream(&cli_ctx, fixture->cq(), tag(1)); + int need_tags = (1 << 0) | (1 << 1); + void* t; + bool ok; + while (need_tags) { + TrickleCQNext(fixture.get(), &t, &ok, state.range(1)); + GPR_ASSERT(ok); + int i = (int)(intptr_t)t; + GPR_ASSERT(need_tags & (1 << i)); + need_tags &= ~(1 << i); + } + request_rw->Read(&recv_response, tag(0)); + while (state.KeepRunning()) { + GPR_TIMER_SCOPE("BenchmarkCycle", 0); + response_rw.Write(send_response, tag(1)); + while (true) { + TrickleCQNext(fixture.get(), &t, &ok, state.range(1)); + if (t == tag(0)) { + request_rw->Read(&recv_response, tag(0)); + } else if (t == tag(1)) { + break; + } else { + GPR_ASSERT(false); + } + } + } + response_rw.Finish(Status::OK, tag(1)); + need_tags = (1 << 0) | (1 << 1); + while (need_tags) { + TrickleCQNext(fixture.get(), &t, &ok, state.range(1)); + int i = (int)(intptr_t)t; + GPR_ASSERT(need_tags & (1 << i)); + need_tags &= ~(1 << i); + } + } + fixture->Finish(state); + fixture.reset(); + state.SetBytesProcessed(state.range(0) * state.iterations()); +} + /******************************************************************************* * CONFIGURATIONS */ @@ -866,6 +1016,16 @@ BENCHMARK_TEMPLATE(BM_PumpStreamServerToClient, SockPair) BENCHMARK_TEMPLATE(BM_PumpStreamServerToClient, InProcessCHTTP2) ->Range(0, 128 * 1024 * 1024); +static void TrickleArgs(benchmark::internal::Benchmark* b) { + for (int i = 1; i <= 128 * 1024 * 1024; i *= 8) { + for (int j = 1024; j <= 8 * 1024 * 1024; j *= 8) { + b->Args({i, j}); + } + } +} + +BENCHMARK(BM_PumpStreamServerToClient_Trickle)->Apply(TrickleArgs); + // Generate Args for StreamingPingPong benchmarks. Currently generates args for // only "small streams" (i.e streams with 0, 1 or 2 messages) static void StreamingPingPongArgs(benchmark::internal::Benchmark* b) { diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 0d5aeb233c4..cc4a2da6289 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7779,7 +7779,8 @@ "test/core/util/passthru_endpoint.h", "test/core/util/port.h", "test/core/util/port_server_client.h", - "test/core/util/slice_splitter.h" + "test/core/util/slice_splitter.h", + "test/core/util/trickle_endpoint.h" ], "is_filegroup": true, "language": "c", @@ -7814,7 +7815,9 @@ "test/core/util/port_uv.c", "test/core/util/port_windows.c", "test/core/util/slice_splitter.c", - "test/core/util/slice_splitter.h" + "test/core/util/slice_splitter.h", + "test/core/util/trickle_endpoint.c", + "test/core/util/trickle_endpoint.h" ], "third_party": false, "type": "filegroup" diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj index 57cbb2c496b..504a3fc9272 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj @@ -193,6 +193,7 @@ + @@ -343,6 +344,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters index 620649a06c4..8e51a641f13 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters @@ -64,6 +64,9 @@ test\core\util + + test\core\util + src\core\lib\channel @@ -554,6 +557,9 @@ test\core\util + + test\core\util + src\core\lib\channel diff --git a/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj b/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj index daf92305c4c..1ea64654e5a 100644 --- a/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj @@ -161,6 +161,7 @@ + @@ -195,6 +196,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj.filters index c9a1b4c10d6..e2ad88c96e1 100644 --- a/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj.filters @@ -49,6 +49,9 @@ test\core\util + + test\core\util + @@ -93,6 +96,9 @@ test\core\util + + test\core\util + From 4cb0a7a5a12802f7deaf77659adb9b07ee58393f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 13 Feb 2017 17:14:20 -0800 Subject: [PATCH 066/126] Better test --- test/core/util/trickle_endpoint.c | 40 +++++++++++++++------- test/core/util/trickle_endpoint.h | 5 +-- test/cpp/microbenchmarks/bm_fullstack.cc | 43 +++++++++++++----------- 3 files changed, 55 insertions(+), 33 deletions(-) diff --git a/test/core/util/trickle_endpoint.c b/test/core/util/trickle_endpoint.c index 8d661e04c69..5b6c666950a 100644 --- a/test/core/util/trickle_endpoint.c +++ b/test/core/util/trickle_endpoint.c @@ -47,7 +47,9 @@ typedef struct { grpc_endpoint base; + double bytes_per_second; grpc_endpoint *wrapped; + gpr_timespec last_write; gpr_mu mu; grpc_slice_buffer write_buffer; @@ -68,8 +70,11 @@ static void te_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, for (size_t i = 0; i < slices->count; i++) { grpc_slice_ref_internal(slices->slices[i]); } - grpc_slice_buffer_addn(&te->write_buffer, slices->slices, slices->count); gpr_mu_lock(&te->mu); + if (te->write_buffer.length == 0) { + te->last_write = gpr_now(GPR_CLOCK_MONOTONIC); + } + grpc_slice_buffer_addn(&te->write_buffer, slices->slices, slices->count); grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_REF(te->error)); gpr_mu_unlock(&te->mu); } @@ -147,10 +152,12 @@ static const grpc_endpoint_vtable vtable = {te_read, te_get_peer, te_get_fd}; -grpc_endpoint *grpc_trickle_endpoint_create(grpc_endpoint *wrap) { +grpc_endpoint *grpc_trickle_endpoint_create(grpc_endpoint *wrap, + double bytes_per_second) { trickle_endpoint *te = gpr_malloc(sizeof(*te)); te->base.vtable = &vtable; te->wrapped = wrap; + te->bytes_per_second = bytes_per_second; gpr_mu_init(&te->mu); grpc_slice_buffer_init(&te->write_buffer); grpc_slice_buffer_init(&te->writing_buffer); @@ -159,18 +166,27 @@ grpc_endpoint *grpc_trickle_endpoint_create(grpc_endpoint *wrap) { return &te->base; } -size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, - size_t bytes) { +static double ts2dbl(gpr_timespec s) { return s.tv_sec + 1e-9 * s.tv_nsec; } + +size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx *exec_ctx, + grpc_endpoint *ep) { trickle_endpoint *te = (trickle_endpoint *)ep; gpr_mu_lock(&te->mu); - if (bytes > 0 && !te->writing) { - grpc_slice_buffer_move_first(&te->write_buffer, - GPR_MIN(bytes, te->write_buffer.length), - &te->writing_buffer); - te->writing = true; - grpc_endpoint_write( - exec_ctx, te->wrapped, &te->writing_buffer, - grpc_closure_create(te_finish_write, te, grpc_schedule_on_exec_ctx)); + if (!te->writing && te->write_buffer.length > 0) { + gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC); + double elapsed = ts2dbl(gpr_time_sub(now, te->last_write)); + size_t bytes = (size_t)(te->bytes_per_second * elapsed); + // gpr_log(GPR_DEBUG, "%lf elapsed --> %" PRIdPTR " bytes", elapsed, bytes); + if (bytes > 0) { + grpc_slice_buffer_move_first(&te->write_buffer, + GPR_MIN(bytes, te->write_buffer.length), + &te->writing_buffer); + te->writing = true; + 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)); + } } size_t backlog = te->write_buffer.length; gpr_mu_unlock(&te->mu); diff --git a/test/core/util/trickle_endpoint.h b/test/core/util/trickle_endpoint.h index 5f16818ebb7..7e8d9d91e33 100644 --- a/test/core/util/trickle_endpoint.h +++ b/test/core/util/trickle_endpoint.h @@ -36,10 +36,11 @@ #include "src/core/lib/iomgr/endpoint.h" -grpc_endpoint *grpc_trickle_endpoint_create(grpc_endpoint *wrap); +grpc_endpoint *grpc_trickle_endpoint_create(grpc_endpoint *wrap, + double bytes_per_second); /* Allow up to \a bytes through the endpoint. Returns the new backlog. */ size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx *exec_ctx, - grpc_endpoint *endpoint, size_t bytes); + grpc_endpoint *endpoint); #endif diff --git a/test/cpp/microbenchmarks/bm_fullstack.cc b/test/cpp/microbenchmarks/bm_fullstack.cc index f83c3599616..b4f57c3e476 100644 --- a/test/cpp/microbenchmarks/bm_fullstack.cc +++ b/test/cpp/microbenchmarks/bm_fullstack.cc @@ -306,8 +306,8 @@ class InProcessCHTTP2 : public EndpointPairFixture { class TrickledCHTTP2 : public EndpointPairFixture { public: - TrickledCHTTP2(Service* service) - : EndpointPairFixture(service, MakeEndpoints()) {} + TrickledCHTTP2(Service* service, size_t megabits_per_second) + : EndpointPairFixture(service, MakeEndpoints(megabits_per_second)) {} void AddToLabel(std::ostream& out, benchmark::State& state) { out << " writes/iter:" @@ -328,12 +328,12 @@ class TrickledCHTTP2 : public EndpointPairFixture { (double)state.iterations()); } - void Step(size_t write_size) { + void Step() { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - size_t client_backlog = grpc_trickle_endpoint_trickle( - &exec_ctx, endpoint_pair_.client, write_size); - size_t server_backlog = grpc_trickle_endpoint_trickle( - &exec_ctx, endpoint_pair_.server, write_size); + size_t client_backlog = + grpc_trickle_endpoint_trickle(&exec_ctx, endpoint_pair_.client); + size_t server_backlog = + grpc_trickle_endpoint_trickle(&exec_ctx, endpoint_pair_.server); grpc_exec_ctx_finish(&exec_ctx); UpdateStats((grpc_chttp2_transport*)client_transport_, &client_stats_, @@ -351,12 +351,13 @@ class TrickledCHTTP2 : public EndpointPairFixture { Stats client_stats_; Stats server_stats_; - grpc_endpoint_pair MakeEndpoints() { + grpc_endpoint_pair MakeEndpoints(size_t kilobits) { grpc_endpoint_pair p; grpc_passthru_endpoint_create(&p.client, &p.server, initialize_stuff.rq(), &stats_); - p.client = grpc_trickle_endpoint_create(p.client); - p.server = grpc_trickle_endpoint_create(p.server); + double bytes_per_second = 125 * kilobits; + p.client = grpc_trickle_endpoint_create(p.client, bytes_per_second); + p.server = grpc_trickle_endpoint_create(p.server, bytes_per_second); return p; } @@ -854,12 +855,13 @@ static void BM_PumpStreamServerToClient(benchmark::State& state) { state.SetBytesProcessed(state.range(0) * state.iterations()); } -static void TrickleCQNext(TrickledCHTTP2* fixture, void** t, bool* ok, - size_t size) { +static void TrickleCQNext(TrickledCHTTP2* fixture, void** t, bool* ok) { while (true) { - switch (fixture->cq()->AsyncNext(t, ok, gpr_now(GPR_CLOCK_MONOTONIC))) { + switch (fixture->cq()->AsyncNext( + t, ok, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_micros(100, GPR_TIMESPAN)))) { case CompletionQueue::TIMEOUT: - fixture->Step(size); + fixture->Step(); break; case CompletionQueue::SHUTDOWN: GPR_ASSERT(false); @@ -872,7 +874,8 @@ static void TrickleCQNext(TrickledCHTTP2* fixture, void** t, bool* ok, static void BM_PumpStreamServerToClient_Trickle(benchmark::State& state) { EchoTestService::AsyncService service; - std::unique_ptr fixture(new TrickledCHTTP2(&service)); + std::unique_ptr fixture( + new TrickledCHTTP2(&service, state.range(1))); { EchoResponse send_response; EchoResponse recv_response; @@ -892,7 +895,7 @@ static void BM_PumpStreamServerToClient_Trickle(benchmark::State& state) { void* t; bool ok; while (need_tags) { - TrickleCQNext(fixture.get(), &t, &ok, state.range(1)); + TrickleCQNext(fixture.get(), &t, &ok); GPR_ASSERT(ok); int i = (int)(intptr_t)t; GPR_ASSERT(need_tags & (1 << i)); @@ -903,7 +906,7 @@ static void BM_PumpStreamServerToClient_Trickle(benchmark::State& state) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); response_rw.Write(send_response, tag(1)); while (true) { - TrickleCQNext(fixture.get(), &t, &ok, state.range(1)); + TrickleCQNext(fixture.get(), &t, &ok); if (t == tag(0)) { request_rw->Read(&recv_response, tag(0)); } else if (t == tag(1)) { @@ -916,7 +919,7 @@ static void BM_PumpStreamServerToClient_Trickle(benchmark::State& state) { response_rw.Finish(Status::OK, tag(1)); need_tags = (1 << 0) | (1 << 1); while (need_tags) { - TrickleCQNext(fixture.get(), &t, &ok, state.range(1)); + TrickleCQNext(fixture.get(), &t, &ok); int i = (int)(intptr_t)t; GPR_ASSERT(need_tags & (1 << i)); need_tags &= ~(1 << i); @@ -1018,7 +1021,9 @@ BENCHMARK_TEMPLATE(BM_PumpStreamServerToClient, InProcessCHTTP2) static void TrickleArgs(benchmark::internal::Benchmark* b) { for (int i = 1; i <= 128 * 1024 * 1024; i *= 8) { - for (int j = 1024; j <= 8 * 1024 * 1024; j *= 8) { + for (int j = 1; j <= 40000; j *= 8) { + double expected_time = (double)(20 + i) / (125 * (double)j); + if (expected_time > 0.1) continue; b->Args({i, j}); } } From ef6d744c23f772f32c6f299291a504e15a10644f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 13 Feb 2017 19:23:09 -0800 Subject: [PATCH 067/126] Include faster networks --- test/cpp/microbenchmarks/bm_fullstack.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_fullstack.cc b/test/cpp/microbenchmarks/bm_fullstack.cc index b4f57c3e476..619a03d4740 100644 --- a/test/cpp/microbenchmarks/bm_fullstack.cc +++ b/test/cpp/microbenchmarks/bm_fullstack.cc @@ -1021,9 +1021,9 @@ BENCHMARK_TEMPLATE(BM_PumpStreamServerToClient, InProcessCHTTP2) static void TrickleArgs(benchmark::internal::Benchmark* b) { for (int i = 1; i <= 128 * 1024 * 1024; i *= 8) { - for (int j = 1; j <= 40000; j *= 8) { - double expected_time = (double)(20 + i) / (125 * (double)j); - if (expected_time > 0.1) continue; + for (int j = 1; j <= 128 * 1024 * 1024; j *= 8) { + double expected_time = (double)(14 + i) / (125 * (double)j); + if (expected_time > 0.01) continue; b->Args({i, j}); } } From 9f3ba09d3cb4dd8c122a34615d6e3779047eea6f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 14 Feb 2017 08:16:09 -0800 Subject: [PATCH 068/126] Use pre-existing script for flamegraph generation --- tools/run_tests/run_microbenchmark.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py index a9a563c1bec..ea87b6cd986 100755 --- a/tools/run_tests/run_microbenchmark.py +++ b/tools/run_tests/run_microbenchmark.py @@ -128,18 +128,19 @@ def collect_perf(bm_name, args): 'CONFIG=mutrace', '-j', '%d' % multiprocessing.cpu_count()]) for line in subprocess.check_output(['bins/mutrace/%s' % bm_name, '--benchmark_list_tests']).splitlines(): - subprocess.check_call(['sudo', 'perf', 'record', '-o', 'perf.data', + subprocess.check_call(['perf', 'record', '-o', '%s-perf.data' % fnize(line), '-g', '-c', '1000', 'bins/mutrace/%s' % bm_name, '--benchmark_filter=^%s$' % line, '--benchmark_min_time=20']) - subprocess.check_call(['sudo', 'perf', 'script', '-i', 'perf.data', '>', 'bm.perf'], shell=True) - subprocess.check_call([ - '%s/stackcollapse-perf.pl' % flamegraph_dir, 'bm.perf', '>', 'bm.folded'], shell=True) - link(line, '%s.svg' % fnize(line)) - with open('reports/%s.svg' % fnize(line), 'w') as f: - f.write(subprocess.check_output([ - '%s/flamegraph.pl' % flamegraph_dir, 'bm.folded'])) + env = os.environ.copy() + env.update({ + 'PERF_BASE_NAME': fnize(line), + 'OUTPUT_DIR': 'reports', + 'OUTPUT_FILENAME': fnize(line), + }) + subprocess.check_call(['tools/run_tests/performance/process_local_perf_flamegraphs.sh'], + env=env) def collect_summary(bm_name, args): heading('Summary: %s' % bm_name) From 4a84bdda7f42e303c570e2ee73cc14c57df6c81b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 14 Feb 2017 09:48:41 -0800 Subject: [PATCH 069/126] s/transport_private/handler_private -- use is no longer restricted to transports --- src/core/ext/client_channel/client_channel.c | 6 +++--- .../ext/transport/chttp2/transport/chttp2_transport.c | 10 +++++----- src/core/lib/transport/transport.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index 43f7e619cfc..49ea7f06be9 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -873,7 +873,7 @@ static void cc_start_transport_stream_op_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error_ignored) { grpc_transport_stream_op *op = arg; - grpc_call_element *elem = op->transport_private.args[0]; + grpc_call_element *elem = op->handler_private.args[0]; call_data *calld = elem->call_data; channel_data *chand = elem->channel_data; grpc_subchannel_call *call; @@ -992,10 +992,10 @@ static void cc_start_transport_stream_op(grpc_exec_ctx *exec_ctx, } /* we failed; lock and figure out what to do */ GRPC_CALL_STACK_REF(calld->owning_call, "start_transport_stream_op"); - op->transport_private.args[0] = elem; + op->handler_private.args[0] = elem; grpc_closure_sched( exec_ctx, - grpc_closure_init(&op->transport_private.closure, + grpc_closure_init(&op->handler_private.closure, cc_start_transport_stream_op_locked, op, grpc_combiner_scheduler(chand->combiner, false)), GRPC_ERROR_NONE); diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 3ee5e976f84..c00e64f0338 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1033,8 +1033,8 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, GPR_TIMER_BEGIN("perform_stream_op_locked", 0); grpc_transport_stream_op *op = stream_op; - grpc_chttp2_transport *t = op->transport_private.args[0]; - grpc_chttp2_stream *s = op->transport_private.args[1]; + grpc_chttp2_transport *t = op->handler_private.args[0]; + grpc_chttp2_stream *s = op->handler_private.args[1]; if (grpc_http_trace) { char *str = grpc_transport_stream_op_string(op); @@ -1255,13 +1255,13 @@ static void perform_stream_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, gpr_free(str); } - op->transport_private.args[0] = gt; - op->transport_private.args[1] = gs; + op->handler_private.args[0] = gt; + op->handler_private.args[1] = gs; GRPC_CHTTP2_STREAM_REF(s, "perform_stream_op"); grpc_closure_sched( exec_ctx, grpc_closure_init( - &op->transport_private.closure, perform_stream_op_locked, op, + &op->handler_private.closure, perform_stream_op_locked, op, grpc_combiner_scheduler(t->combiner, op->covered_by_poller)), GRPC_ERROR_NONE); GPR_TIMER_END("perform_stream_op", 0); diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index 9a0abe1ca46..e56bf2780ab 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -167,9 +167,9 @@ typedef struct grpc_transport_stream_op { /*************************************************************************** * remaining fields are initialized and used at the discretion of the - * transport implementation */ + * current handler of the op */ - grpc_transport_private_op_data transport_private; + grpc_transport_private_op_data handler_private; } grpc_transport_stream_op; /** Transport op: a set of operations to perform on a transport as a whole */ From a11bfc85e76dc1371b4c209259eb3449fd4b0dde Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 14 Feb 2017 09:56:33 -0800 Subject: [PATCH 070/126] Simplify loop --- src/core/ext/client_channel/client_channel.c | 49 ++++++++++++++------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index 49ea7f06be9..28ce224e618 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -869,32 +869,34 @@ static bool pick_subchannel_locked( return false; } -static void cc_start_transport_stream_op_locked(grpc_exec_ctx *exec_ctx, - void *arg, - grpc_error *error_ignored) { - grpc_transport_stream_op *op = arg; - grpc_call_element *elem = op->handler_private.args[0]; - call_data *calld = elem->call_data; +static void cc_start_transport_stream_op_locked_inner( + grpc_exec_ctx *exec_ctx, grpc_transport_stream_op *op, + grpc_call_element *elem) { channel_data *chand = elem->channel_data; + call_data *calld = elem->call_data; grpc_subchannel_call *call; -retry: /* need to recheck that another thread hasn't set the call */ call = GET_CALL(calld); if (call == CANCELLED_CALL) { grpc_transport_stream_op_finish_with_failure( exec_ctx, op, GRPC_ERROR_REF(calld->cancel_error)); - goto done; + /* early out */ + return; } if (call != NULL) { grpc_subchannel_call_process_op(exec_ctx, call, op); - goto done; + /* early out */ + return; } /* if this is a cancellation, then we can raise our cancelled flag */ if (op->cancel_error != GRPC_ERROR_NONE) { if (!gpr_atm_rel_cas(&calld->subchannel_call, 0, (gpr_atm)(uintptr_t)CANCELLED_CALL)) { - goto retry; + /* recurse to retry */ + cc_start_transport_stream_op_locked_inner(exec_ctx, op, elem); + /* early out */ + return; } else { // Stash a copy of cancel_error in our call data, so that we can use // it for subsequent operations. This ensures that if the call is @@ -914,7 +916,8 @@ retry: } grpc_transport_stream_op_finish_with_failure( exec_ctx, op, GRPC_ERROR_REF(op->cancel_error)); - goto done; + /* early out */ + return; } } /* if we don't have a subchannel, try to get one */ @@ -954,14 +957,29 @@ retry: gpr_atm_rel_store(&calld->subchannel_call, (gpr_atm)(uintptr_t)subchannel_call); retry_waiting_locked(exec_ctx, calld); - goto retry; + /* recurse to retry */ + cc_start_transport_stream_op_locked_inner(exec_ctx, op, elem); + /* early out */ + return; } /* nothing to be done but wait */ add_waiting_locked(calld, op); -done: +} + +static void cc_start_transport_stream_op_locked(grpc_exec_ctx *exec_ctx, + void *arg, + grpc_error *error_ignored) { + GPR_TIMER_BEGIN("cc_start_transport_stream_op_locked", 0); + + grpc_transport_stream_op *op = arg; + grpc_call_element *elem = op->handler_private.args[0]; + call_data *calld = elem->call_data; + + cc_start_transport_stream_op_locked_inner(exec_ctx, op, elem); + GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "start_transport_stream_op"); - GPR_TIMER_END("cc_start_transport_stream_op", 0); + GPR_TIMER_END("cc_start_transport_stream_op_locked", 0); } // The logic here is fairly complicated, due to (a) the fact that we @@ -983,11 +1001,13 @@ static void cc_start_transport_stream_op(grpc_exec_ctx *exec_ctx, grpc_transport_stream_op_finish_with_failure( exec_ctx, op, GRPC_ERROR_REF(calld->cancel_error)); GPR_TIMER_END("cc_start_transport_stream_op", 0); + /* early out */ return; } if (call != NULL) { grpc_subchannel_call_process_op(exec_ctx, call, op); GPR_TIMER_END("cc_start_transport_stream_op", 0); + /* early out */ return; } /* we failed; lock and figure out what to do */ @@ -999,6 +1019,7 @@ static void cc_start_transport_stream_op(grpc_exec_ctx *exec_ctx, cc_start_transport_stream_op_locked, op, grpc_combiner_scheduler(chand->combiner, false)), GRPC_ERROR_NONE); + GPR_TIMER_END("cc_start_transport_stream_op", 0); } // Gets data from the service config. Invoked when the resolver returns From be9691af99b438c72b64dd070cf0d45fac29792e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 14 Feb 2017 10:00:42 -0800 Subject: [PATCH 071/126] Add commentary --- src/core/ext/client_channel/client_channel.c | 23 +++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index 28ce224e618..e500187975c 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -898,11 +898,11 @@ static void cc_start_transport_stream_op_locked_inner( /* early out */ return; } else { - // Stash a copy of cancel_error in our call data, so that we can use - // it for subsequent operations. This ensures that if the call is - // cancelled before any ops are passed down (e.g., if the deadline - // is in the past when the call starts), we can return the right - // error to the caller when the first op does get passed down. + /* Stash a copy of cancel_error in our call data, so that we can use + it for subsequent operations. This ensures that if the call is + cancelled before any ops are passed down (e.g., if the deadline + is in the past when the call starts), we can return the right + error to the caller when the first op does get passed down. */ calld->cancel_error = GRPC_ERROR_REF(op->cancel_error); switch (calld->creation_phase) { case GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING: @@ -982,11 +982,14 @@ static void cc_start_transport_stream_op_locked(grpc_exec_ctx *exec_ctx, GPR_TIMER_END("cc_start_transport_stream_op_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 -// the streaming case. -// TODO(ctiller): Explain this more thoroughly. +/* 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 + the streaming case. + + We use double-checked locking to initially see if initialization has been + performed. If it has not, we acquire the combiner and perform initialization. + If it has, we proceed on the fast path. */ static void cc_start_transport_stream_op(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op *op) { From a8610c094d8bdf60188b9fd4c9934b2a9d3c0b56 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 14 Feb 2017 10:05:11 -0800 Subject: [PATCH 072/126] Review nits --- src/core/ext/client_channel/client_channel.c | 34 +++++++++----------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index e500187975c..bedb13d9741 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -421,8 +421,8 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, GRPC_ERROR_UNREF(state_error); } -static void cc_start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error_ignored) { +static void start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error_ignored) { grpc_transport_op *op = arg; grpc_channel_element *elem = op->transport_private.args[0]; channel_data *chand = elem->channel_data; @@ -488,10 +488,9 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx, op->transport_private.args[0] = elem; GRPC_CHANNEL_STACK_REF(chand->owning_stack, "start_transport_op"); grpc_closure_sched( - exec_ctx, - grpc_closure_init(&op->transport_private.closure, - cc_start_transport_op_locked, op, - grpc_combiner_scheduler(chand->combiner, false)), + exec_ctx, grpc_closure_init( + &op->transport_private.closure, start_transport_op_locked, + op, grpc_combiner_scheduler(chand->combiner, false)), GRPC_ERROR_NONE); } @@ -869,9 +868,9 @@ static bool pick_subchannel_locked( return false; } -static void cc_start_transport_stream_op_locked_inner( - grpc_exec_ctx *exec_ctx, grpc_transport_stream_op *op, - grpc_call_element *elem) { +static void start_transport_stream_op_locked_inner(grpc_exec_ctx *exec_ctx, + grpc_transport_stream_op *op, + grpc_call_element *elem) { channel_data *chand = elem->channel_data; call_data *calld = elem->call_data; grpc_subchannel_call *call; @@ -894,7 +893,7 @@ static void cc_start_transport_stream_op_locked_inner( if (!gpr_atm_rel_cas(&calld->subchannel_call, 0, (gpr_atm)(uintptr_t)CANCELLED_CALL)) { /* recurse to retry */ - cc_start_transport_stream_op_locked_inner(exec_ctx, op, elem); + start_transport_stream_op_locked_inner(exec_ctx, op, elem); /* early out */ return; } else { @@ -958,7 +957,7 @@ static void cc_start_transport_stream_op_locked_inner( (gpr_atm)(uintptr_t)subchannel_call); retry_waiting_locked(exec_ctx, calld); /* recurse to retry */ - cc_start_transport_stream_op_locked_inner(exec_ctx, op, elem); + start_transport_stream_op_locked_inner(exec_ctx, op, elem); /* early out */ return; } @@ -975,7 +974,7 @@ static void cc_start_transport_stream_op_locked(grpc_exec_ctx *exec_ctx, grpc_call_element *elem = op->handler_private.args[0]; call_data *calld = elem->call_data; - cc_start_transport_stream_op_locked_inner(exec_ctx, op, elem); + start_transport_stream_op_locked_inner(exec_ctx, op, elem); GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "start_transport_stream_op"); @@ -1221,8 +1220,8 @@ static void try_to_connect_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_connectivity_state grpc_client_channel_check_connectivity_state( grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, int try_to_connect) { channel_data *chand = elem->channel_data; - grpc_connectivity_state out; - out = grpc_connectivity_state_check(&chand->state_tracker); + grpc_connectivity_state out = + 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( @@ -1254,9 +1253,8 @@ static void on_external_watch_complete(grpc_exec_ctx *exec_ctx, void *arg, grpc_closure_run(exec_ctx, follow_up, GRPC_ERROR_REF(error)); } -static void cc_watch_connectivity_state_locked(grpc_exec_ctx *exec_ctx, - void *arg, - grpc_error *error_ignored) { +static void watch_connectivity_state_locked(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error_ignored) { external_connectivity_watcher *w = arg; grpc_closure_init(&w->my_closure, on_external_watch_complete, w, grpc_schedule_on_exec_ctx); @@ -1278,7 +1276,7 @@ void grpc_client_channel_watch_connectivity_state( "external_connectivity_watcher"); grpc_closure_sched( exec_ctx, - grpc_closure_init(&w->my_closure, cc_watch_connectivity_state_locked, w, + grpc_closure_init(&w->my_closure, watch_connectivity_state_locked, w, grpc_combiner_scheduler(chand->combiner, true)), GRPC_ERROR_NONE); } From a74ccafc93022d40210d70dbec392ceddfa3e612 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 14 Feb 2017 10:24:38 -0800 Subject: [PATCH 073/126] Add new dummy Cronet API --- .../transport/cronet/transport/cronet_api_dummy.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/core/ext/transport/cronet/transport/cronet_api_dummy.c b/src/core/ext/transport/cronet/transport/cronet_api_dummy.c index da6c0b4fbcc..0dc6a5152fd 100644 --- a/src/core/ext/transport/cronet/transport/cronet_api_dummy.c +++ b/src/core/ext/transport/cronet/transport/cronet_api_dummy.c @@ -80,4 +80,16 @@ void bidirectional_stream_cancel(bidirectional_stream* stream) { GPR_ASSERT(0); } +void bidirectional_stream_disable_auto_flush(bidirectional_stream* stream, + bool disable_auto_flush) { + GPR_ASSERT(0); +} + +void bidirectional_stream_delay_request_headers_until_flush( + bidirectional_stream* stream, bool delay_headers_until_flush) { + GPR_ASSERT(0); +} + +void bidirectional_stream_flush(bidirectional_stream* stream) { GPR_ASSERT(0); } + #endif /* GRPC_COMPILE_WITH_CRONET */ From 225435972c10da4dfb561ed7b11743022187708a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 14 Feb 2017 10:29:36 -0800 Subject: [PATCH 074/126] Fix bug in poll polling engine causing pollsets to be deleted before they are removed from pollset_sets --- src/core/lib/iomgr/ev_poll_posix.c | 38 ++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index 21eb62753ef..6bae99a3443 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -191,6 +191,7 @@ struct grpc_pollset { int kicked_without_pollers; grpc_closure *shutdown_done; grpc_closure_list idle_jobs; + int pollset_set_count; /* all polled fds */ size_t fd_count; size_t fd_capacity; @@ -228,7 +229,7 @@ static grpc_error *pollset_kick_ext(grpc_pollset *p, /* Return 1 if the pollset has active threads in pollset_work (pollset must * be locked) */ -static int pollset_has_workers(grpc_pollset *pollset); +static bool pollset_has_workers(grpc_pollset *pollset); /******************************************************************************* * pollset_set definitions @@ -658,10 +659,18 @@ static void remove_worker(grpc_pollset *p, grpc_pollset_worker *worker) { worker->next->prev = worker->prev; } -static int pollset_has_workers(grpc_pollset *p) { +static bool pollset_has_workers(grpc_pollset *p) { return p->root_worker.next != &p->root_worker; } +static bool pollset_in_pollset_sets(grpc_pollset *p) { + return p->pollset_set_count; +} + +static bool pollset_has_observers(grpc_pollset *p) { + return pollset_has_workers(p) || pollset_in_pollset_sets(p); +} + static grpc_pollset_worker *pop_front_worker(grpc_pollset *p) { if (pollset_has_workers(p)) { grpc_pollset_worker *w = p->root_worker.next; @@ -800,6 +809,7 @@ static void pollset_init(grpc_pollset *pollset, gpr_mu **mu) { pollset->fd_count = 0; pollset->fd_capacity = 0; pollset->fds = NULL; + pollset->pollset_set_count = 0; } static void pollset_destroy(grpc_pollset *pollset) { @@ -1061,7 +1071,7 @@ static grpc_error *pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, if (pollset->shutting_down) { if (pollset_has_workers(pollset)) { pollset_kick(pollset, NULL); - } else if (!pollset->called_shutdown) { + } else if (!pollset->called_shutdown && !pollset_has_observers(pollset)) { pollset->called_shutdown = 1; gpr_mu_unlock(&pollset->mu); finish_shutdown(exec_ctx, pollset); @@ -1093,7 +1103,7 @@ static void pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, if (!pollset_has_workers(pollset)) { grpc_closure_list_sched(exec_ctx, &pollset->idle_jobs); } - if (!pollset->called_shutdown && !pollset_has_workers(pollset)) { + if (!pollset->called_shutdown && !pollset_has_observers(pollset)) { pollset->called_shutdown = 1; finish_shutdown(exec_ctx, pollset); } @@ -1143,13 +1153,16 @@ static void pollset_set_add_pollset(grpc_exec_ctx *exec_ctx, grpc_pollset_set *pollset_set, grpc_pollset *pollset) { size_t i, j; + gpr_mu_lock(&pollset->mu); + pollset->pollset_set_count++; + gpr_mu_unlock(&pollset->mu); gpr_mu_lock(&pollset_set->mu); if (pollset_set->pollset_count == pollset_set->pollset_capacity) { pollset_set->pollset_capacity = GPR_MAX(8, 2 * pollset_set->pollset_capacity); - pollset_set->pollsets = - gpr_realloc(pollset_set->pollsets, pollset_set->pollset_capacity * - sizeof(*pollset_set->pollsets)); + pollset_set->pollsets = gpr_realloc( + pollset_set->pollsets, + pollset_set->pollset_capacity * sizeof(*pollset_set->pollsets)); } pollset_set->pollsets[pollset_set->pollset_count++] = pollset; for (i = 0, j = 0; i < pollset_set->fd_count; i++) { @@ -1178,6 +1191,17 @@ static void pollset_set_del_pollset(grpc_exec_ctx *exec_ctx, } } gpr_mu_unlock(&pollset_set->mu); + gpr_mu_lock(&pollset->mu); + pollset->pollset_set_count--; + /* check shutdown */ + if (pollset->shutting_down && !pollset->called_shutdown && + !pollset_has_observers(pollset)) { + pollset->called_shutdown = 1; + gpr_mu_unlock(&pollset->mu); + finish_shutdown(exec_ctx, pollset); + } else { + gpr_mu_unlock(&pollset->mu); + } } static void pollset_set_add_pollset_set(grpc_exec_ctx *exec_ctx, From 716f953532a92f3a159d26a78fdb397d0838b20e Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 14 Feb 2017 10:54:20 -0800 Subject: [PATCH 075/126] Update protobuf version used for nanopb compiler --- tools/codegen/core/gen_nano_proto.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/codegen/core/gen_nano_proto.sh b/tools/codegen/core/gen_nano_proto.sh index 99e49814b83..8600573e1cb 100755 --- a/tools/codegen/core/gen_nano_proto.sh +++ b/tools/codegen/core/gen_nano_proto.sh @@ -83,7 +83,7 @@ popd # this should be the same version as the submodule we compile against # ideally we'd update this as a template to ensure that -pip install protobuf==3.0.0 +pip install protobuf==3.2.0 pushd "$(dirname $INPUT_PROTO)" > /dev/null From 4d352bec3dfaee160268de94e27553f94cfa7ae7 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 14 Feb 2017 13:04:08 -0800 Subject: [PATCH 076/126] remove some temporary comments --- src/objective-c/tests/CronetUnitTests/CronetUnitTests.m | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m index b6237c950bf..1833a5be495 100644 --- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m +++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m @@ -71,9 +71,6 @@ static void drain_cq(grpc_completion_queue *cq) { + (void)setUp { [super setUp]; - /*** FILE *roots_file; - size_t roots_size = strlen(test_root_cert);*/ - char *argv[] = {"CoreCronetEnd2EndTests"}; grpc_test_init(1, argv); From b67243fd3dffadaabb661143bacf34b80560e066 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 14 Feb 2017 14:12:33 -0800 Subject: [PATCH 077/126] Polish test --- src/objective-c/tests/CronetUnitTests/CronetUnitTests.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m index 1833a5be495..5e3c59f8b34 100644 --- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m +++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m @@ -358,6 +358,8 @@ unsigned int parse_h2_length(const char *field) { error = grpc_call_start_batch(c, ops, (size_t)(op - ops), (void *)1, NULL); GPR_ASSERT(GRPC_CALL_OK == error); + __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Coalescing"]; + dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ int sl = socket(AF_INET, SOCK_STREAM, 0); @@ -420,6 +422,7 @@ unsigned int parse_h2_length(const char *field) { SSL_CTX_free(ctx); close(s); close(sl); + [expectation fulfill]; }); CQ_EXPECT_COMPLETION(cqv, (void *)1, 1); @@ -442,6 +445,8 @@ unsigned int parse_h2_length(const char *field) { grpc_completion_queue_shutdown(cq); drain_cq(cq); grpc_completion_queue_destroy(cq); + + [self waitForExpectationsWithTimeout:4 handler:nil]; } - (void)testPacketCoalescing { From 8da82bb9cf47442774c5618b856398eddf02f713 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 14 Feb 2017 14:20:13 -0800 Subject: [PATCH 078/126] Add CronetUnitTests into Jenkins tests --- .../xcshareddata/xcschemes/AllTests.xcscheme | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme index 5524a27ffde..49dc3faa3d0 100644 --- a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme +++ b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme @@ -59,6 +59,16 @@ ReferencedContainer = "container:Tests.xcodeproj"> + + + + + + + + From d5d9d9e6727df310596c005d1dfb38775182d05f Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Tue, 14 Feb 2017 12:58:24 -0800 Subject: [PATCH 079/126] Store cython-level call in grpc.Call This allows inspecting c-level properties of the call after completion. --- src/python/grpcio/grpc/_channel.py | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index 691e96a3228..26d93faf752 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -444,10 +444,10 @@ def _start_unary_request(request, timeout, request_serializer): return deadline, deadline_timespec, serialized_request, None -def _end_unary_response_blocking(state, with_call, deadline): +def _end_unary_response_blocking(state, call, with_call, deadline): if state.code is grpc.StatusCode.OK: if with_call: - rendezvous = _Rendezvous(state, None, None, deadline) + rendezvous = _Rendezvous(state, call, None, deadline) return state.response, rendezvous else: return state.response @@ -499,17 +499,17 @@ class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable): _check_call_error(call_error, metadata) _handle_event(completion_queue.poll(), state, self._response_deserializer) - return state, deadline + return state, call, deadline def __call__(self, request, timeout=None, metadata=None, credentials=None): - state, deadline, = self._blocking(request, timeout, metadata, - credentials) - return _end_unary_response_blocking(state, False, deadline) + state, call, deadline = self._blocking(request, timeout, metadata, + credentials) + return _end_unary_response_blocking(state, call, False, deadline) def with_call(self, request, timeout=None, metadata=None, credentials=None): - state, deadline, = self._blocking(request, timeout, metadata, - credentials) - return _end_unary_response_blocking(state, True, deadline) + state, call, deadline = self._blocking(request, timeout, metadata, + credentials) + return _end_unary_response_blocking(state, call, True, deadline) def future(self, request, timeout=None, metadata=None, credentials=None): state, operations, deadline, deadline_timespec, rendezvous = self._prepare( @@ -619,25 +619,25 @@ class _StreamUnaryMultiCallable(grpc.StreamUnaryMultiCallable): state.condition.notify_all() if not state.due: break - return state, deadline + return state, call, deadline def __call__(self, request_iterator, timeout=None, metadata=None, credentials=None): - state, deadline, = self._blocking(request_iterator, timeout, metadata, - credentials) - return _end_unary_response_blocking(state, False, deadline) + state, call, deadline = self._blocking(request_iterator, timeout, + metadata, credentials) + return _end_unary_response_blocking(state, call, False, deadline) def with_call(self, request_iterator, timeout=None, metadata=None, credentials=None): - state, deadline, = self._blocking(request_iterator, timeout, metadata, - credentials) - return _end_unary_response_blocking(state, True, deadline) + state, call, deadline = self._blocking(request_iterator, timeout, + metadata, credentials) + return _end_unary_response_blocking(state, call, True, deadline) def future(self, request_iterator, From 32df85cfab9efd8862cdc337c844de8540846399 Mon Sep 17 00:00:00 2001 From: Jonathan Hseu Date: Tue, 14 Feb 2017 16:03:55 -0800 Subject: [PATCH 080/126] Export LICENSE.txt in //third_party/nanopb --- third_party/nanopb/BUILD | 3 +++ 1 file changed, 3 insertions(+) diff --git a/third_party/nanopb/BUILD b/third_party/nanopb/BUILD index 570988435f1..f9fc57f50aa 100644 --- a/third_party/nanopb/BUILD +++ b/third_party/nanopb/BUILD @@ -1,4 +1,7 @@ licenses(["notice"]) + +exports_files(["LICENSE.txt"]) + package(default_visibility = ["//visibility:public"]) cc_library( From 5481a58da79977423b6ce8fe9bafbd01b19999a1 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 14 Feb 2017 16:11:42 -0800 Subject: [PATCH 081/126] Added to BUILD --- BUILD | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/BUILD b/BUILD index ba92279b8e7..9ea885a390a 100644 --- a/BUILD +++ b/BUILD @@ -526,13 +526,13 @@ grpc_cc_library( "src/core/lib/surface/server.c", "src/core/lib/surface/validate_metadata.c", "src/core/lib/surface/version.c", + "src/core/lib/transport/bdp_estimator.c", "src/core/lib/transport/byte_stream.c", "src/core/lib/transport/connectivity_state.c", "src/core/lib/transport/error_utils.c", "src/core/lib/transport/metadata.c", "src/core/lib/transport/metadata_batch.c", "src/core/lib/transport/pid_controller.c", - "src/core/lib/transport/bdp_estimator.c", "src/core/lib/transport/service_config.c", "src/core/lib/transport/static_metadata.c", "src/core/lib/transport/status_conversion.c", @@ -633,6 +633,7 @@ grpc_cc_library( "src/core/lib/surface/lame_client.h", "src/core/lib/surface/server.h", "src/core/lib/surface/validate_metadata.h", + "src/core/lib/transport/bdp_estimator.h", "src/core/lib/transport/byte_stream.h", "src/core/lib/transport/connectivity_state.h", "src/core/lib/transport/error_utils.h", @@ -640,7 +641,6 @@ grpc_cc_library( "src/core/lib/transport/metadata.h", "src/core/lib/transport/metadata_batch.h", "src/core/lib/transport/pid_controller.h", - "src/core/lib/transport/bdp_estimator.h", "src/core/lib/transport/service_config.h", "src/core/lib/transport/static_metadata.h", "src/core/lib/transport/status_conversion.h", @@ -656,6 +656,7 @@ grpc_cc_library( "include/grpc/byte_buffer.h", "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", + "include/grpc/load_reporting.h", "include/grpc/grpc.h", "include/grpc/grpc_posix.h", "include/grpc/grpc_security_constants.h", @@ -869,8 +870,8 @@ grpc_cc_library( "src/core/lib/security/credentials/plugin/plugin_credentials.c", "src/core/lib/security/credentials/ssl/ssl_credentials.c", "src/core/lib/security/transport/client_auth_filter.c", - "src/core/lib/security/transport/secure_endpoint.c", "src/core/lib/security/transport/lb_targets_info.c", + "src/core/lib/security/transport/secure_endpoint.c", "src/core/lib/security/transport/security_connector.c", "src/core/lib/security/transport/security_handshaker.c", "src/core/lib/security/transport/server_auth_filter.c", @@ -893,8 +894,8 @@ grpc_cc_library( "src/core/lib/security/credentials/plugin/plugin_credentials.h", "src/core/lib/security/credentials/ssl/ssl_credentials.h", "src/core/lib/security/transport/auth_filters.h", - "src/core/lib/security/transport/secure_endpoint.h", "src/core/lib/security/transport/lb_targets_info.h", + "src/core/lib/security/transport/secure_endpoint.h", "src/core/lib/security/transport/security_connector.h", "src/core/lib/security/transport/security_handshaker.h", "src/core/lib/security/transport/tsi_error.h", @@ -1267,13 +1268,13 @@ grpc_cc_library( grpc_cc_library( name = "grpc++_config_proto", + external_deps = [ + "protobuf", + ], language = "c++", public_hdrs = [ "include/grpc++/impl/codegen/config_protobuf.h", ], - external_deps = [ - "protobuf", - ], ) grpc_cc_library( From bd5a4d263d841c8bed87730173d31c5febcc6906 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 14 Feb 2017 16:45:47 -0800 Subject: [PATCH 082/126] Cleanup files during processing --- tools/run_tests/run_microbenchmark.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py index ea87b6cd986..6bba29d74ba 100755 --- a/tools/run_tests/run_microbenchmark.py +++ b/tools/run_tests/run_microbenchmark.py @@ -132,7 +132,7 @@ def collect_perf(bm_name, args): '-g', '-c', '1000', 'bins/mutrace/%s' % bm_name, '--benchmark_filter=^%s$' % line, - '--benchmark_min_time=20']) + '--benchmark_min_time=10']) env = os.environ.copy() env.update({ 'PERF_BASE_NAME': fnize(line), @@ -141,6 +141,8 @@ def collect_perf(bm_name, args): }) subprocess.check_call(['tools/run_tests/performance/process_local_perf_flamegraphs.sh'], env=env) + subprocess.check_call(['rm', '%s-perf.data' % fnize(line)]) + subprocess.check_call(['rm', '%s-out.perf' % fnize(line)]) def collect_summary(bm_name, args): heading('Summary: %s' % bm_name) From 7676e9ac9341759c1d71147e94de020d990783c2 Mon Sep 17 00:00:00 2001 From: Yong Ni Date: Tue, 14 Feb 2017 17:35:25 -0800 Subject: [PATCH 083/126] Tue Feb 14 17:35:25 PST 2017 --- tools/internal_ci/linux/grpc_interop.cfg | 40 ++++++++++++++++++++++ tools/internal_ci/linux/grpc_interop.sh | 42 ++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 tools/internal_ci/linux/grpc_interop.cfg create mode 100755 tools/internal_ci/linux/grpc_interop.sh diff --git a/tools/internal_ci/linux/grpc_interop.cfg b/tools/internal_ci/linux/grpc_interop.cfg new file mode 100644 index 00000000000..ecafcf62ae9 --- /dev/null +++ b/tools/internal_ci/linux/grpc_interop.cfg @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright 2017, 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. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/grpc_interop.sh" +timeout_mins: 60 +action { + define_artifacts { + regex: "**/sponge_log.xml" + } +} diff --git a/tools/internal_ci/linux/grpc_interop.sh b/tools/internal_ci/linux/grpc_interop.sh new file mode 100755 index 00000000000..68bb4199e3d --- /dev/null +++ b/tools/internal_ci/linux/grpc_interop.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# Copyright 2017, 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. + +set -ex + +export LANG=en_US.UTF-8 + +# Enter the gRPC repo root +cd $(dirname $0)/../../.. + +git submodule update --init + +tools/run_tests/run_interop_tests.py -l all -s all --cloud_to_prod --cloud_to_prod_auth --use_docker --http2_interop -t -j 12 $@ || FAILED="true" +tools/run_tests/run_interop_tests.py -l java --use_docker --http2_badserver_interop $@ || FAILED="true" +tools/run_tests/run_interop_tests.py -l python --use_docker --http2_badserver_interop $@ || FAILED="true" From 9e5ac1bf115a182c0418f21d60d15245af6307bf Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 14 Feb 2017 22:25:50 -0800 Subject: [PATCH 084/126] Fix broken shutdown, and cascading exec_ctx usage bugs --- src/core/ext/client_channel/client_channel.c | 2 +- src/core/ext/client_channel/lb_policy.c | 2 +- src/core/ext/client_channel/subchannel.c | 2 +- .../ext/resolver/dns/native/dns_resolver.c | 2 +- src/core/lib/http/httpcli.c | 5 +-- src/core/lib/http/httpcli.h | 3 +- src/core/lib/iomgr/ev_epoll_linux.c | 7 ++-- src/core/lib/iomgr/ev_poll_posix.c | 33 ++++++++++++++----- src/core/lib/iomgr/ev_posix.c | 5 +-- src/core/lib/iomgr/ev_posix.h | 3 +- src/core/lib/iomgr/pollset_set.h | 3 +- src/core/lib/iomgr/pollset_set_uv.c | 3 +- src/core/lib/iomgr/pollset_set_windows.c | 3 +- .../google_default_credentials.c | 2 +- .../security/credentials/jwt/jwt_verifier.c | 4 +-- .../security/credentials/jwt/jwt_verifier.h | 3 +- .../credentials/oauth2/oauth2_credentials.c | 2 +- test/core/end2end/fixtures/http_proxy.c | 2 +- test/core/http/httpcli_test.c | 2 +- test/core/http/httpscli_test.c | 2 +- test/core/iomgr/pollset_set_test.c | 11 ++++--- test/core/iomgr/resolve_address_posix_test.c | 2 +- test/core/iomgr/resolve_address_test.c | 2 +- test/core/iomgr/tcp_client_posix_test.c | 2 +- test/core/security/jwt_verifier_test.c | 16 ++++----- test/core/security/verify_jwt.c | 5 +-- test/core/util/port_server_client.c | 4 +-- 27 files changed, 78 insertions(+), 54 deletions(-) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index bedb13d9741..62fb061bcf9 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -582,7 +582,7 @@ static void cc_destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_slice_hash_table_unref(exec_ctx, chand->method_params_table); } grpc_connectivity_state_destroy(exec_ctx, &chand->state_tracker); - grpc_pollset_set_destroy(chand->interested_parties); + grpc_pollset_set_destroy(exec_ctx, chand->interested_parties); GRPC_COMBINER_UNREF(exec_ctx, chand->combiner, "client_channel"); gpr_mu_destroy(&chand->info_mu); } diff --git a/src/core/ext/client_channel/lb_policy.c b/src/core/ext/client_channel/lb_policy.c index 45ee72e2f0c..90401b586f2 100644 --- a/src/core/ext/client_channel/lb_policy.c +++ b/src/core/ext/client_channel/lb_policy.c @@ -94,7 +94,7 @@ void grpc_lb_policy_weak_unref(grpc_exec_ctx *exec_ctx, gpr_atm old_val = ref_mutate(policy, -(gpr_atm)1, 1 REF_MUTATE_PASS_ARGS("WEAK_UNREF")); if (old_val == 1) { - grpc_pollset_set_destroy(policy->interested_parties); + grpc_pollset_set_destroy(exec_ctx, policy->interested_parties); policy->vtable->destroy(exec_ctx, policy); } } diff --git a/src/core/ext/client_channel/subchannel.c b/src/core/ext/client_channel/subchannel.c index c37134fd5e7..09c68a91dd8 100644 --- a/src/core/ext/client_channel/subchannel.c +++ b/src/core/ext/client_channel/subchannel.c @@ -217,7 +217,7 @@ static void subchannel_destroy(grpc_exec_ctx *exec_ctx, void *arg, grpc_slice_unref_internal(exec_ctx, c->initial_connect_string); grpc_connectivity_state_destroy(exec_ctx, &c->state_tracker); grpc_connector_unref(exec_ctx, c->connector); - grpc_pollset_set_destroy(c->pollset_set); + grpc_pollset_set_destroy(exec_ctx, c->pollset_set); grpc_subchannel_key_destroy(exec_ctx, c->key); gpr_free(c); } diff --git a/src/core/ext/resolver/dns/native/dns_resolver.c b/src/core/ext/resolver/dns/native/dns_resolver.c index 2c9623211b3..c08b53ea040 100644 --- a/src/core/ext/resolver/dns/native/dns_resolver.c +++ b/src/core/ext/resolver/dns/native/dns_resolver.c @@ -244,7 +244,7 @@ static void dns_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *gr) { if (r->resolved_result != NULL) { grpc_channel_args_destroy(exec_ctx, r->resolved_result); } - grpc_pollset_set_destroy(r->interested_parties); + grpc_pollset_set_destroy(exec_ctx, r->interested_parties); gpr_free(r->name_to_resolve); gpr_free(r->default_port); grpc_channel_args_destroy(exec_ctx, r->channel_args); diff --git a/src/core/lib/http/httpcli.c b/src/core/lib/http/httpcli.c index fb2108987b1..6d7aa43b815 100644 --- a/src/core/lib/http/httpcli.c +++ b/src/core/lib/http/httpcli.c @@ -93,8 +93,9 @@ void grpc_httpcli_context_init(grpc_httpcli_context *context) { context->pollset_set = grpc_pollset_set_create(); } -void grpc_httpcli_context_destroy(grpc_httpcli_context *context) { - grpc_pollset_set_destroy(context->pollset_set); +void grpc_httpcli_context_destroy(grpc_exec_ctx *exec_ctx, + grpc_httpcli_context *context) { + grpc_pollset_set_destroy(exec_ctx, context->pollset_set); } static void next_address(grpc_exec_ctx *exec_ctx, internal_request *req, diff --git a/src/core/lib/http/httpcli.h b/src/core/lib/http/httpcli.h index 11e03b44dfd..8ae03ee78f4 100644 --- a/src/core/lib/http/httpcli.h +++ b/src/core/lib/http/httpcli.h @@ -83,7 +83,8 @@ typedef struct grpc_httpcli_request { typedef struct grpc_http_response grpc_httpcli_response; void grpc_httpcli_context_init(grpc_httpcli_context *context); -void grpc_httpcli_context_destroy(grpc_httpcli_context *context); +void grpc_httpcli_context_destroy(grpc_exec_ctx *exec_ctx, + grpc_httpcli_context *context); /* Asynchronously perform a HTTP GET. 'context' specifies the http context under which to do the get diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c index fc56843128e..fac3705142b 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.c +++ b/src/core/lib/iomgr/ev_epoll_linux.c @@ -1842,13 +1842,12 @@ static grpc_pollset_set *pollset_set_create(void) { return pss; } -static void pollset_set_destroy(grpc_pollset_set *pss) { +static void pollset_set_destroy(grpc_exec_ctx *exec_ctx, + grpc_pollset_set *pss) { gpr_mu_destroy(&pss->po.mu); if (pss->po.pi != NULL) { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - PI_UNREF(&exec_ctx, pss->po.pi, "pss_destroy"); - grpc_exec_ctx_finish(&exec_ctx); + PI_UNREF(exec_ctx, pss->po.pi, "pss_destroy"); } gpr_free(pss); diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index 6bae99a3443..c03fadaebb5 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -149,7 +149,7 @@ static void fd_end_poll(grpc_exec_ctx *exec_ctx, grpc_fd_watcher *rec, static bool fd_is_orphaned(grpc_fd *fd); /* Reference counting for fds */ -/*#define GRPC_FD_REF_COUNT_DEBUG*/ +//#define GRPC_FD_REF_COUNT_DEBUG #ifdef GRPC_FD_REF_COUNT_DEBUG 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, @@ -283,8 +283,8 @@ cv_fd_table g_cvfds; 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, - gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + (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) @@ -298,8 +298,8 @@ 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, - gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + (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; @@ -1137,12 +1137,27 @@ static grpc_pollset_set *pollset_set_create(void) { return pollset_set; } -static void pollset_set_destroy(grpc_pollset_set *pollset_set) { +static void pollset_set_destroy(grpc_exec_ctx *exec_ctx, + grpc_pollset_set *pollset_set) { size_t i; gpr_mu_destroy(&pollset_set->mu); for (i = 0; i < pollset_set->fd_count; i++) { GRPC_FD_UNREF(pollset_set->fds[i], "pollset_set"); } + for (i = 0; i < pollset_set->pollset_count; i++) { + grpc_pollset *pollset = pollset_set->pollsets[i]; + gpr_mu_lock(&pollset->mu); + pollset->pollset_set_count--; + /* check shutdown */ + if (pollset->shutting_down && !pollset->called_shutdown && + !pollset_has_observers(pollset)) { + pollset->called_shutdown = 1; + gpr_mu_unlock(&pollset->mu); + finish_shutdown(exec_ctx, pollset); + } else { + gpr_mu_unlock(&pollset->mu); + } + } gpr_free(pollset_set->pollsets); gpr_free(pollset_set->pollset_sets); gpr_free(pollset_set->fds); @@ -1160,9 +1175,9 @@ static void pollset_set_add_pollset(grpc_exec_ctx *exec_ctx, if (pollset_set->pollset_count == pollset_set->pollset_capacity) { pollset_set->pollset_capacity = GPR_MAX(8, 2 * pollset_set->pollset_capacity); - pollset_set->pollsets = gpr_realloc( - pollset_set->pollsets, - pollset_set->pollset_capacity * sizeof(*pollset_set->pollsets)); + pollset_set->pollsets = + gpr_realloc(pollset_set->pollsets, pollset_set->pollset_capacity * + sizeof(*pollset_set->pollsets)); } pollset_set->pollsets[pollset_set->pollset_count++] = pollset; for (i = 0, j = 0; i < pollset_set->fd_count; i++) { diff --git a/src/core/lib/iomgr/ev_posix.c b/src/core/lib/iomgr/ev_posix.c index 95b1d99d757..b5be5504b9d 100644 --- a/src/core/lib/iomgr/ev_posix.c +++ b/src/core/lib/iomgr/ev_posix.c @@ -215,8 +215,9 @@ grpc_pollset_set *grpc_pollset_set_create(void) { return g_event_engine->pollset_set_create(); } -void grpc_pollset_set_destroy(grpc_pollset_set *pollset_set) { - g_event_engine->pollset_set_destroy(pollset_set); +void grpc_pollset_set_destroy(grpc_exec_ctx *exec_ctx, + grpc_pollset_set *pollset_set) { + g_event_engine->pollset_set_destroy(exec_ctx, pollset_set); } void grpc_pollset_set_add_pollset(grpc_exec_ctx *exec_ctx, diff --git a/src/core/lib/iomgr/ev_posix.h b/src/core/lib/iomgr/ev_posix.h index 1aea7d61f32..1a9e5c115ae 100644 --- a/src/core/lib/iomgr/ev_posix.h +++ b/src/core/lib/iomgr/ev_posix.h @@ -74,7 +74,8 @@ typedef struct grpc_event_engine_vtable { struct grpc_fd *fd); grpc_pollset_set *(*pollset_set_create)(void); - void (*pollset_set_destroy)(grpc_pollset_set *pollset_set); + void (*pollset_set_destroy)(grpc_exec_ctx *exec_ctx, + grpc_pollset_set *pollset_set); void (*pollset_set_add_pollset)(grpc_exec_ctx *exec_ctx, grpc_pollset_set *pollset_set, grpc_pollset *pollset); diff --git a/src/core/lib/iomgr/pollset_set.h b/src/core/lib/iomgr/pollset_set.h index 34bb728c410..d11801d63b0 100644 --- a/src/core/lib/iomgr/pollset_set.h +++ b/src/core/lib/iomgr/pollset_set.h @@ -44,7 +44,8 @@ typedef struct grpc_pollset_set grpc_pollset_set; grpc_pollset_set *grpc_pollset_set_create(void); -void grpc_pollset_set_destroy(grpc_pollset_set *pollset_set); +void grpc_pollset_set_destroy(grpc_exec_ctx *exec_ctx, + grpc_pollset_set *pollset_set); void grpc_pollset_set_add_pollset(grpc_exec_ctx *exec_ctx, grpc_pollset_set *pollset_set, grpc_pollset *pollset); diff --git a/src/core/lib/iomgr/pollset_set_uv.c b/src/core/lib/iomgr/pollset_set_uv.c index e5ef8b29e03..836cfee4efc 100644 --- a/src/core/lib/iomgr/pollset_set_uv.c +++ b/src/core/lib/iomgr/pollset_set_uv.c @@ -41,7 +41,8 @@ grpc_pollset_set* grpc_pollset_set_create(void) { return (grpc_pollset_set*)((intptr_t)0xdeafbeef); } -void grpc_pollset_set_destroy(grpc_pollset_set* pollset_set) {} +void grpc_pollset_set_destroy(grpc_exec_ctx* exec_ctx, + grpc_pollset_set* pollset_set) {} void grpc_pollset_set_add_pollset(grpc_exec_ctx* exec_ctx, grpc_pollset_set* pollset_set, diff --git a/src/core/lib/iomgr/pollset_set_windows.c b/src/core/lib/iomgr/pollset_set_windows.c index 645650db9be..ae18c8a3ce1 100644 --- a/src/core/lib/iomgr/pollset_set_windows.c +++ b/src/core/lib/iomgr/pollset_set_windows.c @@ -42,7 +42,8 @@ grpc_pollset_set* grpc_pollset_set_create(void) { return (grpc_pollset_set*)((intptr_t)0xdeafbeef); } -void grpc_pollset_set_destroy(grpc_pollset_set* pollset_set) {} +void grpc_pollset_set_destroy(grpc_exec_ctx* exec_ctx, + grpc_pollset_set* pollset_set) {} void grpc_pollset_set_add_pollset(grpc_exec_ctx* exec_ctx, grpc_pollset_set* pollset_set, 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 a098741b707..ecd26de9faa 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 @@ -154,7 +154,7 @@ static int is_stack_running_on_compute_engine(grpc_exec_ctx *exec_ctx) { } gpr_mu_unlock(g_polling_mu); - grpc_httpcli_context_destroy(&context); + grpc_httpcli_context_destroy(exec_ctx, &context); grpc_closure_init(&destroy_closure, destroy_pollset, grpc_polling_entity_pollset(&detector.pollent), grpc_schedule_on_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 2270be8f449..f128177e8c4 100644 --- a/src/core/lib/security/credentials/jwt/jwt_verifier.c +++ b/src/core/lib/security/credentials/jwt/jwt_verifier.c @@ -898,10 +898,10 @@ grpc_jwt_verifier *grpc_jwt_verifier_create( return v; } -void grpc_jwt_verifier_destroy(grpc_jwt_verifier *v) { +void grpc_jwt_verifier_destroy(grpc_exec_ctx *exec_ctx, grpc_jwt_verifier *v) { size_t i; if (v == NULL) return; - grpc_httpcli_context_destroy(&v->http_ctx); + grpc_httpcli_context_destroy(exec_ctx, &v->http_ctx); if (v->mappings != NULL) { for (i = 0; i < v->num_mappings; i++) { gpr_free(v->mappings[i].email_domain); diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.h b/src/core/lib/security/credentials/jwt/jwt_verifier.h index 4fa320a4159..5c3d2a77887 100644 --- a/src/core/lib/security/credentials/jwt/jwt_verifier.h +++ b/src/core/lib/security/credentials/jwt/jwt_verifier.h @@ -109,7 +109,8 @@ grpc_jwt_verifier *grpc_jwt_verifier_create( size_t num_mappings); /*The verifier must not be destroyed if there are still outstanding callbacks.*/ -void grpc_jwt_verifier_destroy(grpc_jwt_verifier *verifier); +void grpc_jwt_verifier_destroy(grpc_exec_ctx *exec_ctx, + grpc_jwt_verifier *verifier); /* User provided callback that will be called when the verification of the JWT is done (maybe in another thread). diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.c b/src/core/lib/security/credentials/oauth2/oauth2_credentials.c index 1b0e43a1e46..c0f260f9380 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.c @@ -124,7 +124,7 @@ static void oauth2_token_fetcher_destruct(grpc_exec_ctx *exec_ctx, (grpc_oauth2_token_fetcher_credentials *)creds; grpc_credentials_md_store_unref(exec_ctx, c->access_token_md); gpr_mu_destroy(&c->mu); - grpc_httpcli_context_destroy(&c->httpcli_context); + grpc_httpcli_context_destroy(exec_ctx, &c->httpcli_context); } grpc_credentials_status diff --git a/test/core/end2end/fixtures/http_proxy.c b/test/core/end2end/fixtures/http_proxy.c index 6fdc86fc12f..2682ea0e7b0 100644 --- a/test/core/end2end/fixtures/http_proxy.c +++ b/test/core/end2end/fixtures/http_proxy.c @@ -110,7 +110,7 @@ static void proxy_connection_unref(grpc_exec_ctx* exec_ctx, grpc_endpoint_destroy(exec_ctx, conn->client_endpoint); if (conn->server_endpoint != NULL) grpc_endpoint_destroy(exec_ctx, conn->server_endpoint); - grpc_pollset_set_destroy(conn->pollset_set); + grpc_pollset_set_destroy(exec_ctx, conn->pollset_set); grpc_slice_buffer_destroy_internal(exec_ctx, &conn->client_read_buffer); grpc_slice_buffer_destroy_internal(exec_ctx, &conn->client_deferred_write_buffer); diff --git a/test/core/http/httpcli_test.c b/test/core/http/httpcli_test.c index 6cc00f871d8..be8301c5e33 100644 --- a/test/core/http/httpcli_test.c +++ b/test/core/http/httpcli_test.c @@ -209,7 +209,7 @@ int main(int argc, char **argv) { test_get(port); test_post(port); - grpc_httpcli_context_destroy(&g_context); + grpc_httpcli_context_destroy(&exec_ctx, &g_context); grpc_closure_init(&destroyed, destroy_pops, &g_pops, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&g_pops), diff --git a/test/core/http/httpscli_test.c b/test/core/http/httpscli_test.c index e1a26d91e9e..5a6f07bec25 100644 --- a/test/core/http/httpscli_test.c +++ b/test/core/http/httpscli_test.c @@ -212,7 +212,7 @@ int main(int argc, char **argv) { test_get(port); test_post(port); - grpc_httpcli_context_destroy(&g_context); + grpc_httpcli_context_destroy(&exec_ctx, &g_context); grpc_closure_init(&destroyed, destroy_pops, &g_pops, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&g_pops), diff --git a/test/core/iomgr/pollset_set_test.c b/test/core/iomgr/pollset_set_test.c index 40fa8586020..e7777acce1e 100644 --- a/test/core/iomgr/pollset_set_test.c +++ b/test/core/iomgr/pollset_set_test.c @@ -59,10 +59,11 @@ void init_test_pollset_sets(test_pollset_set *pollset_sets, const int num_pss) { } } -void cleanup_test_pollset_sets(test_pollset_set *pollset_sets, +void cleanup_test_pollset_sets(grpc_exec_ctx *exec_ctx, + test_pollset_set *pollset_sets, const int num_pss) { for (int i = 0; i < num_pss; i++) { - grpc_pollset_set_destroy(pollset_sets[i].pss); + grpc_pollset_set_destroy(exec_ctx, pollset_sets[i].pss); pollset_sets[i].pss = NULL; } } @@ -297,7 +298,7 @@ static void pollset_set_test_basic() { cleanup_test_fds(&exec_ctx, tfds, num_fds); cleanup_test_pollsets(&exec_ctx, pollsets, num_ps); - cleanup_test_pollset_sets(pollset_sets, num_pss); + cleanup_test_pollset_sets(&exec_ctx, pollset_sets, num_pss); grpc_exec_ctx_finish(&exec_ctx); } @@ -372,7 +373,7 @@ void pollset_set_test_dup_fds() { cleanup_test_fds(&exec_ctx, tfds, num_fds); cleanup_test_pollsets(&exec_ctx, &pollset, num_ps); - cleanup_test_pollset_sets(pollset_sets, num_pss); + cleanup_test_pollset_sets(&exec_ctx, pollset_sets, num_pss); grpc_exec_ctx_finish(&exec_ctx); } @@ -437,7 +438,7 @@ void pollset_set_test_empty_pollset() { cleanup_test_fds(&exec_ctx, tfds, num_fds); cleanup_test_pollsets(&exec_ctx, pollsets, num_ps); - cleanup_test_pollset_sets(&pollset_set, num_pss); + cleanup_test_pollset_sets(&exec_ctx, &pollset_set, num_pss); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/iomgr/resolve_address_posix_test.c b/test/core/iomgr/resolve_address_posix_test.c index a4feff8b009..ef4cfdf06f8 100644 --- a/test/core/iomgr/resolve_address_posix_test.c +++ b/test/core/iomgr/resolve_address_posix_test.c @@ -74,7 +74,7 @@ void args_finish(grpc_exec_ctx *exec_ctx, args_struct *args) { GPR_ASSERT(gpr_event_wait(&args->ev, test_deadline())); grpc_resolved_addresses_destroy(args->addrs); grpc_pollset_set_del_pollset(exec_ctx, args->pollset_set, args->pollset); - grpc_pollset_set_destroy(args->pollset_set); + grpc_pollset_set_destroy(exec_ctx, args->pollset_set); grpc_closure do_nothing_cb; grpc_closure_init(&do_nothing_cb, do_nothing, NULL, grpc_schedule_on_exec_ctx); diff --git a/test/core/iomgr/resolve_address_test.c b/test/core/iomgr/resolve_address_test.c index 54de9a20e1c..6a9bb5ae6f3 100644 --- a/test/core/iomgr/resolve_address_test.c +++ b/test/core/iomgr/resolve_address_test.c @@ -69,7 +69,7 @@ void args_finish(grpc_exec_ctx *exec_ctx, args_struct *args) { GPR_ASSERT(gpr_event_wait(&args->ev, test_deadline())); grpc_resolved_addresses_destroy(args->addrs); grpc_pollset_set_del_pollset(exec_ctx, args->pollset_set, args->pollset); - grpc_pollset_set_destroy(args->pollset_set); + grpc_pollset_set_destroy(exec_ctx, args->pollset_set); grpc_closure do_nothing_cb; grpc_closure_init(&do_nothing_cb, do_nothing, NULL, 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 dcdff8efb13..c9b514a024a 100644 --- a/test/core/iomgr/tcp_client_posix_test.c +++ b/test/core/iomgr/tcp_client_posix_test.c @@ -207,7 +207,7 @@ int main(int argc, char **argv) { test_succeeds(); gpr_log(GPR_ERROR, "End of first test"); test_fails(); - grpc_pollset_set_destroy(g_pollset_set); + grpc_pollset_set_destroy(&exec_ctx, g_pollset_set); grpc_closure_init(&destroyed, destroy_pollset, g_pollset, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed); diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c index a9bd976a39d..0a73f675280 100644 --- a/test/core/security/jwt_verifier_test.c +++ b/test/core/security/jwt_verifier_test.c @@ -386,9 +386,9 @@ static void test_jwt_verifier_google_email_issuer_success(void) { GPR_ASSERT(jwt != NULL); grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience, on_verification_success, (void *)expected_user_data); + grpc_jwt_verifier_destroy(&exec_ctx, verifier); grpc_exec_ctx_finish(&exec_ctx); gpr_free(jwt); - grpc_jwt_verifier_destroy(verifier); grpc_httpcli_set_override(NULL, NULL); } @@ -420,9 +420,9 @@ static void test_jwt_verifier_custom_email_issuer_success(void) { GPR_ASSERT(jwt != NULL); grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience, on_verification_success, (void *)expected_user_data); + grpc_jwt_verifier_destroy(&exec_ctx, verifier); grpc_exec_ctx_finish(&exec_ctx); gpr_free(jwt); - grpc_jwt_verifier_destroy(verifier); grpc_httpcli_set_override(NULL, NULL); } @@ -469,9 +469,9 @@ static void test_jwt_verifier_url_issuer_success(void) { GPR_ASSERT(jwt != NULL); grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience, on_verification_success, (void *)expected_user_data); + grpc_jwt_verifier_destroy(&exec_ctx, verifier); grpc_exec_ctx_finish(&exec_ctx); gpr_free(jwt); - grpc_jwt_verifier_destroy(verifier); grpc_httpcli_set_override(NULL, NULL); } @@ -511,9 +511,9 @@ static void test_jwt_verifier_url_issuer_bad_config(void) { grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience, on_verification_key_retrieval_error, (void *)expected_user_data); + grpc_jwt_verifier_destroy(&exec_ctx, verifier); grpc_exec_ctx_finish(&exec_ctx); gpr_free(jwt); - grpc_jwt_verifier_destroy(verifier); grpc_httpcli_set_override(NULL, NULL); } @@ -534,9 +534,9 @@ static void test_jwt_verifier_bad_json_key(void) { grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience, on_verification_key_retrieval_error, (void *)expected_user_data); + grpc_jwt_verifier_destroy(&exec_ctx, verifier); grpc_exec_ctx_finish(&exec_ctx); gpr_free(jwt); - grpc_jwt_verifier_destroy(verifier); grpc_httpcli_set_override(NULL, NULL); } @@ -588,9 +588,9 @@ static void test_jwt_verifier_bad_signature(void) { grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience, on_verification_bad_signature, (void *)expected_user_data); - grpc_exec_ctx_finish(&exec_ctx); gpr_free(jwt); - grpc_jwt_verifier_destroy(verifier); + grpc_jwt_verifier_destroy(&exec_ctx, verifier); + grpc_exec_ctx_finish(&exec_ctx); grpc_httpcli_set_override(NULL, NULL); } @@ -619,8 +619,8 @@ static void test_jwt_verifier_bad_format(void) { grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, "bad jwt", expected_audience, on_verification_bad_format, (void *)expected_user_data); + grpc_jwt_verifier_destroy(&exec_ctx, verifier); grpc_exec_ctx_finish(&exec_ctx); - grpc_jwt_verifier_destroy(verifier); grpc_httpcli_set_override(NULL, NULL); } diff --git a/test/core/security/verify_jwt.c b/test/core/security/verify_jwt.c index bbd4a67ac1c..aaf0e7f6b18 100644 --- a/test/core/security/verify_jwt.c +++ b/test/core/security/verify_jwt.c @@ -123,14 +123,15 @@ int main(int argc, char **argv) { gpr_inf_future(GPR_CLOCK_MONOTONIC)))) sync.is_done = true; gpr_mu_unlock(sync.mu); - grpc_exec_ctx_finish(&exec_ctx); + grpc_exec_ctx_flush(&exec_ctx); gpr_mu_lock(sync.mu); } gpr_mu_unlock(sync.mu); gpr_free(sync.pollset); - grpc_jwt_verifier_destroy(verifier); + grpc_jwt_verifier_destroy(&exec_ctx, verifier); + grpc_exec_ctx_finish(&exec_ctx); gpr_cmdline_destroy(cl); grpc_shutdown(); return !sync.success; diff --git a/test/core/util/port_server_client.c b/test/core/util/port_server_client.c index 6d722ffc882..7b733ab9c7d 100644 --- a/test/core/util/port_server_client.c +++ b/test/core/util/port_server_client.c @@ -121,7 +121,7 @@ void grpc_free_port_using_server(char *server, int port) { } gpr_mu_unlock(pr.mu); - grpc_httpcli_context_destroy(&context); + grpc_httpcli_context_destroy(&exec_ctx, &context); grpc_exec_ctx_finish(&exec_ctx); grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&pr.pops), shutdown_closure); @@ -245,7 +245,7 @@ int grpc_pick_port_using_server(char *server) { gpr_mu_unlock(pr.mu); grpc_http_response_destroy(&pr.response); - grpc_httpcli_context_destroy(&context); + grpc_httpcli_context_destroy(&exec_ctx, &context); grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&pr.pops), shutdown_closure); grpc_exec_ctx_finish(&exec_ctx); From 37bfff35eeee1805a88b6ab5bbf91c434c52336e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 14 Feb 2017 22:35:39 -0800 Subject: [PATCH 085/126] Fix port server --- tools/run_tests/python_utils/start_port_server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/run_tests/python_utils/start_port_server.py b/tools/run_tests/python_utils/start_port_server.py index d521aa6a9d9..8ee7080168a 100644 --- a/tools/run_tests/python_utils/start_port_server.py +++ b/tools/run_tests/python_utils/start_port_server.py @@ -36,6 +36,7 @@ import tempfile import sys import time import jobset +import socket def start_port_server(port_server_port): # check if a compatible port server is running From 7f9184f31450a0cff738b2d92a5e08535251348c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 14 Feb 2017 22:39:47 -0800 Subject: [PATCH 086/126] Review feedback --- test/core/util/trickle_endpoint.c | 4 +++- test/cpp/microbenchmarks/bm_fullstack.cc | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/core/util/trickle_endpoint.c b/test/core/util/trickle_endpoint.c index 5b6c666950a..7ab0488a660 100644 --- a/test/core/util/trickle_endpoint.c +++ b/test/core/util/trickle_endpoint.c @@ -166,7 +166,9 @@ grpc_endpoint *grpc_trickle_endpoint_create(grpc_endpoint *wrap, return &te->base; } -static double ts2dbl(gpr_timespec s) { return s.tv_sec + 1e-9 * s.tv_nsec; } +static double ts2dbl(gpr_timespec s) { + return (double)s.tv_sec + 1e-9 * (double)s.tv_nsec; +} size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { diff --git a/test/cpp/microbenchmarks/bm_fullstack.cc b/test/cpp/microbenchmarks/bm_fullstack.cc index 619a03d4740..d449acd7444 100644 --- a/test/cpp/microbenchmarks/bm_fullstack.cc +++ b/test/cpp/microbenchmarks/bm_fullstack.cc @@ -355,7 +355,7 @@ class TrickledCHTTP2 : public EndpointPairFixture { grpc_endpoint_pair p; grpc_passthru_endpoint_create(&p.client, &p.server, initialize_stuff.rq(), &stats_); - double bytes_per_second = 125 * kilobits; + double bytes_per_second = 125.0 * kilobits; p.client = grpc_trickle_endpoint_create(p.client, bytes_per_second); p.server = grpc_trickle_endpoint_create(p.server, bytes_per_second); return p; @@ -1022,7 +1022,8 @@ BENCHMARK_TEMPLATE(BM_PumpStreamServerToClient, InProcessCHTTP2) static void TrickleArgs(benchmark::internal::Benchmark* b) { for (int i = 1; i <= 128 * 1024 * 1024; i *= 8) { for (int j = 1; j <= 128 * 1024 * 1024; j *= 8) { - double expected_time = (double)(14 + i) / (125 * (double)j); + double expected_time = + static_cast(14 + i) / (125.0 * static_cast(j)); if (expected_time > 0.01) continue; b->Args({i, j}); } From fd2cd7856b55f391d6bb43d2fd39904b0db3b397 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 15 Feb 2017 06:53:51 -0800 Subject: [PATCH 087/126] Possible connection window flow control improvements Instead of incrementally doling out connection level flow control, use the fact that if a stream's initial_window_delta >= 0 then the application has made some commitment to read those bytes. That means that we should target connection level flow control to be: target_incoming_window = sum(stream_incoming_window_delta if stream_incoming_window_delta > 0) + max(0, k * bdp - sum(abs(stream_incoming_window_delta) if stream_incoming_window_delta < 0)) --- .../chttp2/transport/chttp2_transport.c | 12 ++++- .../ext/transport/chttp2/transport/internal.h | 54 +++++++++++++++++-- .../ext/transport/chttp2/transport/parsing.c | 20 ++++--- .../ext/transport/chttp2/transport/writing.c | 18 +++++-- 4 files changed, 83 insertions(+), 21 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 3ee5e976f84..93bae9f7bda 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -569,6 +569,14 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, GRPC_ERROR_UNREF(s->read_closed_error); GRPC_ERROR_UNREF(s->write_closed_error); + if (s->incoming_window_delta > 0) { + GRPC_CHTTP2_FLOW_DEBIT_STREAM_INCOMING_WINDOW_DELTA( + "destroy", t, s, s->incoming_window_delta); + } else if (s->incoming_window_delta < 0) { + GRPC_CHTTP2_FLOW_CREDIT_STREAM_INCOMING_WINDOW_DELTA( + "destroy", t, s, -s->incoming_window_delta); + } + GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "stream"); GPR_TIMER_END("destroy_stream", 0); @@ -2054,8 +2062,8 @@ static void incoming_byte_stream_update_flow_control(grpc_exec_ctx *exec_ctx, (int64_t)have_already) { write_type = GRPC_CHTTP2_STREAM_WRITE_INITIATE_COVERED; } - GRPC_CHTTP2_FLOW_CREDIT_STREAM("op", t, s, incoming_window_delta, - add_max_recv_bytes); + GRPC_CHTTP2_FLOW_CREDIT_STREAM_INCOMING_WINDOW_DELTA("op", t, s, + add_max_recv_bytes); GRPC_CHTTP2_FLOW_CREDIT_STREAM("op", t, s, announce_window, add_max_recv_bytes); if ((int64_t)s->incoming_window_delta + (int64_t)initial_window_size - diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 075d421dd46..5d41f4bfda6 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -271,10 +271,6 @@ struct grpc_chttp2_transport { /** data to write next write */ grpc_slice_buffer qbuf; - /** window available to announce to peer */ - int64_t announce_incoming_window; - /** how much window would we like to have for incoming_window */ - uint32_t connection_window_target; /** how much data are we willing to buffer when the WRITE_BUFFER_HINT is set? */ uint32_t write_buffer_size; @@ -328,6 +324,16 @@ struct grpc_chttp2_transport { /** window available for peer to send to us */ int64_t incoming_window; + /** calculating what we should give for incoming window: + we track the total amount of flow control over initial window size + across all streams: this is data that we want to receive right now (it + has an outstanding read) + and the total amount of flow control under initial window size across all + streams: this is data we've read early + we want to adjust incoming_window such that: + incoming_window = total_over - max(bdp - total_under, 0) */ + int64_t stream_total_over_incoming_window; + int64_t stream_total_under_incoming_window; /* deframing */ grpc_chttp2_deframe_transport_state deframe_state; @@ -634,6 +640,44 @@ typedef enum { GRPC_CHTTP2_FLOW_CREDIT_COMMON(phase, dst_context, 0, dst_context, dst_var, \ amount) +#define GRPC_CHTTP2_FLOW_STREAM_INCOMING_WINDOW_DELTA_PREUPDATE( \ + phase, transport, dst_context) \ + if (dst_context->incoming_window_delta < 0) { \ + transport->stream_total_under_incoming_window += \ + dst_context->incoming_window_delta; \ + } else if (dst_context->incoming_window_delta > 0) { \ + transport->stream_total_over_incoming_window -= \ + dst_context->incoming_window_delta; \ + } + +#define GRPC_CHTTP2_FLOW_STREAM_INCOMING_WINDOW_DELTA_POSTUPDATE( \ + phase, transport, dst_context) \ + if (dst_context->incoming_window_delta < 0) { \ + transport->stream_total_under_incoming_window -= \ + dst_context->incoming_window_delta; \ + } else if (dst_context->incoming_window_delta > 0) { \ + transport->stream_total_over_incoming_window += \ + dst_context->incoming_window_delta; \ + } + +#define GRPC_CHTTP2_FLOW_DEBIT_STREAM_INCOMING_WINDOW_DELTA( \ + phase, transport, dst_context, amount) \ + GRPC_CHTTP2_FLOW_STREAM_INCOMING_WINDOW_DELTA_PREUPDATE(phase, transport, \ + dst_context); \ + GRPC_CHTTP2_FLOW_DEBIT_STREAM(phase, transport, dst_context, \ + incoming_window_delta, amount); \ + GRPC_CHTTP2_FLOW_STREAM_INCOMING_WINDOW_DELTA_POSTUPDATE(phase, transport, \ + dst_context); + +#define GRPC_CHTTP2_FLOW_CREDIT_STREAM_INCOMING_WINDOW_DELTA( \ + phase, transport, dst_context, amount) \ + GRPC_CHTTP2_FLOW_STREAM_INCOMING_WINDOW_DELTA_PREUPDATE(phase, transport, \ + dst_context); \ + GRPC_CHTTP2_FLOW_CREDIT_STREAM(phase, transport, dst_context, \ + incoming_window_delta, amount); \ + GRPC_CHTTP2_FLOW_STREAM_INCOMING_WINDOW_DELTA_POSTUPDATE(phase, transport, \ + dst_context); + #define GRPC_CHTTP2_FLOW_DEBIT_COMMON(phase, transport, id, dst_context, \ dst_var, amount) \ do { \ @@ -752,4 +796,6 @@ void grpc_chttp2_fail_pending_writes(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_error *error); +uint32_t grpc_chttp2_target_incoming_window(grpc_chttp2_transport *t); + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H */ diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index 24bd93067b3..7ed00522c3e 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -376,15 +376,6 @@ static grpc_error *update_incoming_window(grpc_exec_ctx *exec_ctx, return err; } - uint32_t target_incoming_window = GPR_MAX( - t->settings[GRPC_SENT_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE], - 1024); - GRPC_CHTTP2_FLOW_DEBIT_TRANSPORT("parse", t, incoming_window, - incoming_frame_size); - if (t->incoming_window <= target_incoming_window / 2) { - grpc_chttp2_initiate_write(exec_ctx, t, false, "flow_control"); - } - if (s != NULL) { if (incoming_frame_size > s->incoming_window_delta + @@ -402,8 +393,8 @@ static grpc_error *update_incoming_window(grpc_exec_ctx *exec_ctx, return err; } - GRPC_CHTTP2_FLOW_DEBIT_STREAM("parse", t, s, incoming_window_delta, - incoming_frame_size); + GRPC_CHTTP2_FLOW_DEBIT_STREAM_INCOMING_WINDOW_DELTA("parse", t, s, + incoming_frame_size); if ((int64_t)t->settings[GRPC_SENT_SETTINGS] [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE] + (int64_t)s->incoming_window_delta - (int64_t)s->announce_window <= @@ -417,6 +408,13 @@ static grpc_error *update_incoming_window(grpc_exec_ctx *exec_ctx, s->received_bytes += incoming_frame_size; } + uint32_t target_incoming_window = grpc_chttp2_target_incoming_window(t); + GRPC_CHTTP2_FLOW_DEBIT_TRANSPORT("parse", t, incoming_window, + incoming_frame_size); + if (t->incoming_window <= target_incoming_window / 2) { + grpc_chttp2_initiate_write(exec_ctx, t, false, "flow_control"); + } + return GRPC_ERROR_NONE; } diff --git a/src/core/ext/transport/chttp2/transport/writing.c b/src/core/ext/transport/chttp2/transport/writing.c index 05e6f59947a..2b9d93cae7c 100644 --- a/src/core/ext/transport/chttp2/transport/writing.c +++ b/src/core/ext/transport/chttp2/transport/writing.c @@ -152,6 +152,17 @@ static bool stream_ref_if_not_destroyed(gpr_refcount *r) { return true; } +uint32_t grpc_chttp2_target_incoming_window(grpc_chttp2_transport *t) { + return (uint32_t)GPR_MAX( + (int64_t)((1u << 31) - 1), + t->stream_total_over_incoming_window + + (int64_t)GPR_MAX( + t->settings[GRPC_SENT_SETTINGS] + [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE] - + t->stream_total_under_incoming_window, + 0)); +} + bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { grpc_chttp2_stream *s; @@ -310,13 +321,12 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx, /* if the grpc_chttp2_transport is ready to send a window update, do so here also; 3/4 is a magic number that will likely get tuned soon */ - uint32_t target_incoming_window = GPR_MAX( - t->settings[GRPC_SENT_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE], - 1024); + uint32_t target_incoming_window = grpc_chttp2_target_incoming_window(t); uint32_t threshold_to_send_transport_window_update = t->outbuf.count > 0 ? 3 * target_incoming_window / 4 : target_incoming_window / 2; - if (t->incoming_window <= threshold_to_send_transport_window_update) { + if (t->incoming_window <= threshold_to_send_transport_window_update && + t->incoming_window != target_incoming_window) { maybe_initiate_ping(exec_ctx, t, GRPC_CHTTP2_PING_BEFORE_TRANSPORT_WINDOW_UPDATE); uint32_t announced = (uint32_t)GPR_CLAMP( From 5a8c586c40ba88632efb75c0762fba9db0d278d6 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 15 Feb 2017 07:59:05 -0800 Subject: [PATCH 088/126] Add flamegraphs to index.html --- tools/run_tests/run_microbenchmark.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py index 6bba29d74ba..92685de5ee8 100755 --- a/tools/run_tests/run_microbenchmark.py +++ b/tools/run_tests/run_microbenchmark.py @@ -128,6 +128,7 @@ def collect_perf(bm_name, args): 'CONFIG=mutrace', '-j', '%d' % multiprocessing.cpu_count()]) for line in subprocess.check_output(['bins/mutrace/%s' % bm_name, '--benchmark_list_tests']).splitlines(): + link(line, '%s.svg' % fnize(line)) subprocess.check_call(['perf', 'record', '-o', '%s-perf.data' % fnize(line), '-g', '-c', '1000', 'bins/mutrace/%s' % bm_name, From e2894b42d73e56c85bda418b163beb49756f7140 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 15 Feb 2017 08:12:55 -0800 Subject: [PATCH 089/126] Add some tracing --- .../ext/transport/chttp2/transport/chttp2_transport.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 93bae9f7bda..ddbc656b96d 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -265,7 +265,7 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, .gain_d = 0, .initial_control_value = log2(DEFAULT_WINDOW), .min_control_value = -1, - .max_control_value = 22, + .max_control_value = 25, .integral_range = 10}); grpc_chttp2_goaway_parser_init(&t->goaway_parser); @@ -1809,13 +1809,13 @@ static void update_bdp(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, if (delta == 0 || (bdp != 0 && delta > -1024 && delta < 1024)) { return; } + if (grpc_bdp_estimator_trace) { + 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, bdp); } -/******************************************************************************* - * INPUT PROCESSING - PARSING - */ - static grpc_error *try_http_parsing(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { grpc_http_parser parser; From d9bc2107e5c69e8e2f47c3c5487aadaef42c0fb0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 15 Feb 2017 08:24:55 -0800 Subject: [PATCH 090/126] Update microbenchmarking framework for new benchmark --- test/cpp/microbenchmarks/bm_fullstack.cc | 8 ++++---- tools/profiling/microbenchmarks/bm2bq.py | 11 ++++++++++- tools/run_tests/run_microbenchmark.py | 13 ++++++++++--- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_fullstack.cc b/test/cpp/microbenchmarks/bm_fullstack.cc index f83c3599616..9496a3ac737 100644 --- a/test/cpp/microbenchmarks/bm_fullstack.cc +++ b/test/cpp/microbenchmarks/bm_fullstack.cc @@ -312,18 +312,18 @@ class TrickledCHTTP2 : public EndpointPairFixture { void AddToLabel(std::ostream& out, benchmark::State& state) { out << " writes/iter:" << ((double)stats_.num_writes / (double)state.iterations()) - << " cli-transport-stalls/iter:" + << " cli_transport_stalls/iter:" << ((double) client_stats_.streams_stalled_due_to_transport_flow_control / (double)state.iterations()) - << " cli-stream-stalls/iter:" + << " cli_stream_stalls/iter:" << ((double)client_stats_.streams_stalled_due_to_stream_flow_control / (double)state.iterations()) - << " svr-transport-stalls/iter:" + << " svr_transport_stalls/iter:" << ((double) server_stats_.streams_stalled_due_to_transport_flow_control / (double)state.iterations()) - << " svr-stream-stalls/iter:" + << " svr_stream_stalls/iter:" << ((double)server_stats_.streams_stalled_due_to_stream_flow_control / (double)state.iterations()); } diff --git a/tools/profiling/microbenchmarks/bm2bq.py b/tools/profiling/microbenchmarks/bm2bq.py index 124dbdfec52..fd6207f42bb 100755 --- a/tools/profiling/microbenchmarks/bm2bq.py +++ b/tools/profiling/microbenchmarks/bm2bq.py @@ -61,6 +61,11 @@ columns = [ ('allocs_per_iteration', 'float'), ('locks_per_iteration', 'float'), ('writes_per_iteration', 'float'), + ('bandwidth_kilobits', 'integer'), + ('cli_transport_stalls_per_iteration', 'float'), + ('cli_stream_stalls_per_iteration', 'float'), + ('svr_transport_stalls_per_iteration', 'float'), + ('svr_stream_stalls_per_iteration', 'float'), ] if sys.argv[1] == '--schema': @@ -92,7 +97,11 @@ bm_specs = { 'BM_StreamingPingPongMsgs': { 'tpl': ['fixture', 'client_mutator', 'server_mutator'], 'dyn': ['request_size'], - } + }, + 'BM_PumpStreamServerToClient_Trickle': { + 'tpl': [], + 'dyn': ['request_size', 'bandwidth_kilobits'], + }, } def numericalize(s): diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py index 6bba29d74ba..3bb4a9547c8 100755 --- a/tools/run_tests/run_microbenchmark.py +++ b/tools/run_tests/run_microbenchmark.py @@ -149,9 +149,12 @@ def collect_summary(bm_name, args): subprocess.check_call( ['make', bm_name, 'CONFIG=counters', '-j', '%d' % multiprocessing.cpu_count()]) - text(subprocess.check_output(['bins/counters/%s' % bm_name, - '--benchmark_out=out.json', - '--benchmark_out_format=json'])) + cmd = ['bins/counters/%s' % bm_name, + '--benchmark_out=out.json', + '--benchmark_out_format=json'] + if args.summary_time is not None: + cmd += ['--benchmark_min_time=%d' % args.summary_time] + text(subprocess.check_output(cmd)) if args.bigquery_upload: with open('out.csv', 'w') as f: f.write(subprocess.check_output(['tools/profiling/microbenchmarks/bm2bq.py', 'out.json'])) @@ -179,6 +182,10 @@ argp.add_argument('--bigquery_upload', action='store_const', const=True, help='Upload results from summary collection to bigquery') +argp.add_argument('--summary_time', + default=None, + type=int, + help='Minimum time to run benchmarks for the summary collection') args = argp.parse_args() for bm_name in args.benchmarks: From 3f878bc78493bc3f0d8a826740355be445ffab7a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 15 Feb 2017 08:33:09 -0800 Subject: [PATCH 091/126] Update microbenchmarking framework for new benchmark --- tools/profiling/microbenchmarks/bm2bq.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm2bq.py b/tools/profiling/microbenchmarks/bm2bq.py index fd6207f42bb..a7d82269f55 100755 --- a/tools/profiling/microbenchmarks/bm2bq.py +++ b/tools/profiling/microbenchmarks/bm2bq.py @@ -115,6 +115,8 @@ def numericalize(s): assert 'not a number: %s' % s def parse_name(name): + if '<' not in name and '/' not in name and name not in bm_specs: + return {'name': name} rest = name out = {} tpl_args = [] @@ -145,7 +147,7 @@ def parse_name(name): rest = s[0] dyn_args = s[1:] name = rest - assert name in bm_specs + assert name in bm_specs, 'bm_specs needs to be expanded for %s' % name assert len(dyn_args) == len(bm_specs[name]['dyn']) assert len(tpl_args) == len(bm_specs[name]['tpl']) out['name'] = name @@ -155,10 +157,13 @@ def parse_name(name): for bm in js['benchmarks']: context = js['context'] - labels_list = [s.split(':') for s in bm.get('label', '').split(' ')] - for el in labels_list: - el[0] = el[0].replace('/iter', '_per_iteration') - labels = dict(labels_list) + if 'label' in bm: + labels_list = [s.split(':') for s in bm['label'].split(' ')] + for el in labels_list: + el[0] = el[0].replace('/iter', '_per_iteration') + labels = dict(labels_list) + else: + labels = {} row = { 'jenkins_build': os.environ.get('BUILD_NUMBER', ''), 'jenkins_job': os.environ.get('JOB_NAME', ''), @@ -167,5 +172,6 @@ for bm in js['benchmarks']: row.update(bm) row.update(parse_name(row['name'])) row.update(labels) - del row['label'] + if 'label' in row: + del row['label'] writer.writerow(row) From 86e369165a69a2c87ea60e6702272d0f8c8d3d24 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 15 Feb 2017 08:35:55 -0800 Subject: [PATCH 092/126] Update microbenchmarking framework for new benchmark --- tools/run_tests/run_microbenchmark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py index 3bb4a9547c8..d748e5a0ce4 100755 --- a/tools/run_tests/run_microbenchmark.py +++ b/tools/run_tests/run_microbenchmark.py @@ -173,7 +173,7 @@ argp.add_argument('-c', '--collect', default=sorted(collectors.keys()), help='Which collectors should be run against each benchmark') argp.add_argument('-b', '--benchmarks', - default=['bm_fullstack'], + default=['bm_fullstack', 'bm_closure'], nargs='+', type=str, help='Which microbenchmarks should be run') From 6ad0072f663f8b6c3816d267d0b71f5520a07157 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 15 Feb 2017 09:14:24 -0800 Subject: [PATCH 093/126] Run perf benchmarks in parallel --- tools/run_tests/run_microbenchmark.py | 51 +++++++++++++++++++-------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py index 92685de5ee8..bda31f6b3d5 100755 --- a/tools/run_tests/run_microbenchmark.py +++ b/tools/run_tests/run_microbenchmark.py @@ -126,24 +126,45 @@ def collect_perf(bm_name, args): subprocess.check_call( ['make', bm_name, 'CONFIG=mutrace', '-j', '%d' % multiprocessing.cpu_count()]) + benchmarks = [] + profile_analysis = [] + cleanup = [] for line in subprocess.check_output(['bins/mutrace/%s' % bm_name, '--benchmark_list_tests']).splitlines(): link(line, '%s.svg' % fnize(line)) - subprocess.check_call(['perf', 'record', '-o', '%s-perf.data' % fnize(line), - '-g', '-c', '1000', - 'bins/mutrace/%s' % bm_name, - '--benchmark_filter=^%s$' % line, - '--benchmark_min_time=10']) - env = os.environ.copy() - env.update({ - 'PERF_BASE_NAME': fnize(line), - 'OUTPUT_DIR': 'reports', - 'OUTPUT_FILENAME': fnize(line), - }) - subprocess.check_call(['tools/run_tests/performance/process_local_perf_flamegraphs.sh'], - env=env) - subprocess.check_call(['rm', '%s-perf.data' % fnize(line)]) - subprocess.check_call(['rm', '%s-out.perf' % fnize(line)]) + benchmarks.append( + jobset.JobSpec(['perf', 'record', '-o', '%s-perf.data' % fnize(line), + '-g', '-c', '1000', + 'bins/mutrace/%s' % bm_name, + '--benchmark_filter=^%s$' % line, + '--benchmark_min_time=10'])) + profile_analysis.append( + jobset.JobSpec(['tools/run_tests/performance/process_local_perf_flamegraphs.sh'], + environ = { + 'PERF_BASE_NAME': fnize(line), + 'OUTPUT_DIR': 'reports', + 'OUTPUT_FILENAME': fnize(line), + })) + cleanup.append(jobset.JobSpec(['rm', '%s-perf.data' % fnize(line)])) + cleanup.append(jobset.JobSpec(['rm', '%s-out.perf' % fnize(line)])) + # periodically flush out the list of jobs: temporary space required for this + # processing is large + if len(benchmarks) >= 20: + # run up to half the cpu count: each benchmark can use up to two cores + # (one for the microbenchmark, one for the data flush) + jobset.run(benchmarks, maxjobs=max(1, multiprocessing.cpu_count()/2), + add_env={'GRPC_TEST_PORT_SERVER': 'localhost:%d' % port_server_port}) + jobset.run(profile_analysis, maxjobs=multiprocessing.cpu_count()) + jobset.run(cleanup, maxjobs=multiprocessing.cpu_count()) + benchmarks = [] + profile_analysis = [] + cleanup = [] + # run the remaining benchmarks that weren't flushed + if len(benchmarks): + jobset.run(benchmarks, maxjobs=max(1, multiprocessing.cpu_count()/2), + add_env={'GRPC_TEST_PORT_SERVER': 'localhost:%d' % port_server_port}) + jobset.run(profile_analysis, maxjobs=multiprocessing.cpu_count()) + jobset.run(cleanup, maxjobs=multiprocessing.cpu_count()) def collect_summary(bm_name, args): heading('Summary: %s' % bm_name) From fafe99590027b882a5cf536f97fccb9ffffdd19a Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 15 Feb 2017 10:53:25 -0800 Subject: [PATCH 094/126] comments --- include/grpc++/test/server_context_test_spouse.h | 5 +++-- src/core/lib/surface/call.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/grpc++/test/server_context_test_spouse.h b/include/grpc++/test/server_context_test_spouse.h index 4cb84e77c19..bac0db7bdc5 100644 --- a/include/grpc++/test/server_context_test_spouse.h +++ b/include/grpc++/test/server_context_test_spouse.h @@ -55,8 +55,9 @@ class ServerContextTestSpouse { for (auto iter = client_metadata_storage_.begin(); iter != client_metadata_storage_.end(); ++iter) { ctx_->client_metadata_.map()->insert( - std::pair(iter->first.c_str(), - iter->second.c_str())); + std::pair( + iter->first.c_str(), + grpc::string_ref(iter->second.data(), iter->second.size()))); } } diff --git a/src/core/lib/surface/call.h b/src/core/lib/surface/call.h index b70343ddf18..7d4d0db28d9 100644 --- a/src/core/lib/surface/call.h +++ b/src/core/lib/surface/call.h @@ -110,6 +110,7 @@ void grpc_call_log_batch(char *file, int line, gpr_log_severity severity, /* Set a context pointer. No thread safety guarantees are made wrt this value. */ +/* TODO(#9731): add exec_ctx to destroy */ void grpc_call_context_set(grpc_call *call, grpc_context_index elem, void *value, void (*destroy)(void *value)); /* Get a context pointer. */ From d5b389d401630ffef65886291f421ef074525f9e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 15 Feb 2017 11:25:50 -0800 Subject: [PATCH 095/126] Serialize running of perf, switch back to -f for consistent event counts --- tools/run_tests/run_microbenchmark.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py index bda31f6b3d5..a2852546b37 100755 --- a/tools/run_tests/run_microbenchmark.py +++ b/tools/run_tests/run_microbenchmark.py @@ -134,7 +134,7 @@ def collect_perf(bm_name, args): link(line, '%s.svg' % fnize(line)) benchmarks.append( jobset.JobSpec(['perf', 'record', '-o', '%s-perf.data' % fnize(line), - '-g', '-c', '1000', + '-g', '-f', '997', 'bins/mutrace/%s' % bm_name, '--benchmark_filter=^%s$' % line, '--benchmark_min_time=10'])) @@ -152,7 +152,7 @@ def collect_perf(bm_name, args): if len(benchmarks) >= 20: # run up to half the cpu count: each benchmark can use up to two cores # (one for the microbenchmark, one for the data flush) - jobset.run(benchmarks, maxjobs=max(1, multiprocessing.cpu_count()/2), + jobset.run(benchmarks, maxjobs=1), add_env={'GRPC_TEST_PORT_SERVER': 'localhost:%d' % port_server_port}) jobset.run(profile_analysis, maxjobs=multiprocessing.cpu_count()) jobset.run(cleanup, maxjobs=multiprocessing.cpu_count()) @@ -161,7 +161,7 @@ def collect_perf(bm_name, args): cleanup = [] # run the remaining benchmarks that weren't flushed if len(benchmarks): - jobset.run(benchmarks, maxjobs=max(1, multiprocessing.cpu_count()/2), + jobset.run(benchmarks, maxjobs=1), add_env={'GRPC_TEST_PORT_SERVER': 'localhost:%d' % port_server_port}) jobset.run(profile_analysis, maxjobs=multiprocessing.cpu_count()) jobset.run(cleanup, maxjobs=multiprocessing.cpu_count()) From ab951947ce07336769682152880dd9eab2e03c80 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 15 Feb 2017 11:26:54 -0800 Subject: [PATCH 096/126] Syntax fix --- tools/run_tests/run_microbenchmark.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py index a2852546b37..05a12332902 100755 --- a/tools/run_tests/run_microbenchmark.py +++ b/tools/run_tests/run_microbenchmark.py @@ -152,7 +152,7 @@ def collect_perf(bm_name, args): if len(benchmarks) >= 20: # run up to half the cpu count: each benchmark can use up to two cores # (one for the microbenchmark, one for the data flush) - jobset.run(benchmarks, maxjobs=1), + jobset.run(benchmarks, maxjobs=1, add_env={'GRPC_TEST_PORT_SERVER': 'localhost:%d' % port_server_port}) jobset.run(profile_analysis, maxjobs=multiprocessing.cpu_count()) jobset.run(cleanup, maxjobs=multiprocessing.cpu_count()) @@ -161,7 +161,7 @@ def collect_perf(bm_name, args): cleanup = [] # run the remaining benchmarks that weren't flushed if len(benchmarks): - jobset.run(benchmarks, maxjobs=1), + jobset.run(benchmarks, maxjobs=1, add_env={'GRPC_TEST_PORT_SERVER': 'localhost:%d' % port_server_port}) jobset.run(profile_analysis, maxjobs=multiprocessing.cpu_count()) jobset.run(cleanup, maxjobs=multiprocessing.cpu_count()) From c2c0c6f549df0428f817a19c9366919f88f5b32b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 15 Feb 2017 11:27:37 -0800 Subject: [PATCH 097/126] capitALization --- tools/run_tests/run_microbenchmark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py index 05a12332902..4e60cce8688 100755 --- a/tools/run_tests/run_microbenchmark.py +++ b/tools/run_tests/run_microbenchmark.py @@ -134,7 +134,7 @@ def collect_perf(bm_name, args): link(line, '%s.svg' % fnize(line)) benchmarks.append( jobset.JobSpec(['perf', 'record', '-o', '%s-perf.data' % fnize(line), - '-g', '-f', '997', + '-g', '-F', '997', 'bins/mutrace/%s' % bm_name, '--benchmark_filter=^%s$' % line, '--benchmark_min_time=10'])) From 18570ec948bc45c03600fe5b41b79afc53f66bb3 Mon Sep 17 00:00:00 2001 From: Yong Ni Date: Wed, 15 Feb 2017 12:49:32 -0800 Subject: [PATCH 098/126] Wed Feb 15 12:49:32 PST 2017 --- tools/internal_ci/linux/grpc_interop.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/internal_ci/linux/grpc_interop.cfg b/tools/internal_ci/linux/grpc_interop.cfg index ecafcf62ae9..23b83d2f91e 100644 --- a/tools/internal_ci/linux/grpc_interop.cfg +++ b/tools/internal_ci/linux/grpc_interop.cfg @@ -32,7 +32,8 @@ # Location of the continuous shell script in repository. build_file: "grpc/tools/internal_ci/linux/grpc_interop.sh" -timeout_mins: 60 +# grpc_interop tests can take MANY hours to complete. +timeout_mins: 480 action { define_artifacts { regex: "**/sponge_log.xml" From 0392025bff4f845607af1c8120117c70a629af67 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 15 Feb 2017 12:51:21 -0800 Subject: [PATCH 099/126] Better error reporting in run_tests.py --- tools/run_tests/run_tests.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 8b76193cbe1..3d9b538ca77 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -80,6 +80,13 @@ def platform_string(): _DEFAULT_TIMEOUT_SECONDS = 5 * 60 +def run_shell_command(cmd, env=None, cwd=None): + try: + subprocess.check_output(cmd, shell=True, env=env, cwd=cwd) + except subprocess.CalledProcessError as e: + print("Error while running command '%s'. Exit status %d. Output:\n%s", + e.cmd, e.returncode, e.output) + raise # SimpleConfig: just compile with CONFIG=config, and run the binary to test class Config(object): @@ -1199,7 +1206,7 @@ for spec in args.update_submodules: cwd = 'third_party/%s' % submodule def git(cmd, cwd=cwd): print('in %s: git %s' % (cwd, cmd)) - subprocess.check_call('git %s' % cmd, cwd=cwd, shell=True) + run_shell_command('git %s' % cmd, cwd=cwd) git('fetch') git('checkout %s' % branch) git('pull origin %s' % branch) @@ -1207,7 +1214,7 @@ for spec in args.update_submodules: need_to_regenerate_projects = True if need_to_regenerate_projects: if jobset.platform_string() == 'linux': - subprocess.check_call('tools/buildgen/generate_projects.sh', shell=True) + run_shell_command('tools/buildgen/generate_projects.sh') else: print('WARNING: may need to regenerate projects, but since we are not on') print(' Linux this step is being skipped. Compilation MAY fail.') @@ -1276,9 +1283,7 @@ if args.use_docker: if not args.travis: env['TTY_FLAG'] = '-t' # enables Ctrl-C when not on Jenkins. - subprocess.check_call(['tools/run_tests/dockerize/build_docker_and_run_tests.sh'], - shell=True, - env=env) + run_shell_command('tools/run_tests/dockerize/build_docker_and_run_tests.sh', env=env) sys.exit(0) _check_arch_option(args.arch) From 17342333a8d36bed87fb01cabb5b685e20c31edf Mon Sep 17 00:00:00 2001 From: yongni Date: Wed, 15 Feb 2017 13:19:41 -0800 Subject: [PATCH 100/126] Update grpc_interop.cfg --- tools/internal_ci/linux/grpc_interop.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/internal_ci/linux/grpc_interop.cfg b/tools/internal_ci/linux/grpc_interop.cfg index 23b83d2f91e..9259faf34d5 100644 --- a/tools/internal_ci/linux/grpc_interop.cfg +++ b/tools/internal_ci/linux/grpc_interop.cfg @@ -32,7 +32,7 @@ # Location of the continuous shell script in repository. build_file: "grpc/tools/internal_ci/linux/grpc_interop.sh" -# grpc_interop tests can take MANY hours to complete. +# grpc_interop tests can take 6+ hours to complete. timeout_mins: 480 action { define_artifacts { From 3577f63136e1f1d6e26a00176a0cff6d9b2d9934 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Wed, 15 Feb 2017 22:09:16 +0000 Subject: [PATCH 101/126] Fix and enable logging-format-interpolation lint --- .pylintrc | 3 +-- src/python/grpcio/grpc/_common.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index a4f757f9bdd..23375149c7a 100644 --- a/.pylintrc +++ b/.pylintrc @@ -32,7 +32,6 @@ #TODO: Enable simplifiable-if-statement #TODO: Enable no-self-use #TODO: Enable no-member -#TODO: Enable logging-format-interpolation #TODO: Enable dangerous-default-value -disable=missing-docstring,too-few-public-methods,too-many-arguments,no-init,duplicate-code,invalid-name,suppressed-message,locally-disabled,protected-access,no-name-in-module,unused-argument,fixme,wrong-import-order,no-value-for-parameter,cyclic-import,unused-variable,redefined-outer-name,unused-import,too-many-instance-attributes,broad-except,too-many-locals,too-many-lines,redefined-variable-type,next-method-called,import-error,useless-else-on-loop,too-many-return-statements,too-many-nested-blocks,super-init-not-called,simplifiable-if-statement,no-self-use,no-member,logging-format-interpolation,dangerous-default-value +disable=missing-docstring,too-few-public-methods,too-many-arguments,no-init,duplicate-code,invalid-name,suppressed-message,locally-disabled,protected-access,no-name-in-module,unused-argument,fixme,wrong-import-order,no-value-for-parameter,cyclic-import,unused-variable,redefined-outer-name,unused-import,too-many-instance-attributes,broad-except,too-many-locals,too-many-lines,redefined-variable-type,next-method-called,import-error,useless-else-on-loop,too-many-return-statements,too-many-nested-blocks,super-init-not-called,simplifiable-if-statement,no-self-use,no-member,dangerous-default-value diff --git a/src/python/grpcio/grpc/_common.py b/src/python/grpcio/grpc/_common.py index a5f1f38ea97..dd74ba3ab61 100644 --- a/src/python/grpcio/grpc/_common.py +++ b/src/python/grpcio/grpc/_common.py @@ -92,7 +92,7 @@ def decode(b): try: return b.decode('utf8') except UnicodeDecodeError: - logging.exception('Invalid encoding on {}'.format(b)) + logging.exception('Invalid encoding on %s', b) return b.decode('latin1') From 402aca6621e2880b39de68ee98acdf43f6a211da Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Wed, 15 Feb 2017 22:43:52 +0000 Subject: [PATCH 102/126] Fix and enable dangerous-default-value lint The fix is more of an elision and the code in the changed area is reflowed. --- .pylintrc | 3 +-- src/python/grpcio/grpc/_common.py | 43 +++++++++++-------------------- 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/.pylintrc b/.pylintrc index 23375149c7a..e887b1cdbd2 100644 --- a/.pylintrc +++ b/.pylintrc @@ -32,6 +32,5 @@ #TODO: Enable simplifiable-if-statement #TODO: Enable no-self-use #TODO: Enable no-member -#TODO: Enable dangerous-default-value -disable=missing-docstring,too-few-public-methods,too-many-arguments,no-init,duplicate-code,invalid-name,suppressed-message,locally-disabled,protected-access,no-name-in-module,unused-argument,fixme,wrong-import-order,no-value-for-parameter,cyclic-import,unused-variable,redefined-outer-name,unused-import,too-many-instance-attributes,broad-except,too-many-locals,too-many-lines,redefined-variable-type,next-method-called,import-error,useless-else-on-loop,too-many-return-statements,too-many-nested-blocks,super-init-not-called,simplifiable-if-statement,no-self-use,no-member,dangerous-default-value +disable=missing-docstring,too-few-public-methods,too-many-arguments,no-init,duplicate-code,invalid-name,suppressed-message,locally-disabled,protected-access,no-name-in-module,unused-argument,fixme,wrong-import-order,no-value-for-parameter,cyclic-import,unused-variable,redefined-outer-name,unused-import,too-many-instance-attributes,broad-except,too-many-locals,too-many-lines,redefined-variable-type,next-method-called,import-error,useless-else-on-loop,too-many-return-statements,too-many-nested-blocks,super-init-not-called,simplifiable-if-statement,no-self-use,no-member diff --git a/src/python/grpcio/grpc/_common.py b/src/python/grpcio/grpc/_common.py index dd74ba3ab61..f9accd75a9f 100644 --- a/src/python/grpcio/grpc/_common.py +++ b/src/python/grpcio/grpc/_common.py @@ -148,36 +148,23 @@ def fully_qualified_method(group, method): class CleanupThread(threading.Thread): """A threading.Thread subclass supporting custom behavior on join(). - On Python Interpreter exit, Python will attempt to join outstanding threads - prior to garbage collection. We may need to do additional cleanup, and - we accomplish this by overriding the join() method. - """ - - def __init__(self, - behavior, - group=None, - target=None, - name=None, - args=(), - kwargs={}): + On Python Interpreter exit, Python will attempt to join outstanding threads + prior to garbage collection. We may need to do additional cleanup, and + we accomplish this by overriding the join() method. + """ + + def __init__(self, behavior, *args, **kwargs): """Constructor. - Args: - behavior (function): Function called on join() with a single - argument, timeout, indicating the maximum duration of - `behavior`, or None indicating `behavior` has no deadline. - `behavior` must be idempotent. - group (None): should be None. Reseved for future extensions - when ThreadGroup is implemented. - target (function): The function to invoke when this thread is - run. Defaults to None. - name (str): The name of this thread. Defaults to None. - args (tuple[object]): A tuple of arguments to pass to `target`. - kwargs (dict[str,object]): A dictionary of keyword arguments to - pass to `target`. - """ - super(CleanupThread, self).__init__( - group=group, target=target, name=name, args=args, kwargs=kwargs) + Args: + behavior (function): Function called on join() with a single + argument, timeout, indicating the maximum duration of + `behavior`, or None indicating `behavior` has no deadline. + `behavior` must be idempotent. + args: Positional arguments passed to threading.Thread constructor. + kwargs: Keyword arguments passed to threading.Thread constructor. + """ + super(CleanupThread, self).__init__(*args, **kwargs) self._behavior = behavior def join(self, timeout=None): From a52d3bb39b79039ebc66725773289035f0c002d7 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Wed, 15 Feb 2017 23:00:05 +0000 Subject: [PATCH 103/126] Fix and enable simplifiable-if-statement lint --- .pylintrc | 3 +-- src/python/grpcio/grpc/_auth.py | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.pylintrc b/.pylintrc index e887b1cdbd2..1682488cb4a 100644 --- a/.pylintrc +++ b/.pylintrc @@ -29,8 +29,7 @@ #TODO: Enable too-many-return-statements #TODO: Enable too-many-nested-blocks #TODO: Enable super-init-not-called -#TODO: Enable simplifiable-if-statement #TODO: Enable no-self-use #TODO: Enable no-member -disable=missing-docstring,too-few-public-methods,too-many-arguments,no-init,duplicate-code,invalid-name,suppressed-message,locally-disabled,protected-access,no-name-in-module,unused-argument,fixme,wrong-import-order,no-value-for-parameter,cyclic-import,unused-variable,redefined-outer-name,unused-import,too-many-instance-attributes,broad-except,too-many-locals,too-many-lines,redefined-variable-type,next-method-called,import-error,useless-else-on-loop,too-many-return-statements,too-many-nested-blocks,super-init-not-called,simplifiable-if-statement,no-self-use,no-member +disable=missing-docstring,too-few-public-methods,too-many-arguments,no-init,duplicate-code,invalid-name,suppressed-message,locally-disabled,protected-access,no-name-in-module,unused-argument,fixme,wrong-import-order,no-value-for-parameter,cyclic-import,unused-variable,redefined-outer-name,unused-import,too-many-instance-attributes,broad-except,too-many-locals,too-many-lines,redefined-variable-type,next-method-called,import-error,useless-else-on-loop,too-many-return-statements,too-many-nested-blocks,super-init-not-called,no-self-use,no-member diff --git a/src/python/grpcio/grpc/_auth.py b/src/python/grpcio/grpc/_auth.py index e8a90cf5047..21131f85f17 100644 --- a/src/python/grpcio/grpc/_auth.py +++ b/src/python/grpcio/grpc/_auth.py @@ -48,11 +48,8 @@ class GoogleCallCredentials(grpc.AuthMetadataPlugin): # Hack to determine if these are JWT creds and we need to pass # additional_claims when getting a token - if 'additional_claims' in inspect.getargspec( - credentials.get_access_token).args: - self._is_jwt = True - else: - self._is_jwt = False + self._is_jwt = 'additional_claims' in inspect.getargspec( + credentials.get_access_token).args def __call__(self, context, callback): # MetadataPlugins cannot block (see grpc.beta.interfaces.py) From 73495e3b3507438828d34376fa06fd68db18250e Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Wed, 15 Feb 2017 23:06:30 +0000 Subject: [PATCH 104/126] Ignore python_pylint_venv/. This should have been included in 1a967c31c3a7fbd2d6d5cb6c1e575fdb2d. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4098106e760..56e4b6d4b43 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ objs cython_debug/ python_build/ python_format_venv/ +python_pylint_venv/ .coverage* .eggs htmlcov/ From b3a1ec2111676d1504e1fdef41fdf8e046c1e283 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Wed, 15 Feb 2017 23:07:40 +0000 Subject: [PATCH 105/126] Output diff on failed yapf sanity --- tools/distrib/yapf_code.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/distrib/yapf_code.sh b/tools/distrib/yapf_code.sh index 030412ebeb9..007b14810eb 100755 --- a/tools/distrib/yapf_code.sh +++ b/tools/distrib/yapf_code.sh @@ -53,7 +53,7 @@ for dir in $DIRS; do tempdir=`mktemp -d` cp -RT $dir $tempdir $PYTHON -m yapf -i -r -p $exclusion_args $dir - if ! diff -rq $dir $tempdir; then + if ! diff -r $dir $tempdir; then script_result=1 fi rm -rf $tempdir From 95b37b7dfd7e11a50cec015f248f26a6485e4373 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 15 Feb 2017 16:49:49 -0800 Subject: [PATCH 106/126] Add random samping to run_tests.py --- tools/run_tests/run_tests.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 8b76193cbe1..54803de6804 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1092,6 +1092,18 @@ def runs_per_test_type(arg_str): raise argparse.ArgumentTypeError(msg) +def percent_type(arg_str): + pct = float(arg_str) + if pct > 100 or pct < 0: + raise argparse.ArgumentTypeError( + "'%f' is not a valid percentage in the [0, 100] range" % pct) + return pct + +# This is math.isclose in python >= 3.5 +def isclose(a, b, rel_tol=1e-09, abs_tol=0.0): + return abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol) + + # parse command line argp = argparse.ArgumentParser(description='Run grpc tests.') argp.add_argument('-c', '--config', @@ -1104,6 +1116,8 @@ argp.add_argument('-r', '--regex', default='.*', type=str) argp.add_argument('--regex_exclude', default='', type=str) argp.add_argument('-j', '--jobs', default=multiprocessing.cpu_count(), type=int) argp.add_argument('-s', '--slowdown', default=1.0, type=float) +argp.add_argument('-p', '--sample_percent', default=100.0, type=percent_type, + help='Run a random sample with that percentage of tests') argp.add_argument('-f', '--forever', default=False, action='store_const', @@ -1438,8 +1452,16 @@ def _build_and_run( else: # whereas otherwise, we want to shuffle things up to give all tests a # chance to run. - massaged_one_run = list(one_run) # random.shuffle needs an indexable seq. - random.shuffle(massaged_one_run) # which it modifies in-place. + massaged_one_run = list(one_run) # random.sample needs an indexable seq. + num_jobs = len(massaged_one_run) + # for a random sample, get as many as indicated by the 'sample_percent' + # argument. By default this arg is 100, resulting in a shuffle of all + # jobs. + sample_size = int(num_jobs * args.sample_percent/100.0) + massaged_one_run = random.sample(massaged_one_run, sample_size) + if not isclose(args.sample_percent, 100.0): + print("Running %d tests out of %d (~%d%%)" % + (sample_size, num_jobs, args.sample_percent)) if infinite_runs: assert len(massaged_one_run) > 0, 'Must have at least one test for a -n inf run' runs_sequence = (itertools.repeat(massaged_one_run) if infinite_runs @@ -1450,7 +1472,7 @@ def _build_and_run( jobset.message('START', 'Running tests quietly, only failing tests will be reported', do_newline=True) num_test_failures, resultset = jobset.run( all_runs, check_cancelled, newline_on_success=newline_on_success, - travis=args.travis, infinite_runs=infinite_runs, maxjobs=args.jobs, + travis=args.travis, maxjobs=args.jobs, stop_on_failure=args.stop_on_failure, add_env={'GRPC_TEST_PORT_SERVER': 'localhost:%d' % port_server_port}, quiet_success=args.quiet_success) From 891e8162e409b7048297c5b820a399f19f2a020b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 15 Feb 2017 23:30:27 -0800 Subject: [PATCH 107/126] Fix escaping in index.html --- tools/run_tests/run_microbenchmark.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py index 4e60cce8688..9bcba598b83 100755 --- a/tools/run_tests/run_microbenchmark.py +++ b/tools/run_tests/run_microbenchmark.py @@ -28,6 +28,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +import cgi import multiprocessing import os import subprocess @@ -71,11 +72,12 @@ def heading(name): def link(txt, tgt): global index_html - index_html += "

%s

\n" % (tgt, txt) + index_html += "

%s

\n" % ( + cgi.escape(tgt, quote=True), cgi.escape(txt)) def text(txt): global index_html - index_html += "

%s

\n" % txt + index_html += "

%s

\n" % cgi.escape(txt) def collect_latency(bm_name, args): """generate latency profiles""" From 6955c5e8d2c881169dfa4ffd80a38182d6e2e14e Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 13 Feb 2017 15:49:27 -0800 Subject: [PATCH 108/126] Remove code from network_status_tracker.c Pull the hash function to useful.h --- include/grpc/support/useful.h | 3 + src/core/lib/iomgr/network_status_tracker.c | 87 ++----------------- src/core/lib/iomgr/timer_generic.c | 10 +-- src/core/lib/support/cpu_posix.c | 9 +- .../end2end/tests/network_status_change.c | 5 +- 5 files changed, 16 insertions(+), 98 deletions(-) diff --git a/include/grpc/support/useful.h b/include/grpc/support/useful.h index 003e096cf9a..9d8314e4bef 100644 --- a/include/grpc/support/useful.h +++ b/include/grpc/support/useful.h @@ -74,4 +74,7 @@ #define GPR_ICMP(a, b) ((a) < (b) ? -1 : ((a) > (b) ? 1 : 0)) +#define GPR_HASH_POINTER(x, range) \ + ((((size_t)x) >> 4) ^ (((size_t)x) >> 9) ^ (((size_t)x) >> 14)) % (range) + #endif /* GRPC_SUPPORT_USEFUL_H */ diff --git a/src/core/lib/iomgr/network_status_tracker.c b/src/core/lib/iomgr/network_status_tracker.c index 1601a390028..4104bf927a1 100644 --- a/src/core/lib/iomgr/network_status_tracker.c +++ b/src/core/lib/iomgr/network_status_tracker.c @@ -31,95 +31,18 @@ * */ -#include -#include #include "src/core/lib/iomgr/endpoint.h" -typedef struct endpoint_ll_node { - grpc_endpoint *ep; - struct endpoint_ll_node *next; -} endpoint_ll_node; - -static endpoint_ll_node *head = NULL; -static gpr_mu g_endpoint_mutex; - -void grpc_network_status_shutdown(void) { - if (head != NULL) { - gpr_log(GPR_ERROR, - "Memory leaked as not all network endpoints were shut down"); - } - gpr_mu_destroy(&g_endpoint_mutex); -} +void grpc_network_status_shutdown(void) {} void grpc_network_status_init(void) { - gpr_mu_init(&g_endpoint_mutex); // TODO(makarandd): Install callback with OS to monitor network status. } -void grpc_destroy_network_status_monitor() { - for (endpoint_ll_node *curr = head; curr != NULL;) { - endpoint_ll_node *next = curr->next; - gpr_free(curr); - curr = next; - } - gpr_mu_destroy(&g_endpoint_mutex); -} - -void grpc_network_status_register_endpoint(grpc_endpoint *ep) { - gpr_mu_lock(&g_endpoint_mutex); - if (head == NULL) { - head = (endpoint_ll_node *)gpr_malloc(sizeof(endpoint_ll_node)); - head->ep = ep; - head->next = NULL; - } else { - endpoint_ll_node *prev_head = head; - head = (endpoint_ll_node *)gpr_malloc(sizeof(endpoint_ll_node)); - head->ep = ep; - head->next = prev_head; - } - gpr_mu_unlock(&g_endpoint_mutex); -} +void grpc_destroy_network_status_monitor() {} -void grpc_network_status_unregister_endpoint(grpc_endpoint *ep) { - gpr_mu_lock(&g_endpoint_mutex); - GPR_ASSERT(head); - bool found = false; - endpoint_ll_node *prev = head; - // if we're unregistering the head, just move head to the next - if (ep == head->ep) { - head = head->next; - gpr_free(prev); - found = true; - } else { - for (endpoint_ll_node *curr = head->next; curr != NULL; curr = curr->next) { - if (ep == curr->ep) { - prev->next = curr->next; - gpr_free(curr); - found = true; - break; - } - prev = curr; - } - } - gpr_mu_unlock(&g_endpoint_mutex); - GPR_ASSERT(found); -} +void grpc_network_status_register_endpoint(grpc_endpoint *ep) { (void)ep; } -// Walk the linked-list from head and execute shutdown. It is possible that -// other threads might be in the process of shutdown as well, but that has -// no side effect since endpoint shutdown is idempotent. -void grpc_network_status_shutdown_all_endpoints() { - gpr_mu_lock(&g_endpoint_mutex); - if (head == NULL) { - gpr_mu_unlock(&g_endpoint_mutex); - return; - } - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; +void grpc_network_status_unregister_endpoint(grpc_endpoint *ep) { (void)ep; } - for (endpoint_ll_node *curr = head; curr != NULL; curr = curr->next) { - curr->ep->vtable->shutdown(&exec_ctx, curr->ep, - GRPC_ERROR_CREATE("Network unavailable")); - } - gpr_mu_unlock(&g_endpoint_mutex); - grpc_exec_ctx_finish(&exec_ctx); -} +void grpc_network_status_shutdown_all_endpoints() {} diff --git a/src/core/lib/iomgr/timer_generic.c b/src/core/lib/iomgr/timer_generic.c index 40c83514724..8a5617e7c13 100644 --- a/src/core/lib/iomgr/timer_generic.c +++ b/src/core/lib/iomgr/timer_generic.c @@ -121,12 +121,6 @@ void grpc_timer_list_shutdown(grpc_exec_ctx *exec_ctx) { g_initialized = false; } -/* This is a cheap, but good enough, pointer hash for sharding the tasks: */ -static size_t shard_idx(const grpc_timer *info) { - size_t x = (size_t)info; - return ((x >> 4) ^ (x >> 9) ^ (x >> 14)) & (NUM_SHARDS - 1); -} - static double ts_to_dbl(gpr_timespec ts) { return (double)ts.tv_sec + 1e-9 * ts.tv_nsec; } @@ -181,7 +175,7 @@ void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer, gpr_timespec deadline, grpc_closure *closure, gpr_timespec now) { int is_first_timer = 0; - shard_type *shard = &g_shards[shard_idx(timer)]; + shard_type *shard = &g_shards[GPR_HASH_POINTER(timer, NUM_SHARDS)]; GPR_ASSERT(deadline.clock_type == g_clock_type); GPR_ASSERT(now.clock_type == g_clock_type); timer->closure = closure; @@ -247,7 +241,7 @@ void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer) { return; } - shard_type *shard = &g_shards[shard_idx(timer)]; + shard_type *shard = &g_shards[GPR_HASH_POINTER(timer, NUM_SHARDS)]; gpr_mu_lock(&shard->mu); if (!timer->triggered) { grpc_closure_sched(exec_ctx, timer->closure, GRPC_ERROR_CANCELLED); diff --git a/src/core/lib/support/cpu_posix.c b/src/core/lib/support/cpu_posix.c index 667bde7cad4..245f12f06d7 100644 --- a/src/core/lib/support/cpu_posix.c +++ b/src/core/lib/support/cpu_posix.c @@ -41,6 +41,7 @@ #include #include +#include static __thread char magic_thread_local; @@ -60,18 +61,12 @@ unsigned gpr_cpu_num_cores(void) { return (unsigned)ncpus; } -/* This is a cheap, but good enough, pointer hash for sharding things: */ -static size_t shard_ptr(const void *info) { - size_t x = (size_t)info; - return ((x >> 4) ^ (x >> 9) ^ (x >> 14)) % gpr_cpu_num_cores(); -} - unsigned gpr_cpu_current_cpu(void) { /* NOTE: there's no way I know to return the actual cpu index portably... most code that's using this is using it to shard across work queues though, so here we use thread identity instead to achieve a similar though not identical effect */ - return (unsigned)shard_ptr(&magic_thread_local); + return (unsigned)GPR_HASH_POINTER(&magic_thread_local, gpr_cpu_num_cores()); } #endif /* GPR_CPU_POSIX */ diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.c index 9cef02b2b3b..7540ce93a1b 100644 --- a/test/core/end2end/tests/network_status_change.c +++ b/test/core/end2end/tests/network_status_change.c @@ -212,8 +212,11 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); + // TODO(makdharma) Update this when the shutdown_all_endpoints is implemented. // Expected behavior of a RPC when network is lost. - GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); + // GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); + GPR_ASSERT(status == GRPC_STATUS_OK); + GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); From 6a5c83d4dea710463c59b972170c7fb0d71fab35 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Thu, 16 Feb 2017 12:25:32 -0800 Subject: [PATCH 109/126] PHP: add macro for arg info in extension --- src/php/ext/grpc/call.c | 52 +++++++++++++++----- src/php/ext/grpc/call_credentials.c | 13 ++++- src/php/ext/grpc/channel.c | 35 +++++++++++-- src/php/ext/grpc/channel_credentials.c | 31 ++++++++++-- src/php/ext/grpc/server.c | 36 +++++++++++--- src/php/ext/grpc/server_credentials.c | 8 ++- src/php/ext/grpc/timeval.c | 68 ++++++++++++++++++++++---- 7 files changed, 201 insertions(+), 42 deletions(-) diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index be071903d03..48a374fa08e 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -104,7 +104,8 @@ zval *grpc_parse_metadata_array(grpc_metadata_array str_key = ecalloc(key_len + 1, sizeof(char)); memcpy(str_key, GRPC_SLICE_START_PTR(elem->key), key_len); str_val = ecalloc(GRPC_SLICE_LENGTH(elem->value) + 1, sizeof(char)); - memcpy(str_val, GRPC_SLICE_START_PTR(elem->value), GRPC_SLICE_LENGTH(elem->value)); + memcpy(str_val, GRPC_SLICE_START_PTR(elem->value), + GRPC_SLICE_LENGTH(elem->value)); if (php_grpc_zend_hash_find(array_hash, str_key, key_len, (void **)&data) == SUCCESS) { if (Z_TYPE_P(data) != IS_ARRAY) { @@ -115,7 +116,8 @@ zval *grpc_parse_metadata_array(grpc_metadata_array efree(str_val); return NULL; } - php_grpc_add_next_index_stringl(data, str_val, GRPC_SLICE_LENGTH(elem->value), + php_grpc_add_next_index_stringl(data, str_val, + GRPC_SLICE_LENGTH(elem->value), false); } else { PHP_GRPC_MAKE_STD_ZVAL(inner_array); @@ -172,8 +174,10 @@ bool create_metadata_array(zval *array, grpc_metadata_array *metadata) { if (Z_TYPE_P(value) != IS_STRING) { return false; } - metadata->metadata[metadata->count].key = grpc_slice_from_copied_string(key1); - metadata->metadata[metadata->count].value = grpc_slice_from_copied_buffer(Z_STRVAL_P(value), Z_STRLEN_P(value)); + metadata->metadata[metadata->count].key = + grpc_slice_from_copied_string(key1); + metadata->metadata[metadata->count].value = + grpc_slice_from_copied_buffer(Z_STRVAL_P(value), Z_STRLEN_P(value)); metadata->count += 1; PHP_GRPC_HASH_FOREACH_END() PHP_GRPC_HASH_FOREACH_END() @@ -233,7 +237,8 @@ PHP_METHOD(Call, __construct) { grpc_slice_from_copied_string(host_override) : grpc_empty_slice(); call->wrapped = grpc_channel_create_call(channel->wrapped, NULL, GRPC_PROPAGATE_DEFAULTS, - completion_queue, method_slice, host_override != NULL ? &host_slice : NULL, + completion_queue, method_slice, + host_override != NULL ? &host_slice : NULL, deadline->wrapped, NULL); grpc_slice_unref(method_slice); grpc_slice_unref(host_slice); @@ -384,8 +389,10 @@ PHP_METHOD(Call, startBatch) { 1 TSRMLS_CC); goto cleanup; } - send_status_details = grpc_slice_from_copied_string(Z_STRVAL_P(inner_value)); - ops[op_num].data.send_status_from_server.status_details = &send_status_details; + send_status_details = grpc_slice_from_copied_string( + Z_STRVAL_P(inner_value)); + ops[op_num].data.send_status_from_server.status_details = + &send_status_details; } else { zend_throw_exception(spl_ce_InvalidArgumentException, "String status details is required", @@ -557,12 +564,33 @@ PHP_METHOD(Call, setCredentials) { RETURN_LONG(error); } +ZEND_BEGIN_ARG_INFO_EX(arginfo_construct, 0, 0, 3) + ZEND_ARG_INFO(0, channel) + ZEND_ARG_INFO(0, method) + ZEND_ARG_INFO(0, deadline) + ZEND_ARG_INFO(0, host_override) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_startBatch, 0, 0, 1) + ZEND_ARG_INFO(0, ops) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_getPeer, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_cancel, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_setCredentials, 0, 0, 1) + ZEND_ARG_INFO(0, credentials) +ZEND_END_ARG_INFO() + static zend_function_entry call_methods[] = { - PHP_ME(Call, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) - PHP_ME(Call, startBatch, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Call, getPeer, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Call, cancel, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Call, setCredentials, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Call, __construct, arginfo_construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) + PHP_ME(Call, startBatch, arginfo_startBatch, ZEND_ACC_PUBLIC) + PHP_ME(Call, getPeer, arginfo_getPeer, ZEND_ACC_PUBLIC) + PHP_ME(Call, cancel, arginfo_cancel, ZEND_ACC_PUBLIC) + PHP_ME(Call, setCredentials, arginfo_setCredentials, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/src/php/ext/grpc/call_credentials.c b/src/php/ext/grpc/call_credentials.c index 043817facd1..625c0c62ae3 100644 --- a/src/php/ext/grpc/call_credentials.c +++ b/src/php/ext/grpc/call_credentials.c @@ -212,10 +212,19 @@ void plugin_destroy_state(void *ptr) { efree(state); } +ZEND_BEGIN_ARG_INFO_EX(arginfo_createComposite, 0, 0, 2) + ZEND_ARG_INFO(0, creds1) + ZEND_ARG_INFO(0, creds2) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_createFromPlugin, 0, 0, 1) + ZEND_ARG_INFO(0, callback) +ZEND_END_ARG_INFO() + static zend_function_entry call_credentials_methods[] = { - PHP_ME(CallCredentials, createComposite, NULL, + PHP_ME(CallCredentials, createComposite, arginfo_createComposite, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(CallCredentials, createFromPlugin, NULL, + PHP_ME(CallCredentials, createFromPlugin, arginfo_createFromPlugin, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c index 4ce4f307b04..c26fe4a6fb8 100644 --- a/src/php/ext/grpc/channel.c +++ b/src/php/ext/grpc/channel.c @@ -243,12 +243,37 @@ PHP_METHOD(Channel, close) { } } +ZEND_BEGIN_ARG_INFO_EX(arginfo_construct, 0, 0, 2) + ZEND_ARG_INFO(0, target) + ZEND_ARG_INFO(0, args) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_getTarget, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_getConnectivityState, 0, 0, 0) + ZEND_ARG_INFO(0, try_to_connect) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_watchConnectivityState, 0, 0, 2) + ZEND_ARG_INFO(0, last_state) + ZEND_ARG_INFO(0, deadline) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_close, 0, 0, 0) +ZEND_END_ARG_INFO() + static zend_function_entry channel_methods[] = { - PHP_ME(Channel, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) - PHP_ME(Channel, getTarget, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Channel, getConnectivityState, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Channel, watchConnectivityState, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Channel, close, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Channel, __construct, arginfo_construct, + ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) + PHP_ME(Channel, getTarget, arginfo_getTarget, + ZEND_ACC_PUBLIC) + PHP_ME(Channel, getConnectivityState, arginfo_getConnectivityState, + ZEND_ACC_PUBLIC) + PHP_ME(Channel, watchConnectivityState, arginfo_watchConnectivityState, + ZEND_ACC_PUBLIC) + PHP_ME(Channel, close, arginfo_close, + ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/src/php/ext/grpc/channel_credentials.c b/src/php/ext/grpc/channel_credentials.c index 36a8223b880..2160a548c3e 100644 --- a/src/php/ext/grpc/channel_credentials.c +++ b/src/php/ext/grpc/channel_credentials.c @@ -199,16 +199,37 @@ PHP_METHOD(ChannelCredentials, createInsecure) { RETURN_NULL(); } +ZEND_BEGIN_ARG_INFO_EX(arginfo_setDefaultRootsPem, 0, 0, 1) + ZEND_ARG_INFO(0, pem_roots) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_createDefault, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_createSsl, 0, 0, 0) + ZEND_ARG_INFO(0, pem_root_certs) + ZEND_ARG_INFO(0, pem_private_key) + ZEND_ARG_INFO(0, pem_cert_chain) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_createComposite, 0, 0, 2) + ZEND_ARG_INFO(0, channel_creds) + ZEND_ARG_INFO(0, call_creds) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_createInsecure, 0, 0, 0) +ZEND_END_ARG_INFO() + static zend_function_entry channel_credentials_methods[] = { - PHP_ME(ChannelCredentials, setDefaultRootsPem, NULL, + PHP_ME(ChannelCredentials, setDefaultRootsPem, arginfo_setDefaultRootsPem, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(ChannelCredentials, createDefault, NULL, + PHP_ME(ChannelCredentials, createDefault, arginfo_createDefault, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(ChannelCredentials, createSsl, NULL, + PHP_ME(ChannelCredentials, createSsl, arginfo_createSsl, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(ChannelCredentials, createComposite, NULL, + PHP_ME(ChannelCredentials, createComposite, arginfo_createComposite, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(ChannelCredentials, createInsecure, NULL, + PHP_ME(ChannelCredentials, createInsecure, arginfo_createInsecure, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/src/php/ext/grpc/server.c b/src/php/ext/grpc/server.c index 9ac5d2a3c39..87780e997e3 100644 --- a/src/php/ext/grpc/server.c +++ b/src/php/ext/grpc/server.c @@ -116,8 +116,6 @@ PHP_METHOD(Server, __construct) { /** * Request a call on a server. Creates a single GRPC_SERVER_RPC_NEW event. - * @param long $tag_new The tag to associate with the new request - * @param long $tag_cancel The tag to use if the call is cancelled * @return void */ PHP_METHOD(Server, requestCall) { @@ -239,12 +237,36 @@ PHP_METHOD(Server, start) { grpc_server_start(server->wrapped); } +ZEND_BEGIN_ARG_INFO_EX(arginfo_construct, 0, 0, 0) + ZEND_ARG_INFO(0, args) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_requestCall, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_addHttp2Port, 0, 0, 1) + ZEND_ARG_INFO(0, addr) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_addSecureHttp2Port, 0, 0, 2) + ZEND_ARG_INFO(0, addr) + ZEND_ARG_INFO(0, server_creds) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_start, 0, 0, 0) +ZEND_END_ARG_INFO() + static zend_function_entry server_methods[] = { - PHP_ME(Server, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) - PHP_ME(Server, requestCall, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Server, addHttp2Port, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Server, addSecureHttp2Port, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Server, start, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Server, __construct, arginfo_construct, + ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) + PHP_ME(Server, requestCall, arginfo_requestCall, + ZEND_ACC_PUBLIC) + PHP_ME(Server, addHttp2Port, arginfo_addHttp2Port, + ZEND_ACC_PUBLIC) + PHP_ME(Server, addSecureHttp2Port, arginfo_addSecureHttp2Port, + ZEND_ACC_PUBLIC) + PHP_ME(Server, start, arginfo_start, + ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/src/php/ext/grpc/server_credentials.c b/src/php/ext/grpc/server_credentials.c index 3e39fee246c..ec29dfdc7c2 100644 --- a/src/php/ext/grpc/server_credentials.c +++ b/src/php/ext/grpc/server_credentials.c @@ -117,8 +117,14 @@ PHP_METHOD(ServerCredentials, createSsl) { RETURN_DESTROY_ZVAL(creds_object); } +ZEND_BEGIN_ARG_INFO_EX(arginfo_createSsl, 0, 0, 3) + ZEND_ARG_INFO(0, pem_root_certs) + ZEND_ARG_INFO(0, pem_private_key) + ZEND_ARG_INFO(0, pem_cert_chain) +ZEND_END_ARG_INFO() + static zend_function_entry server_credentials_methods[] = { - PHP_ME(ServerCredentials, createSsl, NULL, + PHP_ME(ServerCredentials, createSsl, arginfo_createSsl, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/src/php/ext/grpc/timeval.c b/src/php/ext/grpc/timeval.c index 7ada915aadd..78c29e385b1 100644 --- a/src/php/ext/grpc/timeval.c +++ b/src/php/ext/grpc/timeval.c @@ -245,17 +245,65 @@ PHP_METHOD(Timeval, sleepUntil) { gpr_sleep_until(this->wrapped); } +ZEND_BEGIN_ARG_INFO_EX(arginfo_construct, 0, 0, 1) + ZEND_ARG_INFO(0, microseconds) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_add, 0, 0, 1) + ZEND_ARG_INFO(0, timeval) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_compare, 0, 0, 2) + ZEND_ARG_INFO(0, a_timeval) + ZEND_ARG_INFO(0, b_timeval) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_infFuture, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_infPast, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_now, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_similar, 0, 0, 3) + ZEND_ARG_INFO(0, a_timeval) + ZEND_ARG_INFO(0, b_timeval) + ZEND_ARG_INFO(0, threshold_timeval) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_sleepUntil, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_subtract, 0, 0, 1) + ZEND_ARG_INFO(0, timeval) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_zero, 0, 0, 0) +ZEND_END_ARG_INFO() + static zend_function_entry timeval_methods[] = { - PHP_ME(Timeval, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) - PHP_ME(Timeval, add, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Timeval, compare, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Timeval, infFuture, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Timeval, infPast, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Timeval, now, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Timeval, similar, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Timeval, sleepUntil, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Timeval, subtract, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Timeval, zero, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_ME(Timeval, __construct, arginfo_construct, + ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) + PHP_ME(Timeval, add, arginfo_add, + ZEND_ACC_PUBLIC) + PHP_ME(Timeval, compare, arginfo_compare, + ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_ME(Timeval, infFuture, arginfo_infFuture, + ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_ME(Timeval, infPast, arginfo_infPast, + ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_ME(Timeval, now, arginfo_now, + ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_ME(Timeval, similar, arginfo_similar, + ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_ME(Timeval, sleepUntil, arginfo_sleepUntil, + ZEND_ACC_PUBLIC) + PHP_ME(Timeval, subtract, arginfo_subtract, + ZEND_ACC_PUBLIC) + PHP_ME(Timeval, zero, arginfo_zero, + ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END }; From b5359b5fac0513ad60124259c37df64759edb541 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 16 Feb 2017 14:06:34 -0800 Subject: [PATCH 110/126] added assert against combining -p and -n --- tools/run_tests/run_tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 54803de6804..1de20ae1b60 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1462,6 +1462,8 @@ def _build_and_run( if not isclose(args.sample_percent, 100.0): print("Running %d tests out of %d (~%d%%)" % (sample_size, num_jobs, args.sample_percent)) + else: + assert args.runs_per_test == 1, "Can't do sampling (-p) over multiple runs (-n)." if infinite_runs: assert len(massaged_one_run) > 0, 'Must have at least one test for a -n inf run' runs_sequence = (itertools.repeat(massaged_one_run) if infinite_runs From 37cbc3f5b30451254c99a85be36364bae74f2c70 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 16 Feb 2017 14:54:55 -0800 Subject: [PATCH 111/126] Use special errors where appropriate in call cancellation: avoids many allocations in a semi-common case --- src/core/lib/surface/call.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 3352e427cd2..48a1e586e17 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -481,7 +481,10 @@ void grpc_call_destroy(grpc_call *c) { c->destroy_called = 1; cancel = !c->received_final_op; gpr_mu_unlock(&c->mu); - if (cancel) grpc_call_cancel(c, NULL); + if (cancel) { + cancel_with_error(&exec_ctx, c, STATUS_FROM_API_OVERRIDE, + GRPC_ERROR_CANCELLED); + } GRPC_CALL_INTERNAL_UNREF(&exec_ctx, c, "destroy"); grpc_exec_ctx_finish(&exec_ctx); GPR_TIMER_END("grpc_call_destroy", 0); @@ -490,8 +493,11 @@ void grpc_call_destroy(grpc_call *c) { grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved) { GRPC_API_TRACE("grpc_call_cancel(call=%p, reserved=%p)", 2, (call, reserved)); GPR_ASSERT(!reserved); - return grpc_call_cancel_with_status(call, GRPC_STATUS_CANCELLED, "Cancelled", - NULL); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + cancel_with_error(&exec_ctx, call, STATUS_FROM_API_OVERRIDE, + GRPC_ERROR_CANCELLED); + grpc_exec_ctx_finish(&exec_ctx); + return GRPC_CALL_OK; } static void execute_op(grpc_exec_ctx *exec_ctx, grpc_call *call, From f07ed45439110033c8460295a71e4a5b4c42a0a1 Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 16 Feb 2017 23:01:28 -0800 Subject: [PATCH 112/126] Restore the NextMessageSize for streamed calls --- include/grpc++/impl/codegen/call.h | 15 ++++++++++++++- include/grpc++/impl/codegen/sync_stream.h | 8 ++++---- src/cpp/server/server_cc.cc | 4 ++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index a17cdf9236f..19a5ca2b2ee 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -618,7 +618,17 @@ class Call final { public: /* call is owned by the caller */ Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq) - : call_hook_(call_hook), cq_(cq), call_(call) {} + : call_hook_(call_hook), + cq_(cq), + call_(call), + max_receive_message_size_(-1) {} + + Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq, + int max_receive_message_size) + : call_hook_(call_hook), + cq_(cq), + call_(call), + max_receive_message_size_(max_receive_message_size) {} void PerformOps(CallOpSetInterface* ops) { call_hook_->PerformOpsOnCall(ops, this); @@ -627,10 +637,13 @@ class Call final { grpc_call* call() const { return call_; } CompletionQueue* cq() const { return cq_; } + int max_receive_message_size() const { return max_receive_message_size_; } + private: CallHook* call_hook_; CompletionQueue* cq_; grpc_call* call_; + int max_receive_message_size_; }; } // namespace grpc diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h index 1f7708bab94..4d9b074e95f 100644 --- a/include/grpc++/impl/codegen/sync_stream.h +++ b/include/grpc++/impl/codegen/sync_stream.h @@ -160,7 +160,7 @@ class ClientReader final : public ClientReaderInterface { } bool NextMessageSize(uint32_t* sz) override { - *sz = INT_MAX; + *sz = call_.max_receive_message_size(); return true; } @@ -310,7 +310,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { } bool NextMessageSize(uint32_t* sz) override { - *sz = INT_MAX; + *sz = call_.max_receive_message_size(); return true; } @@ -382,7 +382,7 @@ class ServerReader final : public ServerReaderInterface { } bool NextMessageSize(uint32_t* sz) override { - *sz = INT_MAX; + *sz = call_->max_receive_message_size(); return true; } @@ -474,7 +474,7 @@ class ServerReaderWriterBody final { } bool NextMessageSize(uint32_t* sz) { - *sz = INT_MAX; + *sz = call_->max_receive_message_size(); return true; } diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 29898a4209e..5ed9f41d4f4 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -186,7 +186,7 @@ class Server::SyncRequest final : public CompletionQueueTag { public: explicit CallData(Server* server, SyncRequest* mrd) : cq_(mrd->cq_), - call_(mrd->call_, server, &cq_), + call_(mrd->call_, server, &cq_, server->max_receive_message_size()), ctx_(mrd->deadline_, mrd->request_metadata_.metadata, mrd->request_metadata_.count), has_request_payload_(mrd->has_request_payload_), @@ -590,7 +590,7 @@ bool ServerInterface::BaseAsyncRequest::FinalizeResult(void** tag, } context_->set_call(call_); context_->cq_ = call_cq_; - Call call(call_, server_, call_cq_); + Call call(call_, server_, call_cq_, server_->max_receive_message_size()); if (*status && call_) { context_->BeginCompletionOp(&call); } From bbe6bfd6fdb7d59101ab457c4459f98140f71cf1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 17 Feb 2017 11:50:51 -0800 Subject: [PATCH 113/126] Add BUILD file for test/core/slice --- test/core/slice/BUILD | 54 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 test/core/slice/BUILD diff --git a/test/core/slice/BUILD b/test/core/slice/BUILD new file mode 100644 index 00000000000..67a47063482 --- /dev/null +++ b/test/core/slice/BUILD @@ -0,0 +1,54 @@ +# Copyright 2017, 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. + +licenses(["notice"]) # 3-clause BSD + +load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") + +grpc_fuzzer( + name = "percent_decode_fuzzer", + srcs = ["percent_decode_fuzzer.c"], + deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], + corpus = "response_corpus", + copts = ["-std=c99"], +) + +cc_test( + name = "percent_encoding_test", + srcs = ["percent_encoding_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "slice_buffer_test", + srcs = ["slice_string_helpers_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) From 92bc4156535116423d1cf3670a3e401f5315142b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 17 Feb 2017 11:58:30 -0800 Subject: [PATCH 114/126] Add BUILD file for test/core/fling --- test/core/fling/BUILD | 62 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 test/core/fling/BUILD diff --git a/test/core/fling/BUILD b/test/core/fling/BUILD new file mode 100644 index 00000000000..0b0ebcb2523 --- /dev/null +++ b/test/core/fling/BUILD @@ -0,0 +1,62 @@ +# Copyright 2017, 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. + +licenses(["notice"]) # 3-clause BSD + +load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") + +cc_binary( + name = "client", + srcs = ["client.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], + testonly = 1, + copts = ['-std=c99'] +) + +cc_binary( + name = "server", + srcs = ["server.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], + testonly = 1, + copts = ['-std=c99'] +) + +cc_test( + name = "fling", + srcs = ["fling_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], + data = [":client", ":server"] +) + +cc_test( + name = "fling_stream", + srcs = ["fling_stream_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], + data = [":client", ":server"] +) From 4e0363af9c907139ae5fa5d706d32d97f58bf815 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 17 Feb 2017 12:01:08 -0800 Subject: [PATCH 115/126] Complete test/core/http/BUILD --- test/core/http/BUILD | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/test/core/http/BUILD b/test/core/http/BUILD index 037ede3cd1c..abfa7591798 100644 --- a/test/core/http/BUILD +++ b/test/core/http/BUILD @@ -47,3 +47,58 @@ grpc_fuzzer( copts = ["-std=c99"], ) +# Copyright 2017, 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. + +licenses(["notice"]) # 3-clause BSD + +load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") + +cc_test( + name = "httpcli_test", + srcs = ["httpcli_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], + copts = ['-std=c99'], + data = ['test_server.py'] +) + +cc_test( + name = "httpscli_test", + srcs = ["httpscli_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], + copts = ['-std=c99'], + data = ['test_server.py'] +) + +cc_test( + name = "parser_test", + srcs = ["parser_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], + copts = ['-std=c99'] +) From 6f7b26ffb337413050e85ab0a6c4757b5e6ee594 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 17 Feb 2017 12:06:43 -0800 Subject: [PATCH 116/126] Complete test/core/transport/chttp2; add test/core/transport/BUILD --- test/core/transport/BUILD | 72 ++++++++++++++++++++++++++++++++ test/core/transport/chttp2/BUILD | 55 ++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 test/core/transport/BUILD diff --git a/test/core/transport/BUILD b/test/core/transport/BUILD new file mode 100644 index 00000000000..865b0c26ef5 --- /dev/null +++ b/test/core/transport/BUILD @@ -0,0 +1,72 @@ +# Copyright 2017, 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. + +licenses(["notice"]) # 3-clause BSD + +cc_test( + name = "bdp_estimator_test", + srcs = ["bdp_estimator_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "connectivity_state_test", + srcs = ["connectivity_state_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "metadata_test", + srcs = ["metadata_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "pid_controller_test", + srcs = ["pid_controller_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "status_conversion_test", + srcs = ["status_conversion_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "timeout_encoding_test", + srcs = ["timeout_encoding_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) diff --git a/test/core/transport/chttp2/BUILD b/test/core/transport/chttp2/BUILD index 94b48301386..b507e27efe5 100644 --- a/test/core/transport/chttp2/BUILD +++ b/test/core/transport/chttp2/BUILD @@ -38,3 +38,58 @@ grpc_fuzzer( corpus = "hpack_parser_corpus" ) +cc_test( + name = "alpn_test", + srcs = ["alpn_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "bin_decoder_test", + srcs = ["bin_decoder_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "bin_encoder_test", + srcs = ["bin_encoder_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "hpack_encoder_test", + srcs = ["hpack_encoder_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "hpack_parser_test", + srcs = ["hpack_parser_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "hpack_table_test", + srcs = ["hpack_table_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "stream_map_test", + srcs = ["stream_map_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "varint_test", + srcs = ["varint_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) From 911a5dc5b1e41a839d5bbdf0cfa383d7f3167cb9 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 17 Feb 2017 12:09:05 -0800 Subject: [PATCH 117/126] Add test/core/tsi/BUILD --- test/core/tsi/BUILD | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 test/core/tsi/BUILD diff --git a/test/core/tsi/BUILD b/test/core/tsi/BUILD new file mode 100644 index 00000000000..e6cba344eef --- /dev/null +++ b/test/core/tsi/BUILD @@ -0,0 +1,37 @@ +# Copyright 2017, 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. + +licenses(["notice"]) # 3-clause BSD + +cc_test( + name = "transport_security_test", + srcs = ["transport_security_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) From 3b78f42ee39e5e8cf295cceeb0f417d630efe932 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 17 Feb 2017 12:12:46 -0800 Subject: [PATCH 118/126] Add test/core/client_channel/BUILD --- test/core/client_channel/BUILD | 54 ++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 test/core/client_channel/BUILD diff --git a/test/core/client_channel/BUILD b/test/core/client_channel/BUILD new file mode 100644 index 00000000000..a29e9aca4e6 --- /dev/null +++ b/test/core/client_channel/BUILD @@ -0,0 +1,54 @@ +# Copyright 2017, 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. + +licenses(["notice"]) # 3-clause BSD + +load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") + +grpc_fuzzer( + name = "uri_fuzzer_test", + srcs = ["uri_fuzzer_test.c"], + deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], + corpus = "uri_corpus", + copts = ["-std=c99"], +) + +cc_test( + name = "lb_policies_test", + srcs = ["lb_policies_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:cq_verifier"], + copts = ['-std=c99'] +) + +cc_test( + name = "set_initial_connect_string_test", + srcs = ["set_initial_connect_string_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) From 54fa9244e702c64ccd63f085b784125641168f3e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 17 Feb 2017 12:14:45 -0800 Subject: [PATCH 119/126] Add test/core/client_channel/resolvers/BUILD --- test/core/client_channel/resolvers/BUILD | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 test/core/client_channel/resolvers/BUILD diff --git a/test/core/client_channel/resolvers/BUILD b/test/core/client_channel/resolvers/BUILD new file mode 100644 index 00000000000..af37072e3a4 --- /dev/null +++ b/test/core/client_channel/resolvers/BUILD @@ -0,0 +1,51 @@ +# Copyright 2017, 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. + +licenses(["notice"]) # 3-clause BSD + +cc_test( + name = "dns_resolver_connectivity_test", + srcs = ["dns_resolver_connectivity_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "dns_resolver_test", + srcs = ["dns_resolver_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "sockaddr_resolver_test", + srcs = ["sockaddr_resolver_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) From a646b0e019e48b7cb79d59be8ae904e3891f11e2 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 17 Feb 2017 12:21:33 -0800 Subject: [PATCH 120/126] Add test/core/iomgr/BUILD --- test/core/iomgr/BUILD | 180 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 test/core/iomgr/BUILD diff --git a/test/core/iomgr/BUILD b/test/core/iomgr/BUILD new file mode 100644 index 00000000000..08d4a07f413 --- /dev/null +++ b/test/core/iomgr/BUILD @@ -0,0 +1,180 @@ +# Copyright 2017, 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. + +licenses(["notice"]) # 3-clause BSD + +load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") + +cc_library( + name = "endpoint_tests", + srcs = ["endpoint_tests.c"], + hdrs = ["endpoint_tests.h"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "combiner_test", + srcs = ["combiner_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "endpoint_pair_test", + srcs = ["endpoint_pair_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", ":endpoint_tests"], + copts = ['-std=c99'] +) + +cc_test( + name = "ev_epoll_linux_test", + srcs = ["ev_epoll_linux_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "fd_conservation_posix_test", + srcs = ["fd_conservation_posix_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "fd_posix_test", + srcs = ["fd_posix_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "load_file_test", + srcs = ["load_file_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "pollset_set_test", + srcs = ["pollset_set_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "resolve_address_posix_test", + srcs = ["resolve_address_posix_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "resolve_address_test", + srcs = ["resolve_address_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "resource_quota_test", + srcs = ["resource_quota_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "sockaddr_utils_test", + srcs = ["sockaddr_utils_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "socket_utils_test", + srcs = ["socket_utils_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "tcp_client_posix_test", + srcs = ["tcp_client_posix_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "tcp_posix_test", + srcs = ["tcp_posix_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", ":endpoint_tests"], + copts = ['-std=c99'] +) + +cc_test( + name = "tcp_server_posix_test", + srcs = ["tcp_server_posix_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "time_averaged_stats_test", + srcs = ["time_averaged_stats_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "timer_heap_test", + srcs = ["timer_heap_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "timer_list_test", + srcs = ["timer_list_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "udp_server_test", + srcs = ["udp_server_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "wakeup_fd_cv_test", + srcs = ["wakeup_fd_cv_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) From c547c0d9929f5aa83d263d3d8dff1352e3db54d4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 17 Feb 2017 12:43:08 -0800 Subject: [PATCH 121/126] Add test/core/json/BUILD --- test/core/json/BUILD | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/core/json/BUILD b/test/core/json/BUILD index 05d4c6e0c5e..7a12d68126d 100644 --- a/test/core/json/BUILD +++ b/test/core/json/BUILD @@ -39,3 +39,32 @@ grpc_fuzzer( copts = ["-std=c99"], ) +cc_binary( + name = "json_rewrite", + srcs = ["json_rewrite.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + testonly = 1, + copts = ['-std=c99'] +) + +cc_test( + name = "json_rewrite_test", + srcs = ["json_rewrite_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'], + data = ["rewrite_test_input.json", "rewrite_test_output_condensed.json", "rewrite_test_output_indented.json", ":json_stream_error_test"] +) + +cc_test( + name = "json_stream_error_test", + srcs = ["json_stream_error_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "json_test", + srcs = ["json_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) From 528072a1234de26e46f3563c0bd2a3a14b2a25b5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 17 Feb 2017 12:45:41 -0800 Subject: [PATCH 122/126] Add test/core/network_benchmarks/BUILD --- test/core/network_benchmarks/BUILD | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 test/core/network_benchmarks/BUILD diff --git a/test/core/network_benchmarks/BUILD b/test/core/network_benchmarks/BUILD new file mode 100644 index 00000000000..a5209de4c91 --- /dev/null +++ b/test/core/network_benchmarks/BUILD @@ -0,0 +1,37 @@ +# 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. + +licenses(["notice"]) # 3-clause BSD + +cc_binary( + name = "low_level_ping_pong", + srcs = ["low_level_ping_pong.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) From abd887012f096c597ce511d9da3079226c76ad64 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 17 Feb 2017 21:56:10 +0100 Subject: [PATCH 123/126] Initial test/cpp/util/BUILD file. --- test/cpp/util/BUILD | 63 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 test/cpp/util/BUILD diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD new file mode 100644 index 00000000000..78eca8c3bd2 --- /dev/null +++ b/test/cpp/util/BUILD @@ -0,0 +1,63 @@ +# Copyright 2017, 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. + +licenses(["notice"]) # 3-clause BSD + +cc_library( + name = "test_config", + srcs = [ + "test_config_cc.cc", + ], + hdrs = [ + "test_config.h", + ], + deps = ["//:gpr"], + visibility = ["//test:__subpackages__"], +) + +cc_library( + name = "test_util", + srcs = [ +# "test/cpp/end2end/test_service_impl.cc", + "byte_buffer_proto_helper.cc", + "create_test_channel.cc", + "string_ref_helper.cc", + "subprocess.cc", + "test_credentials_provider.cc", + ], + hdrs = [ + "byte_buffer_proto_helper.h", + "create_test_channel.h", + "string_ref_helper.h", + "subprocess.h", + "test_credentials_provider.h", + ], + deps = ["//test/core/util:gpr_test_util", "//:grpc++", "//test/core/end2end:ssl_test_data"], + visibility = ["//test:__subpackages__"], +) From 554144699a386de06422ee04f63e5b1565ab64fa Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 17 Feb 2017 12:56:23 -0800 Subject: [PATCH 124/126] Add test/core/security/BUILD --- test/core/iomgr/BUILD | 1 + test/core/security/BUILD | 104 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 test/core/security/BUILD diff --git a/test/core/iomgr/BUILD b/test/core/iomgr/BUILD index 08d4a07f413..0cf93e73f5c 100644 --- a/test/core/iomgr/BUILD +++ b/test/core/iomgr/BUILD @@ -36,6 +36,7 @@ cc_library( srcs = ["endpoint_tests.c"], hdrs = ["endpoint_tests.h"], deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + visibility = ["//test:__subpackages__"], copts = ['-std=c99'] ) diff --git a/test/core/security/BUILD b/test/core/security/BUILD new file mode 100644 index 00000000000..e750c39b7c6 --- /dev/null +++ b/test/core/security/BUILD @@ -0,0 +1,104 @@ +# Copyright 2017, 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. + +licenses(["notice"]) # 3-clause BSD + +load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") + +grpc_fuzzer( + name = "ssl_server_fuzzer", + srcs = ["ssl_server_fuzzer.c"], + deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], + corpus = "corpus", + copts = ["-std=c99"], +) + +cc_library( + name = "oauth2_utils", + srcs = ["oauth2_utils.c"], + hdrs = ["oauth2_utils.h"], + deps = ["//:grpc"], + copts = ['-std=c99'] +) + +cc_test( + name = "auth_context_test", + srcs = ["auth_context_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "b64_test", + srcs = ["b64_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "credentials_test", + srcs = ["credentials_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_test( + name = "secure_endpoint_test", + srcs = ["secure_endpoint_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/iomgr:endpoint_tests"], + copts = ['-std=c99'] +) + +cc_test( + name = "security_connector_test", + srcs = ["security_connector_test.c"], + deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + copts = ['-std=c99'] +) + +cc_binary( + name = "create_jwt", + srcs = ["create_jwt.c"], + deps = ["//:grpc", "//:gpr"], + copts = ['-std=c99'] +) + +cc_binary( + name = "fetch_oauth2", + srcs = ["fetch_oauth2.c"], + deps = ["//:grpc", "//:gpr", ":oauth2_utils"], + copts = ['-std=c99'] +) + +cc_binary( + name = "verify_jwt", + srcs = ["verify_jwt.c"], + deps = ["//:grpc", "//:gpr"], + copts = ['-std=c99'] +) From 05fbe3c5185c8ba487041862496c41c304ff4c03 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 17 Feb 2017 13:27:21 -0800 Subject: [PATCH 125/126] Get gtest building with Bazel, add first test in test/cpp/common/BUILD --- WORKSPACE | 11 +++++++++++ test/core/json/BUILD | 2 +- test/cpp/common/BUILD | 36 ++++++++++++++++++++++++++++++++++++ third_party/gtest.BUILD | 14 ++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 test/cpp/common/BUILD create mode 100644 third_party/gtest.BUILD diff --git a/WORKSPACE b/WORKSPACE index 98831096345..4f90f06d881 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -28,6 +28,11 @@ bind( actual = "@submodule_protobuf//:protoc", ) +bind( + name = "gtest", + actual = "@submodule_gtest//:gtest", +) + new_local_repository( name = "submodule_boringssl", path = "third_party/boringssl-with-bazel", @@ -45,3 +50,9 @@ new_local_repository( path = "third_party/protobuf", build_file = "third_party/protobuf/BUILD", ) + +new_local_repository( + name = "submodule_gtest", + path = "third_party/googletest", + build_file = "third_party/gtest.BUILD", +) diff --git a/test/core/json/BUILD b/test/core/json/BUILD index 7a12d68126d..f5a877e6af4 100644 --- a/test/core/json/BUILD +++ b/test/core/json/BUILD @@ -1,4 +1,4 @@ -# Copyright 2016, Google Inc. +# Copyright 2017, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/test/cpp/common/BUILD b/test/cpp/common/BUILD new file mode 100644 index 00000000000..0e2db00f0ab --- /dev/null +++ b/test/cpp/common/BUILD @@ -0,0 +1,36 @@ +# Copyright 2017, 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. + +licenses(["notice"]) # 3-clause BSD + +cc_test( + name = "alarm_cpp_test", + srcs = ["alarm_cpp_test.cc"], + deps = ["//:grpc++", "//external:gtest", "//test/core/util:gpr_test_util"], +) diff --git a/third_party/gtest.BUILD b/third_party/gtest.BUILD new file mode 100644 index 00000000000..bf980754ca2 --- /dev/null +++ b/third_party/gtest.BUILD @@ -0,0 +1,14 @@ +cc_library( + name = "gtest", + srcs = [ + "src/gtest-all.cc", + ], + hdrs = glob(["include/**/*.h", "src/*.cc", "src/*.h"]), + includes = [ + "include", "." + ], + linkstatic = 1, + visibility = [ + "//visibility:public", + ], +) From ece502fa12ae9db7fc969f0bae1f7c26ece1dce3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 17 Feb 2017 16:20:50 -0800 Subject: [PATCH 126/126] Speed up latency profiling (and tune down the memory usage) --- tools/run_tests/run_microbenchmark.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py index a9a563c1bec..1cafffb52dd 100755 --- a/tools/run_tests/run_microbenchmark.py +++ b/tools/run_tests/run_microbenchmark.py @@ -91,7 +91,9 @@ def collect_latency(bm_name, args): '--benchmark_list_tests']).splitlines(): link(line, '%s.txt' % fnize(line)) benchmarks.append( - jobset.JobSpec(['bins/basicprof/%s' % bm_name, '--benchmark_filter=^%s$' % line], + jobset.JobSpec(['bins/basicprof/%s' % bm_name, + '--benchmark_filter=^%s$' % line, + '--benchmark_min_time=0.05'], environ={'LATENCY_TRACE': '%s.trace' % fnize(line)})) profile_analysis.append( jobset.JobSpec([sys.executable, @@ -103,7 +105,7 @@ def collect_latency(bm_name, args): # consume upwards of five gigabytes of ram in some cases, and so analysing # hundreds of them at once is impractical -- but we want at least some # concurrency or the work takes too long - if len(benchmarks) >= min(4, multiprocessing.cpu_count()): + if len(benchmarks) >= min(16, multiprocessing.cpu_count()): # run up to half the cpu count: each benchmark can use up to two cores # (one for the microbenchmark, one for the data flush) jobset.run(benchmarks, maxjobs=max(1, multiprocessing.cpu_count()/2),