diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 60131f2eab1..24587a55e1c 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -6,7 +6,7 @@ Create new issues for bugs and feature requests. An issue needs to be actionable - [grpc.io mailing list](https://groups.google.com/forum/#!forum/grpc-io) - [StackOverflow, with `grpc` tag](http://stackoverflow.com/questions/tagged/grpc) -*Please don't double post your questions in more locations, we are monitoring both channels and the time spent de-duplicating questions can is better spent answering more user questions.* +*Please don't double post your questions in more locations; we are monitoring both channels, and the time spent de-duplicating questions is better spent answering more user questions.* ### What version of gRPC and what language are you using? diff --git a/.pylintrc b/.pylintrc index 41027479061..8447821b4e5 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,15 +1,18 @@ [VARIABLES] + # TODO(https://github.com/PyCQA/pylint/issues/1345): How does the inspection # not include "unused_" and "ignored_" by default? dummy-variables-rgx=^ignored_|^unused_ [DESIGN] + # NOTE(nathaniel): Not particularly attached to this value; it just seems to # be what works for us at the moment (excepting the dead-code-walking Beta # API). max-args=6 [MISCELLANEOUS] + # NOTE(nathaniel): We are big fans of "TODO(): " and # "NOTE(): ". We do not allow "TODO:", # "TODO():", "FIXME:", or anything else. @@ -17,24 +20,50 @@ notes=FIXME,XXX [MESSAGES CONTROL] -#TODO: Enable missing-docstring -#TODO: Enable too-few-public-methods -#TODO: Enable no-init -#TODO: Enable duplicate-code -#TODO: Enable invalid-name -#TODO: Enable locally-disabled -#TODO: Enable protected-access -#TODO: Enable no-name-in-module -#TODO: Enable wrong-import-order -# TODO(https://github.com/PyCQA/pylint/issues/59#issuecomment-283774279): -# enable cyclic-import after a 1.7-or-later pylint release that recognizes our -# disable=cyclic-import suppressions. -#TODO: Enable too-many-instance-attributes -#TODO: Enable too-many-lines -#TODO: Enable redefined-variable-type -#TODO: Enable next-method-called -#TODO: Enable import-error -#TODO: Enable useless-else-on-loop -#TODO: Enable too-many-nested-blocks - -disable=missing-docstring,too-few-public-methods,no-init,duplicate-code,invalid-name,locally-disabled,protected-access,no-name-in-module,wrong-import-order,cyclic-import,too-many-instance-attributes,too-many-lines,redefined-variable-type,next-method-called,import-error,useless-else-on-loop,too-many-nested-blocks +disable= + # TODO(https://github.com/PyCQA/pylint/issues/59#issuecomment-283774279): + # Enable cyclic-import after a 1.7-or-later pylint release that + # recognizes our disable=cyclic-import suppressions. + cyclic-import, + # TODO(https://github.com/grpc/grpc/issues/8622): Enable this after the + # Beta API is removed. + duplicate-code, + # TODO(https://github.com/grpc/grpc/issues/261): Doesn't seem to + # understand enum and concurrent.futures; look into this later with the + # latest pylint version. + import-error, + # TODO(https://github.com/grpc/grpc/issues/261): Enable this one. + # Should take a little configuration but not much. + invalid-name, + # TODO(https://github.com/grpc/grpc/issues/261): This doesn't seem to + # work for now? Try with a later pylint? + locally-disabled, + # NOTE(nathaniel): We don't write doc strings for most private code + # elements. + missing-docstring, + # NOTE(nathaniel): Our completely abstract interface classes don't have + # constructors. + no-init, + # TODO(https://github.com/grpc/grpc/issues/261): Doesn't yet play + # nicely with some of our code being implemented in Cython. Maybe in a + # later version? + no-name-in-module, + # TODO(https://github.com/grpc/grpc/issues/261): Suppress these where + # the odd shape of the authentication portion of the API forces them on + # us and enable everywhere else. + protected-access, + # NOTE(nathaniel): Pylint and I will probably never agree on this. + too-few-public-methods, + # NOTE(nathaniel): Pylint and I wil probably never agree on this for + # private classes. For public classes maybe? + too-many-instance-attributes, + # NOTE(nathaniel): Some of our modules have a lot of lines... of + # specification and documentation. Maybe if this were + # lines-of-code-based we would use it. + too-many-lines, + # TODO(https://github.com/grpc/grpc/issues/261): Maybe we could have + # this one if we extracted just a few more helper functions... + too-many-nested-blocks, + # NOTE(nathaniel): I have disputed the premise of this inspection from + # the beginning and will continue to do so until it goes away for good. + useless-else-on-loop, diff --git a/BUILD b/BUILD index 04dba30d7fb..fa423267879 100644 --- a/BUILD +++ b/BUILD @@ -335,7 +335,6 @@ grpc_cc_library( "src/core/lib/support/log_windows.c", "src/core/lib/support/mpscq.c", "src/core/lib/support/murmur_hash.c", - "src/core/lib/support/stack_lockfree.c", "src/core/lib/support/string.c", "src/core/lib/support/string_posix.c", "src/core/lib/support/string_util_windows.c", @@ -371,7 +370,6 @@ grpc_cc_library( "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", "src/core/lib/support/spinlock.h", - "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.h", "src/core/lib/support/string_windows.h", "src/core/lib/support/thd_internal.h", @@ -930,8 +928,8 @@ grpc_cc_library( deps = [ "grpc_base", "grpc_client_channel", - "grpc_secure", "grpc_resolver_fake", + "grpc_secure", ], ) @@ -1025,8 +1023,8 @@ grpc_cc_library( name = "grpc_resolver_fake", srcs = ["src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c"], hdrs = ["src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"], - visibility = ["//test:__subpackages__"], language = "c", + visibility = ["//test:__subpackages__"], deps = [ "grpc_base", "grpc_client_channel", diff --git a/CMakeLists.txt b/CMakeLists.txt index 710f1dc4e9f..257c8330c11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,11 @@ set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") project(${PACKAGE_NAME} C CXX) +set(gRPC_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") +set(gRPC_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") +set(gRPC_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") +set(gRPC_INSTALL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/lib/cmake/${PACKAGE_NAME}" CACHE PATH "Installation directory for cmake config files") + # Options option(gRPC_BUILD_TESTS "Build tests" OFF) @@ -53,6 +58,9 @@ set_property(CACHE gRPC_SSL_PROVIDER PROPERTY STRINGS "module" "package") set(gRPC_PROTOBUF_PROVIDER "module" CACHE STRING "Provider of protobuf library") set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package") +set(gRPC_PROTOBUF_PACKAGE_TYPE "" CACHE STRING "Algorithm for searching protobuf package") +set_property(CACHE gRPC_PROTOBUF_PACKAGE_TYPE PROPERTY STRINGS "CONFIG" "MODULE") + set(gRPC_GFLAGS_PROVIDER "module" CACHE STRING "Provider of gflags library") set_property(CACHE gRPC_GFLAGS_PROVIDER PROPERTY STRINGS "module" "package") @@ -98,6 +106,9 @@ if("${gRPC_ZLIB_PROVIDER}" STREQUAL "module") endif() set(ZLIB_INCLUDE_DIR "${ZLIB_ROOT_DIR}") if(EXISTS "${ZLIB_ROOT_DIR}/CMakeLists.txt") + # TODO(jtattermusch): workaround for https://github.com/madler/zlib/issues/218 + include_directories(${ZLIB_INCLUDE_DIR}) + add_subdirectory(${ZLIB_ROOT_DIR} third_party/zlib) if(TARGET zlibstatic) set(_gRPC_ZLIB_LIBRARIES zlibstatic) @@ -159,6 +170,11 @@ if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module") if(NOT protobuf_BUILD_TESTS) set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests") endif() + # Disable building protobuf with zlib. Building protobuf with zlib breaks + # the build if zlib is not installed on the system. + if(NOT protobuf_WITH_ZLIB) + set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib.") + endif() if(NOT PROTOBUF_ROOT_DIR) set(PROTOBUF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/protobuf) endif() @@ -183,21 +199,27 @@ if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module") set(gRPC_INSTALL FALSE) endif() elseif("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "package") - find_package(protobuf CONFIG) - if(protobuf_FOUND) + find_package(Protobuf ${gRPC_PROTOBUF_PACKAGE_TYPE}) + if(Protobuf_FOUND OR PROTOBUF_FOUND) if(TARGET protobuf::${_gRPC_PROTOBUF_LIBRARY_NAME}) set(_gRPC_PROTOBUF_LIBRARIES protobuf::${_gRPC_PROTOBUF_LIBRARY_NAME}) + else() + set(_gRPC_PROTOBUF_LIBRARIES ${PROTOBUF_LIBRARIES}) endif() if(TARGET protobuf::libprotoc) set(_gRPC_PROTOBUF_PROTOC_LIBRARIES protobuf::libprotoc) + else() + set(_gRPC_PROTOBUF_PROTOC_LIBRARIES ${PROTOBUF_PROTOC_LIBRARIES}) endif() if(TARGET protobuf::protoc) set(_gRPC_PROTOBUF_PROTOC protobuf::protoc) + else() + set(_gRPC_PROTOBUF_PROTOC ${PROTOBUF_PROTOC_EXECUTABLE}) endif() - set(_gRPC_FIND_PROTOBUF "if(NOT protobuf_FOUND)\n find_package(protobuf CONFIG)\nendif()") - else() - find_package(Protobuf MODULE) - set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND)\n find_package(Protobuf)\nendif()") + set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND)\n find_package(Protobuf ${gRPC_PROTOBUF_PACKAGE_TYPE})\nendif()") + endif() + if(PROTOBUF_FOUND) + include_directories(${PROTOBUF_INCLUDE_DIRS}) endif() set(PROTOBUF_WELLKNOWN_IMPORT_DIR /usr/local/include) endif() @@ -282,11 +304,6 @@ if(WIN32 AND MSVC) set(_gRPC_BASELIB_LIBRARIES wsock32 ws2_32) endif() -include(GNUInstallDirs) -if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR) - set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/gRPC") -endif() - # Create directory for generated .proto files set(_gRPC_PROTO_GENS_DIR ${CMAKE_BINARY_DIR}/gens) file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR}) @@ -427,7 +444,6 @@ add_dependencies(buildtests_c gpr_host_port_test) add_dependencies(buildtests_c gpr_log_test) add_dependencies(buildtests_c gpr_mpscq_test) add_dependencies(buildtests_c gpr_spinlock_test) -add_dependencies(buildtests_c gpr_stack_lockfree_test) add_dependencies(buildtests_c gpr_string_test) add_dependencies(buildtests_c gpr_sync_test) add_dependencies(buildtests_c gpr_thd_test) @@ -773,7 +789,6 @@ add_library(gpr src/core/lib/support/log_windows.c src/core/lib/support/mpscq.c src/core/lib/support/murmur_hash.c - src/core/lib/support/stack_lockfree.c src/core/lib/support/string.c src/core/lib/support/string_posix.c src/core/lib/support/string_util_windows.c @@ -803,15 +818,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gpr.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(gpr + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -870,16 +885,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS gpr EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -895,15 +910,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gpr_test_util.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(gpr_test_util + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -1182,15 +1197,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(grpc + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -1249,16 +1264,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -1481,15 +1496,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_cronet.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(grpc_cronet + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -1548,16 +1563,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc_cronet EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -1717,15 +1732,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_test_util.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(grpc_test_util + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -1780,7 +1795,7 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() @@ -1811,15 +1826,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_test_util_unsecure.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(grpc_test_util_unsecure + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2072,15 +2087,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_unsecure.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(grpc_unsecure + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2137,16 +2152,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc_unsecure EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -2162,15 +2177,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/reconnect_server.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(reconnect_server + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2206,15 +2221,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/test_tcp_server.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(test_tcp_server + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2292,15 +2307,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(grpc++ + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2422,16 +2437,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc++ EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -2679,15 +2694,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_cronet.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(grpc++_cronet + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2821,16 +2836,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc++_cronet EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -2849,7 +2864,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_error_details.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -2859,8 +2874,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(grpc++_error_details + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2887,16 +2902,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc++_error_details EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -2916,7 +2931,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_proto_reflection_desc_db.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -2926,8 +2941,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(grpc++_proto_reflection_desc_db + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -2958,7 +2973,7 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() @@ -2979,7 +2994,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_reflection.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -2989,8 +3004,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(grpc++_reflection + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3017,16 +3032,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc++_reflection EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -3042,15 +3057,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_test_config.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(grpc++_test_config + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3110,7 +3125,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_test_util.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3129,8 +3144,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(grpc++_test_util + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3211,7 +3226,7 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() @@ -3266,15 +3281,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_unsecure.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(grpc++_unsecure + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3395,16 +3410,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc++_unsecure EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -3420,15 +3435,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_benchmark.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(grpc_benchmark + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3478,7 +3493,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_cli_libs.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3488,8 +3503,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(grpc_cli_libs + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3521,7 +3536,7 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() @@ -3543,15 +3558,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_plugin_support.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(grpc_plugin_support + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3577,16 +3592,16 @@ foreach(_hdr string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) install(FILES ${_hdr} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() if (gRPC_INSTALL) install(TARGETS grpc_plugin_support EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -3614,7 +3629,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/http2_client_main.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3630,8 +3645,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(http2_client_main + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3677,7 +3692,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/interop_client_helper.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3687,8 +3702,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(interop_client_helper + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3743,7 +3758,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/interop_client_main.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3759,8 +3774,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(interop_client_main + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3805,15 +3820,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/interop_server_helper.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(interop_server_helper + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3867,7 +3882,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/interop_server_lib.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -3883,8 +3898,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(interop_server_lib + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -3929,15 +3944,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/interop_server_main.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(interop_server_main + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4004,7 +4019,7 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qps.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -4026,8 +4041,8 @@ protobuf_generate_grpc_cpp( ) target_include_directories(qps + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4067,15 +4082,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc_csharp_ext.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(grpc_csharp_ext + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4098,9 +4113,9 @@ target_link_libraries(grpc_csharp_ext if (gRPC_INSTALL) install(TARGETS grpc_csharp_ext EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -4164,15 +4179,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ares.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(ares + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4204,15 +4219,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bad_client_test.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(bad_client_test + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4247,15 +4262,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bad_ssl_test_server.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(bad_ssl_test_server + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4345,15 +4360,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/end2end_tests.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(end2end_tests + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4443,15 +4458,15 @@ if(WIN32 AND MSVC) ) if (gRPC_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/end2end_nosec_tests.pdb - DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() target_include_directories(end2end_nosec_tests + PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${PROTOBUF_ROOT_DIR}/src PRIVATE ${ZLIB_INCLUDE_DIR} @@ -4932,9 +4947,9 @@ target_link_libraries(check_epollexclusive if (gRPC_INSTALL) install(TARGETS check_epollexclusive EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -5600,9 +5615,9 @@ target_link_libraries(gen_hpack_tables if (gRPC_INSTALL) install(TARGETS gen_hpack_tables EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -5634,9 +5649,9 @@ target_link_libraries(gen_legal_metadata_characters if (gRPC_INSTALL) install(TARGETS gen_legal_metadata_characters EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -5668,9 +5683,9 @@ target_link_libraries(gen_percent_encoding_tables if (gRPC_INSTALL) install(TARGETS gen_percent_encoding_tables EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -5999,35 +6014,6 @@ target_link_libraries(gpr_spinlock_test endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) -add_executable(gpr_stack_lockfree_test - test/core/support/stack_lockfree_test.c -) - - -target_include_directories(gpr_stack_lockfree_test - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${BORINGSSL_ROOT_DIR}/include - PRIVATE ${PROTOBUF_ROOT_DIR}/src - PRIVATE ${BENCHMARK_ROOT_DIR}/include - PRIVATE ${ZLIB_ROOT_DIR} - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib - PRIVATE ${CARES_BUILD_INCLUDE_DIR} - PRIVATE ${CARES_INCLUDE_DIR} - PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include -) - -target_link_libraries(gpr_stack_lockfree_test - ${_gRPC_ALLTARGETS_LIBRARIES} - gpr_test_util - gpr -) - -endif (gRPC_BUILD_TESTS) -if (gRPC_BUILD_TESTS) - add_executable(gpr_string_test test/core/support/string_test.c ) @@ -6448,9 +6434,9 @@ target_link_libraries(grpc_create_jwt if (gRPC_INSTALL) install(TARGETS grpc_create_jwt EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -6641,9 +6627,9 @@ target_link_libraries(grpc_print_google_default_creds_token if (gRPC_INSTALL) install(TARGETS grpc_print_google_default_creds_token EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -6708,9 +6694,9 @@ target_link_libraries(grpc_verify_jwt if (gRPC_INSTALL) install(TARGETS grpc_verify_jwt EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10351,9 +10337,9 @@ target_link_libraries(grpc_cpp_plugin if (gRPC_INSTALL) install(TARGETS grpc_cpp_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10389,9 +10375,9 @@ target_link_libraries(grpc_csharp_plugin if (gRPC_INSTALL) install(TARGETS grpc_csharp_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10427,9 +10413,9 @@ target_link_libraries(grpc_node_plugin if (gRPC_INSTALL) install(TARGETS grpc_node_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10465,9 +10451,9 @@ target_link_libraries(grpc_objective_c_plugin if (gRPC_INSTALL) install(TARGETS grpc_objective_c_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10503,9 +10489,9 @@ target_link_libraries(grpc_php_plugin if (gRPC_INSTALL) install(TARGETS grpc_php_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10541,9 +10527,9 @@ target_link_libraries(grpc_python_plugin if (gRPC_INSTALL) install(TARGETS grpc_python_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -10579,9 +10565,9 @@ target_link_libraries(grpc_ruby_plugin if (gRPC_INSTALL) install(TARGETS grpc_ruby_plugin EXPORT gRPCTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() @@ -14213,7 +14199,7 @@ endif (gRPC_BUILD_TESTS) if (gRPC_INSTALL) install(EXPORT gRPCTargets - DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + DESTINATION ${gRPC_INSTALL_CMAKEDIR} NAMESPACE gRPC:: ) endif() @@ -14222,6 +14208,6 @@ foreach(_config gRPCConfig gRPCConfigVersion) configure_file(tools/cmake/${_config}.cmake.in ${_config}.cmake @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_config}.cmake - DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + DESTINATION ${gRPC_INSTALL_CMAKEDIR} ) endforeach() diff --git a/LICENSE b/LICENSE index 7750ce4fdd4..d6456956733 100644 --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,14 @@ Apache License Version 2.0, January 2004 - https://www.apache.org/licenses/ + http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. @@ -86,6 +87,7 @@ granted to You under this License for that Work shall terminate as of the date such litigation is filed. + 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: @@ -103,6 +105,7 @@ the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one @@ -120,7 +123,9 @@ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, @@ -171,7 +176,18 @@ END OF TERMS AND CONDITIONS - Copyright 2015-2017 gRPC authors. + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/Makefile b/Makefile index c7890cb8d53..0ca788592c4 100644 --- a/Makefile +++ b/Makefile @@ -324,6 +324,9 @@ HOST_LDXX ?= $(LDXX) CFLAGS += -std=c99 -Wsign-conversion -Wconversion $(W_SHADOW) $(W_EXTRA_SEMI) CXXFLAGS += -std=c++11 +ifeq ($(SYSTEM),Darwin) +CXXFLAGS += -stdlib=libc++ +endif CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -DOSATOMIC_USE_INLINED=1 LDFLAGS += -g @@ -992,7 +995,6 @@ gpr_host_port_test: $(BINDIR)/$(CONFIG)/gpr_host_port_test gpr_log_test: $(BINDIR)/$(CONFIG)/gpr_log_test gpr_mpscq_test: $(BINDIR)/$(CONFIG)/gpr_mpscq_test gpr_spinlock_test: $(BINDIR)/$(CONFIG)/gpr_spinlock_test -gpr_stack_lockfree_test: $(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test gpr_string_test: $(BINDIR)/$(CONFIG)/gpr_string_test gpr_sync_test: $(BINDIR)/$(CONFIG)/gpr_sync_test gpr_thd_test: $(BINDIR)/$(CONFIG)/gpr_thd_test @@ -1177,7 +1179,6 @@ boringssl_base64_test: $(BINDIR)/$(CONFIG)/boringssl_base64_test boringssl_bio_test: $(BINDIR)/$(CONFIG)/boringssl_bio_test boringssl_bn_test: $(BINDIR)/$(CONFIG)/boringssl_bn_test boringssl_bytestring_test: $(BINDIR)/$(CONFIG)/boringssl_bytestring_test -boringssl_chacha_test: $(BINDIR)/$(CONFIG)/boringssl_chacha_test boringssl_aead_test: $(BINDIR)/$(CONFIG)/boringssl_aead_test boringssl_cipher_test: $(BINDIR)/$(CONFIG)/boringssl_cipher_test boringssl_cmac_test: $(BINDIR)/$(CONFIG)/boringssl_cmac_test @@ -1185,16 +1186,13 @@ boringssl_constant_time_test: $(BINDIR)/$(CONFIG)/boringssl_constant_time_test boringssl_ed25519_test: $(BINDIR)/$(CONFIG)/boringssl_ed25519_test boringssl_spake25519_test: $(BINDIR)/$(CONFIG)/boringssl_spake25519_test boringssl_x25519_test: $(BINDIR)/$(CONFIG)/boringssl_x25519_test -boringssl_dh_test: $(BINDIR)/$(CONFIG)/boringssl_dh_test boringssl_digest_test: $(BINDIR)/$(CONFIG)/boringssl_digest_test -boringssl_dsa_test: $(BINDIR)/$(CONFIG)/boringssl_dsa_test -boringssl_ec_test: $(BINDIR)/$(CONFIG)/boringssl_ec_test boringssl_example_mul: $(BINDIR)/$(CONFIG)/boringssl_example_mul +boringssl_p256-x86_64_test: $(BINDIR)/$(CONFIG)/boringssl_p256-x86_64_test boringssl_ecdh_test: $(BINDIR)/$(CONFIG)/boringssl_ecdh_test boringssl_ecdsa_sign_test: $(BINDIR)/$(CONFIG)/boringssl_ecdsa_sign_test boringssl_ecdsa_test: $(BINDIR)/$(CONFIG)/boringssl_ecdsa_test boringssl_ecdsa_verify_test: $(BINDIR)/$(CONFIG)/boringssl_ecdsa_verify_test -boringssl_err_test: $(BINDIR)/$(CONFIG)/boringssl_err_test boringssl_evp_extra_test: $(BINDIR)/$(CONFIG)/boringssl_evp_extra_test boringssl_evp_test: $(BINDIR)/$(CONFIG)/boringssl_evp_test boringssl_pbkdf_test: $(BINDIR)/$(CONFIG)/boringssl_pbkdf_test @@ -1202,21 +1200,17 @@ boringssl_hkdf_test: $(BINDIR)/$(CONFIG)/boringssl_hkdf_test boringssl_hmac_test: $(BINDIR)/$(CONFIG)/boringssl_hmac_test boringssl_lhash_test: $(BINDIR)/$(CONFIG)/boringssl_lhash_test boringssl_gcm_test: $(BINDIR)/$(CONFIG)/boringssl_gcm_test -boringssl_newhope_statistical_test: $(BINDIR)/$(CONFIG)/boringssl_newhope_statistical_test -boringssl_newhope_test: $(BINDIR)/$(CONFIG)/boringssl_newhope_test -boringssl_newhope_vectors_test: $(BINDIR)/$(CONFIG)/boringssl_newhope_vectors_test boringssl_obj_test: $(BINDIR)/$(CONFIG)/boringssl_obj_test boringssl_pkcs12_test: $(BINDIR)/$(CONFIG)/boringssl_pkcs12_test boringssl_pkcs8_test: $(BINDIR)/$(CONFIG)/boringssl_pkcs8_test boringssl_poly1305_test: $(BINDIR)/$(CONFIG)/boringssl_poly1305_test +boringssl_pool_test: $(BINDIR)/$(CONFIG)/boringssl_pool_test boringssl_refcount_test: $(BINDIR)/$(CONFIG)/boringssl_refcount_test -boringssl_rsa_test: $(BINDIR)/$(CONFIG)/boringssl_rsa_test boringssl_thread_test: $(BINDIR)/$(CONFIG)/boringssl_thread_test boringssl_pkcs7_test: $(BINDIR)/$(CONFIG)/boringssl_pkcs7_test boringssl_x509_test: $(BINDIR)/$(CONFIG)/boringssl_x509_test boringssl_tab_test: $(BINDIR)/$(CONFIG)/boringssl_tab_test boringssl_v3name_test: $(BINDIR)/$(CONFIG)/boringssl_v3name_test -boringssl_ssl_test: $(BINDIR)/$(CONFIG)/boringssl_ssl_test badreq_bad_client_test: $(BINDIR)/$(CONFIG)/badreq_bad_client_test connection_prefix_bad_client_test: $(BINDIR)/$(CONFIG)/connection_prefix_bad_client_test head_of_line_blocking_bad_client_test: $(BINDIR)/$(CONFIG)/head_of_line_blocking_bad_client_test @@ -1328,7 +1322,7 @@ pc_cxx: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc ifeq ($(EMBED_OPENSSL),true) -privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_proto_reflection_desc_db.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libhttp2_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_client_helper.a $(LIBDIR)/$(CONFIG)/libinterop_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_server_helper.a $(LIBDIR)/$(CONFIG)/libinterop_server_lib.a $(LIBDIR)/$(CONFIG)/libinterop_server_main.a $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl_aes_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_asn1_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_base64_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bio_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bn_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bytestring_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_aead_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cipher_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ed25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_spake25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_digest_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_sign_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_verify_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_extra_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pbkdf_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_hmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_gcm_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_obj_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs12_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs8_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_poly1305_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x509_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a $(LIBDIR)/$(CONFIG)/libbenchmark.a +privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_proto_reflection_desc_db.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libhttp2_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_client_helper.a $(LIBDIR)/$(CONFIG)/libinterop_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_server_helper.a $(LIBDIR)/$(CONFIG)/libinterop_server_lib.a $(LIBDIR)/$(CONFIG)/libinterop_server_main.a $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl_aes_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_asn1_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_base64_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bio_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bn_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bytestring_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_aead_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cipher_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_constant_time_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ed25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_spake25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_digest_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_sign_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_verify_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_extra_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pbkdf_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_hkdf_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_hmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_lhash_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_gcm_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_obj_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs12_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs8_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_poly1305_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x509_test_lib.a $(LIBDIR)/$(CONFIG)/libbenchmark.a else privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_proto_reflection_desc_db.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libhttp2_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_client_helper.a $(LIBDIR)/$(CONFIG)/libinterop_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_server_helper.a $(LIBDIR)/$(CONFIG)/libinterop_server_lib.a $(LIBDIR)/$(CONFIG)/libinterop_server_main.a $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libbenchmark.a endif @@ -1382,7 +1376,6 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/gpr_log_test \ $(BINDIR)/$(CONFIG)/gpr_mpscq_test \ $(BINDIR)/$(CONFIG)/gpr_spinlock_test \ - $(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test \ $(BINDIR)/$(CONFIG)/gpr_string_test \ $(BINDIR)/$(CONFIG)/gpr_sync_test \ $(BINDIR)/$(CONFIG)/gpr_thd_test \ @@ -1607,7 +1600,6 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/boringssl_bio_test \ $(BINDIR)/$(CONFIG)/boringssl_bn_test \ $(BINDIR)/$(CONFIG)/boringssl_bytestring_test \ - $(BINDIR)/$(CONFIG)/boringssl_chacha_test \ $(BINDIR)/$(CONFIG)/boringssl_aead_test \ $(BINDIR)/$(CONFIG)/boringssl_cipher_test \ $(BINDIR)/$(CONFIG)/boringssl_cmac_test \ @@ -1615,16 +1607,13 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/boringssl_ed25519_test \ $(BINDIR)/$(CONFIG)/boringssl_spake25519_test \ $(BINDIR)/$(CONFIG)/boringssl_x25519_test \ - $(BINDIR)/$(CONFIG)/boringssl_dh_test \ $(BINDIR)/$(CONFIG)/boringssl_digest_test \ - $(BINDIR)/$(CONFIG)/boringssl_dsa_test \ - $(BINDIR)/$(CONFIG)/boringssl_ec_test \ $(BINDIR)/$(CONFIG)/boringssl_example_mul \ + $(BINDIR)/$(CONFIG)/boringssl_p256-x86_64_test \ $(BINDIR)/$(CONFIG)/boringssl_ecdh_test \ $(BINDIR)/$(CONFIG)/boringssl_ecdsa_sign_test \ $(BINDIR)/$(CONFIG)/boringssl_ecdsa_test \ $(BINDIR)/$(CONFIG)/boringssl_ecdsa_verify_test \ - $(BINDIR)/$(CONFIG)/boringssl_err_test \ $(BINDIR)/$(CONFIG)/boringssl_evp_extra_test \ $(BINDIR)/$(CONFIG)/boringssl_evp_test \ $(BINDIR)/$(CONFIG)/boringssl_pbkdf_test \ @@ -1632,21 +1621,17 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/boringssl_hmac_test \ $(BINDIR)/$(CONFIG)/boringssl_lhash_test \ $(BINDIR)/$(CONFIG)/boringssl_gcm_test \ - $(BINDIR)/$(CONFIG)/boringssl_newhope_statistical_test \ - $(BINDIR)/$(CONFIG)/boringssl_newhope_test \ - $(BINDIR)/$(CONFIG)/boringssl_newhope_vectors_test \ $(BINDIR)/$(CONFIG)/boringssl_obj_test \ $(BINDIR)/$(CONFIG)/boringssl_pkcs12_test \ $(BINDIR)/$(CONFIG)/boringssl_pkcs8_test \ $(BINDIR)/$(CONFIG)/boringssl_poly1305_test \ + $(BINDIR)/$(CONFIG)/boringssl_pool_test \ $(BINDIR)/$(CONFIG)/boringssl_refcount_test \ - $(BINDIR)/$(CONFIG)/boringssl_rsa_test \ $(BINDIR)/$(CONFIG)/boringssl_thread_test \ $(BINDIR)/$(CONFIG)/boringssl_pkcs7_test \ $(BINDIR)/$(CONFIG)/boringssl_x509_test \ $(BINDIR)/$(CONFIG)/boringssl_tab_test \ $(BINDIR)/$(CONFIG)/boringssl_v3name_test \ - $(BINDIR)/$(CONFIG)/boringssl_ssl_test \ else buildtests_cxx: privatelibs_cxx \ @@ -1818,8 +1803,6 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/gpr_mpscq_test || ( echo test gpr_mpscq_test failed ; exit 1 ) $(E) "[RUN] Testing gpr_spinlock_test" $(Q) $(BINDIR)/$(CONFIG)/gpr_spinlock_test || ( echo test gpr_spinlock_test failed ; exit 1 ) - $(E) "[RUN] Testing gpr_stack_lockfree_test" - $(Q) $(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test || ( echo test gpr_stack_lockfree_test failed ; exit 1 ) $(E) "[RUN] Testing gpr_string_test" $(Q) $(BINDIR)/$(CONFIG)/gpr_string_test || ( echo test gpr_string_test failed ; exit 1 ) $(E) "[RUN] Testing gpr_sync_test" @@ -2765,7 +2748,6 @@ LIBGPR_SRC = \ src/core/lib/support/log_windows.c \ src/core/lib/support/mpscq.c \ src/core/lib/support/murmur_hash.c \ - src/core/lib/support/stack_lockfree.c \ src/core/lib/support/string.c \ src/core/lib/support/string_posix.c \ src/core/lib/support/string_util_windows.c \ @@ -5901,6 +5883,7 @@ endif LIBBORINGSSL_SRC = \ src/boringssl/err_data.c \ third_party/boringssl/crypto/aes/aes.c \ + third_party/boringssl/crypto/aes/key_wrap.c \ third_party/boringssl/crypto/aes/mode_wrappers.c \ third_party/boringssl/crypto/asn1/a_bitstr.c \ third_party/boringssl/crypto/asn1/a_bool.c \ @@ -5932,12 +5915,12 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/asn1/tasn_new.c \ third_party/boringssl/crypto/asn1/tasn_typ.c \ third_party/boringssl/crypto/asn1/tasn_utl.c \ + third_party/boringssl/crypto/asn1/time_support.c \ third_party/boringssl/crypto/asn1/x_bignum.c \ third_party/boringssl/crypto/asn1/x_long.c \ third_party/boringssl/crypto/base64/base64.c \ third_party/boringssl/crypto/bio/bio.c \ third_party/boringssl/crypto/bio/bio_mem.c \ - third_party/boringssl/crypto/bio/buffer.c \ third_party/boringssl/crypto/bio/connect.c \ third_party/boringssl/crypto/bio/fd.c \ third_party/boringssl/crypto/bio/file.c \ @@ -6044,12 +6027,7 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/modes/ctr.c \ third_party/boringssl/crypto/modes/gcm.c \ third_party/boringssl/crypto/modes/ofb.c \ - third_party/boringssl/crypto/newhope/error_correction.c \ - third_party/boringssl/crypto/newhope/newhope.c \ - third_party/boringssl/crypto/newhope/ntt.c \ - third_party/boringssl/crypto/newhope/poly.c \ - third_party/boringssl/crypto/newhope/precomp.c \ - third_party/boringssl/crypto/newhope/reduce.c \ + third_party/boringssl/crypto/modes/polyval.c \ third_party/boringssl/crypto/obj/obj.c \ third_party/boringssl/crypto/obj/obj_xref.c \ third_party/boringssl/crypto/pem/pem_all.c \ @@ -6060,14 +6038,15 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/pem/pem_pkey.c \ third_party/boringssl/crypto/pem/pem_x509.c \ third_party/boringssl/crypto/pem/pem_xaux.c \ - third_party/boringssl/crypto/pkcs8/p5_pbe.c \ third_party/boringssl/crypto/pkcs8/p5_pbev2.c \ third_party/boringssl/crypto/pkcs8/p8_pkey.c \ third_party/boringssl/crypto/pkcs8/pkcs8.c \ third_party/boringssl/crypto/poly1305/poly1305.c \ third_party/boringssl/crypto/poly1305/poly1305_arm.c \ third_party/boringssl/crypto/poly1305/poly1305_vec.c \ + third_party/boringssl/crypto/pool/pool.c \ third_party/boringssl/crypto/rand/deterministic.c \ + third_party/boringssl/crypto/rand/fuchsia.c \ third_party/boringssl/crypto/rand/rand.c \ third_party/boringssl/crypto/rand/urandom.c \ third_party/boringssl/crypto/rand/windows.c \ @@ -6079,6 +6058,7 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/rsa/rsa.c \ third_party/boringssl/crypto/rsa/rsa_asn1.c \ third_party/boringssl/crypto/rsa/rsa_impl.c \ + third_party/boringssl/crypto/sha/sha1-altivec.c \ third_party/boringssl/crypto/sha/sha1.c \ third_party/boringssl/crypto/sha/sha256.c \ third_party/boringssl/crypto/sha/sha512.c \ @@ -6087,7 +6067,6 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/thread_none.c \ third_party/boringssl/crypto/thread_pthread.c \ third_party/boringssl/crypto/thread_win.c \ - third_party/boringssl/crypto/time_support.c \ third_party/boringssl/crypto/x509/a_digest.c \ third_party/boringssl/crypto/x509/a_sign.c \ third_party/boringssl/crypto/x509/a_strex.c \ @@ -6171,6 +6150,7 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/crypto/x509v3/v3_skey.c \ third_party/boringssl/crypto/x509v3/v3_sxnet.c \ third_party/boringssl/crypto/x509v3/v3_utl.c \ + third_party/boringssl/ssl/bio_ssl.c \ third_party/boringssl/ssl/custom_extensions.c \ third_party/boringssl/ssl/d1_both.c \ third_party/boringssl/ssl/d1_lib.c \ @@ -6181,7 +6161,6 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/ssl/handshake_client.c \ third_party/boringssl/ssl/handshake_server.c \ third_party/boringssl/ssl/s3_both.c \ - third_party/boringssl/ssl/s3_enc.c \ third_party/boringssl/ssl/s3_lib.c \ third_party/boringssl/ssl/s3_pkt.c \ third_party/boringssl/ssl/ssl_aead_ctx.c \ @@ -6192,9 +6171,12 @@ LIBBORINGSSL_SRC = \ third_party/boringssl/ssl/ssl_ecdh.c \ third_party/boringssl/ssl/ssl_file.c \ third_party/boringssl/ssl/ssl_lib.c \ - third_party/boringssl/ssl/ssl_rsa.c \ + third_party/boringssl/ssl/ssl_privkey.c \ + third_party/boringssl/ssl/ssl_privkey_cc.cc \ third_party/boringssl/ssl/ssl_session.c \ third_party/boringssl/ssl/ssl_stat.c \ + third_party/boringssl/ssl/ssl_transcript.c \ + third_party/boringssl/ssl/ssl_x509.c \ third_party/boringssl/ssl/t1_enc.c \ third_party/boringssl/ssl/t1_lib.c \ third_party/boringssl/ssl/tls13_both.c \ @@ -6496,44 +6478,6 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_CHACHA_TEST_LIB_SRC = \ - third_party/boringssl/crypto/chacha/chacha_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_CHACHA_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_CHACHA_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_CHACHA_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_CHACHA_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_CHACHA_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a $(LIBBORINGSSL_CHACHA_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_CHACHA_TEST_LIB_OBJS:.o=.dep) -endif - - LIBBORINGSSL_AEAD_TEST_LIB_SRC = \ third_party/boringssl/crypto/cipher/aead_test.cc \ @@ -6649,16 +6593,25 @@ endif LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_SRC = \ - third_party/boringssl/crypto/constant_time_test.c \ + third_party/boringssl/crypto/constant_time_test.cc \ -PUBLIC_HEADERS_C += \ +PUBLIC_HEADERS_CXX += \ LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_SRC)))) $(LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) -$(LIBDIR)/$(CONFIG)/libboringssl_constant_time_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS) +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +$(LIBDIR)/$(CONFIG)/libboringssl_constant_time_test_lib.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libboringssl_constant_time_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_constant_time_test_lib.a @@ -6670,6 +6623,8 @@ endif +endif + ifneq ($(NO_DEPS),true) -include $(LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS:.o=.dep) endif @@ -6789,44 +6744,6 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_DH_TEST_LIB_SRC = \ - third_party/boringssl/crypto/dh/dh_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_DH_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_DH_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_DH_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_DH_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_DH_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a $(LIBBORINGSSL_DH_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_DH_TEST_LIB_OBJS:.o=.dep) -endif - - LIBBORINGSSL_DIGEST_TEST_LIB_SRC = \ third_party/boringssl/crypto/digest/digest_test.cc \ @@ -6865,59 +6782,59 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_DSA_TEST_LIB_SRC = \ - third_party/boringssl/crypto/dsa/dsa_test.c \ +LIBBORINGSSL_EXAMPLE_MUL_LIB_SRC = \ + third_party/boringssl/crypto/ec/example_mul.c \ PUBLIC_HEADERS_C += \ -LIBBORINGSSL_DSA_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_DSA_TEST_LIB_SRC)))) +LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_EXAMPLE_MUL_LIB_SRC)))) -$(LIBBORINGSSL_DSA_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_DSA_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) -$(LIBDIR)/$(CONFIG)/libboringssl_dsa_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_DSA_TEST_LIB_OBJS) +$(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_dsa_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_dsa_test_lib.a $(LIBBORINGSSL_DSA_TEST_LIB_OBJS) + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a $(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS) ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_dsa_test_lib.a + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a endif ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_DSA_TEST_LIB_OBJS:.o=.dep) +-include $(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS:.o=.dep) endif -LIBBORINGSSL_EC_TEST_LIB_SRC = \ - third_party/boringssl/crypto/ec/ec_test.cc \ +LIBBORINGSSL_P256-X86_64_TEST_LIB_SRC = \ + third_party/boringssl/crypto/ec/p256-x86_64_test.cc \ PUBLIC_HEADERS_CXX += \ -LIBBORINGSSL_EC_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_EC_TEST_LIB_SRC)))) +LIBBORINGSSL_P256-X86_64_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_P256-X86_64_TEST_LIB_SRC)))) -$(LIBBORINGSSL_EC_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_EC_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(LIBBORINGSSL_P256-X86_64_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(LIBBORINGSSL_P256-X86_64_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) ifeq ($(NO_PROTOBUF),true) # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. -$(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a: protobuf_dep_error +$(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a: protobuf_dep_error else -$(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_EC_TEST_LIB_OBJS) +$(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_P256-X86_64_TEST_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a $(LIBBORINGSSL_EC_TEST_LIB_OBJS) + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a $(LIBBORINGSSL_P256-X86_64_TEST_LIB_OBJS) ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a endif @@ -6926,34 +6843,7 @@ endif endif ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_EC_TEST_LIB_OBJS:.o=.dep) -endif - - -LIBBORINGSSL_EXAMPLE_MUL_LIB_SRC = \ - third_party/boringssl/crypto/ec/example_mul.c \ - -PUBLIC_HEADERS_C += \ - -LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_EXAMPLE_MUL_LIB_SRC)))) - -$(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -$(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a $(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a -endif - - - - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS:.o=.dep) +-include $(LIBBORINGSSL_P256-X86_64_TEST_LIB_OBJS:.o=.dep) endif @@ -7109,44 +6999,6 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_ERR_TEST_LIB_SRC = \ - third_party/boringssl/crypto/err/err_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_ERR_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_ERR_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_ERR_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_ERR_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_ERR_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a $(LIBBORINGSSL_ERR_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_ERR_TEST_LIB_OBJS:.o=.dep) -endif - - LIBBORINGSSL_EVP_EXTRA_TEST_LIB_SRC = \ third_party/boringssl/crypto/evp/evp_extra_test.cc \ @@ -7262,16 +7114,25 @@ endif LIBBORINGSSL_HKDF_TEST_LIB_SRC = \ - third_party/boringssl/crypto/hkdf/hkdf_test.c \ + third_party/boringssl/crypto/hkdf/hkdf_test.cc \ -PUBLIC_HEADERS_C += \ +PUBLIC_HEADERS_CXX += \ LIBBORINGSSL_HKDF_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_HKDF_TEST_LIB_SRC)))) $(LIBBORINGSSL_HKDF_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(LIBBORINGSSL_HKDF_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) -$(LIBDIR)/$(CONFIG)/libboringssl_hkdf_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_HKDF_TEST_LIB_OBJS) +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +$(LIBDIR)/$(CONFIG)/libboringssl_hkdf_test_lib.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libboringssl_hkdf_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_HKDF_TEST_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_hkdf_test_lib.a @@ -7283,6 +7144,8 @@ endif +endif + ifneq ($(NO_DEPS),true) -include $(LIBBORINGSSL_HKDF_TEST_LIB_OBJS:.o=.dep) endif @@ -7327,16 +7190,25 @@ endif LIBBORINGSSL_LHASH_TEST_LIB_SRC = \ - third_party/boringssl/crypto/lhash/lhash_test.c \ + third_party/boringssl/crypto/lhash/lhash_test.cc \ -PUBLIC_HEADERS_C += \ +PUBLIC_HEADERS_CXX += \ LIBBORINGSSL_LHASH_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_LHASH_TEST_LIB_SRC)))) $(LIBBORINGSSL_LHASH_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(LIBBORINGSSL_LHASH_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) -$(LIBDIR)/$(CONFIG)/libboringssl_lhash_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_LHASH_TEST_LIB_OBJS) +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +$(LIBDIR)/$(CONFIG)/libboringssl_lhash_test_lib.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libboringssl_lhash_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_LHASH_TEST_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_lhash_test_lib.a @@ -7348,6 +7220,8 @@ endif +endif + ifneq ($(NO_DEPS),true) -include $(LIBBORINGSSL_LHASH_TEST_LIB_OBJS:.o=.dep) endif @@ -7391,120 +7265,6 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_SRC = \ - third_party/boringssl/crypto/newhope/newhope_statistical_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a $(LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_NEWHOPE_STATISTICAL_TEST_LIB_OBJS:.o=.dep) -endif - - -LIBBORINGSSL_NEWHOPE_TEST_LIB_SRC = \ - third_party/boringssl/crypto/newhope/newhope_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_NEWHOPE_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_NEWHOPE_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_NEWHOPE_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_NEWHOPE_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_NEWHOPE_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a $(LIBBORINGSSL_NEWHOPE_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_NEWHOPE_TEST_LIB_OBJS:.o=.dep) -endif - - -LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_SRC = \ - third_party/boringssl/crypto/newhope/newhope_vectors_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a $(LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_NEWHOPE_VECTORS_TEST_LIB_OBJS:.o=.dep) -endif - - LIBBORINGSSL_OBJ_TEST_LIB_SRC = \ third_party/boringssl/crypto/obj/obj_test.cc \ @@ -7657,59 +7417,70 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_REFCOUNT_TEST_LIB_SRC = \ - third_party/boringssl/crypto/refcount_test.c \ +LIBBORINGSSL_POOL_TEST_LIB_SRC = \ + third_party/boringssl/crypto/pool/pool_test.cc \ -PUBLIC_HEADERS_C += \ +PUBLIC_HEADERS_CXX += \ -LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_REFCOUNT_TEST_LIB_SRC)))) +LIBBORINGSSL_POOL_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_POOL_TEST_LIB_SRC)))) -$(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(LIBBORINGSSL_POOL_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(LIBBORINGSSL_POOL_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) -$(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(LIBBORINGSSL_REFCOUNT_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_pool_test_lib.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_POOL_TEST_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS) + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a $(LIBBORINGSSL_POOL_TEST_LIB_OBJS) ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a endif +endif + ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS:.o=.dep) +-include $(LIBBORINGSSL_POOL_TEST_LIB_OBJS:.o=.dep) endif -LIBBORINGSSL_RSA_TEST_LIB_SRC = \ - third_party/boringssl/crypto/rsa/rsa_test.cc \ +LIBBORINGSSL_REFCOUNT_TEST_LIB_SRC = \ + third_party/boringssl/crypto/refcount_test.cc \ PUBLIC_HEADERS_CXX += \ -LIBBORINGSSL_RSA_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_RSA_TEST_LIB_SRC)))) +LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_REFCOUNT_TEST_LIB_SRC)))) -$(LIBBORINGSSL_RSA_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_RSA_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) ifeq ($(NO_PROTOBUF),true) # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. -$(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a: protobuf_dep_error +$(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a: protobuf_dep_error else -$(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_RSA_TEST_LIB_OBJS) +$(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a $(LIBBORINGSSL_RSA_TEST_LIB_OBJS) + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS) ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a endif @@ -7718,7 +7489,7 @@ endif endif ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_RSA_TEST_LIB_OBJS:.o=.dep) +-include $(LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS:.o=.dep) endif @@ -7868,44 +7639,6 @@ ifneq ($(NO_DEPS),true) endif -LIBBORINGSSL_SSL_TEST_LIB_SRC = \ - third_party/boringssl/ssl/ssl_test.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBORINGSSL_SSL_TEST_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_SSL_TEST_LIB_SRC)))) - -$(LIBBORINGSSL_SSL_TEST_LIB_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(LIBBORINGSSL_SSL_TEST_LIB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a: $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBBORINGSSL_SSL_TEST_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a $(LIBBORINGSSL_SSL_TEST_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a -endif - - - - -endif - -ifneq ($(NO_DEPS),true) --include $(LIBBORINGSSL_SSL_TEST_LIB_OBJS:.o=.dep) -endif - - LIBBENCHMARK_SRC = \ third_party/benchmark/src/benchmark.cc \ third_party/benchmark/src/benchmark_register.cc \ @@ -9957,38 +9690,6 @@ endif endif -GPR_STACK_LOCKFREE_TEST_SRC = \ - test/core/support/stack_lockfree_test.c \ - -GPR_STACK_LOCKFREE_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GPR_STACK_LOCKFREE_TEST_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test: openssl_dep_error - -else - - - -$(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test: $(GPR_STACK_LOCKFREE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_STACK_LOCKFREE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test - -endif - -$(OBJDIR)/$(CONFIG)/test/core/support/stack_lockfree_test.o: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a - -deps_gpr_stack_lockfree_test: $(GPR_STACK_LOCKFREE_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(GPR_STACK_LOCKFREE_TEST_OBJS:.o=.dep) -endif -endif - - GPR_STRING_TEST_SRC = \ test/core/support/string_test.c \ @@ -16758,35 +16459,6 @@ $(BORINGSSL_BYTESTRING_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversio -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_CHACHA_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_CHACHA_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_CHACHA_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_chacha_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_chacha_test: $(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_chacha_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_chacha_test - -endif - -$(BORINGSSL_CHACHA_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_CHACHA_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment @@ -16990,35 +16662,6 @@ $(BORINGSSL_X25519_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -W -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_DH_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_DH_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_DH_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_dh_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_dh_test: $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_dh_test - -endif - -$(BORINGSSL_DH_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_DH_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment @@ -17051,57 +16694,28 @@ $(BORINGSSL_DIGEST_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -W # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment -$(BORINGSSL_DSA_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_DSA_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_DSA_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_dsa_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_dsa_test: $(LIBDIR)/$(CONFIG)/libboringssl_dsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_dsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_dsa_test - -endif - -$(BORINGSSL_DSA_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_DSA_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_EC_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_EC_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_EC_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE +$(BORINGSSL_EXAMPLE_MUL_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) +$(BORINGSSL_EXAMPLE_MUL_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) +$(BORINGSSL_EXAMPLE_MUL_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/boringssl_ec_test: protobuf_dep_error +$(BINDIR)/$(CONFIG)/boringssl_example_mul: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/boringssl_ec_test: $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a +$(BINDIR)/$(CONFIG)/boringssl_example_mul: $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_ec_test + $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_example_mul endif -$(BORINGSSL_EC_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_EC_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(BORINGSSL_EXAMPLE_MUL_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(BORINGSSL_EXAMPLE_MUL_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) @@ -17109,28 +16723,28 @@ $(BORINGSSL_EC_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-u # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment -$(BORINGSSL_EXAMPLE_MUL_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_EXAMPLE_MUL_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_EXAMPLE_MUL_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE +$(BORINGSSL_P256-X86_64_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) +$(BORINGSSL_P256-X86_64_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) +$(BORINGSSL_P256-X86_64_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/boringssl_example_mul: protobuf_dep_error +$(BINDIR)/$(CONFIG)/boringssl_p256-x86_64_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/boringssl_example_mul: $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a +$(BINDIR)/$(CONFIG)/boringssl_p256-x86_64_test: $(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_example_mul_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_example_mul + $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_p256-x86_64_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_p256-x86_64_test endif -$(BORINGSSL_EXAMPLE_MUL_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_EXAMPLE_MUL_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(BORINGSSL_P256-X86_64_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(BORINGSSL_P256-X86_64_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) @@ -17251,35 +16865,6 @@ $(BORINGSSL_ECDSA_VERIFY_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-convers -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_ERR_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_ERR_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_ERR_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_err_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_err_test: $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_err_test - -endif - -$(BORINGSSL_ERR_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_ERR_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment @@ -17483,93 +17068,6 @@ $(BORINGSSL_GCM_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno- -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_NEWHOPE_STATISTICAL_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_NEWHOPE_STATISTICAL_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_NEWHOPE_STATISTICAL_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_newhope_statistical_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_newhope_statistical_test: $(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_newhope_statistical_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_newhope_statistical_test - -endif - -$(BORINGSSL_NEWHOPE_STATISTICAL_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_NEWHOPE_STATISTICAL_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_NEWHOPE_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_NEWHOPE_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_NEWHOPE_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_newhope_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_newhope_test: $(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_newhope_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_newhope_test - -endif - -$(BORINGSSL_NEWHOPE_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_NEWHOPE_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_NEWHOPE_VECTORS_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_NEWHOPE_VECTORS_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_NEWHOPE_VECTORS_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_newhope_vectors_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_newhope_vectors_test: $(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_newhope_vectors_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_newhope_vectors_test - -endif - -$(BORINGSSL_NEWHOPE_VECTORS_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_NEWHOPE_VECTORS_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - - # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment @@ -17689,28 +17187,28 @@ $(BORINGSSL_POLY1305_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment -$(BORINGSSL_REFCOUNT_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_REFCOUNT_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_REFCOUNT_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE +$(BORINGSSL_POOL_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) +$(BORINGSSL_POOL_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) +$(BORINGSSL_POOL_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/boringssl_refcount_test: protobuf_dep_error +$(BINDIR)/$(CONFIG)/boringssl_pool_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/boringssl_refcount_test: $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a +$(BINDIR)/$(CONFIG)/boringssl_pool_test: $(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_refcount_test + $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_pool_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_pool_test endif -$(BORINGSSL_REFCOUNT_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_REFCOUNT_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(BORINGSSL_POOL_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(BORINGSSL_POOL_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) @@ -17718,28 +17216,28 @@ $(BORINGSSL_REFCOUNT_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion # boringssl needs an override to ensure that it does not include # system openssl headers regardless of other configuration # we do so here with a target specific variable assignment -$(BORINGSSL_RSA_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_RSA_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_RSA_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE +$(BORINGSSL_REFCOUNT_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) +$(BORINGSSL_REFCOUNT_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) +$(BORINGSSL_REFCOUNT_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/boringssl_rsa_test: protobuf_dep_error +$(BINDIR)/$(CONFIG)/boringssl_refcount_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/boringssl_rsa_test: $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a +$(BINDIR)/$(CONFIG)/boringssl_refcount_test: $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_rsa_test + $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_refcount_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_refcount_test endif -$(BORINGSSL_RSA_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_RSA_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) +$(BORINGSSL_REFCOUNT_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX +$(BORINGSSL_REFCOUNT_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) @@ -17888,35 +17386,6 @@ $(BORINGSSL_V3NAME_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -W - -# boringssl needs an override to ensure that it does not include -# system openssl headers regardless of other configuration -# we do so here with a target specific variable assignment -$(BORINGSSL_SSL_TEST_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI) -$(BORINGSSL_SSL_TEST_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -$(BORINGSSL_SSL_TEST_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/boringssl_ssl_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/boringssl_ssl_test: $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/boringssl_ssl_test - -endif - -$(BORINGSSL_SSL_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -$(BORINGSSL_SSL_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - - - BADREQ_BAD_CLIENT_TEST_SRC = \ test/core/bad_client/tests/badreq.c \ diff --git a/binding.gyp b/binding.gyp index d5bb27f6da0..d85cf0be14f 100644 --- a/binding.gyp +++ b/binding.gyp @@ -115,6 +115,15 @@ ] }, { 'conditions': [ + ["target_arch=='ia32'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] + }], + ["target_arch=='x64'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] + }], + ["target_arch=='arm'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] + }], ['grpc_alpn=="true"', { 'defines': [ 'TSI_OPENSSL_ALPN_SUPPORT=1' @@ -127,17 +136,6 @@ ], 'include_dirs': [ '<(node_root_dir)/deps/openssl/openssl/include', - ], - 'conditions': [ - ["target_arch=='ia32'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] - }], - ["target_arch=='x64'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] - }], - ["target_arch=='arm'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] - }] ] }], ['OS == "win"', { @@ -174,6 +172,7 @@ 'targets': [ { 'cflags': [ + '-std=c++11', '-std=c99', '-Wall', '-Werror' @@ -186,6 +185,7 @@ 'sources': [ 'src/boringssl/err_data.c', 'third_party/boringssl/crypto/aes/aes.c', + 'third_party/boringssl/crypto/aes/key_wrap.c', 'third_party/boringssl/crypto/aes/mode_wrappers.c', 'third_party/boringssl/crypto/asn1/a_bitstr.c', 'third_party/boringssl/crypto/asn1/a_bool.c', @@ -217,12 +217,12 @@ 'third_party/boringssl/crypto/asn1/tasn_new.c', 'third_party/boringssl/crypto/asn1/tasn_typ.c', 'third_party/boringssl/crypto/asn1/tasn_utl.c', + 'third_party/boringssl/crypto/asn1/time_support.c', 'third_party/boringssl/crypto/asn1/x_bignum.c', 'third_party/boringssl/crypto/asn1/x_long.c', 'third_party/boringssl/crypto/base64/base64.c', 'third_party/boringssl/crypto/bio/bio.c', 'third_party/boringssl/crypto/bio/bio_mem.c', - 'third_party/boringssl/crypto/bio/buffer.c', 'third_party/boringssl/crypto/bio/connect.c', 'third_party/boringssl/crypto/bio/fd.c', 'third_party/boringssl/crypto/bio/file.c', @@ -329,12 +329,7 @@ 'third_party/boringssl/crypto/modes/ctr.c', 'third_party/boringssl/crypto/modes/gcm.c', 'third_party/boringssl/crypto/modes/ofb.c', - 'third_party/boringssl/crypto/newhope/error_correction.c', - 'third_party/boringssl/crypto/newhope/newhope.c', - 'third_party/boringssl/crypto/newhope/ntt.c', - 'third_party/boringssl/crypto/newhope/poly.c', - 'third_party/boringssl/crypto/newhope/precomp.c', - 'third_party/boringssl/crypto/newhope/reduce.c', + 'third_party/boringssl/crypto/modes/polyval.c', 'third_party/boringssl/crypto/obj/obj.c', 'third_party/boringssl/crypto/obj/obj_xref.c', 'third_party/boringssl/crypto/pem/pem_all.c', @@ -345,14 +340,15 @@ 'third_party/boringssl/crypto/pem/pem_pkey.c', 'third_party/boringssl/crypto/pem/pem_x509.c', 'third_party/boringssl/crypto/pem/pem_xaux.c', - 'third_party/boringssl/crypto/pkcs8/p5_pbe.c', 'third_party/boringssl/crypto/pkcs8/p5_pbev2.c', 'third_party/boringssl/crypto/pkcs8/p8_pkey.c', 'third_party/boringssl/crypto/pkcs8/pkcs8.c', 'third_party/boringssl/crypto/poly1305/poly1305.c', 'third_party/boringssl/crypto/poly1305/poly1305_arm.c', 'third_party/boringssl/crypto/poly1305/poly1305_vec.c', + 'third_party/boringssl/crypto/pool/pool.c', 'third_party/boringssl/crypto/rand/deterministic.c', + 'third_party/boringssl/crypto/rand/fuchsia.c', 'third_party/boringssl/crypto/rand/rand.c', 'third_party/boringssl/crypto/rand/urandom.c', 'third_party/boringssl/crypto/rand/windows.c', @@ -364,6 +360,7 @@ 'third_party/boringssl/crypto/rsa/rsa.c', 'third_party/boringssl/crypto/rsa/rsa_asn1.c', 'third_party/boringssl/crypto/rsa/rsa_impl.c', + 'third_party/boringssl/crypto/sha/sha1-altivec.c', 'third_party/boringssl/crypto/sha/sha1.c', 'third_party/boringssl/crypto/sha/sha256.c', 'third_party/boringssl/crypto/sha/sha512.c', @@ -372,7 +369,6 @@ 'third_party/boringssl/crypto/thread_none.c', 'third_party/boringssl/crypto/thread_pthread.c', 'third_party/boringssl/crypto/thread_win.c', - 'third_party/boringssl/crypto/time_support.c', 'third_party/boringssl/crypto/x509/a_digest.c', 'third_party/boringssl/crypto/x509/a_sign.c', 'third_party/boringssl/crypto/x509/a_strex.c', @@ -456,6 +452,7 @@ 'third_party/boringssl/crypto/x509v3/v3_skey.c', 'third_party/boringssl/crypto/x509v3/v3_sxnet.c', 'third_party/boringssl/crypto/x509v3/v3_utl.c', + 'third_party/boringssl/ssl/bio_ssl.c', 'third_party/boringssl/ssl/custom_extensions.c', 'third_party/boringssl/ssl/d1_both.c', 'third_party/boringssl/ssl/d1_lib.c', @@ -466,7 +463,6 @@ 'third_party/boringssl/ssl/handshake_client.c', 'third_party/boringssl/ssl/handshake_server.c', 'third_party/boringssl/ssl/s3_both.c', - 'third_party/boringssl/ssl/s3_enc.c', 'third_party/boringssl/ssl/s3_lib.c', 'third_party/boringssl/ssl/s3_pkt.c', 'third_party/boringssl/ssl/ssl_aead_ctx.c', @@ -477,9 +473,12 @@ 'third_party/boringssl/ssl/ssl_ecdh.c', 'third_party/boringssl/ssl/ssl_file.c', 'third_party/boringssl/ssl/ssl_lib.c', - 'third_party/boringssl/ssl/ssl_rsa.c', + 'third_party/boringssl/ssl/ssl_privkey.c', + 'third_party/boringssl/ssl/ssl_privkey_cc.cc', 'third_party/boringssl/ssl/ssl_session.c', 'third_party/boringssl/ssl/ssl_stat.c', + 'third_party/boringssl/ssl/ssl_transcript.c', + 'third_party/boringssl/ssl/ssl_x509.c', 'third_party/boringssl/ssl/t1_enc.c', 'third_party/boringssl/ssl/t1_lib.c', 'third_party/boringssl/ssl/tls13_both.c', @@ -488,9 +487,20 @@ 'third_party/boringssl/ssl/tls13_server.c', 'third_party/boringssl/ssl/tls_method.c', 'third_party/boringssl/ssl/tls_record.c', - ] + ], + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'MACOSX_DEPLOYMENT_TARGET': '10.9', + 'OTHER_CPLUSPLUSFLAGS': [ + '-stdlib=libc++', + '-std=c++11' + ], + } + }], + ], }, - ] + ], }], ['OS == "win" and runtime!="electron"', { 'targets': [ @@ -594,7 +604,6 @@ 'src/core/lib/support/log_windows.c', 'src/core/lib/support/mpscq.c', 'src/core/lib/support/murmur_hash.c', - 'src/core/lib/support/stack_lockfree.c', 'src/core/lib/support/string.c', 'src/core/lib/support/string_posix.c', 'src/core/lib/support/string_util_windows.c', diff --git a/build.yaml b/build.yaml index 404f95c2ae5..abf97c58bde 100644 --- a/build.yaml +++ b/build.yaml @@ -99,7 +99,6 @@ filegroups: - src/core/lib/support/mpscq.h - src/core/lib/support/murmur_hash.h - src/core/lib/support/spinlock.h - - src/core/lib/support/stack_lockfree.h - src/core/lib/support/string.h - src/core/lib/support/string_windows.h - src/core/lib/support/thd_internal.h @@ -130,7 +129,6 @@ filegroups: - src/core/lib/support/log_windows.c - src/core/lib/support/mpscq.c - src/core/lib/support/murmur_hash.c - - src/core/lib/support/stack_lockfree.c - src/core/lib/support/string.c - src/core/lib/support/string_posix.c - src/core/lib/support/string_util_windows.c @@ -2123,15 +2121,6 @@ targets: deps: - gpr_test_util - gpr -- name: gpr_stack_lockfree_test - cpu_cost: 7 - build: test - language: c - src: - - test/core/support/stack_lockfree_test.c - deps: - - gpr_test_util - - gpr - name: gpr_string_test build: test language: c diff --git a/config.m4 b/config.m4 index 0049b72d483..eb0df98acdf 100644 --- a/config.m4 +++ b/config.m4 @@ -63,7 +63,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/support/log_windows.c \ src/core/lib/support/mpscq.c \ src/core/lib/support/murmur_hash.c \ - src/core/lib/support/stack_lockfree.c \ src/core/lib/support/string.c \ src/core/lib/support/string_posix.c \ src/core/lib/support/string_util_windows.c \ @@ -336,6 +335,7 @@ if test "$PHP_GRPC" != "no"; then src/core/plugin_registry/grpc_plugin_registry.c \ src/boringssl/err_data.c \ third_party/boringssl/crypto/aes/aes.c \ + third_party/boringssl/crypto/aes/key_wrap.c \ third_party/boringssl/crypto/aes/mode_wrappers.c \ third_party/boringssl/crypto/asn1/a_bitstr.c \ third_party/boringssl/crypto/asn1/a_bool.c \ @@ -367,12 +367,12 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/asn1/tasn_new.c \ third_party/boringssl/crypto/asn1/tasn_typ.c \ third_party/boringssl/crypto/asn1/tasn_utl.c \ + third_party/boringssl/crypto/asn1/time_support.c \ third_party/boringssl/crypto/asn1/x_bignum.c \ third_party/boringssl/crypto/asn1/x_long.c \ third_party/boringssl/crypto/base64/base64.c \ third_party/boringssl/crypto/bio/bio.c \ third_party/boringssl/crypto/bio/bio_mem.c \ - third_party/boringssl/crypto/bio/buffer.c \ third_party/boringssl/crypto/bio/connect.c \ third_party/boringssl/crypto/bio/fd.c \ third_party/boringssl/crypto/bio/file.c \ @@ -479,12 +479,7 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/modes/ctr.c \ third_party/boringssl/crypto/modes/gcm.c \ third_party/boringssl/crypto/modes/ofb.c \ - third_party/boringssl/crypto/newhope/error_correction.c \ - third_party/boringssl/crypto/newhope/newhope.c \ - third_party/boringssl/crypto/newhope/ntt.c \ - third_party/boringssl/crypto/newhope/poly.c \ - third_party/boringssl/crypto/newhope/precomp.c \ - third_party/boringssl/crypto/newhope/reduce.c \ + third_party/boringssl/crypto/modes/polyval.c \ third_party/boringssl/crypto/obj/obj.c \ third_party/boringssl/crypto/obj/obj_xref.c \ third_party/boringssl/crypto/pem/pem_all.c \ @@ -495,14 +490,15 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/pem/pem_pkey.c \ third_party/boringssl/crypto/pem/pem_x509.c \ third_party/boringssl/crypto/pem/pem_xaux.c \ - third_party/boringssl/crypto/pkcs8/p5_pbe.c \ third_party/boringssl/crypto/pkcs8/p5_pbev2.c \ third_party/boringssl/crypto/pkcs8/p8_pkey.c \ third_party/boringssl/crypto/pkcs8/pkcs8.c \ third_party/boringssl/crypto/poly1305/poly1305.c \ third_party/boringssl/crypto/poly1305/poly1305_arm.c \ third_party/boringssl/crypto/poly1305/poly1305_vec.c \ + third_party/boringssl/crypto/pool/pool.c \ third_party/boringssl/crypto/rand/deterministic.c \ + third_party/boringssl/crypto/rand/fuchsia.c \ third_party/boringssl/crypto/rand/rand.c \ third_party/boringssl/crypto/rand/urandom.c \ third_party/boringssl/crypto/rand/windows.c \ @@ -514,6 +510,7 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/rsa/rsa.c \ third_party/boringssl/crypto/rsa/rsa_asn1.c \ third_party/boringssl/crypto/rsa/rsa_impl.c \ + third_party/boringssl/crypto/sha/sha1-altivec.c \ third_party/boringssl/crypto/sha/sha1.c \ third_party/boringssl/crypto/sha/sha256.c \ third_party/boringssl/crypto/sha/sha512.c \ @@ -522,7 +519,6 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/thread_none.c \ third_party/boringssl/crypto/thread_pthread.c \ third_party/boringssl/crypto/thread_win.c \ - third_party/boringssl/crypto/time_support.c \ third_party/boringssl/crypto/x509/a_digest.c \ third_party/boringssl/crypto/x509/a_sign.c \ third_party/boringssl/crypto/x509/a_strex.c \ @@ -606,6 +602,7 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/crypto/x509v3/v3_skey.c \ third_party/boringssl/crypto/x509v3/v3_sxnet.c \ third_party/boringssl/crypto/x509v3/v3_utl.c \ + third_party/boringssl/ssl/bio_ssl.c \ third_party/boringssl/ssl/custom_extensions.c \ third_party/boringssl/ssl/d1_both.c \ third_party/boringssl/ssl/d1_lib.c \ @@ -616,7 +613,6 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/ssl/handshake_client.c \ third_party/boringssl/ssl/handshake_server.c \ third_party/boringssl/ssl/s3_both.c \ - third_party/boringssl/ssl/s3_enc.c \ third_party/boringssl/ssl/s3_lib.c \ third_party/boringssl/ssl/s3_pkt.c \ third_party/boringssl/ssl/ssl_aead_ctx.c \ @@ -627,9 +623,12 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/ssl/ssl_ecdh.c \ third_party/boringssl/ssl/ssl_file.c \ third_party/boringssl/ssl/ssl_lib.c \ - third_party/boringssl/ssl/ssl_rsa.c \ + third_party/boringssl/ssl/ssl_privkey.c \ + third_party/boringssl/ssl/ssl_privkey_cc.cc \ third_party/boringssl/ssl/ssl_session.c \ third_party/boringssl/ssl/ssl_stat.c \ + third_party/boringssl/ssl/ssl_transcript.c \ + third_party/boringssl/ssl/ssl_x509.c \ third_party/boringssl/ssl/t1_enc.c \ third_party/boringssl/ssl/t1_lib.c \ third_party/boringssl/ssl/tls13_both.c \ @@ -728,11 +727,11 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/md4) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/md5) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/modes) - PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/newhope) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/obj) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/pem) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/pkcs8) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/poly1305) + PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/pool) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/rand) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/rc4) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/rsa) diff --git a/config.w32 b/config.w32 index 919587dc586..cca36040455 100644 --- a/config.w32 +++ b/config.w32 @@ -40,7 +40,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\support\\log_windows.c " + "src\\core\\lib\\support\\mpscq.c " + "src\\core\\lib\\support\\murmur_hash.c " + - "src\\core\\lib\\support\\stack_lockfree.c " + "src\\core\\lib\\support\\string.c " + "src\\core\\lib\\support\\string_posix.c " + "src\\core\\lib\\support\\string_util_windows.c " + @@ -313,6 +312,7 @@ if (PHP_GRPC != "no") { "src\\core\\plugin_registry\\grpc_plugin_registry.c " + "src\\boringssl\\err_data.c " + "third_party\\boringssl\\crypto\\aes\\aes.c " + + "third_party\\boringssl\\crypto\\aes\\key_wrap.c " + "third_party\\boringssl\\crypto\\aes\\mode_wrappers.c " + "third_party\\boringssl\\crypto\\asn1\\a_bitstr.c " + "third_party\\boringssl\\crypto\\asn1\\a_bool.c " + @@ -344,12 +344,12 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\crypto\\asn1\\tasn_new.c " + "third_party\\boringssl\\crypto\\asn1\\tasn_typ.c " + "third_party\\boringssl\\crypto\\asn1\\tasn_utl.c " + + "third_party\\boringssl\\crypto\\asn1\\time_support.c " + "third_party\\boringssl\\crypto\\asn1\\x_bignum.c " + "third_party\\boringssl\\crypto\\asn1\\x_long.c " + "third_party\\boringssl\\crypto\\base64\\base64.c " + "third_party\\boringssl\\crypto\\bio\\bio.c " + "third_party\\boringssl\\crypto\\bio\\bio_mem.c " + - "third_party\\boringssl\\crypto\\bio\\buffer.c " + "third_party\\boringssl\\crypto\\bio\\connect.c " + "third_party\\boringssl\\crypto\\bio\\fd.c " + "third_party\\boringssl\\crypto\\bio\\file.c " + @@ -456,12 +456,7 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\crypto\\modes\\ctr.c " + "third_party\\boringssl\\crypto\\modes\\gcm.c " + "third_party\\boringssl\\crypto\\modes\\ofb.c " + - "third_party\\boringssl\\crypto\\newhope\\error_correction.c " + - "third_party\\boringssl\\crypto\\newhope\\newhope.c " + - "third_party\\boringssl\\crypto\\newhope\\ntt.c " + - "third_party\\boringssl\\crypto\\newhope\\poly.c " + - "third_party\\boringssl\\crypto\\newhope\\precomp.c " + - "third_party\\boringssl\\crypto\\newhope\\reduce.c " + + "third_party\\boringssl\\crypto\\modes\\polyval.c " + "third_party\\boringssl\\crypto\\obj\\obj.c " + "third_party\\boringssl\\crypto\\obj\\obj_xref.c " + "third_party\\boringssl\\crypto\\pem\\pem_all.c " + @@ -472,14 +467,15 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\crypto\\pem\\pem_pkey.c " + "third_party\\boringssl\\crypto\\pem\\pem_x509.c " + "third_party\\boringssl\\crypto\\pem\\pem_xaux.c " + - "third_party\\boringssl\\crypto\\pkcs8\\p5_pbe.c " + "third_party\\boringssl\\crypto\\pkcs8\\p5_pbev2.c " + "third_party\\boringssl\\crypto\\pkcs8\\p8_pkey.c " + "third_party\\boringssl\\crypto\\pkcs8\\pkcs8.c " + "third_party\\boringssl\\crypto\\poly1305\\poly1305.c " + "third_party\\boringssl\\crypto\\poly1305\\poly1305_arm.c " + "third_party\\boringssl\\crypto\\poly1305\\poly1305_vec.c " + + "third_party\\boringssl\\crypto\\pool\\pool.c " + "third_party\\boringssl\\crypto\\rand\\deterministic.c " + + "third_party\\boringssl\\crypto\\rand\\fuchsia.c " + "third_party\\boringssl\\crypto\\rand\\rand.c " + "third_party\\boringssl\\crypto\\rand\\urandom.c " + "third_party\\boringssl\\crypto\\rand\\windows.c " + @@ -491,6 +487,7 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\crypto\\rsa\\rsa.c " + "third_party\\boringssl\\crypto\\rsa\\rsa_asn1.c " + "third_party\\boringssl\\crypto\\rsa\\rsa_impl.c " + + "third_party\\boringssl\\crypto\\sha\\sha1-altivec.c " + "third_party\\boringssl\\crypto\\sha\\sha1.c " + "third_party\\boringssl\\crypto\\sha\\sha256.c " + "third_party\\boringssl\\crypto\\sha\\sha512.c " + @@ -499,7 +496,6 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\crypto\\thread_none.c " + "third_party\\boringssl\\crypto\\thread_pthread.c " + "third_party\\boringssl\\crypto\\thread_win.c " + - "third_party\\boringssl\\crypto\\time_support.c " + "third_party\\boringssl\\crypto\\x509\\a_digest.c " + "third_party\\boringssl\\crypto\\x509\\a_sign.c " + "third_party\\boringssl\\crypto\\x509\\a_strex.c " + @@ -583,6 +579,7 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\crypto\\x509v3\\v3_skey.c " + "third_party\\boringssl\\crypto\\x509v3\\v3_sxnet.c " + "third_party\\boringssl\\crypto\\x509v3\\v3_utl.c " + + "third_party\\boringssl\\ssl\\bio_ssl.c " + "third_party\\boringssl\\ssl\\custom_extensions.c " + "third_party\\boringssl\\ssl\\d1_both.c " + "third_party\\boringssl\\ssl\\d1_lib.c " + @@ -593,7 +590,6 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\ssl\\handshake_client.c " + "third_party\\boringssl\\ssl\\handshake_server.c " + "third_party\\boringssl\\ssl\\s3_both.c " + - "third_party\\boringssl\\ssl\\s3_enc.c " + "third_party\\boringssl\\ssl\\s3_lib.c " + "third_party\\boringssl\\ssl\\s3_pkt.c " + "third_party\\boringssl\\ssl\\ssl_aead_ctx.c " + @@ -604,9 +600,12 @@ if (PHP_GRPC != "no") { "third_party\\boringssl\\ssl\\ssl_ecdh.c " + "third_party\\boringssl\\ssl\\ssl_file.c " + "third_party\\boringssl\\ssl\\ssl_lib.c " + - "third_party\\boringssl\\ssl\\ssl_rsa.c " + + "third_party\\boringssl\\ssl\\ssl_privkey.c " + + "third_party\\boringssl\\ssl\\ssl_privkey_cc.cc " + "third_party\\boringssl\\ssl\\ssl_session.c " + "third_party\\boringssl\\ssl\\ssl_stat.c " + + "third_party\\boringssl\\ssl\\ssl_transcript.c " + + "third_party\\boringssl\\ssl\\ssl_x509.c " + "third_party\\boringssl\\ssl\\t1_enc.c " + "third_party\\boringssl\\ssl\\t1_lib.c " + "third_party\\boringssl\\ssl\\tls13_both.c " + @@ -640,4 +639,134 @@ if (PHP_GRPC != "no") { "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+ "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ "/I"+configure_module_dirname+"\\third_party\\zlib"); + + base_dir = get_define('BUILD_DIR'); + FSO.CreateFolder(base_dir+"\\ext"); + FSO.CreateFolder(base_dir+"\\ext\\grpc"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\boringssl"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\census"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\census\\gen"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\pick_first"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\round_robin"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\dns"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\dns\\c_ares"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\dns\\native"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\fake"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\sockaddr"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\deadline"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\http"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\http\\client"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\http\\message_compress"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\http\\server"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\load_reporting"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\max_age"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\message_size"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\workarounds"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\alpn"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\client"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\client\\insecure"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\client\\secure"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\server"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\server\\insecure"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\server\\secure"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\transport"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\channel"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\compression"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\debug"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\http"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\iomgr"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\json"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\profiling"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\context"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\composite"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\fake"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\google_default"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\iam"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\jwt"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\oauth2"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\plugin"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\ssl"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\transport"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\util"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\slice"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\support"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\surface"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\transport"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\plugin_registry"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\tsi"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\php"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\php\\ext"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\php\\ext\\grpc"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\aes"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\asn1"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\base64"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\bio"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\bn"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\bn\\asm"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\buf"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\bytestring"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\chacha"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\cipher"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\cmac"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\conf"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\curve25519"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\des"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\dh"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\digest"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\dsa"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\ec"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\ecdh"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\ecdsa"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\engine"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\err"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\evp"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\hkdf"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\hmac"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\lhash"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\md4"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\md5"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\modes"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\obj"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\pem"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\pkcs8"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\poly1305"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\pool"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\rand"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\rc4"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\rsa"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\sha"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\stack"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\x509"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\crypto\\x509v3"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\ssl"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\nanopb"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\zlib"); + _build_dirs = new Array(); + for (i = 0; i < build_dirs.length; i++) { + if (build_dirs[i].indexOf('grpc') == -1) { + _build_dirs[_build_dirs.length] = build_dirs[i]; + } + } + build_dirs = _build_dirs; + } diff --git a/doc/PROTOCOL-HTTP2.md b/doc/PROTOCOL-HTTP2.md index 68af1f2ca19..29d3cc2e767 100644 --- a/doc/PROTOCOL-HTTP2.md +++ b/doc/PROTOCOL-HTTP2.md @@ -24,7 +24,8 @@ Request-Headers are delivered as HTTP2 headers in HEADERS + CONTINUATION frames. * **Call-Definition** → Method Scheme Path TE [Authority] [Timeout] Content-Type [Message-Type] [Message-Encoding] [Message-Accept-Encoding] [User-Agent] * **Method** → ":method POST" * **Scheme** → ":scheme " ("http" / "https") -* **Path** → ":path" {_path identifying method within exposed API_} +* **Path** → ":path" "/" Service-Name "/" {_method name_} +* **Service-Name** → {_IDL-specific service name_} * **Authority** → ":authority" {_virtual host name of authority_} * **TE** → "te" "trailers" # Used to detect incompatible proxies * **Timeout** → "grpc-timeout" TimeoutValue TimeoutUnit @@ -51,6 +52,13 @@ Request-Headers are delivered as HTTP2 headers in HEADERS + CONTINUATION frames. HTTP2 requires that reserved headers, ones starting with ":" appear before all other headers. Additionally implementations should send **Timeout** immediately after the reserved headers and they should send the **Call-Definition** headers before sending **Custom-Metadata**. +Some gRPC implementations may allow the **Path** format shown above +to be overridden, but this functionality is strongly discouraged. +gRPC does not go out of its way to break users that are using this kind +of override, but we do not actively support it, and some functionality +(e.g., service config support) will not work when the path is not of +the form shown above. + If **Timeout** is omitted a server should assume an infinite timeout. Client implementations are free to send a default minimum timeout based on their deployment requirements. **Custom-Metadata** is an arbitrary set of key-value pairs defined by the application layer. Header names starting with "grpc-" but not listed here are reserved for future GRPC use and should not be used by applications as **Custom-Metadata**. @@ -238,10 +246,10 @@ If a detectable connection failure occurs on the client all calls will be closed ### Appendix A - GRPC for Protobuf -The service interfaces declared by protobuf are easily mapped onto GRPC by code generation extensions to protoc. The following defines the mapping to be used - +The service interfaces declared by protobuf are easily mapped onto GRPC by +code generation extensions to protoc. The following defines the mapping +to be used. -* **Path** → / Service-Name / {_method name_} * **Service-Name** → ?( {_proto package name_} "." ) {_service name_} * **Message-Type** → {_fully qualified proto message name_} * **Content-Type** → "application/grpc+proto" diff --git a/doc/environment_variables.md b/doc/environment_variables.md index dce434ff30d..0a289ac94d4 100644 --- a/doc/environment_variables.md +++ b/doc/environment_variables.md @@ -51,8 +51,6 @@ some configuration as environment variables that can be set. - flowctl - traces http2 flow control - op_failure - traces error information when failure is pushed onto a completion queue - - pending_tags - [debug builds only] traces still-in-progress tags on - completion queues - round_robin - traces the round_robin load balancing policy - glb - traces the grpclb load balancer - queue_pluck @@ -63,6 +61,23 @@ some configuration as environment variables that can be set. - transport_security - traces metadata about secure channel establishment - tcp - traces bytes in and out of a channel + The following tracers will only run in binaries built in DEBUG mode. This is + accomplished by invoking `CONFIG=dbg make ` + - metadata - tracks creation and mutation of metadata + - closure - tracks closure creation, scheduling, and completion + - pending_tags - traces still-in-progress tags on completion queues + - polling - traces the selected polling engine + - queue_refcount + - error_refcount + - stream_refcount + - workqueue_refcount + - fd_refcount + - auth_context_refcount + - security_connector_refcount + - resolver_refcount + - lb_policy_refcount + - chttp2_refcount + 'all' can additionally be used to turn all traces on. Individual traces can be disabled by prefixing them with '-'. diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 277f97944cf..782ebb8ae13 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -193,7 +193,6 @@ Pod::Spec.new do |s| 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', 'src/core/lib/support/spinlock.h', - 'src/core/lib/support/stack_lockfree.h', 'src/core/lib/support/string.h', 'src/core/lib/support/string_windows.h', 'src/core/lib/support/thd_internal.h', @@ -223,7 +222,6 @@ Pod::Spec.new do |s| 'src/core/lib/support/log_windows.c', 'src/core/lib/support/mpscq.c', 'src/core/lib/support/murmur_hash.c', - 'src/core/lib/support/stack_lockfree.c', 'src/core/lib/support/string.c', 'src/core/lib/support/string_posix.c', 'src/core/lib/support/string_util_windows.c', @@ -723,7 +721,6 @@ Pod::Spec.new do |s| 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', 'src/core/lib/support/spinlock.h', - 'src/core/lib/support/stack_lockfree.h', 'src/core/lib/support/string.h', 'src/core/lib/support/string_windows.h', 'src/core/lib/support/thd_internal.h', diff --git a/grpc.gemspec b/grpc.gemspec index a4e22dfbdf1..18ef37a0774 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -92,7 +92,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/support/mpscq.h ) s.files += %w( src/core/lib/support/murmur_hash.h ) s.files += %w( src/core/lib/support/spinlock.h ) - s.files += %w( src/core/lib/support/stack_lockfree.h ) s.files += %w( src/core/lib/support/string.h ) s.files += %w( src/core/lib/support/string_windows.h ) s.files += %w( src/core/lib/support/thd_internal.h ) @@ -122,7 +121,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/support/log_windows.c ) s.files += %w( src/core/lib/support/mpscq.c ) s.files += %w( src/core/lib/support/murmur_hash.c ) - s.files += %w( src/core/lib/support/stack_lockfree.c ) s.files += %w( src/core/lib/support/string.c ) s.files += %w( src/core/lib/support/string_posix.c ) s.files += %w( src/core/lib/support/string_util_windows.c ) @@ -656,14 +654,14 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/digest/md32_common.h ) s.files += %w( third_party/boringssl/crypto/ec/internal.h ) s.files += %w( third_party/boringssl/crypto/ec/p256-x86_64-table.h ) + s.files += %w( third_party/boringssl/crypto/ec/p256-x86_64.h ) s.files += %w( third_party/boringssl/crypto/evp/internal.h ) s.files += %w( third_party/boringssl/crypto/internal.h ) s.files += %w( third_party/boringssl/crypto/modes/internal.h ) - s.files += %w( third_party/boringssl/crypto/newhope/internal.h ) s.files += %w( third_party/boringssl/crypto/obj/obj_dat.h ) - s.files += %w( third_party/boringssl/crypto/obj/obj_xref.h ) s.files += %w( third_party/boringssl/crypto/pkcs8/internal.h ) s.files += %w( third_party/boringssl/crypto/poly1305/internal.h ) + s.files += %w( third_party/boringssl/crypto/pool/internal.h ) s.files += %w( third_party/boringssl/crypto/rand/internal.h ) s.files += %w( third_party/boringssl/crypto/rsa/internal.h ) s.files += %w( third_party/boringssl/crypto/x509/charmap.h ) @@ -713,7 +711,6 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/include/openssl/md4.h ) s.files += %w( third_party/boringssl/include/openssl/md5.h ) s.files += %w( third_party/boringssl/include/openssl/mem.h ) - s.files += %w( third_party/boringssl/include/openssl/newhope.h ) s.files += %w( third_party/boringssl/include/openssl/nid.h ) s.files += %w( third_party/boringssl/include/openssl/obj.h ) s.files += %w( third_party/boringssl/include/openssl/obj_mac.h ) @@ -726,6 +723,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/include/openssl/pkcs7.h ) s.files += %w( third_party/boringssl/include/openssl/pkcs8.h ) s.files += %w( third_party/boringssl/include/openssl/poly1305.h ) + s.files += %w( third_party/boringssl/include/openssl/pool.h ) s.files += %w( third_party/boringssl/include/openssl/rand.h ) s.files += %w( third_party/boringssl/include/openssl/rc4.h ) s.files += %w( third_party/boringssl/include/openssl/ripemd.h ) @@ -738,7 +736,6 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/include/openssl/stack.h ) s.files += %w( third_party/boringssl/include/openssl/stack_macros.h ) s.files += %w( third_party/boringssl/include/openssl/thread.h ) - s.files += %w( third_party/boringssl/include/openssl/time_support.h ) s.files += %w( third_party/boringssl/include/openssl/tls1.h ) s.files += %w( third_party/boringssl/include/openssl/type_check.h ) s.files += %w( third_party/boringssl/include/openssl/x509.h ) @@ -747,6 +744,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/ssl/internal.h ) s.files += %w( src/boringssl/err_data.c ) s.files += %w( third_party/boringssl/crypto/aes/aes.c ) + s.files += %w( third_party/boringssl/crypto/aes/key_wrap.c ) s.files += %w( third_party/boringssl/crypto/aes/mode_wrappers.c ) s.files += %w( third_party/boringssl/crypto/asn1/a_bitstr.c ) s.files += %w( third_party/boringssl/crypto/asn1/a_bool.c ) @@ -778,12 +776,12 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/asn1/tasn_new.c ) s.files += %w( third_party/boringssl/crypto/asn1/tasn_typ.c ) s.files += %w( third_party/boringssl/crypto/asn1/tasn_utl.c ) + s.files += %w( third_party/boringssl/crypto/asn1/time_support.c ) s.files += %w( third_party/boringssl/crypto/asn1/x_bignum.c ) s.files += %w( third_party/boringssl/crypto/asn1/x_long.c ) s.files += %w( third_party/boringssl/crypto/base64/base64.c ) s.files += %w( third_party/boringssl/crypto/bio/bio.c ) s.files += %w( third_party/boringssl/crypto/bio/bio_mem.c ) - s.files += %w( third_party/boringssl/crypto/bio/buffer.c ) s.files += %w( third_party/boringssl/crypto/bio/connect.c ) s.files += %w( third_party/boringssl/crypto/bio/fd.c ) s.files += %w( third_party/boringssl/crypto/bio/file.c ) @@ -890,12 +888,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/modes/ctr.c ) s.files += %w( third_party/boringssl/crypto/modes/gcm.c ) s.files += %w( third_party/boringssl/crypto/modes/ofb.c ) - s.files += %w( third_party/boringssl/crypto/newhope/error_correction.c ) - s.files += %w( third_party/boringssl/crypto/newhope/newhope.c ) - s.files += %w( third_party/boringssl/crypto/newhope/ntt.c ) - s.files += %w( third_party/boringssl/crypto/newhope/poly.c ) - s.files += %w( third_party/boringssl/crypto/newhope/precomp.c ) - s.files += %w( third_party/boringssl/crypto/newhope/reduce.c ) + s.files += %w( third_party/boringssl/crypto/modes/polyval.c ) s.files += %w( third_party/boringssl/crypto/obj/obj.c ) s.files += %w( third_party/boringssl/crypto/obj/obj_xref.c ) s.files += %w( third_party/boringssl/crypto/pem/pem_all.c ) @@ -906,14 +899,15 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/pem/pem_pkey.c ) s.files += %w( third_party/boringssl/crypto/pem/pem_x509.c ) s.files += %w( third_party/boringssl/crypto/pem/pem_xaux.c ) - s.files += %w( third_party/boringssl/crypto/pkcs8/p5_pbe.c ) s.files += %w( third_party/boringssl/crypto/pkcs8/p5_pbev2.c ) s.files += %w( third_party/boringssl/crypto/pkcs8/p8_pkey.c ) s.files += %w( third_party/boringssl/crypto/pkcs8/pkcs8.c ) s.files += %w( third_party/boringssl/crypto/poly1305/poly1305.c ) s.files += %w( third_party/boringssl/crypto/poly1305/poly1305_arm.c ) s.files += %w( third_party/boringssl/crypto/poly1305/poly1305_vec.c ) + s.files += %w( third_party/boringssl/crypto/pool/pool.c ) s.files += %w( third_party/boringssl/crypto/rand/deterministic.c ) + s.files += %w( third_party/boringssl/crypto/rand/fuchsia.c ) s.files += %w( third_party/boringssl/crypto/rand/rand.c ) s.files += %w( third_party/boringssl/crypto/rand/urandom.c ) s.files += %w( third_party/boringssl/crypto/rand/windows.c ) @@ -925,6 +919,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/rsa/rsa.c ) s.files += %w( third_party/boringssl/crypto/rsa/rsa_asn1.c ) s.files += %w( third_party/boringssl/crypto/rsa/rsa_impl.c ) + s.files += %w( third_party/boringssl/crypto/sha/sha1-altivec.c ) s.files += %w( third_party/boringssl/crypto/sha/sha1.c ) s.files += %w( third_party/boringssl/crypto/sha/sha256.c ) s.files += %w( third_party/boringssl/crypto/sha/sha512.c ) @@ -933,7 +928,6 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/thread_none.c ) s.files += %w( third_party/boringssl/crypto/thread_pthread.c ) s.files += %w( third_party/boringssl/crypto/thread_win.c ) - s.files += %w( third_party/boringssl/crypto/time_support.c ) s.files += %w( third_party/boringssl/crypto/x509/a_digest.c ) s.files += %w( third_party/boringssl/crypto/x509/a_sign.c ) s.files += %w( third_party/boringssl/crypto/x509/a_strex.c ) @@ -1017,6 +1011,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/crypto/x509v3/v3_skey.c ) s.files += %w( third_party/boringssl/crypto/x509v3/v3_sxnet.c ) s.files += %w( third_party/boringssl/crypto/x509v3/v3_utl.c ) + s.files += %w( third_party/boringssl/ssl/bio_ssl.c ) s.files += %w( third_party/boringssl/ssl/custom_extensions.c ) s.files += %w( third_party/boringssl/ssl/d1_both.c ) s.files += %w( third_party/boringssl/ssl/d1_lib.c ) @@ -1027,7 +1022,6 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/ssl/handshake_client.c ) s.files += %w( third_party/boringssl/ssl/handshake_server.c ) s.files += %w( third_party/boringssl/ssl/s3_both.c ) - s.files += %w( third_party/boringssl/ssl/s3_enc.c ) s.files += %w( third_party/boringssl/ssl/s3_lib.c ) s.files += %w( third_party/boringssl/ssl/s3_pkt.c ) s.files += %w( third_party/boringssl/ssl/ssl_aead_ctx.c ) @@ -1038,9 +1032,12 @@ Gem::Specification.new do |s| s.files += %w( third_party/boringssl/ssl/ssl_ecdh.c ) s.files += %w( third_party/boringssl/ssl/ssl_file.c ) s.files += %w( third_party/boringssl/ssl/ssl_lib.c ) - s.files += %w( third_party/boringssl/ssl/ssl_rsa.c ) + s.files += %w( third_party/boringssl/ssl/ssl_privkey.c ) + s.files += %w( third_party/boringssl/ssl/ssl_privkey_cc.cc ) s.files += %w( third_party/boringssl/ssl/ssl_session.c ) s.files += %w( third_party/boringssl/ssl/ssl_stat.c ) + s.files += %w( third_party/boringssl/ssl/ssl_transcript.c ) + s.files += %w( third_party/boringssl/ssl/ssl_x509.c ) s.files += %w( third_party/boringssl/ssl/t1_enc.c ) s.files += %w( third_party/boringssl/ssl/t1_lib.c ) s.files += %w( third_party/boringssl/ssl/tls13_both.c ) diff --git a/include/grpc++/alarm.h b/include/grpc++/alarm.h index bd000cf4f79..ed8dacbc944 100644 --- a/include/grpc++/alarm.h +++ b/include/grpc++/alarm.h @@ -52,8 +52,25 @@ class Alarm : private GrpcLibraryCodegen { alarm_(grpc_alarm_create(cq->cq(), TimePoint(deadline).raw_time(), static_cast(&tag_))) {} + /// Alarms aren't copyable. + Alarm(const Alarm&) = delete; + Alarm& operator=(const Alarm&) = delete; + + /// Alarms are movable. + Alarm(Alarm&& rhs) : tag_(rhs.tag_), alarm_(rhs.alarm_) { + rhs.alarm_ = nullptr; + } + Alarm& operator=(Alarm&& rhs) { + tag_ = rhs.tag_; + alarm_ = rhs.alarm_; + rhs.alarm_ = nullptr; + return *this; + } + /// Destroy the given completion queue alarm, cancelling it in the process. - ~Alarm() { grpc_alarm_destroy(alarm_); } + ~Alarm() { + if (alarm_ != nullptr) grpc_alarm_destroy(alarm_); + } /// Cancel a completion queue alarm. Calling this function over an alarm that /// has already fired has no effect. @@ -73,7 +90,7 @@ class Alarm : private GrpcLibraryCodegen { }; AlarmEntry tag_; - grpc_alarm* const alarm_; // owned + grpc_alarm* alarm_; // owned }; } // namespace grpc diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h index 4aa4e25a9e9..a5a698c6401 100644 --- a/include/grpc++/impl/codegen/async_unary_call.h +++ b/include/grpc++/impl/codegen/async_unary_call.h @@ -87,6 +87,28 @@ class ClientAsyncResponseReader final ClientAsyncResponseReader(call, context, request); } + /// TODO(vjpai): Delete the below constructor + /// PLEASE DO NOT USE THIS CONSTRUCTOR IN NEW CODE + /// This code is only present as a short-term workaround + /// for users that bypassed the code-generator and directly + /// created this struct rather than properly using a stub. + /// This code will not remain a valid public constructor for long. + template + ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq, + const RpcMethod& method, ClientContext* context, + const W& request) + : context_(context), + call_(channel->CreateCall(method, context, cq)), + collection_(std::make_shared()) { + collection_->init_buf.SetCollection(collection_); + collection_->init_buf.SendInitialMetadata( + context->send_initial_metadata_, context->initial_metadata_flags()); + // TODO(ctiller): don't assert + GPR_CODEGEN_ASSERT(collection_->init_buf.SendMessage(request).ok()); + collection_->init_buf.ClientSendClose(); + call_.PerformOps(&collection_->init_buf); + } + // always allocated against a call arena, no memory free required static void operator delete(void* ptr, std::size_t size) { assert(size == sizeof(ClientAsyncResponseReader)); @@ -101,9 +123,18 @@ class ClientAsyncResponseReader final void ReadInitialMetadata(void* tag) { GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); - meta_buf_.set_output_tag(tag); - meta_buf_.RecvInitialMetadata(context_); - call_.PerformOps(&meta_buf_); + Ops& o = ops_; + + // TODO(vjpai): Remove the collection_ specialization as soon + // as the public constructor is deleted + if (collection_) { + o = *collection_; + collection_->meta_buf.SetCollection(collection_); + } + + o.meta_buf.set_output_tag(tag); + o.meta_buf.RecvInitialMetadata(context_); + call_.PerformOps(&o.meta_buf); } /// See \a ClientAysncResponseReaderInterface::Finish for semantics. @@ -112,14 +143,23 @@ class ClientAsyncResponseReader final /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata sent from the server. void Finish(R* msg, Status* status, void* tag) { - finish_buf_.set_output_tag(tag); + Ops& o = ops_; + + // TODO(vjpai): Remove the collection_ specialization as soon + // as the public constructor is deleted + if (collection_) { + o = *collection_; + collection_->finish_buf.SetCollection(collection_); + } + + o.finish_buf.set_output_tag(tag); if (!context_->initial_metadata_received_) { - finish_buf_.RecvInitialMetadata(context_); + o.finish_buf.RecvInitialMetadata(context_); } - finish_buf_.RecvMessage(msg); - finish_buf_.AllowNoMessage(); - finish_buf_.ClientRecvStatus(context_, status); - call_.PerformOps(&finish_buf_); + o.finish_buf.RecvMessage(msg); + o.finish_buf.AllowNoMessage(); + o.finish_buf.ClientRecvStatus(context_, status); + call_.PerformOps(&o.finish_buf); } private: @@ -129,25 +169,33 @@ class ClientAsyncResponseReader final template ClientAsyncResponseReader(Call call, ClientContext* context, const W& request) : context_(context), call_(call) { - init_buf_.SendInitialMetadata(context->send_initial_metadata_, - context->initial_metadata_flags()); + ops_.init_buf.SendInitialMetadata(context->send_initial_metadata_, + context->initial_metadata_flags()); // TODO(ctiller): don't assert - GPR_CODEGEN_ASSERT(init_buf_.SendMessage(request).ok()); - init_buf_.ClientSendClose(); - call_.PerformOps(&init_buf_); + GPR_CODEGEN_ASSERT(ops_.init_buf.SendMessage(request).ok()); + ops_.init_buf.ClientSendClose(); + call_.PerformOps(&ops_.init_buf); } // disable operator new static void* operator new(std::size_t size); static void* operator new(std::size_t size, void* p) { return p; } - SneakyCallOpSet - init_buf_; - CallOpSet meta_buf_; - CallOpSet, - CallOpClientRecvStatus> - finish_buf_; + // TODO(vjpai): Remove the reference to CallOpSetCollectionInterface + // as soon as the related workaround (public constructor) is deleted + struct Ops : public CallOpSetCollectionInterface { + SneakyCallOpSet + init_buf; + CallOpSet meta_buf; + CallOpSet, + CallOpClientRecvStatus> + finish_buf; + } ops_; + + // TODO(vjpai): Remove the collection_ as soon as the related workaround + // (public constructor) is deleted + std::shared_ptr collection_; }; /// Async server-side API for handling unary calls, where the single diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index 2ded2d97762..342ea462033 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -544,6 +544,11 @@ class CallOpClientRecvStatus { grpc_slice error_message_; }; +/// TODO(vjpai): Remove the existence of CallOpSetCollectionInterface +/// and references to it. This code is deprecated-on-arrival and is +/// only added for users that bypassed the code-generator. +class CallOpSetCollectionInterface {}; + /// An abstract collection of call ops, used to generate the /// grpc_call_op structure to pass down to the lower layers, /// and as it is-a CompletionQueueTag, also massages the final @@ -554,6 +559,18 @@ class CallOpSetInterface : public CompletionQueueTag { /// Fills in grpc_op, starting from ops[*nops] and moving /// upwards. virtual void FillOps(grpc_call* call, grpc_op* ops, size_t* nops) = 0; + + /// TODO(vjpai): Remove the SetCollection method and comment. This is only + /// a short-term workaround for users that bypassed the code generator + /// Mark this as belonging to a collection if needed + void SetCollection(std::shared_ptr collection) { + collection_ = collection; + } + + protected: + /// TODO(vjpai): Remove the collection_ field once the idea of bypassing the + /// code generator is forbidden. This is already deprecated + std::shared_ptr collection_; }; /// Primary implementaiton of CallOpSetInterface. @@ -593,6 +610,11 @@ class CallOpSet : public CallOpSetInterface, this->Op5::FinishOp(status); this->Op6::FinishOp(status); *tag = return_tag_; + + // TODO(vjpai): Remove the reference to collection_ once the idea of + // bypassing the code generator is forbidden. It is already deprecated + collection_.reset(); + g_core_codegen_interface->grpc_call_unref(call_); return true; } diff --git a/package.json b/package.json index e050a344366..451a7777021 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "arguejs": "^0.2.3", "lodash": "^4.15.0", "nan": "^2.0.0", - "node-pre-gyp": "^0.6.0", + "node-pre-gyp": "^0.6.35", "protobufjs": "^5.0.0" }, "devDependencies": { diff --git a/package.xml b/package.xml index 18b1d639b99..10cb2e63ff1 100644 --- a/package.xml +++ b/package.xml @@ -106,7 +106,6 @@ - @@ -136,7 +135,6 @@ - @@ -670,14 +668,14 @@ + - - + @@ -727,7 +725,6 @@ - @@ -740,6 +737,7 @@ + @@ -752,7 +750,6 @@ - @@ -761,6 +758,7 @@ + @@ -792,12 +790,12 @@ + - @@ -904,12 +902,7 @@ - - - - - - + @@ -920,14 +913,15 @@ - + + @@ -939,6 +933,7 @@ + @@ -947,7 +942,6 @@ - @@ -1031,6 +1025,7 @@ + @@ -1041,7 +1036,6 @@ - @@ -1052,9 +1046,12 @@ - + + + + diff --git a/setup.py b/setup.py index 98d812aaaca..8ca3e4fe0c0 100644 --- a/setup.py +++ b/setup.py @@ -101,9 +101,9 @@ if EXTRA_ENV_COMPILE_ARGS is None: elif 'win32' in sys.platform: EXTRA_ENV_COMPILE_ARGS += ' -D_PYTHON_MSVC' elif "linux" in sys.platform: - EXTRA_ENV_COMPILE_ARGS += ' -std=c++11 -std=gnu99 -fvisibility=hidden -fno-wrapv' + EXTRA_ENV_COMPILE_ARGS += ' -std=c++11 -std=gnu99 -fvisibility=hidden -fno-wrapv -fno-exceptions' elif "darwin" in sys.platform: - EXTRA_ENV_COMPILE_ARGS += ' -fvisibility=hidden -fno-wrapv' + EXTRA_ENV_COMPILE_ARGS += ' -fvisibility=hidden -fno-wrapv -fno-exceptions' if EXTRA_ENV_LINK_ARGS is None: EXTRA_ENV_LINK_ARGS = '' @@ -117,7 +117,7 @@ if EXTRA_ENV_LINK_ARGS is None: ' -static-libgcc -static-libstdc++ -mcrtdll={msvcr} ' '-static'.format(msvcr=msvcr)) if "linux" in sys.platform: - EXTRA_ENV_LINK_ARGS += ' -Wl,-wrap,memcpy' + EXTRA_ENV_LINK_ARGS += ' -Wl,-wrap,memcpy -static-libgcc' EXTRA_COMPILE_ARGS = shlex.split(EXTRA_ENV_COMPILE_ARGS) EXTRA_LINK_ARGS = shlex.split(EXTRA_ENV_LINK_ARGS) diff --git a/src/boringssl/err_data.c b/src/boringssl/err_data.c index c1257cdc787..88462d13762 100644 --- a/src/boringssl/err_data.c +++ b/src/boringssl/err_data.c @@ -178,42 +178,42 @@ const uint32_t kOpenSSLReasonValues[] = { 0x28340c19, 0x283480ac, 0x283500ea, - 0x2c3228ca, - 0x2c32a8d8, - 0x2c3328ea, - 0x2c33a8fc, - 0x2c342910, - 0x2c34a922, - 0x2c35293d, - 0x2c35a94f, - 0x2c362962, + 0x2c3229b1, + 0x2c32a9bf, + 0x2c3329d1, + 0x2c33a9e3, + 0x2c3429f7, + 0x2c34aa09, + 0x2c352a24, + 0x2c35aa36, + 0x2c362a49, 0x2c36832d, - 0x2c37296f, - 0x2c37a981, - 0x2c382994, - 0x2c38a9ab, - 0x2c3929b9, - 0x2c39a9c9, - 0x2c3a29db, - 0x2c3aa9ef, - 0x2c3b2a00, - 0x2c3baa1f, - 0x2c3c2a33, - 0x2c3caa49, - 0x2c3d2a62, - 0x2c3daa7f, - 0x2c3e2a90, - 0x2c3eaa9e, - 0x2c3f2ab6, - 0x2c3faace, - 0x2c402adb, + 0x2c372a56, + 0x2c37aa68, + 0x2c382a7b, + 0x2c38aa92, + 0x2c392aa0, + 0x2c39aab0, + 0x2c3a2ac2, + 0x2c3aaad6, + 0x2c3b2ae7, + 0x2c3bab06, + 0x2c3c2b1a, + 0x2c3cab30, + 0x2c3d2b49, + 0x2c3dab66, + 0x2c3e2b77, + 0x2c3eab85, + 0x2c3f2b9d, + 0x2c3fabb5, + 0x2c402bc2, 0x2c4090e7, - 0x2c412aec, - 0x2c41aaff, + 0x2c412bd3, + 0x2c41abe6, 0x2c4210c0, - 0x2c42ab10, + 0x2c42abf7, 0x2c430720, - 0x2c43aa11, + 0x2c43aaf8, 0x30320000, 0x30328015, 0x3033001f, @@ -366,180 +366,189 @@ const uint32_t kOpenSSLReasonValues[] = { 0x403b9861, 0x403c0064, 0x403c8083, - 0x403d18aa, - 0x403d98c0, - 0x403e18cf, - 0x403e98e2, - 0x403f18fc, - 0x403f990a, - 0x4040191f, - 0x40409933, - 0x40411950, - 0x4041996b, - 0x40421984, - 0x40429997, - 0x404319ab, - 0x404399c3, - 0x404419da, + 0x403d18c1, + 0x403d98d7, + 0x403e18e6, + 0x403e98f9, + 0x403f1913, + 0x403f9921, + 0x40401936, + 0x4040994a, + 0x40411967, + 0x40419982, + 0x4042199b, + 0x404299ae, + 0x404319c2, + 0x404399da, + 0x404419f1, 0x404480ac, - 0x404519ef, - 0x40459a01, - 0x40461a25, - 0x40469a45, - 0x40471a53, - 0x40479a7a, - 0x40481ab7, - 0x40489ad0, - 0x40491ae7, - 0x40499b01, - 0x404a1b18, - 0x404a9b36, - 0x404b1b4e, - 0x404b9b65, - 0x404c1b7b, - 0x404c9b8d, - 0x404d1bae, - 0x404d9bd0, - 0x404e1be4, - 0x404e9bf1, - 0x404f1c1e, - 0x404f9c47, - 0x40501c71, - 0x40509c85, - 0x40511ca0, - 0x40519cb0, - 0x40521cc7, - 0x40529ceb, - 0x40531d03, - 0x40539d16, - 0x40541d2b, - 0x40549d4e, - 0x40551d5c, - 0x40559d79, - 0x40561d86, - 0x40569d9f, - 0x40571db7, - 0x40579dca, - 0x40581ddf, - 0x40589e06, - 0x40591e35, - 0x40599e62, - 0x405a1e76, - 0x405a9e86, - 0x405b1e9e, - 0x405b9eaf, - 0x405c1ec2, - 0x405c9ed3, - 0x405d1ee0, - 0x405d9ef7, - 0x405e1f17, + 0x40451a06, + 0x40459a18, + 0x40461a3c, + 0x40469a5c, + 0x40471a6a, + 0x40479a91, + 0x40481ace, + 0x40489ae7, + 0x40491afe, + 0x40499b18, + 0x404a1b2f, + 0x404a9b4d, + 0x404b1b65, + 0x404b9b7c, + 0x404c1b92, + 0x404c9ba4, + 0x404d1bc5, + 0x404d9be7, + 0x404e1bfb, + 0x404e9c08, + 0x404f1c35, + 0x404f9c5e, + 0x40501c99, + 0x40509cad, + 0x40511cc8, + 0x40519cd8, + 0x40521cef, + 0x40529d13, + 0x40531d2b, + 0x40539d3e, + 0x40541d53, + 0x40549d76, + 0x40551d84, + 0x40559da1, + 0x40561dae, + 0x40569dc7, + 0x40571ddf, + 0x40579df2, + 0x40581e07, + 0x40589e2e, + 0x40591e5d, + 0x40599e8a, + 0x405a1e9e, + 0x405a9eae, + 0x405b1ec6, + 0x405b9ed7, + 0x405c1eea, + 0x405c9f0b, + 0x405d1f18, + 0x405d9f2f, + 0x405e1f6d, 0x405e8a95, - 0x405f1f38, - 0x405f9f45, - 0x40601f53, - 0x40609f75, - 0x40611f9d, - 0x40619fb2, - 0x40621fc9, - 0x40629fda, - 0x40631feb, - 0x4063a000, - 0x40642017, - 0x4064a043, - 0x4065205e, - 0x4065a075, - 0x4066208d, - 0x4066a0b7, - 0x406720e2, - 0x4067a103, - 0x40682116, - 0x4068a137, - 0x40692169, - 0x4069a197, - 0x406a21b8, - 0x406aa1d8, - 0x406b2360, - 0x406ba383, - 0x406c2399, - 0x406ca5c5, - 0x406d25f4, - 0x406da61c, - 0x406e264a, - 0x406ea662, - 0x406f2681, - 0x406fa696, - 0x407026a9, - 0x4070a6c6, + 0x405f1f8e, + 0x405f9f9b, + 0x40601fa9, + 0x40609fcb, + 0x4061200f, + 0x4061a047, + 0x4062205e, + 0x4062a06f, + 0x40632080, + 0x4063a095, + 0x406420ac, + 0x4064a0d8, + 0x406520f3, + 0x4065a10a, + 0x40662122, + 0x4066a14c, + 0x40672177, + 0x4067a198, + 0x406821ab, + 0x4068a1cc, + 0x406921fe, + 0x4069a22c, + 0x406a224d, + 0x406aa26d, + 0x406b23f5, + 0x406ba418, + 0x406c242e, + 0x406ca690, + 0x406d26bf, + 0x406da6e7, + 0x406e2715, + 0x406ea749, + 0x406f2768, + 0x406fa77d, + 0x40702790, + 0x4070a7ad, 0x40710800, - 0x4071a6d8, - 0x407226eb, - 0x4072a704, - 0x4073271c, + 0x4071a7bf, + 0x407227d2, + 0x4072a7eb, + 0x40732803, 0x4073936d, - 0x40742730, - 0x4074a74a, - 0x4075275b, - 0x4075a76f, - 0x4076277d, + 0x40742817, + 0x4074a831, + 0x40752842, + 0x4075a856, + 0x40762864, 0x407691aa, - 0x407727a2, - 0x4077a7c4, - 0x407827df, - 0x4078a818, - 0x4079282f, - 0x4079a845, - 0x407a2851, - 0x407aa864, - 0x407b2879, - 0x407ba88b, - 0x407c28a0, - 0x407ca8a9, - 0x407d2152, - 0x407d9c57, - 0x407e27f4, - 0x407e9e16, - 0x407f1a67, + 0x40772889, + 0x4077a8ab, + 0x407828c6, + 0x4078a8ff, + 0x40792916, + 0x4079a92c, + 0x407a2938, + 0x407aa94b, + 0x407b2960, + 0x407ba972, + 0x407c2987, + 0x407ca990, + 0x407d21e7, + 0x407d9c6e, + 0x407e28db, + 0x407e9e3e, + 0x407f1a7e, 0x407f9887, - 0x40801c2e, - 0x40809a8f, - 0x40811cd9, - 0x40819c08, - 0x40822635, + 0x40801c45, + 0x40809aa6, + 0x40811d01, + 0x40819c1f, + 0x40822700, 0x4082986d, - 0x40831df1, - 0x4083a028, - 0x40841aa3, - 0x40849e4e, - 0x41f4228b, - 0x41f9231d, - 0x41fe2210, - 0x41fea3ec, - 0x41ff24dd, - 0x420322a4, - 0x420822c6, - 0x4208a302, - 0x420921f4, - 0x4209a33c, - 0x420a224b, - 0x420aa22b, - 0x420b226b, - 0x420ba2e4, - 0x420c24f9, - 0x420ca3b9, - 0x420d23d3, - 0x420da40a, - 0x42122424, - 0x421724c0, - 0x4217a466, - 0x421c2488, - 0x421f2443, - 0x42212510, - 0x422624a3, - 0x422b25a9, - 0x422ba572, - 0x422c2591, - 0x422ca54c, - 0x422d252b, + 0x40831e19, + 0x4083a0bd, + 0x40841aba, + 0x40849e76, + 0x40851efb, + 0x40859ff3, + 0x40861f4f, + 0x40869c88, + 0x4087272d, + 0x4087a024, + 0x408818aa, + 0x41f42320, + 0x41f923b2, + 0x41fe22a5, + 0x41fea481, + 0x41ff2572, + 0x42032339, + 0x4208235b, + 0x4208a397, + 0x42092289, + 0x4209a3d1, + 0x420a22e0, + 0x420aa2c0, + 0x420b2300, + 0x420ba379, + 0x420c258e, + 0x420ca44e, + 0x420d2468, + 0x420da49f, + 0x421224b9, + 0x42172555, + 0x4217a4fb, + 0x421c251d, + 0x421f24d8, + 0x422125a5, + 0x42262538, + 0x422b2674, + 0x422ba622, + 0x422c265c, + 0x422ca5e1, + 0x422d25c0, + 0x422da641, + 0x422e2607, 0x4432072b, 0x4432873a, 0x44330746, @@ -582,69 +591,69 @@ const uint32_t kOpenSSLReasonValues[] = { 0x4c3d136d, 0x4c3d937c, 0x4c3e1389, - 0x50322b22, - 0x5032ab31, - 0x50332b3c, - 0x5033ab4c, - 0x50342b65, - 0x5034ab7f, - 0x50352b8d, - 0x5035aba3, - 0x50362bb5, - 0x5036abcb, - 0x50372be4, - 0x5037abf7, - 0x50382c0f, - 0x5038ac20, - 0x50392c35, - 0x5039ac49, - 0x503a2c69, - 0x503aac7f, - 0x503b2c97, - 0x503baca9, - 0x503c2cc5, - 0x503cacdc, - 0x503d2cf5, - 0x503dad0b, - 0x503e2d18, - 0x503ead2e, - 0x503f2d40, + 0x50322c09, + 0x5032ac18, + 0x50332c23, + 0x5033ac33, + 0x50342c4c, + 0x5034ac66, + 0x50352c74, + 0x5035ac8a, + 0x50362c9c, + 0x5036acb2, + 0x50372ccb, + 0x5037acde, + 0x50382cf6, + 0x5038ad07, + 0x50392d1c, + 0x5039ad30, + 0x503a2d50, + 0x503aad66, + 0x503b2d7e, + 0x503bad90, + 0x503c2dac, + 0x503cadc3, + 0x503d2ddc, + 0x503dadf2, + 0x503e2dff, + 0x503eae15, + 0x503f2e27, 0x503f8382, - 0x50402d53, - 0x5040ad63, - 0x50412d7d, - 0x5041ad8c, - 0x50422da6, - 0x5042adc3, - 0x50432dd3, - 0x5043ade3, - 0x50442df2, + 0x50402e3a, + 0x5040ae4a, + 0x50412e64, + 0x5041ae73, + 0x50422e8d, + 0x5042aeaa, + 0x50432eba, + 0x5043aeca, + 0x50442ed9, 0x5044843f, - 0x50452e06, - 0x5045ae24, - 0x50462e37, - 0x5046ae4d, - 0x50472e5f, - 0x5047ae74, - 0x50482e9a, - 0x5048aea8, - 0x50492ebb, - 0x5049aed0, - 0x504a2ee6, - 0x504aaef6, - 0x504b2f16, - 0x504baf29, - 0x504c2f4c, - 0x504caf7a, - 0x504d2f8c, - 0x504dafa9, - 0x504e2fc4, - 0x504eafe0, - 0x504f2ff2, - 0x504fb009, - 0x50503018, + 0x50452eed, + 0x5045af0b, + 0x50462f1e, + 0x5046af34, + 0x50472f46, + 0x5047af5b, + 0x50482f81, + 0x5048af8f, + 0x50492fa2, + 0x5049afb7, + 0x504a2fcd, + 0x504aafdd, + 0x504b2ffd, + 0x504bb010, + 0x504c3033, + 0x504cb061, + 0x504d3073, + 0x504db090, + 0x504e30ab, + 0x504eb0c7, + 0x504f30d9, + 0x504fb0f0, + 0x505030ff, 0x505086ef, - 0x5051302b, + 0x50513112, 0x58320ec9, 0x68320e8b, 0x68328c25, @@ -1007,6 +1016,7 @@ const char kOpenSSLReasonStringData[] = "BIO_NOT_SET\0" "BLOCK_CIPHER_PAD_IS_WRONG\0" "BUFFERED_MESSAGES_ON_CIPHER_CHANGE\0" + "CANNOT_PARSE_LEAF_CERT\0" "CA_DN_LENGTH_MISMATCH\0" "CA_DN_TOO_LONG\0" "CCS_RECEIVED_EARLY\0" @@ -1050,6 +1060,7 @@ const char kOpenSSLReasonStringData[] = "INVALID_COMPRESSION_LIST\0" "INVALID_MESSAGE\0" "INVALID_OUTER_RECORD_TYPE\0" + "INVALID_SCT_LIST\0" "INVALID_SSL_SESSION\0" "INVALID_TICKET_KEYS_LENGTH\0" "LENGTH_MISMATCH\0" @@ -1079,15 +1090,19 @@ const char kOpenSSLReasonStringData[] = "NO_RENEGOTIATION\0" "NO_REQUIRED_DIGEST\0" "NO_SHARED_CIPHER\0" + "NO_SHARED_GROUP\0" "NULL_SSL_CTX\0" "NULL_SSL_METHOD_PASSED\0" "OLD_SESSION_CIPHER_NOT_RETURNED\0" + "OLD_SESSION_PRF_HASH_MISMATCH\0" "OLD_SESSION_VERSION_NOT_RETURNED\0" "PARSE_TLSEXT\0" "PATH_TOO_LONG\0" "PEER_DID_NOT_RETURN_A_CERTIFICATE\0" "PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE\0" + "PRE_SHARED_KEY_MUST_BE_LAST\0" "PROTOCOL_IS_SHUTDOWN\0" + "PSK_IDENTITY_BINDER_COUNT_MISMATCH\0" "PSK_IDENTITY_NOT_FOUND\0" "PSK_NO_CLIENT_CB\0" "PSK_NO_SERVER_CB\0" @@ -1139,7 +1154,9 @@ const char kOpenSSLReasonStringData[] = "TLSV1_ALERT_USER_CANCELLED\0" "TLSV1_BAD_CERTIFICATE_HASH_VALUE\0" "TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE\0" + "TLSV1_CERTIFICATE_REQUIRED\0" "TLSV1_CERTIFICATE_UNOBTAINABLE\0" + "TLSV1_UNKNOWN_PSK_IDENTITY\0" "TLSV1_UNRECOGNIZED_NAME\0" "TLSV1_UNSUPPORTED_EXTENSION\0" "TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST\0" @@ -1147,6 +1164,7 @@ const char kOpenSSLReasonStringData[] = "TOO_MANY_EMPTY_FRAGMENTS\0" "TOO_MANY_KEY_UPDATES\0" "TOO_MANY_WARNING_ALERTS\0" + "TOO_MUCH_SKIPPED_EARLY_DATA\0" "UNABLE_TO_FIND_ECDH_PARAMETERS\0" "UNEXPECTED_EXTENSION\0" "UNEXPECTED_MESSAGE\0" diff --git a/src/compiler/php_generator.cc b/src/compiler/php_generator.cc index a7387d7223f..6d34761fdfd 100644 --- a/src/compiler/php_generator.cc +++ b/src/compiler/php_generator.cc @@ -52,14 +52,16 @@ void PrintMethod(const MethodDescriptor *method, Printer *out) { vars["input_type_id"] = MessageIdentifierName(input_type->full_name()); vars["output_type_id"] = MessageIdentifierName(output_type->full_name()); - out->Print(GetPHPComments(method, " //").c_str()); + out->Print("/**\n"); + out->Print(GetPHPComments(method, " *").c_str()); if (method->client_streaming()) { out->Print(vars, - " // @param array $$metadata metadata\n" - " // @param array $$options call options\n" + " * @param array $$metadata metadata\n" + " * @param array $$options call options\n */\n" "public function $name$($$metadata = [], " "$$options = []) {\n"); out->Indent(); + out->Indent(); if (method->server_streaming()) { out->Print("return $$this->_bidiRequest("); } else { @@ -71,12 +73,13 @@ void PrintMethod(const MethodDescriptor *method, Printer *out) { "$$metadata, $$options);\n"); } else { out->Print(vars, - " // @param \\$input_type_id$ $$argument input argument\n" - " // @param array $$metadata metadata\n" - " // @param array $$options call options\n" + " * @param \\$input_type_id$ $$argument input argument\n" + " * @param array $$metadata metadata\n" + " * @param array $$options call options\n */\n" "public function $name$(\\$input_type_id$ $$argument,\n" " $$metadata = [], $$options = []) {\n"); out->Indent(); + out->Indent(); if (method->server_streaming()) { out->Print("return $$this->_serverStreamRequest("); } else { @@ -89,26 +92,32 @@ void PrintMethod(const MethodDescriptor *method, Printer *out) { "$$metadata, $$options);\n"); } out->Outdent(); + out->Outdent(); out->Print("}\n\n"); } // Prints out the service descriptor object void PrintService(const ServiceDescriptor *service, Printer *out) { map vars; - out->Print(GetPHPComments(service, "//").c_str()); + out->Print("/**\n"); + out->Print(GetPHPComments(service, " *").c_str()); + out->Print(" */\n"); vars["name"] = service->name(); out->Print(vars, "class $name$Client extends \\Grpc\\BaseStub {\n\n"); out->Indent(); + out->Indent(); out->Print( - " // @param string $$hostname hostname\n" - " // @param array $$opts channel options\n" - " // @param \\Grpc\\Channel $$channel (optional) re-use channel " - "object\n" + "/**\n * @param string $$hostname hostname\n" + " * @param array $$opts channel options\n" + " * @param \\Grpc\\Channel $$channel (optional) re-use channel " + "object\n */\n" "public function __construct($$hostname, $$opts, " "$$channel = null) {\n"); out->Indent(); + out->Indent(); out->Print("parent::__construct($$hostname, $$opts, $$channel);\n"); out->Outdent(); + out->Outdent(); out->Print("}\n\n"); for (int i = 0; i < service->method_count(); i++) { grpc::string method_name = @@ -116,7 +125,8 @@ void PrintService(const ServiceDescriptor *service, Printer *out) { PrintMethod(service->method(i), out); } out->Outdent(); - out->Print("}\n\n"); + out->Outdent(); + out->Print("}\n"); } } @@ -138,13 +148,9 @@ grpc::string GenerateFile(const FileDescriptor *file, map vars; vars["package"] = MessageIdentifierName(file->package()); - out.Print(vars, "namespace $package$ {\n\n"); - out.Indent(); + out.Print(vars, "namespace $package$;\n\n"); PrintService(service, &out); - - out.Outdent(); - out.Print("}\n"); } return output; } diff --git a/src/compiler/php_generator_helpers.h b/src/compiler/php_generator_helpers.h index 8e358093579..3a5c08b3e69 100644 --- a/src/compiler/php_generator_helpers.h +++ b/src/compiler/php_generator_helpers.h @@ -39,12 +39,24 @@ inline grpc::string GetPHPServiceFilename( return oss.str() + "/" + service->name() + "Client.php"; } +// ReplaceAll replaces all instances of search with replace in s. +inline grpc::string ReplaceAll(grpc::string s, const grpc::string &search, + const grpc::string &replace) { + size_t pos = 0; + while ((pos = s.find(search, pos)) != grpc::string::npos) { + s.replace(pos, search.length(), replace); + pos += replace.length(); + } + return s; +} + // Get leading or trailing comments in a string. Comment lines start with "// ". // Leading detached comments are put in in front of leading comments. template inline grpc::string GetPHPComments(const DescriptorType *desc, grpc::string prefix) { - return grpc_generator::GetPrefixedComments(desc, true, prefix); + return ReplaceAll(grpc_generator::GetPrefixedComments(desc, true, prefix), + "*/", "*/"); } } // namespace grpc_php_generator diff --git a/src/core/ext/filters/client_channel/client_channel.c b/src/core/ext/filters/client_channel/client_channel.c index f29c5d55ed0..de516ab4c97 100644 --- a/src/core/ext/filters/client_channel/client_channel.c +++ b/src/core/ext/filters/client_channel/client_channel.c @@ -178,8 +178,8 @@ typedef struct client_channel_channel_data { grpc_slice_hash_table *method_params_table; /** incoming resolver result - set by resolver.next() */ grpc_channel_args *resolver_result; - /** a list of closures that are all waiting for config to come in */ - grpc_closure_list waiting_for_config_closures; + /** a list of closures that are all waiting for resolver result to come in */ + grpc_closure_list waiting_for_resolver_result_closures; /** resolver callback */ grpc_closure on_resolver_result_changed; /** connectivity state being tracked */ @@ -342,49 +342,15 @@ static void parse_retry_throttle_params(const grpc_json *field, void *arg) { } } -// Wrap a closure associated with \a lb_policy. The associated callback (\a -// wrapped_on_pick_closure_cb) is responsible for unref'ing \a lb_policy after -// scheduling \a wrapped_closure. -typedef struct wrapped_on_pick_closure_arg { - /* the closure instance using this struct as argument */ - grpc_closure wrapper_closure; - - /* the original closure. Usually a on_complete/notify cb for pick() and ping() - * calls against the internal RR instance, respectively. */ - grpc_closure *wrapped_closure; - - /* The policy instance related to the closure */ - grpc_lb_policy *lb_policy; -} wrapped_on_pick_closure_arg; - -// Invoke \a arg->wrapped_closure, unref \a arg->lb_policy and free \a arg. -static void wrapped_on_pick_closure_cb(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { - wrapped_on_pick_closure_arg *wc_arg = arg; - GPR_ASSERT(wc_arg != NULL); - GPR_ASSERT(wc_arg->wrapped_closure != NULL); - GPR_ASSERT(wc_arg->lb_policy != NULL); - GRPC_CLOSURE_RUN(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error)); - GRPC_LB_POLICY_UNREF(exec_ctx, wc_arg->lb_policy, "pick_subchannel_wrapping"); - gpr_free(wc_arg); -} - static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { channel_data *chand = arg; + // Extract the following fields from the resolver result, if non-NULL. char *lb_policy_name = NULL; - grpc_lb_policy *lb_policy = NULL; - grpc_lb_policy *old_lb_policy = NULL; - grpc_slice_hash_table *method_params_table = NULL; - grpc_connectivity_state state = GRPC_CHANNEL_TRANSIENT_FAILURE; - bool exit_idle = false; - grpc_error *state_error = - GRPC_ERROR_CREATE_FROM_STATIC_STRING("No load balancing policy"); + grpc_lb_policy *new_lb_policy = NULL; char *service_config_json = NULL; - service_config_parsing_state parsing_state; - memset(&parsing_state, 0, sizeof(parsing_state)); - - bool lb_policy_updated = false; + grpc_server_retry_throttle_data *retry_throttle_data = NULL; + grpc_slice_hash_table *method_params_table = NULL; if (chand->resolver_result != NULL) { // Find LB policy name. const grpc_arg *channel_arg = @@ -419,32 +385,29 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, // Use pick_first if nothing was specified and we didn't select grpclb // above. if (lb_policy_name == NULL) lb_policy_name = "pick_first"; - // Instantiate LB policy. grpc_lb_policy_args lb_policy_args; lb_policy_args.args = chand->resolver_result; lb_policy_args.client_channel_factory = chand->client_channel_factory; lb_policy_args.combiner = chand->combiner; - + // Check to see if we're already using the right LB policy. + // Note: It's safe to use chand->info_lb_policy_name here without + // taking a lock on chand->info_mu, because this function is the + // only thing that modifies its value, and it can only be invoked + // once at any given time. const bool lb_policy_type_changed = - (chand->info_lb_policy_name == NULL) || - (strcmp(chand->info_lb_policy_name, lb_policy_name) != 0); + chand->info_lb_policy_name == NULL || + strcmp(chand->info_lb_policy_name, lb_policy_name) != 0; if (chand->lb_policy != NULL && !lb_policy_type_changed) { - // update - lb_policy_updated = true; + // Continue using the same LB policy. Update with new addresses. grpc_lb_policy_update_locked(exec_ctx, chand->lb_policy, &lb_policy_args); } else { - lb_policy = + // Instantiate new LB policy. + new_lb_policy = grpc_lb_policy_create(exec_ctx, lb_policy_name, &lb_policy_args); - if (lb_policy != NULL) { - GRPC_LB_POLICY_REF(lb_policy, "config_change"); - GRPC_ERROR_UNREF(state_error); - state = grpc_lb_policy_check_connectivity_locked(exec_ctx, lb_policy, - &state_error); - old_lb_policy = chand->lb_policy; - chand->lb_policy = lb_policy; + if (new_lb_policy == NULL) { + gpr_log(GPR_ERROR, "could not create LB policy \"%s\"", lb_policy_name); } } - // Find service config. channel_arg = grpc_channel_args_find(chand->resolver_result, GRPC_ARG_SERVICE_CONFIG); @@ -461,12 +424,14 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, grpc_uri *uri = grpc_uri_parse(exec_ctx, channel_arg->value.string, true); GPR_ASSERT(uri->path[0] != '\0'); + service_config_parsing_state parsing_state; + memset(&parsing_state, 0, sizeof(parsing_state)); parsing_state.server_name = uri->path[0] == '/' ? uri->path + 1 : uri->path; grpc_service_config_parse_global_params( service_config, parse_retry_throttle_params, &parsing_state); - parsing_state.server_name = NULL; grpc_uri_destroy(uri); + retry_throttle_data = parsing_state.retry_throttle_data; method_params_table = grpc_service_config_create_method_config_table( exec_ctx, service_config, method_parameters_create_from_json, method_parameters_free); @@ -480,12 +445,11 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, grpc_channel_args_destroy(exec_ctx, chand->resolver_result); chand->resolver_result = NULL; } - - if (lb_policy != NULL) { - grpc_pollset_set_add_pollset_set(exec_ctx, lb_policy->interested_parties, - chand->interested_parties); - } - + // Now swap out fields in chand. Note that the new values may still + // be NULL if (e.g.) the resolver failed to return results or the + // results did not contain the necessary data. + // + // First, swap out the data used by cc_get_channel_info(). gpr_mu_lock(&chand->info_mu); if (lb_policy_name != NULL) { gpr_free(chand->info_lb_policy_name); @@ -496,75 +460,77 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, chand->info_service_config_json = service_config_json; } gpr_mu_unlock(&chand->info_mu); - + // Swap out the retry throttle data. if (chand->retry_throttle_data != NULL) { grpc_server_retry_throttle_data_unref(chand->retry_throttle_data); } - chand->retry_throttle_data = parsing_state.retry_throttle_data; + chand->retry_throttle_data = retry_throttle_data; + // Swap out the method params table. if (chand->method_params_table != NULL) { grpc_slice_hash_table_unref(exec_ctx, chand->method_params_table); } chand->method_params_table = method_params_table; - if (lb_policy != NULL) { - GRPC_CLOSURE_LIST_SCHED(exec_ctx, &chand->waiting_for_config_closures); - } else if (chand->resolver == NULL /* disconnected */) { - grpc_closure_list_fail_all(&chand->waiting_for_config_closures, - GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( - "Channel disconnected", &error, 1)); - GRPC_CLOSURE_LIST_SCHED(exec_ctx, &chand->waiting_for_config_closures); - } - if (!lb_policy_updated && lb_policy != NULL && - chand->exit_idle_when_lb_policy_arrives) { - GRPC_LB_POLICY_REF(lb_policy, "exit_idle"); - exit_idle = true; - chand->exit_idle_when_lb_policy_arrives = false; - } - - if (error == GRPC_ERROR_NONE && chand->resolver) { - if (!lb_policy_updated) { - set_channel_connectivity_state_locked(exec_ctx, chand, state, - GRPC_ERROR_REF(state_error), - "new_lb+resolver"); - if (lb_policy != NULL) { - watch_lb_policy_locked(exec_ctx, chand, lb_policy, state); - } + // If we have a new LB policy or are shutting down (in which case + // new_lb_policy will be NULL), swap out the LB policy, unreffing the + // old one and removing its fds from chand->interested_parties. + // Note that we do NOT do this if either (a) we updated the existing + // LB policy above or (b) we failed to create the new LB policy (in + // which case we want to continue using the most recent one we had). + if (new_lb_policy != NULL || error != GRPC_ERROR_NONE || + chand->resolver == NULL) { + if (chand->lb_policy != NULL) { + grpc_pollset_set_del_pollset_set(exec_ctx, + chand->lb_policy->interested_parties, + chand->interested_parties); + GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "channel"); } - GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver"); - grpc_resolver_next_locked(exec_ctx, chand->resolver, - &chand->resolver_result, - &chand->on_resolver_result_changed); - } else { + chand->lb_policy = new_lb_policy; + } + // Now that we've swapped out the relevant fields of chand, check for + // error or shutdown. + if (error != GRPC_ERROR_NONE || chand->resolver == NULL) { if (chand->resolver != NULL) { grpc_resolver_shutdown_locked(exec_ctx, chand->resolver); GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel"); chand->resolver = NULL; } - grpc_error *refs[] = {error, state_error}; set_channel_connectivity_state_locked( exec_ctx, chand, GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( - "Got config after disconnection", refs, GPR_ARRAY_SIZE(refs)), + "Got resolver result after disconnection", &error, 1), "resolver_gone"); + GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "resolver"); + grpc_closure_list_fail_all(&chand->waiting_for_resolver_result_closures, + GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( + "Channel disconnected", &error, 1)); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, + &chand->waiting_for_resolver_result_closures); + } else { // Not shutting down. + grpc_connectivity_state state = GRPC_CHANNEL_TRANSIENT_FAILURE; + grpc_error *state_error = + GRPC_ERROR_CREATE_FROM_STATIC_STRING("No load balancing policy"); + if (new_lb_policy != NULL) { + GRPC_ERROR_UNREF(state_error); + state = grpc_lb_policy_check_connectivity_locked(exec_ctx, new_lb_policy, + &state_error); + grpc_pollset_set_add_pollset_set(exec_ctx, + new_lb_policy->interested_parties, + chand->interested_parties); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, + &chand->waiting_for_resolver_result_closures); + if (chand->exit_idle_when_lb_policy_arrives) { + grpc_lb_policy_exit_idle_locked(exec_ctx, new_lb_policy); + chand->exit_idle_when_lb_policy_arrives = false; + } + watch_lb_policy_locked(exec_ctx, chand, new_lb_policy, state); + } + set_channel_connectivity_state_locked( + exec_ctx, chand, state, GRPC_ERROR_REF(state_error), "new_lb+resolver"); + grpc_resolver_next_locked(exec_ctx, chand->resolver, + &chand->resolver_result, + &chand->on_resolver_result_changed); + GRPC_ERROR_UNREF(state_error); } - - if (!lb_policy_updated && lb_policy != NULL && exit_idle) { - grpc_lb_policy_exit_idle_locked(exec_ctx, lb_policy); - GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "exit_idle"); - } - - if (old_lb_policy != NULL) { - grpc_pollset_set_del_pollset_set( - exec_ctx, old_lb_policy->interested_parties, chand->interested_parties); - GRPC_LB_POLICY_UNREF(exec_ctx, old_lb_policy, "channel"); - old_lb_policy = NULL; - } - - if (!lb_policy_updated && lb_policy != NULL) { - GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "config_change"); - } - - GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "resolver"); - GRPC_ERROR_UNREF(state_error); } static void start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg, @@ -602,9 +568,10 @@ static void start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg, GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel"); chand->resolver = NULL; if (!chand->started_resolving) { - grpc_closure_list_fail_all(&chand->waiting_for_config_closures, + grpc_closure_list_fail_all(&chand->waiting_for_resolver_result_closures, GRPC_ERROR_REF(op->disconnect_with_error)); - GRPC_CLOSURE_LIST_SCHED(exec_ctx, &chand->waiting_for_config_closures); + GRPC_CLOSURE_LIST_SCHED(exec_ctx, + &chand->waiting_for_resolver_result_closures); } if (chand->lb_policy != NULL) { grpc_pollset_set_del_pollset_set(exec_ctx, @@ -770,6 +737,16 @@ static void cc_destroy_channel_elem(grpc_exec_ctx *exec_ctx, * PER-CALL FUNCTIONS */ +// Max number of batches that can be pending on a call at any given +// time. This includes: +// recv_initial_metadata +// send_initial_metadata +// recv_message +// send_message +// recv_trailing_metadata +// send_trailing_metadata +#define MAX_WAITING_BATCHES 6 + /** Call data. Holds a pointer to grpc_subchannel_call and the associated machinery to create such a pointer. Handles queueing of stream ops until a call object is ready, waiting @@ -800,11 +777,10 @@ typedef struct client_channel_call_data { grpc_call_context_element subchannel_call_context[GRPC_CONTEXT_COUNT]; grpc_polling_entity *pollent; - grpc_transport_stream_op_batch **waiting_ops; - size_t waiting_ops_count; - size_t waiting_ops_capacity; + grpc_transport_stream_op_batch *waiting_for_pick_batches[MAX_WAITING_BATCHES]; + size_t waiting_for_pick_batches_count; - grpc_closure next_step; + grpc_transport_stream_op_batch_payload *initial_metadata_payload; grpc_call_stack *owning_call; @@ -853,57 +829,44 @@ grpc_subchannel_call *grpc_client_channel_get_subchannel_call( return get_call_or_error(call_elem->call_data).subchannel_call; } -static void add_waiting_locked(call_data *calld, - grpc_transport_stream_op_batch *op) { - GPR_TIMER_BEGIN("add_waiting_locked", 0); - if (calld->waiting_ops_count == calld->waiting_ops_capacity) { - calld->waiting_ops_capacity = GPR_MAX(3, 2 * calld->waiting_ops_capacity); - calld->waiting_ops = - gpr_realloc(calld->waiting_ops, - calld->waiting_ops_capacity * sizeof(*calld->waiting_ops)); - } - calld->waiting_ops[calld->waiting_ops_count++] = op; - GPR_TIMER_END("add_waiting_locked", 0); +static void waiting_for_pick_batches_add_locked( + call_data *calld, grpc_transport_stream_op_batch *batch) { + GPR_ASSERT(calld->waiting_for_pick_batches_count < MAX_WAITING_BATCHES); + calld->waiting_for_pick_batches[calld->waiting_for_pick_batches_count++] = + batch; } -static void fail_locked(grpc_exec_ctx *exec_ctx, call_data *calld, - grpc_error *error) { - size_t i; - for (i = 0; i < calld->waiting_ops_count; i++) { +static void waiting_for_pick_batches_fail_locked(grpc_exec_ctx *exec_ctx, + call_data *calld, + grpc_error *error) { + for (size_t i = 0; i < calld->waiting_for_pick_batches_count; ++i) { grpc_transport_stream_op_batch_finish_with_failure( - exec_ctx, calld->waiting_ops[i], GRPC_ERROR_REF(error)); + exec_ctx, calld->waiting_for_pick_batches[i], GRPC_ERROR_REF(error)); } - calld->waiting_ops_count = 0; + calld->waiting_for_pick_batches_count = 0; GRPC_ERROR_UNREF(error); } -static void retry_waiting_locked(grpc_exec_ctx *exec_ctx, call_data *calld) { - if (calld->waiting_ops_count == 0) { - return; - } - - call_or_error call = get_call_or_error(calld); - grpc_transport_stream_op_batch **ops = calld->waiting_ops; - size_t nops = calld->waiting_ops_count; - if (call.error != GRPC_ERROR_NONE) { - fail_locked(exec_ctx, calld, GRPC_ERROR_REF(call.error)); +static void waiting_for_pick_batches_resume_locked(grpc_exec_ctx *exec_ctx, + call_data *calld) { + if (calld->waiting_for_pick_batches_count == 0) return; + call_or_error coe = get_call_or_error(calld); + if (coe.error != GRPC_ERROR_NONE) { + waiting_for_pick_batches_fail_locked(exec_ctx, calld, + GRPC_ERROR_REF(coe.error)); return; } - calld->waiting_ops = NULL; - calld->waiting_ops_count = 0; - calld->waiting_ops_capacity = 0; - for (size_t i = 0; i < nops; i++) { - grpc_subchannel_call_process_op(exec_ctx, call.subchannel_call, ops[i]); + for (size_t i = 0; i < calld->waiting_for_pick_batches_count; ++i) { + grpc_subchannel_call_process_op(exec_ctx, coe.subchannel_call, + calld->waiting_for_pick_batches[i]); } - gpr_free(ops); + calld->waiting_for_pick_batches_count = 0; } -// Sets calld->method_params and calld->retry_throttle_data. -// If the method params specify a timeout, populates -// *per_method_deadline and returns true. -static bool set_call_method_params_from_service_config_locked( - grpc_exec_ctx *exec_ctx, grpc_call_element *elem, - gpr_timespec *per_method_deadline) { +// Applies service config to the call. Must be invoked once we know +// that the resolver has returned results to the channel. +static void apply_service_config_to_call_locked(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem) { channel_data *chand = elem->channel_data; call_data *calld = elem->call_data; if (chand->retry_throttle_data != NULL) { @@ -915,39 +878,48 @@ static bool set_call_method_params_from_service_config_locked( exec_ctx, chand->method_params_table, calld->path); if (calld->method_params != NULL) { method_parameters_ref(calld->method_params); - if (gpr_time_cmp(calld->method_params->timeout, + // If the deadline from the service config is shorter than the one + // from the client API, reset the deadline timer. + if (chand->deadline_checking_enabled && + gpr_time_cmp(calld->method_params->timeout, gpr_time_0(GPR_TIMESPAN)) != 0) { - *per_method_deadline = + const gpr_timespec per_method_deadline = gpr_time_add(calld->call_start_time, calld->method_params->timeout); - return true; + if (gpr_time_cmp(per_method_deadline, calld->deadline) < 0) { + calld->deadline = per_method_deadline; + grpc_deadline_state_reset(exec_ctx, elem, calld->deadline); + } } } } - return false; } -static void apply_final_configuration_locked(grpc_exec_ctx *exec_ctx, - grpc_call_element *elem) { - /* apply service-config level configuration to the call (now that we're - * certain it exists) */ - call_data *calld = elem->call_data; - channel_data *chand = elem->channel_data; - gpr_timespec per_method_deadline; - if (set_call_method_params_from_service_config_locked(exec_ctx, elem, - &per_method_deadline)) { - // If the deadline from the service config is shorter than the one - // from the client API, reset the deadline timer. - if (chand->deadline_checking_enabled && - gpr_time_cmp(per_method_deadline, calld->deadline) < 0) { - calld->deadline = per_method_deadline; - grpc_deadline_state_reset(exec_ctx, elem, calld->deadline); - } +static void create_subchannel_call_locked(grpc_exec_ctx *exec_ctx, + call_data *calld, grpc_error *error) { + grpc_subchannel_call *subchannel_call = NULL; + const grpc_connected_subchannel_call_args call_args = { + .pollent = calld->pollent, + .path = calld->path, + .start_time = calld->call_start_time, + .deadline = calld->deadline, + .arena = calld->arena, + .context = calld->subchannel_call_context}; + grpc_error *new_error = grpc_connected_subchannel_create_call( + exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call); + GPR_ASSERT(set_call_or_error( + calld, (call_or_error){.subchannel_call = subchannel_call})); + if (new_error != GRPC_ERROR_NONE) { + new_error = grpc_error_add_child(new_error, error); + waiting_for_pick_batches_fail_locked(exec_ctx, calld, new_error); + } else { + waiting_for_pick_batches_resume_locked(exec_ctx, calld); } + GRPC_ERROR_UNREF(error); } -static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, void *arg, +static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem, grpc_error *error) { - grpc_call_element *elem = arg; call_data *calld = elem->call_data; channel_data *chand = elem->channel_data; GPR_ASSERT(calld->pick_pending); @@ -956,6 +928,7 @@ static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, void *arg, chand->interested_parties); call_or_error coe = get_call_or_error(calld); if (calld->connected_subchannel == NULL) { + // Failed to create subchannel. grpc_error *failure = error == GRPC_ERROR_NONE ? GRPC_ERROR_CREATE_FROM_STATIC_STRING( @@ -963,7 +936,7 @@ static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, void *arg, : GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Failed to create subchannel", &error, 1); set_call_or_error(calld, (call_or_error){.error = GRPC_ERROR_REF(failure)}); - fail_locked(exec_ctx, calld, failure); + waiting_for_pick_batches_fail_locked(exec_ctx, calld, failure); } else if (coe.error != GRPC_ERROR_NONE) { /* already cancelled before subchannel became ready */ grpc_error *child_errors[] = {error, coe.error}; @@ -977,29 +950,13 @@ static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error_set_int(cancellation_error, GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_DEADLINE_EXCEEDED); } - fail_locked(exec_ctx, calld, cancellation_error); + waiting_for_pick_batches_fail_locked(exec_ctx, calld, cancellation_error); } else { /* Create call on subchannel. */ - grpc_subchannel_call *subchannel_call = NULL; - const grpc_connected_subchannel_call_args call_args = { - .pollent = calld->pollent, - .path = calld->path, - .start_time = calld->call_start_time, - .deadline = calld->deadline, - .arena = calld->arena, - .context = calld->subchannel_call_context}; - grpc_error *new_error = grpc_connected_subchannel_create_call( - exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call); - GPR_ASSERT(set_call_or_error( - calld, (call_or_error){.subchannel_call = subchannel_call})); - if (new_error != GRPC_ERROR_NONE) { - new_error = grpc_error_add_child(new_error, error); - fail_locked(exec_ctx, calld, new_error); - } else { - retry_waiting_locked(exec_ctx, calld); - } + create_subchannel_call_locked(exec_ctx, calld, GRPC_ERROR_REF(error)); } GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "pick_subchannel"); + GRPC_ERROR_UNREF(error); } static char *cc_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { @@ -1013,41 +970,32 @@ static char *cc_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { } } +/** Return true if subchannel is available immediately (in which case + subchannel_ready_locked() should not be called), or false otherwise (in + which case subchannel_ready_locked() should be called when the subchannel + is available). */ +static bool pick_subchannel_locked(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem); + typedef struct { - grpc_metadata_batch *initial_metadata; - uint32_t initial_metadata_flags; - grpc_connected_subchannel **connected_subchannel; - grpc_call_context_element *subchannel_call_context; - grpc_closure *on_ready; grpc_call_element *elem; + bool cancelled; grpc_closure closure; -} continue_picking_args; +} pick_after_resolver_result_args; -/** Return true if subchannel is available immediately (in which case on_ready - should not be called), or false otherwise (in which case on_ready should be - called when the subchannel is available). */ -static bool pick_subchannel_locked( - grpc_exec_ctx *exec_ctx, grpc_call_element *elem, - grpc_metadata_batch *initial_metadata, uint32_t initial_metadata_flags, - grpc_connected_subchannel **connected_subchannel, - grpc_call_context_element *subchannel_call_context, grpc_closure *on_ready); - -static void continue_picking_locked(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { - continue_picking_args *cpa = arg; - if (cpa->connected_subchannel == NULL) { +static void continue_picking_after_resolver_result_locked( + grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { + pick_after_resolver_result_args *args = arg; + if (args->cancelled) { /* cancelled, do nothing */ } else if (error != GRPC_ERROR_NONE) { - GRPC_CLOSURE_SCHED(exec_ctx, cpa->on_ready, GRPC_ERROR_REF(error)); + subchannel_ready_locked(exec_ctx, args->elem, GRPC_ERROR_REF(error)); } else { - if (pick_subchannel_locked(exec_ctx, cpa->elem, cpa->initial_metadata, - cpa->initial_metadata_flags, - cpa->connected_subchannel, - cpa->subchannel_call_context, cpa->on_ready)) { - GRPC_CLOSURE_SCHED(exec_ctx, cpa->on_ready, GRPC_ERROR_NONE); + if (pick_subchannel_locked(exec_ctx, args->elem)) { + subchannel_ready_locked(exec_ctx, args->elem, GRPC_ERROR_NONE); } } - gpr_free(cpa); + gpr_free(args); } static void cancel_pick_locked(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, @@ -1059,39 +1007,85 @@ static void cancel_pick_locked(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, &calld->connected_subchannel, GRPC_ERROR_REF(error)); } - for (grpc_closure *closure = chand->waiting_for_config_closures.head; + // If we don't yet have a resolver result, then a closure for + // continue_picking_after_resolver_result_locked() will have been added to + // chand->waiting_for_resolver_result_closures, and it may not be invoked + // until after this call has been destroyed. We mark the operation as + // cancelled, so that when continue_picking_after_resolver_result_locked() + // is called, it will be a no-op. We also immediately invoke + // subchannel_ready_locked() to propagate the error back to the caller. + for (grpc_closure *closure = chand->waiting_for_resolver_result_closures.head; closure != NULL; closure = closure->next_data.next) { - continue_picking_args *cpa = closure->cb_arg; - if (cpa->connected_subchannel == &calld->connected_subchannel) { - cpa->connected_subchannel = NULL; - GRPC_CLOSURE_SCHED(exec_ctx, cpa->on_ready, - GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( - "Pick cancelled", &error, 1)); + pick_after_resolver_result_args *args = closure->cb_arg; + if (!args->cancelled && args->elem == elem) { + args->cancelled = true; + subchannel_ready_locked(exec_ctx, elem, + GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( + "Pick cancelled", &error, 1)); } } GRPC_ERROR_UNREF(error); } -static bool pick_subchannel_locked( - grpc_exec_ctx *exec_ctx, grpc_call_element *elem, - grpc_metadata_batch *initial_metadata, uint32_t initial_metadata_flags, - grpc_connected_subchannel **connected_subchannel, - grpc_call_context_element *subchannel_call_context, - grpc_closure *on_ready) { - GPR_TIMER_BEGIN("pick_subchannel", 0); +// State for pick callback that holds a reference to the LB policy +// from which the pick was requested. +typedef struct { + grpc_lb_policy *lb_policy; + grpc_call_element *elem; + grpc_closure closure; +} pick_callback_args; + +// Callback invoked by grpc_lb_policy_pick_locked() for async picks. +// Unrefs the LB policy after invoking subchannel_ready_locked(). +static void pick_callback_done_locked(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error) { + pick_callback_args *args = arg; + GPR_ASSERT(args != NULL); + GPR_ASSERT(args->lb_policy != NULL); + subchannel_ready_locked(exec_ctx, args->elem, GRPC_ERROR_REF(error)); + GRPC_LB_POLICY_UNREF(exec_ctx, args->lb_policy, "pick_subchannel"); + gpr_free(args); +} +// Takes a ref to chand->lb_policy and calls grpc_lb_policy_pick_locked(). +// If the pick was completed synchronously, unrefs the LB policy and +// returns true. +static bool pick_callback_start_locked(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem, + const grpc_lb_policy_pick_args *inputs) { channel_data *chand = elem->channel_data; call_data *calld = elem->call_data; + pick_callback_args *pick_args = gpr_zalloc(sizeof(*pick_args)); + GRPC_LB_POLICY_REF(chand->lb_policy, "pick_subchannel"); + pick_args->lb_policy = chand->lb_policy; + pick_args->elem = elem; + GRPC_CLOSURE_INIT(&pick_args->closure, pick_callback_done_locked, pick_args, + grpc_combiner_scheduler(chand->combiner)); + const bool pick_done = grpc_lb_policy_pick_locked( + exec_ctx, chand->lb_policy, inputs, &calld->connected_subchannel, + calld->subchannel_call_context, NULL, &pick_args->closure); + if (pick_done) { + /* synchronous grpc_lb_policy_pick call. Unref the LB policy. */ + GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "pick_subchannel"); + gpr_free(pick_args); + } + return pick_done; +} - GPR_ASSERT(connected_subchannel); - +static bool pick_subchannel_locked(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem) { + GPR_TIMER_BEGIN("pick_subchannel", 0); + channel_data *chand = elem->channel_data; + call_data *calld = elem->call_data; + bool pick_done = false; if (chand->lb_policy != NULL) { - apply_final_configuration_locked(exec_ctx, elem); - grpc_lb_policy *lb_policy = chand->lb_policy; - GRPC_LB_POLICY_REF(lb_policy, "pick_subchannel"); + apply_service_config_to_call_locked(exec_ctx, elem); // If the application explicitly set wait_for_ready, use that. // Otherwise, if the service config specified a value for this // method, use that. + uint32_t initial_metadata_flags = + calld->initial_metadata_payload->send_initial_metadata + .send_initial_metadata_flags; const bool wait_for_ready_set_from_api = initial_metadata_flags & GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET; @@ -1107,78 +1101,57 @@ static bool pick_subchannel_locked( } } const grpc_lb_policy_pick_args inputs = { - initial_metadata, initial_metadata_flags, &calld->lb_token_mdelem}; - - // Wrap the user-provided callback in order to hold a strong reference to - // the LB policy for the duration of the pick. - wrapped_on_pick_closure_arg *w_on_pick_arg = - gpr_zalloc(sizeof(*w_on_pick_arg)); - GRPC_CLOSURE_INIT(&w_on_pick_arg->wrapper_closure, - wrapped_on_pick_closure_cb, w_on_pick_arg, - grpc_schedule_on_exec_ctx); - w_on_pick_arg->wrapped_closure = on_ready; - GRPC_LB_POLICY_REF(lb_policy, "pick_subchannel_wrapping"); - w_on_pick_arg->lb_policy = lb_policy; - const bool pick_done = grpc_lb_policy_pick_locked( - exec_ctx, lb_policy, &inputs, connected_subchannel, - subchannel_call_context, NULL, &w_on_pick_arg->wrapper_closure); - if (pick_done) { - /* synchronous grpc_lb_policy_pick call. Unref the LB policy. */ - GRPC_LB_POLICY_UNREF(exec_ctx, w_on_pick_arg->lb_policy, - "pick_subchannel_wrapping"); - gpr_free(w_on_pick_arg); + calld->initial_metadata_payload->send_initial_metadata + .send_initial_metadata, + initial_metadata_flags, &calld->lb_token_mdelem}; + pick_done = pick_callback_start_locked(exec_ctx, elem, &inputs); + } else if (chand->resolver != NULL) { + if (!chand->started_resolving) { + chand->started_resolving = true; + GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver"); + grpc_resolver_next_locked(exec_ctx, chand->resolver, + &chand->resolver_result, + &chand->on_resolver_result_changed); } - GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "pick_subchannel"); - GPR_TIMER_END("pick_subchannel", 0); - return pick_done; - } - if (chand->resolver != NULL && !chand->started_resolving) { - chand->started_resolving = true; - GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver"); - grpc_resolver_next_locked(exec_ctx, chand->resolver, - &chand->resolver_result, - &chand->on_resolver_result_changed); - } - if (chand->resolver != NULL) { - continue_picking_args *cpa = gpr_malloc(sizeof(*cpa)); - cpa->initial_metadata = initial_metadata; - cpa->initial_metadata_flags = initial_metadata_flags; - cpa->connected_subchannel = connected_subchannel; - cpa->subchannel_call_context = subchannel_call_context; - cpa->on_ready = on_ready; - cpa->elem = elem; - GRPC_CLOSURE_INIT(&cpa->closure, continue_picking_locked, cpa, + pick_after_resolver_result_args *args = + (pick_after_resolver_result_args *)gpr_zalloc(sizeof(*args)); + args->elem = elem; + GRPC_CLOSURE_INIT(&args->closure, + continue_picking_after_resolver_result_locked, args, grpc_combiner_scheduler(chand->combiner)); - grpc_closure_list_append(&chand->waiting_for_config_closures, &cpa->closure, - GRPC_ERROR_NONE); + grpc_closure_list_append(&chand->waiting_for_resolver_result_closures, + &args->closure, GRPC_ERROR_NONE); } else { - GRPC_CLOSURE_SCHED(exec_ctx, on_ready, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected")); + subchannel_ready_locked( + exec_ctx, elem, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected")); } - GPR_TIMER_END("pick_subchannel", 0); - return false; + return pick_done; } -static void start_transport_stream_op_batch_locked_inner( - grpc_exec_ctx *exec_ctx, grpc_transport_stream_op_batch *op, - grpc_call_element *elem) { - channel_data *chand = elem->channel_data; +static void start_transport_stream_op_batch_locked(grpc_exec_ctx *exec_ctx, + void *arg, + grpc_error *error_ignored) { + GPR_TIMER_BEGIN("start_transport_stream_op_batch_locked", 0); + grpc_transport_stream_op_batch *op = arg; + grpc_call_element *elem = op->handler_private.extra_arg; call_data *calld = elem->call_data; - + channel_data *chand = elem->channel_data; /* need to recheck that another thread hasn't set the call */ call_or_error coe = get_call_or_error(calld); if (coe.error != GRPC_ERROR_NONE) { grpc_transport_stream_op_batch_finish_with_failure( exec_ctx, op, GRPC_ERROR_REF(coe.error)); - /* early out */ - return; + goto done; } if (coe.subchannel_call != NULL) { grpc_subchannel_call_process_op(exec_ctx, coe.subchannel_call, op); - /* early out */ - return; + goto done; } + // Add to waiting-for-pick list. If we succeed in getting a + // subchannel call below, we'll handle this batch (along with any + // other waiting batches) in waiting_for_pick_batches_resume_locked(). + waiting_for_pick_batches_add_locked(calld, op); /* if this is a cancellation, then we can raise our cancelled flag */ if (op->cancel_stream) { grpc_error *error = op->payload->cancel_stream.cancel_error; @@ -1190,30 +1163,22 @@ static void start_transport_stream_op_batch_locked_inner( set_call_or_error(calld, (call_or_error){.error = GRPC_ERROR_REF(error)}); if (calld->pick_pending) { cancel_pick_locked(exec_ctx, elem, GRPC_ERROR_REF(error)); - } else { - fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error)); } - grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, - GRPC_ERROR_REF(error)); - /* early out */ - return; + waiting_for_pick_batches_fail_locked(exec_ctx, calld, + GRPC_ERROR_REF(error)); + goto done; } /* if we don't have a subchannel, try to get one */ if (!calld->pick_pending && calld->connected_subchannel == NULL && op->send_initial_metadata) { + calld->initial_metadata_payload = op->payload; calld->pick_pending = true; - GRPC_CLOSURE_INIT(&calld->next_step, subchannel_ready_locked, elem, - grpc_combiner_scheduler(chand->combiner)); GRPC_CALL_STACK_REF(calld->owning_call, "pick_subchannel"); /* If a subchannel is not available immediately, the polling entity from call_data should be provided to channel_data's interested_parties, so that IO of the lb_policy and resolver could be done under it. */ - if (pick_subchannel_locked( - exec_ctx, elem, - op->payload->send_initial_metadata.send_initial_metadata, - op->payload->send_initial_metadata.send_initial_metadata_flags, - &calld->connected_subchannel, calld->subchannel_call_context, - &calld->next_step)) { + if (pick_subchannel_locked(exec_ctx, elem)) { + // Pick was returned synchronously. calld->pick_pending = false; GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "pick_subchannel"); if (calld->connected_subchannel == NULL) { @@ -1221,42 +1186,20 @@ static void start_transport_stream_op_batch_locked_inner( "Call dropped by load balancing policy"); set_call_or_error(calld, (call_or_error){.error = GRPC_ERROR_REF(error)}); - fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error)); - grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error); - return; // Early out. + waiting_for_pick_batches_fail_locked(exec_ctx, calld, error); + } else { + // Create subchannel call. + create_subchannel_call_locked(exec_ctx, calld, GRPC_ERROR_NONE); } } else { grpc_polling_entity_add_to_pollset_set(exec_ctx, calld->pollent, chand->interested_parties); } } - /* if we've got a subchannel, then let's ask it to create a call */ - if (!calld->pick_pending && calld->connected_subchannel != NULL) { - grpc_subchannel_call *subchannel_call = NULL; - const grpc_connected_subchannel_call_args call_args = { - .pollent = calld->pollent, - .path = calld->path, - .start_time = calld->call_start_time, - .deadline = calld->deadline, - .arena = calld->arena, - .context = calld->subchannel_call_context}; - grpc_error *error = grpc_connected_subchannel_create_call( - exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call); - GPR_ASSERT(set_call_or_error( - calld, (call_or_error){.subchannel_call = subchannel_call})); - if (error != GRPC_ERROR_NONE) { - fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error)); - grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error); - } else { - retry_waiting_locked(exec_ctx, calld); - /* recurse to retry */ - start_transport_stream_op_batch_locked_inner(exec_ctx, op, elem); - } - /* early out */ - return; - } - /* nothing to be done but wait */ - add_waiting_locked(calld, op); +done: + GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, + "start_transport_stream_op_batch"); + GPR_TIMER_END("start_transport_stream_op_batch_locked", 0); } static void on_complete(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { @@ -1279,30 +1222,6 @@ static void on_complete(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { GRPC_ERROR_REF(error)); } -static void start_transport_stream_op_batch_locked(grpc_exec_ctx *exec_ctx, - void *arg, - grpc_error *error_ignored) { - GPR_TIMER_BEGIN("start_transport_stream_op_batch_locked", 0); - - grpc_transport_stream_op_batch *op = arg; - grpc_call_element *elem = op->handler_private.extra_arg; - call_data *calld = elem->call_data; - - if (op->recv_trailing_metadata) { - GPR_ASSERT(op->on_complete != NULL); - calld->original_on_complete = op->on_complete; - GRPC_CLOSURE_INIT(&calld->on_complete, on_complete, elem, - grpc_schedule_on_exec_ctx); - op->on_complete = &calld->on_complete; - } - - start_transport_stream_op_batch_locked_inner(exec_ctx, op, elem); - - GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, - "start_transport_stream_op_batch"); - GPR_TIMER_END("start_transport_stream_op_batch_locked", 0); -} - /* The logic here is fairly complicated, due to (a) the fact that we need to handle the case where we receive the send op before the initial metadata op, and (b) the need for efficiency, especially in @@ -1321,6 +1240,15 @@ static void cc_start_transport_stream_op_batch( grpc_deadline_state_client_start_transport_stream_op_batch(exec_ctx, elem, op); } + // Intercept on_complete for recv_trailing_metadata so that we can + // check retry throttle status. + if (op->recv_trailing_metadata) { + GPR_ASSERT(op->on_complete != NULL); + calld->original_on_complete = op->on_complete; + GRPC_CLOSURE_INIT(&calld->on_complete, on_complete, elem, + grpc_schedule_on_exec_ctx); + op->on_complete = &calld->on_complete; + } /* try to (atomically) get the call */ call_or_error coe = get_call_or_error(calld); GPR_TIMER_BEGIN("cc_start_transport_stream_op_batch", 0); @@ -1390,7 +1318,7 @@ static void cc_destroy_call_elem(grpc_exec_ctx *exec_ctx, "client_channel_destroy_call"); } GPR_ASSERT(!calld->pick_pending); - GPR_ASSERT(calld->waiting_ops_count == 0); + GPR_ASSERT(calld->waiting_for_pick_batches_count == 0); if (calld->connected_subchannel != NULL) { GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, calld->connected_subchannel, "picked"); @@ -1401,7 +1329,6 @@ static void cc_destroy_call_elem(grpc_exec_ctx *exec_ctx, calld->subchannel_call_context[i].value); } } - gpr_free(calld->waiting_ops); GRPC_CLOSURE_SCHED(exec_ctx, then_schedule_closure, GRPC_ERROR_NONE); } diff --git a/src/core/ext/filters/client_channel/client_channel_plugin.c b/src/core/ext/filters/client_channel/client_channel_plugin.c index 2c6af1d78e2..60e77d62683 100644 --- a/src/core/ext/filters/client_channel/client_channel_plugin.c +++ b/src/core/ext/filters/client_channel/client_channel_plugin.c @@ -78,6 +78,9 @@ void grpc_client_channel_init(void) { GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, append_filter, (void *)&grpc_client_channel_filter); grpc_http_connect_register_handshaker_factory(); +#ifndef NDEBUG + grpc_register_tracer("resolver_refcount", &grpc_trace_resolver_refcount); +#endif } void grpc_client_channel_shutdown(void) { diff --git a/src/core/ext/filters/client_channel/lb_policy.c b/src/core/ext/filters/client_channel/lb_policy.c index 50f8faef8e5..8d69ba6af52 100644 --- a/src/core/ext/filters/client_channel/lb_policy.c +++ b/src/core/ext/filters/client_channel/lb_policy.c @@ -21,6 +21,10 @@ #define WEAK_REF_BITS 16 +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_lb_policy_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + void grpc_lb_policy_init(grpc_lb_policy *policy, const grpc_lb_policy_vtable *vtable, grpc_combiner *combiner) { @@ -30,7 +34,7 @@ void grpc_lb_policy_init(grpc_lb_policy *policy, policy->combiner = GRPC_COMBINER_REF(combiner, "lb_policy"); } -#ifdef GRPC_LB_POLICY_REFCOUNT_DEBUG +#ifndef NDEBUG #define REF_FUNC_EXTRA_ARGS , const char *file, int line, const char *reason #define REF_MUTATE_EXTRA_ARGS REF_FUNC_EXTRA_ARGS, const char *purpose #define REF_FUNC_PASS_ARGS(new_reason) , file, line, new_reason @@ -46,11 +50,12 @@ static gpr_atm ref_mutate(grpc_lb_policy *c, gpr_atm delta, int barrier REF_MUTATE_EXTRA_ARGS) { gpr_atm old_val = barrier ? gpr_atm_full_fetch_add(&c->ref_pair, delta) : gpr_atm_no_barrier_fetch_add(&c->ref_pair, delta); -#ifdef GRPC_LB_POLICY_REFCOUNT_DEBUG - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "LB_POLICY: 0x%" PRIxPTR " %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR - " [%s]", - (intptr_t)c, purpose, old_val, old_val + delta, reason); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_lb_policy_refcount)) { + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "LB_POLICY: 0x%p %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR " [%s]", c, + purpose, old_val, old_val + delta, reason); + } #endif return old_val; } diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h index 42503c37ca2..645d51e1385 100644 --- a/src/core/ext/filters/client_channel/lb_policy.h +++ b/src/core/ext/filters/client_channel/lb_policy.h @@ -29,6 +29,10 @@ typedef struct grpc_lb_policy grpc_lb_policy; typedef struct grpc_lb_policy_vtable grpc_lb_policy_vtable; typedef struct grpc_lb_policy_args grpc_lb_policy_args; +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_lb_policy_refcount; +#endif + struct grpc_lb_policy { const grpc_lb_policy_vtable *vtable; gpr_atm ref_pair; @@ -96,8 +100,7 @@ struct grpc_lb_policy_vtable { const grpc_lb_policy_args *args); }; -//#define GRPC_LB_POLICY_REFCOUNT_DEBUG -#ifdef GRPC_LB_POLICY_REFCOUNT_DEBUG +#ifndef NDEBUG /* Strong references: the policy will shutdown when they reach zero */ #define GRPC_LB_POLICY_REF(p, r) \ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c index e80b1dcd80f..5a5ff2902d0 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c @@ -1880,6 +1880,9 @@ static bool maybe_add_client_load_reporting_filter( void grpc_lb_policy_grpclb_init() { grpc_register_lb_policy(grpc_glb_lb_factory_create()); grpc_register_tracer("glb", &grpc_lb_glb_trace); +#ifndef NDEBUG + grpc_register_tracer("lb_policy_refcount", &grpc_trace_lb_policy_refcount); +#endif grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, maybe_add_client_load_reporting_filter, diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c index 307e3bad674..d0acd7a9019 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c @@ -95,6 +95,9 @@ static void pf_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { gpr_free(p->subchannels); gpr_free(p->new_subchannels); gpr_free(p); + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log(GPR_DEBUG, "Pick First %p destroyed.", (void *)p); + } } static void pf_shutdown_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { @@ -268,11 +271,20 @@ static void stop_connectivity_watchers(grpc_exec_ctx *exec_ctx, pick_first_lb_policy *p) { if (p->num_subchannels > 0) { GPR_ASSERT(p->selected == NULL); + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log(GPR_DEBUG, "Pick First %p unsubscribing from subchannel %p", + (void *)p, (void *)p->subchannels[p->checking_subchannel]); + } grpc_subchannel_notify_on_state_change( exec_ctx, p->subchannels[p->checking_subchannel], NULL, NULL, &p->connectivity_changed); p->updating_subchannels = true; } else if (p->selected != NULL) { + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log(GPR_DEBUG, + "Pick First %p unsubscribing from selected subchannel %p", + (void *)p, (void *)p->selected); + } grpc_connected_subchannel_notify_on_state_change( exec_ctx, p->selected, NULL, NULL, &p->connectivity_changed); p->updating_selected = true; @@ -451,12 +463,25 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_subchannel *selected_subchannel; pending_pick *pp; + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log( + GPR_DEBUG, + "Pick First %p connectivity changed. Updating selected: %d; Updating " + "subchannels: %d; Checking %lu index (%lu total); State: %d; ", + (void *)p, p->updating_selected, p->updating_subchannels, + (unsigned long)p->checking_subchannel, + (unsigned long)p->num_subchannels, p->checking_connectivity); + } bool restart = false; - if (p->updating_selected && error == GRPC_ERROR_CANCELLED) { + if (p->updating_selected && error != GRPC_ERROR_NONE) { /* Captured the unsubscription for p->selected */ GPR_ASSERT(p->selected != NULL); GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, p->selected, "pf_update_connectivity"); + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log(GPR_DEBUG, "Pick First %p unreffing selected subchannel %p", + (void *)p, (void *)p->selected); + } p->updating_selected = false; if (p->num_new_subchannels == 0) { p->selected = NULL; @@ -464,12 +489,16 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, } restart = true; } - if (p->updating_subchannels && error == GRPC_ERROR_CANCELLED) { + if (p->updating_subchannels && error != GRPC_ERROR_NONE) { /* Captured the unsubscription for the checking subchannel */ GPR_ASSERT(p->selected == NULL); for (size_t i = 0; i < p->num_subchannels; i++) { GRPC_SUBCHANNEL_UNREF(exec_ctx, p->subchannels[i], "pf_update_connectivity"); + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log(GPR_DEBUG, "Pick First %p unreffing subchannel %p", (void *)p, + (void *)p->subchannels[i]); + } } gpr_free(p->subchannels); p->subchannels = NULL; @@ -481,14 +510,12 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, if (restart) { p->selected = NULL; p->selected_key = NULL; - GPR_ASSERT(p->new_subchannels != NULL); GPR_ASSERT(p->num_new_subchannels > 0); p->num_subchannels = p->num_new_subchannels; p->subchannels = p->new_subchannels; p->num_new_subchannels = 0; p->new_subchannels = NULL; - if (p->started_picking) { /* If we were picking, continue to do so over the new subchannels, * starting from the 0th index. */ @@ -542,7 +569,9 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, "picked_first"); if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { - gpr_log(GPR_INFO, "Selected subchannel %p", (void *)p->selected); + gpr_log(GPR_INFO, + "Pick First %p selected subchannel %p (connected %p)", + (void *)p, (void *)selected_subchannel, (void *)p->selected); } p->selected_key = grpc_subchannel_get_key(selected_subchannel); /* drop the pick list: we are connected now */ @@ -568,7 +597,8 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, p->checking_subchannel = (p->checking_subchannel + 1) % p->num_subchannels; if (p->checking_subchannel == 0) { - /* only trigger transient failure when we've tried all alternatives */ + /* only trigger transient failure when we've tried all alternatives + */ grpc_connectivity_state_set( exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE, GRPC_ERROR_REF(error), "connecting_transient_failure"); @@ -652,6 +682,9 @@ static grpc_lb_policy *create_pick_first(grpc_exec_ctx *exec_ctx, grpc_lb_policy_args *args) { GPR_ASSERT(args->client_channel_factory != NULL); pick_first_lb_policy *p = gpr_zalloc(sizeof(*p)); + if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) { + gpr_log(GPR_DEBUG, "Pick First %p created.", (void *)p); + } pf_update_locked(exec_ctx, &p->base, args); grpc_lb_policy_init(&p->base, &pick_first_lb_policy_vtable, args->combiner); GRPC_CLOSURE_INIT(&p->connectivity_changed, pf_connectivity_changed_locked, p, diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c index 3c8520cc1c3..8e9d6b0f47b 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c @@ -126,6 +126,8 @@ struct rr_subchannel_list { size_t num_ready; /** how many subchannels are in state TRANSIENT_FAILURE */ size_t num_transient_failures; + /** how many subchannels are in state SHUTDOWN */ + size_t num_shutdown; /** how many subchannels are in state IDLE */ size_t num_idle; @@ -425,6 +427,9 @@ static void update_state_counters_locked(subchannel_data *sd) { } else if (sd->prev_connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) { GPR_ASSERT(subchannel_list->num_transient_failures > 0); --subchannel_list->num_transient_failures; + } else if (sd->prev_connectivity_state == GRPC_CHANNEL_SHUTDOWN) { + GPR_ASSERT(subchannel_list->num_shutdown > 0); + --subchannel_list->num_shutdown; } else if (sd->prev_connectivity_state == GRPC_CHANNEL_IDLE) { GPR_ASSERT(subchannel_list->num_idle > 0); --subchannel_list->num_idle; @@ -433,6 +438,8 @@ static void update_state_counters_locked(subchannel_data *sd) { ++subchannel_list->num_ready; } else if (sd->curr_connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) { ++subchannel_list->num_transient_failures; + } else if (sd->curr_connectivity_state == GRPC_CHANNEL_SHUTDOWN) { + ++subchannel_list->num_shutdown; } else if (sd->curr_connectivity_state == GRPC_CHANNEL_IDLE) { ++subchannel_list->num_idle; } @@ -455,7 +462,8 @@ static grpc_connectivity_state update_lb_connectivity_status_locked( * CHECK: sd->curr_connectivity_state == CONNECTING. * * 3) RULE: ALL subchannels are SHUTDOWN => policy is SHUTDOWN. - * CHECK: p->subchannel_list->num_subchannels = 0. + * CHECK: p->subchannel_list->num_shutdown == + * p->subchannel_list->num_subchannels. * * 4) RULE: ALL subchannels are TRANSIENT_FAILURE => policy is * TRANSIENT_FAILURE. @@ -464,37 +472,39 @@ static grpc_connectivity_state update_lb_connectivity_status_locked( * 5) RULE: ALL subchannels are IDLE => policy is IDLE. * CHECK: p->num_idle == p->subchannel_list->num_subchannels. */ + grpc_connectivity_state new_state = sd->curr_connectivity_state; rr_subchannel_list *subchannel_list = sd->subchannel_list; round_robin_lb_policy *p = subchannel_list->policy; if (subchannel_list->num_ready > 0) { /* 1) READY */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_READY, GRPC_ERROR_NONE, "rr_ready"); - return GRPC_CHANNEL_READY; + new_state = GRPC_CHANNEL_READY; } else if (sd->curr_connectivity_state == GRPC_CHANNEL_CONNECTING) { /* 2) CONNECTING */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_CONNECTING, GRPC_ERROR_NONE, "rr_connecting"); - return GRPC_CHANNEL_CONNECTING; - } else if (p->subchannel_list->num_subchannels == 0) { /* 3) SHUTDOWN */ + new_state = GRPC_CHANNEL_CONNECTING; + } else if (p->subchannel_list->num_shutdown == + p->subchannel_list->num_subchannels) { /* 3) SHUTDOWN */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error), "rr_shutdown"); - return GRPC_CHANNEL_SHUTDOWN; + new_state = GRPC_CHANNEL_SHUTDOWN; } else if (subchannel_list->num_transient_failures == p->subchannel_list->num_subchannels) { /* 4) TRANSIENT_FAILURE */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE, GRPC_ERROR_REF(error), "rr_transient_failure"); - return GRPC_CHANNEL_TRANSIENT_FAILURE; + new_state = GRPC_CHANNEL_TRANSIENT_FAILURE; } else if (subchannel_list->num_idle == p->subchannel_list->num_subchannels) { /* 5) IDLE */ grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_IDLE, GRPC_ERROR_NONE, "rr_idle"); - return GRPC_CHANNEL_IDLE; + new_state = GRPC_CHANNEL_IDLE; } - /* no change */ - return sd->curr_connectivity_state; + GRPC_ERROR_UNREF(error); + return new_state; } static void rr_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, @@ -571,13 +581,15 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, GPR_ASSERT(sd->subchannel_list == p->latest_pending_subchannel_list); GPR_ASSERT(!sd->subchannel_list->shutting_down); if (GRPC_TRACER_ON(grpc_lb_round_robin_trace)) { + const unsigned long num_subchannels = + p->subchannel_list != NULL + ? (unsigned long)p->subchannel_list->num_subchannels + : 0; gpr_log(GPR_DEBUG, "[RR %p] phasing out subchannel list %p (size %lu) in favor " "of %p (size %lu)", - (void *)p, (void *)p->subchannel_list, - (unsigned long)p->subchannel_list->num_subchannels, - (void *)sd->subchannel_list, - (unsigned long)sd->subchannel_list->num_subchannels); + (void *)p, (void *)p->subchannel_list, num_subchannels, + (void *)sd->subchannel_list, num_subchannels); } if (p->subchannel_list != NULL) { // dispose of the current subchannel_list diff --git a/src/core/ext/filters/client_channel/resolver.c b/src/core/ext/filters/client_channel/resolver.c index 69b1c31e592..de9a8ce41b9 100644 --- a/src/core/ext/filters/client_channel/resolver.c +++ b/src/core/ext/filters/client_channel/resolver.c @@ -19,6 +19,10 @@ #include "src/core/ext/filters/client_channel/resolver.h" #include "src/core/lib/iomgr/combiner.h" +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_resolver_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + void grpc_resolver_init(grpc_resolver *resolver, const grpc_resolver_vtable *vtable, grpc_combiner *combiner) { @@ -27,25 +31,30 @@ void grpc_resolver_init(grpc_resolver *resolver, gpr_ref_init(&resolver->refs, 1); } -#ifdef GRPC_RESOLVER_REFCOUNT_DEBUG -void grpc_resolver_ref(grpc_resolver *resolver, grpc_closure_list *closure_list, - const char *file, int line, const char *reason) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "RESOLVER:%p ref %d -> %d %s", - resolver, (int)resolver->refs.count, (int)resolver->refs.count + 1, - reason); +#ifndef NDEBUG +void grpc_resolver_ref(grpc_resolver *resolver, const char *file, int line, + const char *reason) { + if (GRPC_TRACER_ON(grpc_trace_resolver_refcount)) { + gpr_atm old_refs = gpr_atm_no_barrier_load(&resolver->refs.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "RESOLVER:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", resolver, + old_refs, old_refs + 1, reason); + } #else void grpc_resolver_ref(grpc_resolver *resolver) { #endif gpr_ref(&resolver->refs); } -#ifdef GRPC_RESOLVER_REFCOUNT_DEBUG -void grpc_resolver_unref(grpc_resolver *resolver, - grpc_closure_list *closure_list, const char *file, - int line, const char *reason) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "RESOLVER:%p unref %d -> %d %s", - resolver, (int)resolver->refs.count, (int)resolver->refs.count - 1, - reason); +#ifndef NDEBUG +void grpc_resolver_unref(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver, + const char *file, int line, const char *reason) { + if (GRPC_TRACER_ON(grpc_trace_resolver_refcount)) { + gpr_atm old_refs = gpr_atm_no_barrier_load(&resolver->refs.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "RESOLVER:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", resolver, + old_refs, old_refs - 1, reason); + } #else void grpc_resolver_unref(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver) { #endif diff --git a/src/core/ext/filters/client_channel/resolver.h b/src/core/ext/filters/client_channel/resolver.h index c78bb316cbc..ae9c8f66fed 100644 --- a/src/core/ext/filters/client_channel/resolver.h +++ b/src/core/ext/filters/client_channel/resolver.h @@ -25,6 +25,10 @@ typedef struct grpc_resolver grpc_resolver; typedef struct grpc_resolver_vtable grpc_resolver_vtable; +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_resolver_refcount; +#endif + /** \a grpc_resolver provides \a grpc_channel_args objects to its caller */ struct grpc_resolver { const grpc_resolver_vtable *vtable; @@ -41,17 +45,17 @@ struct grpc_resolver_vtable { grpc_channel_args **result, grpc_closure *on_complete); }; -#ifdef GRPC_RESOLVER_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p), __FILE__, __LINE__, (r)) -#define GRPC_RESOLVER_UNREF(cl, p, r) \ - grpc_resolver_unref((cl), (p), __FILE__, __LINE__, (r)) +#define GRPC_RESOLVER_UNREF(e, p, r) \ + grpc_resolver_unref((e), (p), __FILE__, __LINE__, (r)) void grpc_resolver_ref(grpc_resolver *policy, const char *file, int line, const char *reason); -void grpc_resolver_unref(grpc_resolver *policy, grpc_closure_list *closure_list, +void grpc_resolver_unref(grpc_exec_ctx *exec_ctx, grpc_resolver *policy, const char *file, int line, const char *reason); #else #define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p)) -#define GRPC_RESOLVER_UNREF(cl, p, r) grpc_resolver_unref((cl), (p)) +#define GRPC_RESOLVER_UNREF(e, p, r) grpc_resolver_unref((e), (p)) void grpc_resolver_ref(grpc_resolver *policy); void grpc_resolver_unref(grpc_exec_ctx *exec_ctx, grpc_resolver *policy); #endif diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h index eb1a8ab011c..386012d2edc 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h @@ -19,8 +19,6 @@ #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H -#include - #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/pollset_set.h" diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c index 4e79c44ba3f..1ab8295e9ec 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c @@ -19,6 +19,8 @@ #include "src/core/lib/iomgr/port.h" #if GRPC_ARES == 1 && defined(GRPC_POSIX_SOCKET) +#include + #include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h" #include diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c index 8e73d606aac..56ed4371a91 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c @@ -56,6 +56,10 @@ typedef struct { // grpc_resolver_next_locked()'s closure. grpc_channel_args* next_results; + // Results to use for the pretended re-resolution in + // fake_resolver_channel_saw_error_locked(). + grpc_channel_args* results_upon_error; + // pending next completion, or NULL grpc_closure* next_completion; // target result address for next completion @@ -65,6 +69,7 @@ typedef struct { static void fake_resolver_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* gr) { fake_resolver* r = (fake_resolver*)gr; grpc_channel_args_destroy(exec_ctx, r->next_results); + grpc_channel_args_destroy(exec_ctx, r->results_upon_error); grpc_channel_args_destroy(exec_ctx, r->channel_args); gpr_free(r); } @@ -74,7 +79,9 @@ static void fake_resolver_shutdown_locked(grpc_exec_ctx* exec_ctx, fake_resolver* r = (fake_resolver*)resolver; if (r->next_completion != NULL) { *r->target_result = NULL; - GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED( + exec_ctx, r->next_completion, + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown")); r->next_completion = NULL; } } @@ -85,15 +92,19 @@ static void fake_resolver_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx, *r->target_result = grpc_channel_args_union(r->next_results, r->channel_args); grpc_channel_args_destroy(exec_ctx, r->next_results); + r->next_results = NULL; GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE); r->next_completion = NULL; - r->next_results = NULL; } } static void fake_resolver_channel_saw_error_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver) { fake_resolver* r = (fake_resolver*)resolver; + if (r->next_results == NULL && r->results_upon_error != NULL) { + // Pretend we re-resolved. + r->next_results = grpc_channel_args_copy(r->results_upon_error); + } fake_resolver_maybe_finish_next_locked(exec_ctx, r); } @@ -149,6 +160,10 @@ static void set_response_cb(grpc_exec_ctx* exec_ctx, void* arg, grpc_channel_args_destroy(exec_ctx, r->next_results); } r->next_results = generator->next_response; + if (r->results_upon_error != NULL) { + grpc_channel_args_destroy(exec_ctx, r->results_upon_error); + } + r->results_upon_error = grpc_channel_args_copy(generator->next_response); fake_resolver_maybe_finish_next_locked(exec_ctx, r); } diff --git a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c index b5d2e5c92b1..7b4fe382725 100644 --- a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +++ b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c @@ -73,7 +73,9 @@ static void sockaddr_shutdown_locked(grpc_exec_ctx *exec_ctx, sockaddr_resolver *r = (sockaddr_resolver *)resolver; if (r->next_completion != NULL) { *r->target_result = NULL; - GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED( + exec_ctx, r->next_completion, + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown")); r->next_completion = NULL; } } diff --git a/src/core/ext/filters/client_channel/subchannel.c b/src/core/ext/filters/client_channel/subchannel.c index 0877ef4e671..88157ed738c 100644 --- a/src/core/ext/filters/client_channel/subchannel.c +++ b/src/core/ext/filters/client_channel/subchannel.c @@ -140,25 +140,13 @@ struct grpc_subchannel_call { static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *subchannel, grpc_error *error); -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG #define REF_REASON reason -#define REF_LOG(name, p) \ - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "%s: %p ref %d -> %d %s", \ - (name), (p), (p)->refs.count, (p)->refs.count + 1, reason) -#define UNREF_LOG(name, p) \ - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "%s: %p unref %d -> %d %s", \ - (name), (p), (p)->refs.count, (p)->refs.count - 1, reason) #define REF_MUTATE_EXTRA_ARGS \ GRPC_SUBCHANNEL_REF_EXTRA_ARGS, const char *purpose #define REF_MUTATE_PURPOSE(x) , file, line, reason, x #else #define REF_REASON "" -#define REF_LOG(name, p) \ - do { \ - } while (0) -#define UNREF_LOG(name, p) \ - do { \ - } while (0) #define REF_MUTATE_EXTRA_ARGS #define REF_MUTATE_PURPOSE(x) #endif @@ -207,10 +195,12 @@ static gpr_atm ref_mutate(grpc_subchannel *c, gpr_atm delta, int barrier REF_MUTATE_EXTRA_ARGS) { gpr_atm old_val = barrier ? gpr_atm_full_fetch_add(&c->ref_pair, delta) : gpr_atm_no_barrier_fetch_add(&c->ref_pair, delta); -#ifdef GRPC_STREAM_REFCOUNT_DEBUG - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "SUBCHANNEL: %p %s 0x%08" PRIxPTR " -> 0x%08" PRIxPTR " [%s]", c, - purpose, old_val, old_val + delta, reason); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_stream_refcount)) { + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "SUBCHANNEL: %p %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR " [%s]", c, + purpose, old_val, old_val + delta, reason); + } #endif return old_val; } diff --git a/src/core/ext/filters/client_channel/subchannel.h b/src/core/ext/filters/client_channel/subchannel.h index f38bf42803c..6d2abb04df5 100644 --- a/src/core/ext/filters/client_channel/subchannel.h +++ b/src/core/ext/filters/client_channel/subchannel.h @@ -37,7 +37,7 @@ typedef struct grpc_subchannel_call grpc_subchannel_call; typedef struct grpc_subchannel_args grpc_subchannel_args; typedef struct grpc_subchannel_key grpc_subchannel_key; -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_SUBCHANNEL_REF(p, r) \ grpc_subchannel_ref((p), __FILE__, __LINE__, (r)) #define GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(p, r) \ diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.c b/src/core/ext/filters/http/message_compress/message_compress_filter.c index 04cb1d94f80..71a8bc5bec2 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.c +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.c @@ -255,6 +255,23 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx, } } +static void handle_send_message_batch(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem, + grpc_transport_stream_op_batch *op, + bool has_compression_algorithm) { + call_data *calld = elem->call_data; + if (!skip_compression(elem, op->payload->send_message.send_message->flags, + has_compression_algorithm)) { + calld->send_op = op; + calld->send_length = op->payload->send_message.send_message->length; + calld->send_flags = op->payload->send_message.send_message->flags; + continue_send_message(exec_ctx, elem); + } else { + /* pass control down the stack */ + grpc_call_next_op(exec_ctx, elem, op); + } +} + static void compress_start_transport_stream_op_batch( grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op_batch *op) { @@ -307,8 +324,9 @@ static void compress_start_transport_stream_op_batch( goto retry_send_im; } if (cur != INITIAL_METADATA_UNSEEN) { - grpc_call_next_op(exec_ctx, elem, - (grpc_transport_stream_op_batch *)cur); + handle_send_message_batch(exec_ctx, elem, + (grpc_transport_stream_op_batch *)cur, + has_compression_algorithm); } } } @@ -325,17 +343,8 @@ static void compress_start_transport_stream_op_batch( break; case HAS_COMPRESSION_ALGORITHM: case NO_COMPRESSION_ALGORITHM: - if (!skip_compression(elem, - op->payload->send_message.send_message->flags, - cur == HAS_COMPRESSION_ALGORITHM)) { - calld->send_op = op; - calld->send_length = op->payload->send_message.send_message->length; - calld->send_flags = op->payload->send_message.send_message->flags; - continue_send_message(exec_ctx, elem); - } else { - /* pass control down the stack */ - grpc_call_next_op(exec_ctx, elem, op); - } + handle_send_message_batch(exec_ctx, elem, op, + cur == HAS_COMPRESSION_ALGORITHM); break; default: if (cur & CANCELLED_BIT) { diff --git a/src/core/ext/transport/chttp2/transport/chttp2_plugin.c b/src/core/ext/transport/chttp2/transport/chttp2_plugin.c index b0ffdc0cf92..6a8c81445a1 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_plugin.c @@ -23,6 +23,9 @@ void grpc_chttp2_plugin_init(void) { grpc_register_tracer("http", &grpc_http_trace); grpc_register_tracer("flowctl", &grpc_flowctl_trace); +#ifndef NDEBUG + grpc_register_tracer("chttp2_refcount", &grpc_trace_chttp2_refcount); +#endif } void grpc_chttp2_plugin_shutdown(void) {} diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 0ad63d1af2f..6e8eadf7a1a 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -52,7 +52,7 @@ #define DEFAULT_CONNECTION_WINDOW_TARGET (1024 * 1024) #define MAX_WINDOW 0x7fffffffu #define MAX_WRITE_BUFFER_SIZE (64 * 1024 * 1024) -#define DEFAULT_MAX_HEADER_LIST_SIZE (16 * 1024) +#define DEFAULT_MAX_HEADER_LIST_SIZE (8 * 1024) #define DEFAULT_CLIENT_KEEPALIVE_TIME_MS INT_MAX #define DEFAULT_CLIENT_KEEPALIVE_TIMEOUT_MS 20000 /* 20 seconds */ @@ -76,6 +76,10 @@ static bool g_default_keepalive_permit_without_calls = grpc_tracer_flag grpc_http_trace = GRPC_TRACER_INITIALIZER(false); grpc_tracer_flag grpc_flowctl_trace = GRPC_TRACER_INITIALIZER(false); +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_chttp2_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + static const grpc_transport_vtable vtable; /* forward declarations of various callbacks that we'll build closures around */ @@ -91,8 +95,9 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *t, static void complete_fetch_locked(grpc_exec_ctx *exec_ctx, void *gs, grpc_error *error); /** Set a transport level setting, and push it to our peer */ -static void push_setting(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, - grpc_chttp2_setting_id id, uint32_t value); +static void queue_setting_update(grpc_exec_ctx *exec_ctx, + grpc_chttp2_transport *t, + grpc_chttp2_setting_id id, uint32_t value); static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_error *error); @@ -212,20 +217,26 @@ static void destruct_transport(grpc_exec_ctx *exec_ctx, gpr_free(t); } -#ifdef GRPC_CHTTP2_REFCOUNTING_DEBUG +#ifndef NDEBUG void grpc_chttp2_unref_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, const char *reason, const char *file, int line) { - gpr_log(GPR_DEBUG, "chttp2:unref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", t, - t->refs.count, t->refs.count - 1, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_chttp2_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&t->refs.count); + gpr_log(GPR_DEBUG, "chttp2:unref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", + t, val, val - 1, reason, file, line); + } if (!gpr_unref(&t->refs)) return; destruct_transport(exec_ctx, t); } void grpc_chttp2_ref_transport(grpc_chttp2_transport *t, const char *reason, const char *file, int line) { - gpr_log(GPR_DEBUG, "chttp2: ref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", t, - t->refs.count, t->refs.count + 1, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_chttp2_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&t->refs.count); + gpr_log(GPR_DEBUG, "chttp2: ref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", + t, val, val + 1, reason, file, line); + } gpr_ref(&t->refs); } #else @@ -342,15 +353,16 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, /* configure http2 the way we like it */ if (is_client) { - push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_ENABLE_PUSH, 0); - push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 0); + queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_ENABLE_PUSH, 0); + queue_setting_update(exec_ctx, t, + GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 0); } - push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, - DEFAULT_WINDOW); - push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE, - DEFAULT_MAX_HEADER_LIST_SIZE); - push_setting(exec_ctx, t, - GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA, 1); + queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, + DEFAULT_WINDOW); + queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE, + DEFAULT_MAX_HEADER_LIST_SIZE); + queue_setting_update(exec_ctx, t, + GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA, 1); t->ping_policy = (grpc_chttp2_repeated_ping_policy){ .max_pings_without_data = DEFAULT_MAX_PINGS_BETWEEN_DATA, @@ -517,8 +529,8 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, int value = grpc_channel_arg_get_integer( &channel_args->args[i], settings_map[j].integer_options); if (value >= 0) { - push_setting(exec_ctx, t, settings_map[j].setting_id, - (uint32_t)value); + queue_setting_update(exec_ctx, t, settings_map[j].setting_id, + (uint32_t)value); } } break; @@ -620,7 +632,7 @@ static void close_transport_locked(grpc_exec_ctx *exec_ctx, GRPC_ERROR_UNREF(error); } -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_chttp2_stream_ref(grpc_chttp2_stream *s, const char *reason) { grpc_stream_ref(s->refcount, reason); } @@ -929,8 +941,11 @@ static void write_action_end_locked(grpc_exec_ctx *exec_ctx, void *tp, GPR_TIMER_END("terminate_writing_with_lock", 0); } -static void push_setting(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, - grpc_chttp2_setting_id id, uint32_t value) { +// Dirties an HTTP2 setting to be sent out next time a writing path occurs. +// If the change needs to occur immediately, manually initiate a write. +static void queue_setting_update(grpc_exec_ctx *exec_ctx, + grpc_chttp2_transport *t, + grpc_chttp2_setting_id id, uint32_t value) { const grpc_chttp2_setting_parameters *sp = &grpc_chttp2_settings_parameters[id]; uint32_t use_value = GPR_CLAMP(value, sp->min_value, sp->max_value); @@ -941,7 +956,6 @@ static void push_setting(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, if (use_value != t->settings[GRPC_LOCAL_SETTINGS][id]) { t->settings[GRPC_LOCAL_SETTINGS][id] = use_value; t->dirtied_local_settings = 1; - grpc_chttp2_initiate_write(exec_ctx, t, "push_setting"); } } @@ -1403,6 +1417,8 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, op_payload->recv_initial_metadata.recv_initial_metadata_ready; s->recv_initial_metadata = op_payload->recv_initial_metadata.recv_initial_metadata; + s->trailing_metadata_available = + op_payload->recv_initial_metadata.trailing_metadata_available; grpc_chttp2_maybe_complete_recv_initial_metadata(exec_ctx, t, s); } @@ -2107,8 +2123,8 @@ static void update_bdp(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, gpr_log(GPR_DEBUG, "%s: update initial window size to %d", t->peer_string, (int)bdp); } - push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, - (uint32_t)bdp); + queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, + (uint32_t)bdp); } static void update_frame(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, @@ -2127,8 +2143,8 @@ static void update_frame(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, gpr_log(GPR_DEBUG, "%s: update max_frame size to %d", t->peer_string, (int)frame_size); } - push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE, - (uint32_t)frame_size); + queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE, + (uint32_t)frame_size); } static grpc_error *try_http_parsing(grpc_exec_ctx *exec_ctx, @@ -2726,6 +2742,7 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( gpr_ref_init(&incoming_byte_stream->refs, 2); incoming_byte_stream->transport = t; incoming_byte_stream->stream = s; + GRPC_ERROR_UNREF(s->byte_stream_error); s->byte_stream_error = GRPC_ERROR_NONE; return incoming_byte_stream; } diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.h b/src/core/ext/transport/chttp2/transport/chttp2_transport.h index 0a1fb4d772a..0c4e2a91c03 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.h +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.h @@ -26,6 +26,10 @@ extern grpc_tracer_flag grpc_http_trace; extern grpc_tracer_flag grpc_flowctl_trace; +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_chttp2_refcount; +#endif + grpc_transport *grpc_create_chttp2_transport( grpc_exec_ctx *exec_ctx, const grpc_channel_args *channel_args, grpc_endpoint *ep, int is_client); diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.c b/src/core/ext/transport/chttp2/transport/frame_rst_stream.c index ccca0f1871e..689dc8935cf 100644 --- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.c @@ -93,7 +93,7 @@ grpc_error *grpc_chttp2_rst_stream_parser_parse(grpc_exec_ctx *exec_ctx, (((uint32_t)p->reason_bytes[2]) << 8) | (((uint32_t)p->reason_bytes[3])); grpc_error *error = GRPC_ERROR_NONE; - if (reason != GRPC_HTTP2_NO_ERROR || s->header_frames_received < 2) { + if (reason != GRPC_HTTP2_NO_ERROR || s->metadata_buffer[1].size == 0) { char *message; gpr_asprintf(&message, "Received RST_STREAM with error code %d", reason); error = grpc_error_set_int( diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.c b/src/core/ext/transport/chttp2/transport/hpack_encoder.c index 28c66326952..a0e748e7b11 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.c +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.c @@ -608,15 +608,14 @@ void grpc_chttp2_hpack_compressor_set_max_table_size( void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_compressor *c, + grpc_mdelem **extra_headers, + size_t extra_headers_size, grpc_metadata_batch *metadata, const grpc_encode_header_options *options, grpc_slice_buffer *outbuf) { - framer_state st; - grpc_linked_mdelem *l; - gpr_timespec deadline; - GPR_ASSERT(options->stream_id != 0); + framer_state st; st.seen_regular_header = 0; st.stream_id = options->stream_id; st.output = outbuf; @@ -633,11 +632,14 @@ void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx, if (c->advertise_table_size_change != 0) { emit_advertise_table_size_change(c, &st); } + for (size_t i = 0; i < extra_headers_size; ++i) { + hpack_enc(exec_ctx, c, *extra_headers[i], &st); + } grpc_metadata_batch_assert_ok(metadata); - for (l = metadata->list.head; l; l = l->next) { + for (grpc_linked_mdelem *l = metadata->list.head; l; l = l->next) { hpack_enc(exec_ctx, c, l->md, &st); } - deadline = metadata->deadline; + gpr_timespec deadline = metadata->deadline; if (gpr_time_cmp(deadline, gpr_inf_future(deadline.clock_type)) != 0) { deadline_enc(exec_ctx, c, deadline, &st); } diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.h b/src/core/ext/transport/chttp2/transport/hpack_encoder.h index 84ab6dde2ce..271192f8947 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.h +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.h @@ -85,6 +85,8 @@ typedef struct { void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_compressor *c, + grpc_mdelem **extra_headers, + size_t extra_headers_size, grpc_metadata_batch *metadata, const grpc_encode_header_options *options, grpc_slice_buffer *outbuf); diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 4041b29fecb..9fa72ddbdf8 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -447,6 +447,7 @@ struct grpc_chttp2_stream { grpc_metadata_batch *recv_initial_metadata; grpc_closure *recv_initial_metadata_ready; + bool *trailing_metadata_available; grpc_byte_stream **recv_message; grpc_closure *recv_message_ready; grpc_metadata_batch *recv_trailing_metadata; @@ -748,7 +749,7 @@ void grpc_chttp2_mark_stream_closed(grpc_exec_ctx *exec_ctx, void grpc_chttp2_start_writing(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t); -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_CHTTP2_STREAM_REF(stream, reason) \ grpc_chttp2_stream_ref(stream, reason) #define GRPC_CHTTP2_STREAM_UNREF(exec_ctx, stream, reason) \ @@ -764,8 +765,7 @@ void grpc_chttp2_stream_ref(grpc_chttp2_stream *s); void grpc_chttp2_stream_unref(grpc_exec_ctx *exec_ctx, grpc_chttp2_stream *s); #endif -//#define GRPC_CHTTP2_REFCOUNTING_DEBUG 1 -#ifdef GRPC_CHTTP2_REFCOUNTING_DEBUG +#ifndef NDEBUG #define GRPC_CHTTP2_REF_TRANSPORT(t, r) \ grpc_chttp2_ref_transport(t, r, __FILE__, __LINE__) #define GRPC_CHTTP2_UNREF_TRANSPORT(cl, t, r) \ diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index 941260be9ac..3c8b470b4f9 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -681,9 +681,19 @@ static grpc_error *init_header_frame_parser(grpc_exec_ctx *exec_ctx, t->parser_data = &t->hpack_parser; switch (s->header_frames_received) { case 0: - t->hpack_parser.on_header = on_initial_header; + if (t->is_client && t->header_eof) { + GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "parsing Trailers-Only")); + if (s->trailing_metadata_available != NULL) { + *s->trailing_metadata_available = true; + } + t->hpack_parser.on_header = on_trailing_header; + } else { + GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "parsing initial_metadata")); + t->hpack_parser.on_header = on_initial_header; + } break; case 1: + GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "parsing trailing_metadata")); t->hpack_parser.on_header = on_trailing_header; break; case 2: diff --git a/src/core/ext/transport/chttp2/transport/writing.c b/src/core/ext/transport/chttp2/transport/writing.c index 4db0fbb0980..315f2a67a21 100644 --- a/src/core/ext/transport/chttp2/transport/writing.c +++ b/src/core/ext/transport/chttp2/transport/writing.c @@ -162,6 +162,20 @@ static uint32_t target_write_size(grpc_chttp2_transport *t) { return 1024 * 1024; } +// Returns true if initial_metadata contains only default headers. +// +// TODO(roth): The fact that we hard-code these particular headers here +// is fairly ugly. Need some better way to know which headers are +// default, maybe via a bit in the static metadata table? +static bool is_default_initial_metadata(grpc_metadata_batch *initial_metadata) { + int num_default_fields = + (initial_metadata->idx.named.status != NULL) + + (initial_metadata->idx.named.content_type != NULL) + + (initial_metadata->idx.named.grpc_encoding != NULL) + + (initial_metadata->idx.named.grpc_accept_encoding != NULL); + return (size_t)num_default_fields == initial_metadata->list.count; +} + grpc_chttp2_begin_write_result grpc_chttp2_begin_write( grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { grpc_chttp2_stream *s; @@ -218,31 +232,59 @@ grpc_chttp2_begin_write_result grpc_chttp2_begin_write( t->is_client ? "CLIENT" : "SERVER", s->id, sent_initial_metadata, s->send_initial_metadata != NULL, s->announce_window)); + grpc_mdelem *extra_headers_for_trailing_metadata[2]; + size_t num_extra_headers_for_trailing_metadata = 0; + /* send initial metadata if it's available */ - if (!sent_initial_metadata && s->send_initial_metadata) { - grpc_encode_header_options hopt = { - .stream_id = s->id, - .is_eof = false, - .use_true_binary_metadata = - t->settings - [GRPC_PEER_SETTINGS] - [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != 0, - .max_frame_size = t->settings[GRPC_PEER_SETTINGS] - [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], - .stats = &s->stats.outgoing}; - grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, - s->send_initial_metadata, &hopt, &t->outbuf); + if (!sent_initial_metadata && s->send_initial_metadata != NULL) { + // We skip this on the server side if there is no custom initial + // metadata, there are no messages to send, and we are also sending + // trailing metadata. This results in a Trailers-Only response, + // which is required for retries, as per: + // https://github.com/grpc/proposal/blob/master/A6-client-retries.md#when-retries-are-valid + if (t->is_client || s->fetching_send_message != NULL || + s->flow_controlled_buffer.length != 0 || + s->send_trailing_metadata == NULL || + !is_default_initial_metadata(s->send_initial_metadata)) { + grpc_encode_header_options hopt = { + .stream_id = s->id, + .is_eof = false, + .use_true_binary_metadata = + t->settings + [GRPC_PEER_SETTINGS] + [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != 0, + .max_frame_size = t->settings[GRPC_PEER_SETTINGS] + [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], + .stats = &s->stats.outgoing}; + grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, NULL, 0, + s->send_initial_metadata, &hopt, &t->outbuf); + now_writing = true; + t->ping_state.pings_before_data_required = + t->ping_policy.max_pings_without_data; + if (!t->is_client) { + t->ping_recv_state.last_ping_recv_time = + gpr_inf_past(GPR_CLOCK_MONOTONIC); + t->ping_recv_state.ping_strikes = 0; + } + } else { + GRPC_CHTTP2_IF_TRACING( + gpr_log(GPR_INFO, "not sending initial_metadata (Trailers-Only)")); + // When sending Trailers-Only, we need to move the :status and + // content-type headers to the trailers. + if (s->send_initial_metadata->idx.named.status != NULL) { + extra_headers_for_trailing_metadata + [num_extra_headers_for_trailing_metadata++] = + &s->send_initial_metadata->idx.named.status->md; + } + if (s->send_initial_metadata->idx.named.content_type != NULL) { + extra_headers_for_trailing_metadata + [num_extra_headers_for_trailing_metadata++] = + &s->send_initial_metadata->idx.named.content_type->md; + } + } s->send_initial_metadata = NULL; s->sent_initial_metadata = true; sent_initial_metadata = true; - now_writing = true; - t->ping_state.pings_before_data_required = - t->ping_policy.max_pings_without_data; - if (!t->is_client) { - t->ping_recv_state.last_ping_recv_time = - gpr_inf_past(GPR_CLOCK_MONOTONIC); - t->ping_recv_state.ping_strikes = 0; - } } /* send any window updates */ if (s->announce_window > 0) { @@ -320,6 +362,7 @@ grpc_chttp2_begin_write_result grpc_chttp2_begin_write( if (s->send_trailing_metadata != NULL && s->fetching_send_message == NULL && s->flow_controlled_buffer.length == 0) { + GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "sending trailing_metadata")); if (grpc_metadata_batch_is_empty(s->send_trailing_metadata)) { grpc_chttp2_encode_data(s->id, &s->flow_controlled_buffer, 0, true, &s->stats.outgoing, &t->outbuf); @@ -337,6 +380,8 @@ grpc_chttp2_begin_write_result grpc_chttp2_begin_write( [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], .stats = &s->stats.outgoing}; grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, + extra_headers_for_trailing_metadata, + num_extra_headers_for_trailing_metadata, s->send_trailing_metadata, &hopt, &t->outbuf); } diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index ce72fc3d08a..29dfa885de4 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -766,20 +766,50 @@ static bool op_can_be_run(grpc_transport_stream_op_batch *curr_op, bool is_canceled_or_failed = stream_state->state_op_done[OP_CANCEL_ERROR] || stream_state->state_callback_received[OP_FAILED]; if (is_canceled_or_failed) { - if (op_id == OP_SEND_INITIAL_METADATA) result = false; - if (op_id == OP_SEND_MESSAGE) result = false; - if (op_id == OP_SEND_TRAILING_METADATA) result = false; - if (op_id == OP_CANCEL_ERROR) result = false; + if (op_id == OP_SEND_INITIAL_METADATA) { + CRONET_LOG(GPR_DEBUG, "Because"); + result = false; + } + if (op_id == OP_SEND_MESSAGE) { + CRONET_LOG(GPR_DEBUG, "Because"); + result = false; + } + if (op_id == OP_SEND_TRAILING_METADATA) { + CRONET_LOG(GPR_DEBUG, "Because"); + result = false; + } + if (op_id == OP_CANCEL_ERROR) { + CRONET_LOG(GPR_DEBUG, "Because"); + result = false; + } /* already executed */ if (op_id == OP_RECV_INITIAL_METADATA && - stream_state->state_op_done[OP_RECV_INITIAL_METADATA]) + stream_state->state_op_done[OP_RECV_INITIAL_METADATA]) { + CRONET_LOG(GPR_DEBUG, "Because"); result = false; - if (op_id == OP_RECV_MESSAGE && - stream_state->state_op_done[OP_RECV_MESSAGE]) + } + if (op_id == OP_RECV_MESSAGE && op_state->state_op_done[OP_RECV_MESSAGE]) { + CRONET_LOG(GPR_DEBUG, "Because"); result = false; + } if (op_id == OP_RECV_TRAILING_METADATA && - stream_state->state_op_done[OP_RECV_TRAILING_METADATA]) + stream_state->state_op_done[OP_RECV_TRAILING_METADATA]) { + CRONET_LOG(GPR_DEBUG, "Because"); result = false; + } + /* ON_COMPLETE can be processed if one of the following conditions is met: + * 1. the stream failed + * 2. the stream is cancelled, and the callback is received + * 3. the stream succeeded before cancel is effective + * 4. the stream is cancelled, and the stream is never started */ + if (op_id == OP_ON_COMPLETE && + !(stream_state->state_callback_received[OP_FAILED] || + stream_state->state_callback_received[OP_CANCELED] || + stream_state->state_callback_received[OP_SUCCEEDED] || + !stream_state->state_op_done[OP_SEND_INITIAL_METADATA])) { + CRONET_LOG(GPR_DEBUG, "Because"); + result = false; + } } else if (op_id == OP_SEND_INITIAL_METADATA) { /* already executed */ if (stream_state->state_op_done[OP_SEND_INITIAL_METADATA]) result = false; @@ -868,7 +898,7 @@ static bool op_can_be_run(grpc_transport_stream_op_batch *curr_op, CRONET_LOG(GPR_DEBUG, "Because"); result = false; } else if (curr_op->recv_message && - !stream_state->state_op_done[OP_RECV_MESSAGE]) { + !op_state->state_op_done[OP_RECV_MESSAGE]) { CRONET_LOG(GPR_DEBUG, "Because"); result = false; } else if (curr_op->cancel_stream && @@ -1067,6 +1097,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_op->payload->recv_message.recv_message_ready, GRPC_ERROR_NONE); stream_state->state_op_done[OP_RECV_MESSAGE] = true; + oas->state.state_op_done[OP_RECV_MESSAGE] = true; result = ACTION_TAKEN_NO_CALLBACK; } else if (stream_state->state_callback_received[OP_FAILED]) { CRONET_LOG(GPR_DEBUG, "Stream failed."); @@ -1074,6 +1105,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_op->payload->recv_message.recv_message_ready, GRPC_ERROR_NONE); stream_state->state_op_done[OP_RECV_MESSAGE] = true; + oas->state.state_op_done[OP_RECV_MESSAGE] = true; result = ACTION_TAKEN_NO_CALLBACK; } else if (stream_state->rs.read_stream_closed == true) { /* No more data will be received */ @@ -1214,8 +1246,8 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, } else if (stream_op->cancel_stream && op_can_be_run(stream_op, s, &oas->state, OP_CANCEL_ERROR)) { CRONET_LOG(GPR_DEBUG, "running: %p OP_CANCEL_ERROR", oas); - CRONET_LOG(GPR_DEBUG, "W: bidirectional_stream_cancel(%p)", s->cbs); if (s->cbs) { + CRONET_LOG(GPR_DEBUG, "W: bidirectional_stream_cancel(%p)", s->cbs); bidirectional_stream_cancel(s->cbs); result = ACTION_TAKEN_WITH_CALLBACK; } else { diff --git a/src/core/lib/channel/channel_stack.h b/src/core/lib/channel/channel_stack.h index b0559ad745c..a80f8aa8268 100644 --- a/src/core/lib/channel/channel_stack.h +++ b/src/core/lib/channel/channel_stack.h @@ -234,7 +234,7 @@ void grpc_call_stack_set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx, grpc_call_stack *call_stack, grpc_polling_entity *pollent); -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_CALL_STACK_REF(call_stack, reason) \ grpc_stream_ref(&(call_stack)->refcount, reason) #define GRPC_CALL_STACK_UNREF(exec_ctx, call_stack, reason) \ diff --git a/src/core/lib/http/httpcli_security_connector.c b/src/core/lib/http/httpcli_security_connector.c index 34a77c3bf41..97c28865258 100644 --- a/src/core/lib/http/httpcli_security_connector.c +++ b/src/core/lib/http/httpcli_security_connector.c @@ -25,6 +25,7 @@ #include #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/channel/handshaker_registry.h" #include "src/core/lib/security/transport/security_handshaker.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/support/string.h" @@ -157,7 +158,6 @@ static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg, gpr_timespec deadline, void (*on_done)(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *endpoint)) { - grpc_channel_security_connector *sc = NULL; on_done_closure *c = gpr_malloc(sizeof(*c)); const char *pem_root_certs = grpc_get_default_ssl_roots(); if (pem_root_certs == NULL) { @@ -168,11 +168,13 @@ static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg, } c->func = on_done; c->arg = arg; - c->handshake_mgr = grpc_handshake_manager_create(); + grpc_channel_security_connector *sc = NULL; GPR_ASSERT(httpcli_ssl_channel_security_connector_create( exec_ctx, pem_root_certs, host, &sc) == GRPC_SECURITY_OK); - grpc_channel_security_connector_add_handshakers(exec_ctx, sc, - c->handshake_mgr); + grpc_arg channel_arg = grpc_security_connector_to_arg(&sc->base); + grpc_channel_args args = {1, &channel_arg}; + c->handshake_mgr = grpc_handshake_manager_create(); + grpc_handshakers_add(exec_ctx, HANDSHAKER_CLIENT, &args, c->handshake_mgr); grpc_handshake_manager_do_handshake( exec_ctx, c->handshake_mgr, tcp, NULL /* channel_args */, deadline, NULL /* acceptor */, on_handshake_done, c /* user_data */); diff --git a/src/core/lib/iomgr/closure.c b/src/core/lib/iomgr/closure.c index 719e2e8cee0..e028e72ed6d 100644 --- a/src/core/lib/iomgr/closure.c +++ b/src/core/lib/iomgr/closure.c @@ -24,7 +24,11 @@ #include "src/core/lib/profiling/timers.h" -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_closure = GRPC_TRACER_INITIALIZER(false); +#endif + +#ifndef NDEBUG grpc_closure *grpc_closure_init(const char *file, int line, grpc_closure *closure, grpc_iomgr_cb_func cb, void *cb_arg, @@ -37,7 +41,7 @@ grpc_closure *grpc_closure_init(grpc_closure *closure, grpc_iomgr_cb_func cb, closure->cb = cb; closure->cb_arg = cb_arg; closure->scheduler = scheduler; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG closure->scheduled = false; closure->file_initiated = NULL; closure->line_initiated = 0; @@ -112,7 +116,7 @@ static void closure_wrapper(grpc_exec_ctx *exec_ctx, void *arg, cb(exec_ctx, cb_arg, error); } -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG grpc_closure *grpc_closure_create(const char *file, int line, grpc_iomgr_cb_func cb, void *cb_arg, grpc_closure_scheduler *scheduler) { @@ -123,7 +127,7 @@ grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg, wrapped_closure *wc = gpr_malloc(sizeof(*wc)); wc->cb = cb; wc->cb_arg = cb_arg; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG grpc_closure_init(file, line, &wc->wrapper, closure_wrapper, wc, scheduler); #else grpc_closure_init(&wc->wrapper, closure_wrapper, wc, scheduler); @@ -131,7 +135,7 @@ grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg, return &wc->wrapper; } -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_run(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure *c, grpc_error *error) { #else @@ -140,7 +144,7 @@ void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *c, #endif GPR_TIMER_BEGIN("grpc_closure_run", 0); if (c != NULL) { -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG c->file_initiated = file; c->line_initiated = line; c->run = true; @@ -153,7 +157,7 @@ void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *c, GPR_TIMER_END("grpc_closure_run", 0); } -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_sched(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure *c, grpc_error *error) { #else @@ -162,7 +166,7 @@ void grpc_closure_sched(grpc_exec_ctx *exec_ctx, grpc_closure *c, #endif GPR_TIMER_BEGIN("grpc_closure_sched", 0); if (c != NULL) { -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG GPR_ASSERT(!c->scheduled); c->scheduled = true; c->file_initiated = file; @@ -177,7 +181,7 @@ void grpc_closure_sched(grpc_exec_ctx *exec_ctx, grpc_closure *c, GPR_TIMER_END("grpc_closure_sched", 0); } -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_list_sched(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure_list *list) { #else @@ -186,7 +190,7 @@ void grpc_closure_list_sched(grpc_exec_ctx *exec_ctx, grpc_closure_list *list) { grpc_closure *c = list->head; while (c != NULL) { grpc_closure *next = c->next_data.next; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG GPR_ASSERT(!c->scheduled); c->scheduled = true; c->file_initiated = file; diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index 3ecf9e947bf..cd32a4ba381 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -26,9 +26,17 @@ #include "src/core/lib/iomgr/error.h" #include "src/core/lib/support/mpscq.h" +#ifdef __cplusplus +extern "C" { +#endif + struct grpc_closure; typedef struct grpc_closure grpc_closure; +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_closure; +#endif + typedef struct grpc_closure_list { grpc_closure *head; grpc_closure *tail; @@ -38,7 +46,9 @@ typedef struct grpc_closure_list { * * \param arg Arbitrary input. * \param error GRPC_ERROR_NONE if no error occurred, otherwise some grpc_error - * describing what went wrong */ + * describing what went wrong. + * Error contract: it is not the cb's job to unref this error; + * the closure scheduler will do that after the cb returns */ typedef void (*grpc_iomgr_cb_func)(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error); @@ -59,8 +69,6 @@ struct grpc_closure_scheduler { const grpc_closure_scheduler_vtable *vtable; }; -// #define GRPC_CLOSURE_RICH_DEBUG - /** A closure over a grpc_iomgr_cb_func. */ struct grpc_closure { /** Once queued, next indicates the next queued closure; before then, scratch @@ -89,7 +97,7 @@ struct grpc_closure { // extra tracing and debugging for grpc_closure. This incurs a decent amount of // overhead per closure, so it must be enabled at compile time. -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG bool scheduled; bool run; // true = run, false = scheduled const char *file_created; @@ -100,7 +108,7 @@ struct grpc_closure { }; /** Initializes \a closure with \a cb and \a cb_arg. Returns \a closure. */ -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG grpc_closure *grpc_closure_init(const char *file, int line, grpc_closure *closure, grpc_iomgr_cb_func cb, void *cb_arg, @@ -116,7 +124,7 @@ grpc_closure *grpc_closure_init(grpc_closure *closure, grpc_iomgr_cb_func cb, #endif /* Create a heap allocated closure: try to avoid except for very rare events */ -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG grpc_closure *grpc_closure_create(const char *file, int line, grpc_iomgr_cb_func cb, void *cb_arg, grpc_closure_scheduler *scheduler); @@ -153,7 +161,7 @@ bool grpc_closure_list_empty(grpc_closure_list list); /** Run a closure directly. Caller ensures that no locks are being held above. * Note that calling this at the end of a closure callback function itself is * by definition safe. */ -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_run(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error); #define GRPC_CLOSURE_RUN(exec_ctx, closure, error) \ @@ -166,7 +174,7 @@ void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *closure, #endif /** Schedule a closure to be run. Does not need to be run from a safe point. */ -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_sched(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error); #define GRPC_CLOSURE_SCHED(exec_ctx, closure, error) \ @@ -180,7 +188,7 @@ void grpc_closure_sched(grpc_exec_ctx *exec_ctx, grpc_closure *closure, /** Schedule all closures in a list to be run. Does not need to be run from a * safe point. */ -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_list_sched(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure_list *closure_list); @@ -193,4 +201,8 @@ void grpc_closure_list_sched(grpc_exec_ctx *exec_ctx, grpc_closure_list_sched(exec_ctx, closure_list) #endif +#ifdef __cplusplus +} +#endif + #endif /* GRPC_CORE_LIB_IOMGR_CLOSURE_H */ diff --git a/src/core/lib/iomgr/combiner.c b/src/core/lib/iomgr/combiner.c index 750ff102ff3..7f9c5d837f8 100644 --- a/src/core/lib/iomgr/combiner.c +++ b/src/core/lib/iomgr/combiner.c @@ -102,12 +102,14 @@ static void start_destroy(grpc_exec_ctx *exec_ctx, grpc_combiner *lock) { } } -#ifdef GRPC_COMBINER_REFCOUNT_DEBUG -#define GRPC_COMBINER_DEBUG_SPAM(op, delta) \ - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, \ - "combiner[%p] %s %" PRIdPTR " --> %" PRIdPTR " %s", lock, (op), \ - gpr_atm_no_barrier_load(&lock->refs.count), \ - gpr_atm_no_barrier_load(&lock->refs.count) + (delta), reason); +#ifndef NDEBUG +#define GRPC_COMBINER_DEBUG_SPAM(op, delta) \ + if (GRPC_TRACER_ON(grpc_combiner_trace)) { \ + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, \ + "C:%p %s %" PRIdPTR " --> %" PRIdPTR " %s", lock, (op), \ + gpr_atm_no_barrier_load(&lock->refs.count), \ + gpr_atm_no_barrier_load(&lock->refs.count) + (delta), reason); \ + } #else #define GRPC_COMBINER_DEBUG_SPAM(op, delta) #endif @@ -247,7 +249,7 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx) { GPR_TIMER_BEGIN("combiner.exec1", 0); grpc_closure *cl = (grpc_closure *)n; grpc_error *cl_err = cl->error_data.error; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG cl->scheduled = false; #endif cl->cb(exec_ctx, cl->cb_arg, cl_err); @@ -264,7 +266,7 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx) { gpr_log(GPR_DEBUG, "C:%p execute_final[%d] c=%p", lock, loops, c)); grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG c->scheduled = false; #endif c->cb(exec_ctx, c->cb_arg, error); diff --git a/src/core/lib/iomgr/combiner.h b/src/core/lib/iomgr/combiner.h index a616113ca0b..8e0434369d3 100644 --- a/src/core/lib/iomgr/combiner.h +++ b/src/core/lib/iomgr/combiner.h @@ -35,8 +35,7 @@ // necessary grpc_combiner *grpc_combiner_create(void); -//#define GRPC_COMBINER_REFCOUNT_DEBUG -#ifdef GRPC_COMBINER_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_COMBINER_DEBUG_ARGS \ , const char *file, int line, const char *reason #define GRPC_COMBINER_REF(combiner, reason) \ diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index 68884226b55..a95929a1fb5 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -30,10 +30,15 @@ #include #endif +#include "src/core/lib/debug/trace.h" #include "src/core/lib/iomgr/error_internal.h" #include "src/core/lib/profiling/timers.h" #include "src/core/lib/slice/slice_internal.h" +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_error_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + static const char *error_int_name(grpc_error_ints key) { switch (key) { case GRPC_ERROR_INT_ERRNO: @@ -119,14 +124,14 @@ bool grpc_error_is_special(grpc_error *err) { err == GRPC_ERROR_CANCELLED; } -#ifdef GRPC_ERROR_REFCOUNT_DEBUG -grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line, - const char *func) { +#ifndef NDEBUG +grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line) { if (grpc_error_is_special(err)) return err; - gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d %s]", err, - gpr_atm_no_barrier_load(&err->atomics.refs.count), - gpr_atm_no_barrier_load(&err->atomics.refs.count) + 1, file, line, - func); + if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { + gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d]", err, + gpr_atm_no_barrier_load(&err->atomics.refs.count), + gpr_atm_no_barrier_load(&err->atomics.refs.count) + 1, file, line); + } gpr_ref(&err->atomics.refs); return err; } @@ -172,14 +177,14 @@ static void error_destroy(grpc_error *err) { gpr_free(err); } -#ifdef GRPC_ERROR_REFCOUNT_DEBUG -void grpc_error_unref(grpc_error *err, const char *file, int line, - const char *func) { +#ifndef NDEBUG +void grpc_error_unref(grpc_error *err, const char *file, int line) { if (grpc_error_is_special(err)) return; - gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d %s]", err, - gpr_atm_no_barrier_load(&err->atomics.refs.count), - gpr_atm_no_barrier_load(&err->atomics.refs.count) - 1, file, line, - func); + if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { + gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d]", err, + gpr_atm_no_barrier_load(&err->atomics.refs.count), + gpr_atm_no_barrier_load(&err->atomics.refs.count) - 1, file, line); + } if (gpr_unref(&err->atomics.refs)) { error_destroy(err); } @@ -202,13 +207,17 @@ static uint8_t get_placement(grpc_error **err, size_t size) { if ((*err)->arena_size + slots > (*err)->arena_capacity) { return UINT8_MAX; } -#ifdef GRPC_ERROR_REFCOUNT_DEBUG +#ifndef NDEBUG grpc_error *orig = *err; #endif *err = gpr_realloc( *err, sizeof(grpc_error) + (*err)->arena_capacity * sizeof(intptr_t)); -#ifdef GRPC_ERROR_REFCOUNT_DEBUG - if (*err != orig) gpr_log(GPR_DEBUG, "realloc %p -> %p", orig, *err); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { + if (*err != orig) { + gpr_log(GPR_DEBUG, "realloc %p -> %p", orig, *err); + } + } #endif } uint8_t placement = (*err)->arena_size; @@ -316,8 +325,10 @@ grpc_error *grpc_error_create(const char *file, int line, grpc_slice desc, if (err == NULL) { // TODO(ctiller): make gpr_malloc return NULL return GRPC_ERROR_OOM; } -#ifdef GRPC_ERROR_REFCOUNT_DEBUG - gpr_log(GPR_DEBUG, "%p create [%s:%d]", err, file, line); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { + gpr_log(GPR_DEBUG, "%p create [%s:%d]", err, file, line); + } #endif err->arena_size = 0; @@ -395,8 +406,10 @@ static grpc_error *copy_error_and_unref(grpc_error *in) { new_arena_capacity = (uint8_t)(3 * new_arena_capacity / 2); } out = gpr_malloc(sizeof(*in) + new_arena_capacity * sizeof(intptr_t)); -#ifdef GRPC_ERROR_REFCOUNT_DEBUG - gpr_log(GPR_DEBUG, "%p create copying %p", out, in); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { + gpr_log(GPR_DEBUG, "%p create copying %p", out, in); + } #endif // bulk memcpy of the rest of the struct. size_t skip = sizeof(&out->atomics); diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index 1ce916f2ec5..b3629486918 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -26,6 +26,8 @@ #include #include +#include "src/core/lib/debug/trace.h" + #ifdef __cplusplus extern "C" { #endif @@ -36,6 +38,10 @@ extern "C" { typedef struct grpc_error grpc_error; +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_error_refcount; +#endif + typedef enum { /// 'errno' from the operating system GRPC_ERROR_INT_ERRNO, @@ -149,15 +155,11 @@ grpc_error *grpc_error_create(const char *file, int line, grpc_slice desc, grpc_error_create(__FILE__, __LINE__, grpc_slice_from_copied_string(desc), \ errs, count) -// #define GRPC_ERROR_REFCOUNT_DEBUG -#ifdef GRPC_ERROR_REFCOUNT_DEBUG -grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line, - const char *func); -void grpc_error_unref(grpc_error *err, const char *file, int line, - const char *func); -#define GRPC_ERROR_REF(err) grpc_error_ref(err, __FILE__, __LINE__, __func__) -#define GRPC_ERROR_UNREF(err) \ - grpc_error_unref(err, __FILE__, __LINE__, __func__) +#ifndef NDEBUG +grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line); +void grpc_error_unref(grpc_error *err, const char *file, int line); +#define GRPC_ERROR_REF(err) grpc_error_ref(err, __FILE__, __LINE__) +#define GRPC_ERROR_UNREF(err) grpc_error_unref(err, __FILE__, __LINE__) #else grpc_error *grpc_error_ref(grpc_error *err); void grpc_error_unref(grpc_error *err); diff --git a/src/core/lib/iomgr/ev_epoll1_linux.c b/src/core/lib/iomgr/ev_epoll1_linux.c index fae6827b512..fb54e9c9547 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.c +++ b/src/core/lib/iomgr/ev_epoll1_linux.c @@ -214,8 +214,10 @@ static grpc_fd *fd_create(int fd, const char *name) { char *fd_name; gpr_asprintf(&fd_name, "%s fd=%d", name, fd); grpc_iomgr_register_object(&new_fd->iomgr_object, fd_name); -#ifdef GRPC_FD_REF_COUNT_DEBUG - gpr_log(GPR_ERROR, "FD %d %p create %s", fd, (void *)new_fd, fd_name); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, new_fd, fd_name); + } #endif gpr_free(fd_name); diff --git a/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c b/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c index 1b5fe587835..23e2189c766 100644 --- a/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +++ b/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c @@ -147,8 +147,7 @@ struct grpc_fd { }; /* Reference counting for fds */ -// #define GRPC_FD_REF_COUNT_DEBUG -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void fd_ref(grpc_fd *fd, const char *reason, const char *file, int line); static void fd_unref(grpc_fd *fd, const char *reason, const char *file, int line); @@ -168,20 +167,18 @@ static void fd_global_shutdown(void); * Polling island Declarations */ -//#define PI_REFCOUNT_DEBUG - -#ifdef PI_REFCOUNT_DEBUG +#ifndef NDEBUG #define PI_ADD_REF(p, r) pi_add_ref_dbg((p), (r), __FILE__, __LINE__) #define PI_UNREF(exec_ctx, p, r) \ pi_unref_dbg((exec_ctx), (p), (r), __FILE__, __LINE__) -#else /* defined(PI_REFCOUNT_DEBUG) */ +#else #define PI_ADD_REF(p, r) pi_add_ref((p)) #define PI_UNREF(exec_ctx, p, r) pi_unref((exec_ctx), (p)) -#endif /* !defined(GRPC_PI_REF_COUNT_DEBUG) */ +#endif typedef struct worker_node { struct worker_node *next; @@ -313,21 +310,27 @@ gpr_atm g_epoll_sync; static void pi_add_ref(polling_island *pi); static void pi_unref(grpc_exec_ctx *exec_ctx, polling_island *pi); -#ifdef PI_REFCOUNT_DEBUG +#ifndef NDEBUG static void pi_add_ref_dbg(polling_island *pi, const char *reason, const char *file, int line) { - long old_cnt = gpr_atm_acq_load(&pi->ref_count); + if (GRPC_TRACER_ON(grpc_polling_trace)) { + gpr_atm old_cnt = gpr_atm_acq_load(&pi->ref_count); + gpr_log(GPR_DEBUG, "Add ref pi: %p, old:%" PRIdPTR " -> new:%" PRIdPTR + " (%s) - (%s, %d)", + pi, old_cnt, old_cnt + 1, reason, file, line); + } pi_add_ref(pi); - gpr_log(GPR_DEBUG, "Add ref pi: %p, old: %ld -> new:%ld (%s) - (%s, %d)", - (void *)pi, old_cnt, old_cnt + 1, reason, file, line); } static void pi_unref_dbg(grpc_exec_ctx *exec_ctx, polling_island *pi, const char *reason, const char *file, int line) { - long old_cnt = gpr_atm_acq_load(&pi->ref_count); + if (GRPC_TRACER_ON(grpc_polling_trace)) { + gpr_atm old_cnt = gpr_atm_acq_load(&pi->ref_count); + gpr_log(GPR_DEBUG, "Unref pi: %p, old:%" PRIdPTR " -> new:%" PRIdPTR + " (%s) - (%s, %d)", + pi, old_cnt, (old_cnt - 1), reason, file, line); + } pi_unref(exec_ctx, pi); - gpr_log(GPR_DEBUG, "Unref pi: %p, old:%ld -> new:%ld (%s) - (%s, %d)", - (void *)pi, old_cnt, (old_cnt - 1), reason, file, line); } #endif @@ -792,14 +795,17 @@ static void polling_island_global_shutdown() { static grpc_fd *fd_freelist = NULL; static gpr_mu fd_freelist_mu; -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG #define REF_BY(fd, n, reason) ref_by(fd, n, reason, __FILE__, __LINE__) #define UNREF_BY(fd, n, reason) unref_by(fd, n, reason, __FILE__, __LINE__) static void ref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_log(GPR_DEBUG, "FD %d %p ref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, + "FD %d %p ref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + } #else #define REF_BY(fd, n, reason) ref_by(fd, n) #define UNREF_BY(fd, n, reason) unref_by(fd, n) @@ -808,18 +814,19 @@ static void ref_by(grpc_fd *fd, int n) { GPR_ASSERT(gpr_atm_no_barrier_fetch_add(&fd->refst, n) > 0); } -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void unref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_atm old; - gpr_log(GPR_DEBUG, "FD %d %p unref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, + "FD %d %p unref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + } #else static void unref_by(grpc_fd *fd, int n) { - gpr_atm old; #endif - old = gpr_atm_full_fetch_add(&fd->refst, -n); + gpr_atm old = gpr_atm_full_fetch_add(&fd->refst, -n); if (old == n) { /* Add the fd to the freelist */ gpr_mu_lock(&fd_freelist_mu); @@ -837,7 +844,7 @@ static void unref_by(grpc_fd *fd, int n) { } /* Increment refcount by two to avoid changing the orphan bit */ -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void fd_ref(grpc_fd *fd, const char *reason, const char *file, int line) { ref_by(fd, 2, reason, file, line); @@ -905,8 +912,10 @@ static grpc_fd *fd_create(int fd, const char *name) { char *fd_name; gpr_asprintf(&fd_name, "%s fd=%d", name, fd); grpc_iomgr_register_object(&new_fd->iomgr_object, fd_name); -#ifdef GRPC_FD_REF_COUNT_DEBUG - gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, (void *)new_fd, fd_name); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, new_fd, fd_name); + } #endif gpr_free(fd_name); return new_fd; diff --git a/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c b/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c index d9be28b5bbc..1058f69a83d 100644 --- a/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +++ b/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c @@ -93,20 +93,18 @@ static void fd_global_shutdown(void); * epoll set Declarations */ -//#define EPS_REFCOUNT_DEBUG - -#ifdef EPS_REFCOUNT_DEBUG +#ifndef NDEBUG #define EPS_ADD_REF(p, r) eps_add_ref_dbg((p), (r), __FILE__, __LINE__) #define EPS_UNREF(exec_ctx, p, r) \ eps_unref_dbg((exec_ctx), (p), (r), __FILE__, __LINE__) -#else /* defined(EPS_REFCOUNT_DEBUG) */ +#else #define EPS_ADD_REF(p, r) eps_add_ref((p)) #define EPS_UNREF(exec_ctx, p, r) eps_unref((exec_ctx), (p)) -#endif /* !defined(GRPC_EPS_REF_COUNT_DEBUG) */ +#endif typedef struct epoll_set { /* Mutex poller should acquire to poll this. This enforces that only one @@ -226,21 +224,27 @@ gpr_atm g_epoll_sync; static void eps_add_ref(epoll_set *eps); static void eps_unref(grpc_exec_ctx *exec_ctx, epoll_set *eps); -#ifdef EPS_REFCOUNT_DEBUG +#ifndef NDEBUG static void eps_add_ref_dbg(epoll_set *eps, const char *reason, const char *file, int line) { - long old_cnt = gpr_atm_acq_load(&eps->ref_count); + if (GRPC_TRACER_ON(grpc_polling_trace)) { + gpr_atm old_cnt = gpr_atm_acq_load(&eps->ref_count); + gpr_log(GPR_DEBUG, "Add ref eps: %p, old:%" PRIdPTR " -> new:%" PRIdPTR + " (%s) - (%s, %d)", + eps, old_cnt, old_cnt + 1, reason, file, line); + } eps_add_ref(eps); - gpr_log(GPR_DEBUG, "Add ref eps: %p, old: %ld -> new:%ld (%s) - (%s, %d)", - (void *)eps, old_cnt, old_cnt + 1, reason, file, line); } static void eps_unref_dbg(grpc_exec_ctx *exec_ctx, epoll_set *eps, const char *reason, const char *file, int line) { - long old_cnt = gpr_atm_acq_load(&eps->ref_count); + if (GRPC_TRACER_ON(grpc_polling_trace)) { + gpr_atm old_cnt = gpr_atm_acq_load(&eps->ref_count); + gpr_log(GPR_DEBUG, "Unref eps: %p, old:%" PRIdPTR " -> new:%" PRIdPTR + " (%s) - (%s, %d)", + eps, old_cnt, (old_cnt - 1), reason, file, line); + } eps_unref(exec_ctx, eps); - gpr_log(GPR_DEBUG, "Unref eps: %p, old:%ld -> new:%ld (%s) - (%s, %d)", - (void *)eps, old_cnt, (old_cnt - 1), reason, file, line); } #endif diff --git a/src/core/lib/iomgr/ev_epollex_linux.c b/src/core/lib/iomgr/ev_epollex_linux.c index 615a238b5d8..ceecff7a880 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.c +++ b/src/core/lib/iomgr/ev_epollex_linux.c @@ -231,15 +231,18 @@ static bool append_error(grpc_error **composite, grpc_error *error, static grpc_fd *fd_freelist = NULL; static gpr_mu fd_freelist_mu; -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG #define REF_BY(fd, n, reason) ref_by(fd, n, reason, __FILE__, __LINE__) #define UNREF_BY(ec, fd, n, reason) \ unref_by(ec, fd, n, reason, __FILE__, __LINE__) static void ref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_log(GPR_DEBUG, "FD %d %p ref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, + "FD %d %p ref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + } #else #define REF_BY(fd, n, reason) ref_by(fd, n) #define UNREF_BY(ec, fd, n, reason) unref_by(ec, fd, n) @@ -264,18 +267,19 @@ static void fd_destroy(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { gpr_mu_unlock(&fd_freelist_mu); } -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void unref_by(grpc_exec_ctx *exec_ctx, grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_atm old; - gpr_log(GPR_DEBUG, "FD %d %p unref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, + "FD %d %p unref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + } #else static void unref_by(grpc_exec_ctx *exec_ctx, grpc_fd *fd, int n) { - gpr_atm old; #endif - old = gpr_atm_full_fetch_add(&fd->refst, -n); + gpr_atm old = gpr_atm_full_fetch_add(&fd->refst, -n); if (old == n) { GRPC_CLOSURE_SCHED(exec_ctx, GRPC_CLOSURE_CREATE(fd_destroy, fd, grpc_schedule_on_exec_ctx), @@ -328,8 +332,10 @@ static grpc_fd *fd_create(int fd, const char *name) { char *fd_name; gpr_asprintf(&fd_name, "%s fd=%d", name, fd); grpc_iomgr_register_object(&new_fd->iomgr_object, fd_name); -#ifdef GRPC_FD_REF_COUNT_DEBUG - gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, (void *)new_fd, fd_name); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, new_fd, fd_name); + } #endif gpr_free(fd_name); return new_fd; diff --git a/src/core/lib/iomgr/ev_epollsig_linux.c b/src/core/lib/iomgr/ev_epollsig_linux.c index e5757e4da76..29d5bf8e730 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.c +++ b/src/core/lib/iomgr/ev_epollsig_linux.c @@ -140,8 +140,7 @@ struct grpc_fd { }; /* Reference counting for fds */ -// #define GRPC_FD_REF_COUNT_DEBUG -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void fd_ref(grpc_fd *fd, const char *reason, const char *file, int line); static void fd_unref(grpc_fd *fd, const char *reason, const char *file, int line); @@ -161,20 +160,18 @@ static void fd_global_shutdown(void); * Polling island Declarations */ -//#define PI_REFCOUNT_DEBUG - -#ifdef PI_REFCOUNT_DEBUG +#ifndef NDEBUG #define PI_ADD_REF(p, r) pi_add_ref_dbg((p), (r), __FILE__, __LINE__) #define PI_UNREF(exec_ctx, p, r) \ pi_unref_dbg((exec_ctx), (p), (r), __FILE__, __LINE__) -#else /* defined(GRPC_WORKQUEUE_REFCOUNT_DEBUG) */ +#else #define PI_ADD_REF(p, r) pi_add_ref((p)) #define PI_UNREF(exec_ctx, p, r) pi_unref((exec_ctx), (p)) -#endif /* !defined(GRPC_PI_REF_COUNT_DEBUG) */ +#endif /* This is also used as grpc_workqueue (by directly casing it) */ typedef struct polling_island { @@ -287,21 +284,27 @@ gpr_atm g_epoll_sync; static void pi_add_ref(polling_island *pi); static void pi_unref(grpc_exec_ctx *exec_ctx, polling_island *pi); -#ifdef PI_REFCOUNT_DEBUG +#ifndef NDEBUG static void pi_add_ref_dbg(polling_island *pi, const char *reason, const char *file, int line) { - long old_cnt = gpr_atm_acq_load(&pi->ref_count); + if (GRPC_TRACER_ON(grpc_polling_trace)) { + gpr_atm old_cnt = gpr_atm_acq_load(&pi->ref_count); + gpr_log(GPR_DEBUG, "Add ref pi: %p, old:%" PRIdPTR " -> new:%" PRIdPTR + " (%s) - (%s, %d)", + pi, old_cnt, old_cnt + 1, reason, file, line); + } pi_add_ref(pi); - gpr_log(GPR_DEBUG, "Add ref pi: %p, old: %ld -> new:%ld (%s) - (%s, %d)", - (void *)pi, old_cnt, old_cnt + 1, reason, file, line); } static void pi_unref_dbg(grpc_exec_ctx *exec_ctx, polling_island *pi, const char *reason, const char *file, int line) { - long old_cnt = gpr_atm_acq_load(&pi->ref_count); + if (GRPC_TRACER_ON(grpc_polling_trace)) { + gpr_atm old_cnt = gpr_atm_acq_load(&pi->ref_count); + gpr_log(GPR_DEBUG, "Unref pi: %p, old:%" PRIdPTR " -> new:%" PRIdPTR + " (%s) - (%s, %d)", + pi, old_cnt, (old_cnt - 1), reason, file, line); + } pi_unref(exec_ctx, pi); - gpr_log(GPR_DEBUG, "Unref pi: %p, old:%ld -> new:%ld (%s) - (%s, %d)", - (void *)pi, old_cnt, (old_cnt - 1), reason, file, line); } #endif @@ -720,14 +723,17 @@ static void polling_island_global_shutdown() { static grpc_fd *fd_freelist = NULL; static gpr_mu fd_freelist_mu; -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG #define REF_BY(fd, n, reason) ref_by(fd, n, reason, __FILE__, __LINE__) #define UNREF_BY(fd, n, reason) unref_by(fd, n, reason, __FILE__, __LINE__) static void ref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_log(GPR_DEBUG, "FD %d %p ref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, + "FD %d %p ref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + } #else #define REF_BY(fd, n, reason) ref_by(fd, n) #define UNREF_BY(fd, n, reason) unref_by(fd, n) @@ -736,18 +742,19 @@ static void ref_by(grpc_fd *fd, int n) { GPR_ASSERT(gpr_atm_no_barrier_fetch_add(&fd->refst, n) > 0); } -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void unref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_atm old; - gpr_log(GPR_DEBUG, "FD %d %p unref %d %ld -> %ld [%s; %s:%d]", fd->fd, - (void *)fd, n, gpr_atm_no_barrier_load(&fd->refst), - gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, + "FD %d %p unref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + } #else static void unref_by(grpc_fd *fd, int n) { - gpr_atm old; #endif - old = gpr_atm_full_fetch_add(&fd->refst, -n); + gpr_atm old = gpr_atm_full_fetch_add(&fd->refst, -n); if (old == n) { /* Add the fd to the freelist */ gpr_mu_lock(&fd_freelist_mu); @@ -765,7 +772,7 @@ static void unref_by(grpc_fd *fd, int n) { } /* Increment refcount by two to avoid changing the orphan bit */ -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void fd_ref(grpc_fd *fd, const char *reason, const char *file, int line) { ref_by(fd, 2, reason, file, line); @@ -833,9 +840,6 @@ static grpc_fd *fd_create(int fd, const char *name) { char *fd_name; gpr_asprintf(&fd_name, "%s fd=%d", name, fd); grpc_iomgr_register_object(&new_fd->iomgr_object, fd_name); -#ifdef GRPC_FD_REF_COUNT_DEBUG - gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, (void *)new_fd, fd_name); -#endif gpr_free(fd_name); return new_fd; } diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index d1a27b82287..1f8d7eef26d 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -134,9 +134,7 @@ static void fd_end_poll(grpc_exec_ctx *exec_ctx, grpc_fd_watcher *rec, /* Return 1 if this fd is orphaned, 0 otherwise */ static bool fd_is_orphaned(grpc_fd *fd); -/* Reference counting for fds */ -//#define GRPC_FD_REF_COUNT_DEBUG -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void fd_ref(grpc_fd *fd, const char *reason, const char *file, int line); static void fd_unref(grpc_fd *fd, const char *reason, const char *file, int line); @@ -263,14 +261,17 @@ cv_fd_table g_cvfds; * fd_posix.c */ -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG #define REF_BY(fd, n, reason) ref_by(fd, n, reason, __FILE__, __LINE__) #define UNREF_BY(fd, n, reason) unref_by(fd, n, reason, __FILE__, __LINE__) static void ref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_log(GPR_DEBUG, "FD %d %p ref %d %d -> %d [%s; %s:%d]", fd->fd, fd, n, - (int)gpr_atm_no_barrier_load(&fd->refst), - (int)gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, + "FD %d %p ref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line); + } #else #define REF_BY(fd, n, reason) ref_by(fd, n) #define UNREF_BY(fd, n, reason) unref_by(fd, n) @@ -279,18 +280,19 @@ static void ref_by(grpc_fd *fd, int n) { GPR_ASSERT(gpr_atm_no_barrier_fetch_add(&fd->refst, n) > 0); } -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void unref_by(grpc_fd *fd, int n, const char *reason, const char *file, int line) { - gpr_atm old; - gpr_log(GPR_DEBUG, "FD %d %p unref %d %d -> %d [%s; %s:%d]", fd->fd, fd, n, - (int)gpr_atm_no_barrier_load(&fd->refst), - (int)gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + if (GRPC_TRACER_ON(grpc_trace_fd_refcount)) { + gpr_log(GPR_DEBUG, + "FD %d %p unref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]", + fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst), + gpr_atm_no_barrier_load(&fd->refst) - n, reason, file, line); + } #else static void unref_by(grpc_fd *fd, int n) { - gpr_atm old; #endif - old = gpr_atm_full_fetch_add(&fd->refst, -n); + gpr_atm old = gpr_atm_full_fetch_add(&fd->refst, -n); if (old == n) { gpr_mu_destroy(&fd->mu); grpc_iomgr_unregister_object(&fd->iomgr_object); @@ -321,9 +323,6 @@ static grpc_fd *fd_create(int fd, const char *name) { gpr_asprintf(&name2, "%s fd=%d", name, fd); grpc_iomgr_register_object(&r->iomgr_object, name2); gpr_free(name2); -#ifdef GRPC_FD_REF_COUNT_DEBUG - gpr_log(GPR_DEBUG, "FD %d %p create %s", fd, r, name); -#endif return r; } @@ -417,7 +416,7 @@ static void fd_orphan(grpc_exec_ctx *exec_ctx, grpc_fd *fd, } /* increment refcount by two to avoid changing the orphan bit */ -#ifdef GRPC_FD_REF_COUNT_DEBUG +#ifndef NDEBUG static void fd_ref(grpc_fd *fd, const char *reason, const char *file, int line) { ref_by(fd, 2, reason, file, line); diff --git a/src/core/lib/iomgr/ev_posix.c b/src/core/lib/iomgr/ev_posix.c index dacdb9f4da6..2648df393d7 100644 --- a/src/core/lib/iomgr/ev_posix.c +++ b/src/core/lib/iomgr/ev_posix.c @@ -41,6 +41,10 @@ grpc_tracer_flag grpc_polling_trace = GRPC_TRACER_INITIALIZER(false); /* Disabled by default */ +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + /** Default poll() function - a pointer so that it can be overridden by some * tests */ grpc_poll_function_type grpc_poll_function = poll; diff --git a/src/core/lib/iomgr/exec_ctx.c b/src/core/lib/iomgr/exec_ctx.c index 51c36216c5d..833170ceed5 100644 --- a/src/core/lib/iomgr/exec_ctx.c +++ b/src/core/lib/iomgr/exec_ctx.c @@ -62,7 +62,7 @@ bool grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx) { grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; did_something = true; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG c->scheduled = false; #endif c->cb(exec_ctx, c->cb_arg, error); @@ -85,10 +85,21 @@ void grpc_exec_ctx_finish(grpc_exec_ctx *exec_ctx) { static void exec_ctx_run(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error) { -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG closure->scheduled = false; + if (GRPC_TRACER_ON(grpc_trace_closure)) { + gpr_log(GPR_DEBUG, "running closure %p: created [%s:%d]: %s [%s:%d]", + closure, closure->file_created, closure->line_created, + closure->run ? "run" : "scheduled", closure->file_initiated, + closure->line_initiated); + } #endif closure->cb(exec_ctx, closure->cb_arg, error); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_closure)) { + gpr_log(GPR_DEBUG, "closure %p finished", closure); + } +#endif GRPC_ERROR_UNREF(error); } diff --git a/src/core/lib/iomgr/executor.c b/src/core/lib/iomgr/executor.c index fda274e7978..7621a7fe75a 100644 --- a/src/core/lib/iomgr/executor.c +++ b/src/core/lib/iomgr/executor.c @@ -58,7 +58,7 @@ static size_t run_closures(grpc_exec_ctx *exec_ctx, grpc_closure_list list) { while (c != NULL) { grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG c->scheduled = false; #endif c->cb(exec_ctx, c->cb_arg, error); diff --git a/src/core/lib/iomgr/pollset.h b/src/core/lib/iomgr/pollset.h index 3ff878e5960..a609a3877a7 100644 --- a/src/core/lib/iomgr/pollset.h +++ b/src/core/lib/iomgr/pollset.h @@ -25,6 +25,10 @@ #include "src/core/lib/iomgr/exec_ctx.h" +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_fd_refcount; +#endif + /* A grpc_pollset is a set of file descriptors that a higher level item is interested in. For example: - a server will typically keep a pollset containing all connected channels, diff --git a/src/core/lib/iomgr/pollset_uv.c b/src/core/lib/iomgr/pollset_uv.c index 07c7c045591..1a54065a914 100644 --- a/src/core/lib/iomgr/pollset_uv.c +++ b/src/core/lib/iomgr/pollset_uv.c @@ -31,6 +31,12 @@ #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/iomgr/pollset_uv.h" +#include "src/core/lib/debug/trace.h" + +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + struct grpc_pollset { uv_timer_t timer; int shutting_down; diff --git a/src/core/lib/iomgr/pollset_windows.c b/src/core/lib/iomgr/pollset_windows.c index d5a03732cbe..1bfc2a22a8b 100644 --- a/src/core/lib/iomgr/pollset_windows.c +++ b/src/core/lib/iomgr/pollset_windows.c @@ -30,6 +30,10 @@ #define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker *)1) +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + gpr_mu grpc_polling_mu; static grpc_pollset_worker *g_active_poller; static grpc_pollset_worker g_global_root_worker; diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c index 66e81bf81f7..5de2b0f4ee0 100644 --- a/src/core/lib/iomgr/tcp_posix.c +++ b/src/core/lib/iomgr/tcp_posix.c @@ -163,15 +163,18 @@ static void tcp_free(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { gpr_free(tcp); } -/*#define GRPC_TCP_REFCOUNT_DEBUG*/ -#ifdef GRPC_TCP_REFCOUNT_DEBUG +#ifndef NDEBUG #define TCP_UNREF(cl, tcp, reason) \ tcp_unref((cl), (tcp), (reason), __FILE__, __LINE__) #define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), __FILE__, __LINE__) static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP unref %p : %s %d -> %d", tcp, - reason, tcp->refcount.count, tcp->refcount.count - 1); + if (GRPC_TRACER_ON(grpc_tcp_trace)) { + gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, + val - 1); + } if (gpr_unref(&tcp->refcount)) { tcp_free(exec_ctx, tcp); } @@ -179,8 +182,12 @@ static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, static void tcp_ref(grpc_tcp *tcp, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP ref %p : %s %d -> %d", tcp, - reason, tcp->refcount.count, tcp->refcount.count + 1); + if (GRPC_TRACER_ON(grpc_tcp_trace)) { + gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "TCP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, + val + 1); + } gpr_ref(&tcp->refcount); } #else diff --git a/src/core/lib/iomgr/tcp_uv.c b/src/core/lib/iomgr/tcp_uv.c index ab5bb9f7dac..7c21b44e76c 100644 --- a/src/core/lib/iomgr/tcp_uv.c +++ b/src/core/lib/iomgr/tcp_uv.c @@ -69,16 +69,18 @@ static void tcp_free(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { gpr_free(tcp); } -/*#define GRPC_TCP_REFCOUNT_DEBUG*/ -#ifdef GRPC_TCP_REFCOUNT_DEBUG +#ifndef NDEBUG #define TCP_UNREF(exec_ctx, tcp, reason) \ tcp_unref((exec_ctx), (tcp), (reason), __FILE__, __LINE__) #define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), __FILE__, __LINE__) static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "TCP unref %p : %s %" PRIiPTR " -> %" PRIiPTR, tcp, reason, - tcp->refcount.count, tcp->refcount.count - 1); + if (GRPC_TRACER_ON(grpc_tcp_trace)) { + gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, + val - 1); + } if (gpr_unref(&tcp->refcount)) { tcp_free(exec_ctx, tcp); } @@ -86,9 +88,12 @@ static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, static void tcp_ref(grpc_tcp *tcp, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "TCP ref %p : %s %" PRIiPTR " -> %" PRIiPTR, tcp, reason, - tcp->refcount.count, tcp->refcount.count + 1); + if (GRPC_TRACER_ON(grpc_tcp_trace)) { + gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "TCP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, + val + 1); + } gpr_ref(&tcp->refcount); } #else diff --git a/src/core/lib/iomgr/tcp_windows.c b/src/core/lib/iomgr/tcp_windows.c index 161b3975349..6704a158ceb 100644 --- a/src/core/lib/iomgr/tcp_windows.c +++ b/src/core/lib/iomgr/tcp_windows.c @@ -48,6 +48,8 @@ #define GRPC_FIONBIO FIONBIO #endif +grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false); + static grpc_error *set_non_block(SOCKET sock) { int status; uint32_t param = 1; @@ -115,15 +117,18 @@ static void tcp_free(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { gpr_free(tcp); } -/*#define GRPC_TCP_REFCOUNT_DEBUG*/ -#ifdef GRPC_TCP_REFCOUNT_DEBUG +#ifndef NDEBUG #define TCP_UNREF(exec_ctx, tcp, reason) \ tcp_unref((exec_ctx), (tcp), (reason), __FILE__, __LINE__) #define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), __FILE__, __LINE__) static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP unref %p : %s %d -> %d", tcp, - reason, tcp->refcount.count, tcp->refcount.count - 1); + if (GRPC_TRACER_ON(grpc_tcp_trace)) { + gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, + val - 1); + } if (gpr_unref(&tcp->refcount)) { tcp_free(exec_ctx, tcp); } @@ -131,8 +136,12 @@ static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, static void tcp_ref(grpc_tcp *tcp, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP ref %p : %s %d -> %d", tcp, - reason, tcp->refcount.count, tcp->refcount.count + 1); + if (GRPC_TRACER_ON(grpc_tcp_trace)) { + gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "TCP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, + val + 1); + } gpr_ref(&tcp->refcount); } #else diff --git a/src/core/lib/security/context/security_context.c b/src/core/lib/security/context/security_context.c index 02b6d0164b3..dffe6d2e912 100644 --- a/src/core/lib/security/context/security_context.c +++ b/src/core/lib/security/context/security_context.c @@ -29,6 +29,11 @@ #include #include +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_auth_context_refcount = + GRPC_TRACER_INITIALIZER(false); +#endif + /* --- grpc_call --- */ grpc_call_error grpc_call_set_credentials(grpc_call *call, @@ -122,14 +127,17 @@ grpc_auth_context *grpc_auth_context_create(grpc_auth_context *chained) { return ctx; } -#ifdef GRPC_AUTH_CONTEXT_REFCOUNT_DEBUG +#ifndef NDEBUG grpc_auth_context *grpc_auth_context_ref(grpc_auth_context *ctx, const char *file, int line, const char *reason) { if (ctx == NULL) return NULL; - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "AUTH_CONTEXT:%p ref %d -> %d %s", ctx, (int)ctx->refcount.count, - (int)ctx->refcount.count + 1, reason); + if (GRPC_TRACER_ON(grpc_trace_auth_context_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&ctx->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "AUTH_CONTEXT:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", ctx, val, + val + 1, reason); + } #else grpc_auth_context *grpc_auth_context_ref(grpc_auth_context *ctx) { if (ctx == NULL) return NULL; @@ -138,13 +146,16 @@ grpc_auth_context *grpc_auth_context_ref(grpc_auth_context *ctx) { return ctx; } -#ifdef GRPC_AUTH_CONTEXT_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_auth_context_unref(grpc_auth_context *ctx, const char *file, int line, const char *reason) { if (ctx == NULL) return; - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "AUTH_CONTEXT:%p unref %d -> %d %s", ctx, (int)ctx->refcount.count, - (int)ctx->refcount.count - 1, reason); + if (GRPC_TRACER_ON(grpc_trace_auth_context_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&ctx->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "AUTH_CONTEXT:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", ctx, val, + val - 1, reason); + } #else void grpc_auth_context_unref(grpc_auth_context *ctx) { if (ctx == NULL) return; diff --git a/src/core/lib/security/context/security_context.h b/src/core/lib/security/context/security_context.h index 102f9d6e2ff..0df39257a7a 100644 --- a/src/core/lib/security/context/security_context.h +++ b/src/core/lib/security/context/security_context.h @@ -22,6 +22,10 @@ #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/security/credentials/credentials.h" +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_auth_context_refcount; +#endif + #ifdef __cplusplus extern "C" { #endif @@ -50,7 +54,7 @@ struct grpc_auth_context { grpc_auth_context *grpc_auth_context_create(grpc_auth_context *chained); /* Refcounting. */ -#ifdef GRPC_AUTH_CONTEXT_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_AUTH_CONTEXT_REF(p, r) \ grpc_auth_context_ref((p), __FILE__, __LINE__, (r)) #define GRPC_AUTH_CONTEXT_UNREF(p, r) \ diff --git a/src/core/lib/security/transport/secure_endpoint.c b/src/core/lib/security/transport/secure_endpoint.c index 140cf294aed..f4ed81db1a0 100644 --- a/src/core/lib/security/transport/secure_endpoint.c +++ b/src/core/lib/security/transport/secure_endpoint.c @@ -75,18 +75,20 @@ static void destroy(grpc_exec_ctx *exec_ctx, secure_endpoint *secure_ep) { gpr_free(ep); } -/*#define GRPC_SECURE_ENDPOINT_REFCOUNT_DEBUG*/ -#ifdef GRPC_SECURE_ENDPOINT_REFCOUNT_DEBUG +#ifndef NDEBUG #define SECURE_ENDPOINT_UNREF(exec_ctx, ep, reason) \ secure_endpoint_unref((exec_ctx), (ep), (reason), __FILE__, __LINE__) #define SECURE_ENDPOINT_REF(ep, reason) \ secure_endpoint_ref((ep), (reason), __FILE__, __LINE__) -static void secure_endpoint_unref(secure_endpoint *ep, - grpc_closure_list *closure_list, +static void secure_endpoint_unref(grpc_exec_ctx *exec_ctx, secure_endpoint *ep, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "SECENDP unref %p : %s %d -> %d", - ep, reason, ep->ref.count, ep->ref.count - 1); + if (GRPC_TRACER_ON(grpc_trace_secure_endpoint)) { + gpr_atm val = gpr_atm_no_barrier_load(&ep->ref.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "SECENDP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, ep, reason, val, + val - 1); + } if (gpr_unref(&ep->ref)) { destroy(exec_ctx, ep); } @@ -94,8 +96,12 @@ static void secure_endpoint_unref(secure_endpoint *ep, static void secure_endpoint_ref(secure_endpoint *ep, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "SECENDP ref %p : %s %d -> %d", - ep, reason, ep->ref.count, ep->ref.count + 1); + if (GRPC_TRACER_ON(grpc_trace_secure_endpoint)) { + gpr_atm val = gpr_atm_no_barrier_load(&ep->ref.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "SECENDP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, ep, reason, val, + val + 1); + } gpr_ref(&ep->ref); } #else diff --git a/src/core/lib/security/transport/security_connector.c b/src/core/lib/security/transport/security_connector.c index 9934d57ee62..3c0c24254b7 100644 --- a/src/core/lib/security/transport/security_connector.c +++ b/src/core/lib/security/transport/security_connector.c @@ -43,6 +43,11 @@ #include "src/core/tsi/ssl_transport_security.h" #include "src/core/tsi/transport_security_adapter.h" +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_security_connector_refcount = + GRPC_TRACER_INITIALIZER(false); +#endif + /* -- Constants. -- */ #ifndef INSTALL_PREFIX @@ -142,14 +147,17 @@ void grpc_channel_security_connector_check_call_host( } } -#ifdef GRPC_SECURITY_CONNECTOR_REFCOUNT_DEBUG +#ifndef NDEBUG grpc_security_connector *grpc_security_connector_ref( grpc_security_connector *sc, const char *file, int line, const char *reason) { if (sc == NULL) return NULL; - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "SECURITY_CONNECTOR:%p ref %d -> %d %s", sc, - (int)sc->refcount.count, (int)sc->refcount.count + 1, reason); + if (GRPC_TRACER_ON(grpc_trace_security_connector_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&sc->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "SECURITY_CONNECTOR:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", sc, + val, val + 1, reason); + } #else grpc_security_connector *grpc_security_connector_ref( grpc_security_connector *sc) { @@ -159,15 +167,18 @@ grpc_security_connector *grpc_security_connector_ref( return sc; } -#ifdef GRPC_SECURITY_CONNECTOR_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_security_connector_unref(grpc_exec_ctx *exec_ctx, grpc_security_connector *sc, const char *file, int line, const char *reason) { if (sc == NULL) return; - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "SECURITY_CONNECTOR:%p unref %d -> %d %s", sc, - (int)sc->refcount.count, (int)sc->refcount.count - 1, reason); + if (GRPC_TRACER_ON(grpc_trace_security_connector_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&sc->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "SECURITY_CONNECTOR:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", sc, + val, val - 1, reason); + } #else void grpc_security_connector_unref(grpc_exec_ctx *exec_ctx, grpc_security_connector *sc) { diff --git a/src/core/lib/security/transport/security_connector.h b/src/core/lib/security/transport/security_connector.h index 24b1086ee3a..1c0fe40045d 100644 --- a/src/core/lib/security/transport/security_connector.h +++ b/src/core/lib/security/transport/security_connector.h @@ -29,6 +29,10 @@ #include "src/core/tsi/ssl_transport_security.h" #include "src/core/tsi/transport_security_interface.h" +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_security_connector_refcount; +#endif + /* --- status enum. --- */ typedef enum { GRPC_SECURITY_OK = 0, GRPC_SECURITY_ERROR } grpc_security_status; @@ -66,7 +70,7 @@ struct grpc_security_connector { }; /* Refcounting. */ -#ifdef GRPC_SECURITY_CONNECTOR_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_SECURITY_CONNECTOR_REF(p, r) \ grpc_security_connector_ref((p), __FILE__, __LINE__, (r)) #define GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, p, r) \ diff --git a/src/core/lib/support/stack_lockfree.c b/src/core/lib/support/stack_lockfree.c deleted file mode 100644 index 0fb64ed0017..00000000000 --- a/src/core/lib/support/stack_lockfree.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "src/core/lib/support/stack_lockfree.h" - -#include -#include - -#include -#include -#include -#include - -/* The lockfree node structure is a single architecture-level - word that allows for an atomic CAS to set it up. */ -struct lockfree_node_contents { - /* next thing to look at. Actual index for head, next index otherwise */ - uint16_t index; -#ifdef GPR_ARCH_64 - uint16_t pad; - uint32_t aba_ctr; -#else -#ifdef GPR_ARCH_32 - uint16_t aba_ctr; -#else -#error Unsupported bit width architecture -#endif -#endif -}; - -/* Use a union to make sure that these are in the same bits as an atm word */ -typedef union lockfree_node { - gpr_atm atm; - struct lockfree_node_contents contents; -} lockfree_node; - -/* make sure that entries aligned to 8-bytes */ -#define ENTRY_ALIGNMENT_BITS 3 -/* reserve this entry as invalid */ -#define INVALID_ENTRY_INDEX ((1 << 16) - 1) - -struct gpr_stack_lockfree { - lockfree_node *entries; - lockfree_node head; /* An atomic entry describing curr head */ -}; - -gpr_stack_lockfree *gpr_stack_lockfree_create(size_t entries) { - gpr_stack_lockfree *stack; - stack = (gpr_stack_lockfree *)gpr_malloc(sizeof(*stack)); - /* Since we only allocate 16 bits to represent an entry number, - * make sure that we are within the desired range */ - /* Reserve the highest entry number as a dummy */ - GPR_ASSERT(entries < INVALID_ENTRY_INDEX); - stack->entries = (lockfree_node *)gpr_malloc_aligned( - entries * sizeof(stack->entries[0]), ENTRY_ALIGNMENT_BITS); - /* Clear out all entries */ - memset(stack->entries, 0, entries * sizeof(stack->entries[0])); - memset(&stack->head, 0, sizeof(stack->head)); - - GPR_ASSERT(sizeof(stack->entries->atm) == sizeof(stack->entries->contents)); - - /* Point the head at reserved dummy entry */ - stack->head.contents.index = INVALID_ENTRY_INDEX; -/* Fill in the pad and aba_ctr to avoid confusing memcheck tools */ -#ifdef GPR_ARCH_64 - stack->head.contents.pad = 0; -#endif - stack->head.contents.aba_ctr = 0; - return stack; -} - -void gpr_stack_lockfree_destroy(gpr_stack_lockfree *stack) { - gpr_free_aligned(stack->entries); - gpr_free(stack); -} - -int gpr_stack_lockfree_push(gpr_stack_lockfree *stack, int entry) { - lockfree_node head; - lockfree_node newhead; - lockfree_node curent; - lockfree_node newent; - - /* First fill in the entry's index and aba ctr for new head */ - newhead.contents.index = (uint16_t)entry; -#ifdef GPR_ARCH_64 - /* Fill in the pad to avoid confusing memcheck tools */ - newhead.contents.pad = 0; -#endif - - /* Also post-increment the aba_ctr */ - curent.atm = gpr_atm_no_barrier_load(&stack->entries[entry].atm); - newhead.contents.aba_ctr = ++curent.contents.aba_ctr; - gpr_atm_no_barrier_store(&stack->entries[entry].atm, curent.atm); - - do { - /* Atomically get the existing head value for use */ - head.atm = gpr_atm_no_barrier_load(&(stack->head.atm)); - /* Point to it */ - newent.atm = gpr_atm_no_barrier_load(&stack->entries[entry].atm); - newent.contents.index = head.contents.index; - gpr_atm_no_barrier_store(&stack->entries[entry].atm, newent.atm); - } while (!gpr_atm_rel_cas(&(stack->head.atm), head.atm, newhead.atm)); - /* Use rel_cas above to make sure that entry index is set properly */ - return head.contents.index == INVALID_ENTRY_INDEX; -} - -int gpr_stack_lockfree_pop(gpr_stack_lockfree *stack) { - lockfree_node head; - lockfree_node newhead; - - do { - head.atm = gpr_atm_acq_load(&(stack->head.atm)); - if (head.contents.index == INVALID_ENTRY_INDEX) { - return -1; - } - newhead.atm = - gpr_atm_no_barrier_load(&(stack->entries[head.contents.index].atm)); - - } while (!gpr_atm_no_barrier_cas(&(stack->head.atm), head.atm, newhead.atm)); - - return head.contents.index; -} diff --git a/src/core/lib/support/stack_lockfree.h b/src/core/lib/support/stack_lockfree.h deleted file mode 100644 index 6324211b720..00000000000 --- a/src/core/lib/support/stack_lockfree.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPC_CORE_LIB_SUPPORT_STACK_LOCKFREE_H -#define GRPC_CORE_LIB_SUPPORT_STACK_LOCKFREE_H - -#include - -typedef struct gpr_stack_lockfree gpr_stack_lockfree; - -/* This stack must specify the maximum number of entries to track. - The current implementation only allows up to 65534 entries */ -gpr_stack_lockfree *gpr_stack_lockfree_create(size_t entries); -void gpr_stack_lockfree_destroy(gpr_stack_lockfree *stack); - -/* Pass in a valid entry number for the next stack entry */ -/* Returns 1 if this is the first element on the stack, 0 otherwise */ -int gpr_stack_lockfree_push(gpr_stack_lockfree *, int entry); - -/* Returns -1 on empty or the actual entry number */ -int gpr_stack_lockfree_pop(gpr_stack_lockfree *stack); - -#endif /* GRPC_CORE_LIB_SUPPORT_STACK_LOCKFREE_H */ diff --git a/src/core/lib/support/time_precise.c b/src/core/lib/support/time_precise.c index 1de373e0025..6ce19e53ccb 100644 --- a/src/core/lib/support/time_precise.c +++ b/src/core/lib/support/time_precise.c @@ -22,26 +22,26 @@ #ifdef GRPC_TIMERS_RDTSC #if defined(__i386__) -static void gpr_get_cycle_counter(long long int *clk) { - long long int ret; +static void gpr_get_cycle_counter(int64_t int *clk) { + int64_t int ret; __asm__ volatile("rdtsc" : "=A"(ret)); *clk = ret; } // ---------------------------------------------------------------- #elif defined(__x86_64__) || defined(__amd64__) -static void gpr_get_cycle_counter(long long int *clk) { - unsigned long long low, high; +static void gpr_get_cycle_counter(int64_t *clk) { + uint64_t low, high; __asm__ volatile("rdtsc" : "=a"(low), "=d"(high)); - *clk = (long long)(high << 32) | (long long)low; + *clk = (int64_t)(high << 32) | (int64_t)low; } #endif static double cycles_per_second = 0; -static long long int start_cycle; +static int64_t start_cycle; void gpr_precise_clock_init(void) { time_t start; - long long end_cycle; + int64_t end_cycle; gpr_log(GPR_DEBUG, "Calibrating timers"); start = time(NULL); while (time(NULL) == start) @@ -55,7 +55,7 @@ void gpr_precise_clock_init(void) { } void gpr_precise_clock_now(gpr_timespec *clk) { - long long int counter; + int64_t counter; double secs; gpr_get_cycle_counter(&counter); secs = (double)(counter - start_cycle) / cycles_per_second; diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index b499219e170..c769866ceb4 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -457,7 +457,7 @@ void grpc_call_set_completion_queue(grpc_exec_ctx *exec_ctx, grpc_call *call, exec_ctx, CALL_STACK_FROM_CALL(call), &call->pollent); } -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG #define REF_REASON reason #define REF_ARG , const char *reason #else @@ -929,33 +929,6 @@ static grpc_compression_algorithm decode_compression(grpc_mdelem md) { return algorithm; } -static void recv_common_filter(grpc_exec_ctx *exec_ctx, grpc_call *call, - grpc_metadata_batch *b) { - if (b->idx.named.grpc_status != NULL) { - uint32_t status_code = decode_status(b->idx.named.grpc_status->md); - grpc_error *error = - status_code == GRPC_STATUS_OK - ? GRPC_ERROR_NONE - : grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING( - "Error received from peer"), - GRPC_ERROR_INT_GRPC_STATUS, - (intptr_t)status_code); - - if (b->idx.named.grpc_message != NULL) { - error = grpc_error_set_str( - error, GRPC_ERROR_STR_GRPC_MESSAGE, - grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.grpc_message->md))); - grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_message); - } else if (error != GRPC_ERROR_NONE) { - error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE, - grpc_empty_slice()); - } - - set_status_from_error(exec_ctx, call, STATUS_FROM_WIRE, error); - grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_status); - } -} - static void publish_app_metadata(grpc_call *call, grpc_metadata_batch *b, int is_trailing) { if (b->list.count == 0) return; @@ -980,8 +953,6 @@ static void publish_app_metadata(grpc_call *call, grpc_metadata_batch *b, static void recv_initial_filter(grpc_exec_ctx *exec_ctx, grpc_call *call, grpc_metadata_batch *b) { - recv_common_filter(exec_ctx, call, b); - if (b->idx.named.grpc_encoding != NULL) { GPR_TIMER_BEGIN("incoming_compression_algorithm", 0); set_incoming_compression_algorithm( @@ -989,7 +960,6 @@ static void recv_initial_filter(grpc_exec_ctx *exec_ctx, grpc_call *call, GPR_TIMER_END("incoming_compression_algorithm", 0); grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_encoding); } - if (b->idx.named.grpc_accept_encoding != NULL) { GPR_TIMER_BEGIN("encodings_accepted_by_peer", 0); set_encodings_accepted_by_peer(exec_ctx, call, @@ -997,14 +967,33 @@ static void recv_initial_filter(grpc_exec_ctx *exec_ctx, grpc_call *call, grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_accept_encoding); GPR_TIMER_END("encodings_accepted_by_peer", 0); } - publish_app_metadata(call, b, false); } static void recv_trailing_filter(grpc_exec_ctx *exec_ctx, void *args, grpc_metadata_batch *b) { grpc_call *call = args; - recv_common_filter(exec_ctx, call, b); + if (b->idx.named.grpc_status != NULL) { + uint32_t status_code = decode_status(b->idx.named.grpc_status->md); + grpc_error *error = + status_code == GRPC_STATUS_OK + ? GRPC_ERROR_NONE + : grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "Error received from peer"), + GRPC_ERROR_INT_GRPC_STATUS, + (intptr_t)status_code); + if (b->idx.named.grpc_message != NULL) { + error = grpc_error_set_str( + error, GRPC_ERROR_STR_GRPC_MESSAGE, + grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.grpc_message->md))); + grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_message); + } else if (error != GRPC_ERROR_NONE) { + error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE, + grpc_empty_slice()); + } + set_status_from_error(exec_ctx, call, STATUS_FROM_WIRE, error); + grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_status); + } publish_app_metadata(call, b, true); } diff --git a/src/core/lib/surface/call.h b/src/core/lib/surface/call.h index 60b661cf8cd..185bfccb77d 100644 --- a/src/core/lib/surface/call.h +++ b/src/core/lib/surface/call.h @@ -62,7 +62,7 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx, void grpc_call_set_completion_queue(grpc_exec_ctx *exec_ctx, grpc_call *call, grpc_completion_queue *cq); -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_call_internal_ref(grpc_call *call, const char *reason); void grpc_call_internal_unref(grpc_exec_ctx *exec_ctx, grpc_call *call, const char *reason); diff --git a/src/core/lib/surface/channel.c b/src/core/lib/surface/channel.c index 5647dff28b1..5780a18ce8e 100644 --- a/src/core/lib/surface/channel.c +++ b/src/core/lib/surface/channel.c @@ -345,7 +345,7 @@ grpc_call *grpc_channel_create_registered_call( return call; } -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG #define REF_REASON reason #define REF_ARG , const char *reason #else diff --git a/src/core/lib/surface/channel.h b/src/core/lib/surface/channel.h index 848debc7c58..528bb868e2c 100644 --- a/src/core/lib/surface/channel.h +++ b/src/core/lib/surface/channel.h @@ -59,7 +59,7 @@ grpc_mdelem grpc_channel_get_reffed_status_elem(grpc_exec_ctx *exec_ctx, size_t grpc_channel_get_call_size_estimate(grpc_channel *channel); void grpc_channel_update_call_size_estimate(grpc_channel *channel, size_t size); -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_channel_internal_ref(grpc_channel *channel, const char *reason); void grpc_channel_internal_unref(grpc_exec_ctx *exec_ctx, grpc_channel *channel, const char *reason); diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index 5f83bb5a6bb..8067b1000df 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -38,6 +38,7 @@ grpc_tracer_flag grpc_trace_operation_failures = GRPC_TRACER_INITIALIZER(false); #ifndef NDEBUG grpc_tracer_flag grpc_trace_pending_tags = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_cq_refcount = GRPC_TRACER_INITIALIZER(false); #endif typedef struct { @@ -472,11 +473,15 @@ int grpc_get_cq_poll_num(grpc_completion_queue *cq) { return cur_num_polls; } -#ifdef GRPC_CQ_REF_COUNT_DEBUG +#ifndef NDEBUG void grpc_cq_internal_ref(grpc_completion_queue *cq, const char *reason, const char *file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "CQ:%p ref %d -> %d %s", cq, - (int)cq->owning_refs.count, (int)cq->owning_refs.count + 1, reason); + if (GRPC_TRACER_ON(grpc_trace_cq_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&cq->owning_refs.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "CQ:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", cq, val, val + 1, + reason); + } #else void grpc_cq_internal_ref(grpc_completion_queue *cq) { #endif @@ -489,12 +494,15 @@ static void on_pollset_shutdown_done(grpc_exec_ctx *exec_ctx, void *arg, GRPC_CQ_INTERNAL_UNREF(exec_ctx, cq, "pollset_destroy"); } -#ifdef GRPC_CQ_REF_COUNT_DEBUG -void grpc_cq_internal_unref(grpc_completion_queue *cq, const char *reason, - const char *file, int line) { - cq_data *cqd = &cq->data; - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "CQ:%p unref %d -> %d %s", cq, - (int)cqd->owning_refs.count, (int)cqd->owning_refs.count - 1, reason); +#ifndef NDEBUG +void grpc_cq_internal_unref(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cq, + const char *reason, const char *file, int line) { + if (GRPC_TRACER_ON(grpc_trace_cq_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&cq->owning_refs.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "CQ:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", cq, val, val - 1, + reason); + } #else void grpc_cq_internal_unref(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cq) { @@ -563,7 +571,8 @@ static void cq_check_tag(grpc_completion_queue *cq, void *tag, bool lock_cq) { static void cq_check_tag(grpc_completion_queue *cq, void *tag, bool lock_cq) {} #endif -/* Queue a GRPC_OP_COMPLETED operation to a completion queue (with a completion +/* Queue a GRPC_OP_COMPLETED operation to a completion queue (with a + * completion * type of GRPC_CQ_NEXT) */ static void cq_end_op_for_next(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cq, void *tag, @@ -639,7 +648,8 @@ static void cq_end_op_for_next(grpc_exec_ctx *exec_ctx, GRPC_ERROR_UNREF(error); } -/* Queue a GRPC_OP_COMPLETED operation to a completion queue (with a completion +/* Queue a GRPC_OP_COMPLETED operation to a completion queue (with a + * completion * type of GRPC_CQ_PLUCK) */ static void cq_end_op_for_pluck(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cq, void *tag, @@ -743,7 +753,8 @@ static bool cq_is_next_finished(grpc_exec_ctx *exec_ctx, void *arg) { gpr_atm_no_barrier_load(&cqd->things_queued_ever); /* Pop a cq_completion from the queue. Returns NULL if the queue is empty - * might return NULL in some cases even if the queue is not empty; but that + * might return NULL in some cases even if the queue is not empty; but + * that * is ok and doesn't affect correctness. Might effect the tail latencies a * bit) */ a->stolen_completion = cq_event_queue_pop(&cqd->queue); @@ -838,7 +849,8 @@ static grpc_event cq_next(grpc_completion_queue *cq, gpr_timespec deadline, /* If c == NULL it means either the queue is empty OR in an transient inconsistent state. If it is the latter, we shold do a 0-timeout poll so that the thread comes back quickly from poll to make a second - attempt at popping. Not doing this can potentially deadlock this thread + attempt at popping. Not doing this can potentially deadlock this + thread forever (if the deadline is infinity) */ if (cq_event_queue_num_items(&cqd->queue) > 0) { iteration_deadline = gpr_time_0(GPR_CLOCK_MONOTONIC); @@ -851,8 +863,10 @@ static grpc_event cq_next(grpc_completion_queue *cq, gpr_timespec deadline, empty. If so, keep retrying but do not return GRPC_QUEUE_SHUTDOWN */ if (cq_event_queue_num_items(&cqd->queue) > 0) { /* Go to the beginning of the loop. No point doing a poll because - (cq->shutdown == true) is only possible when there is no pending work - (i.e cq->pending_events == 0) and any outstanding grpc_cq_completion + (cq->shutdown == true) is only possible when there is no pending + work + (i.e cq->pending_events == 0) and any outstanding + grpc_cq_completion events are already queued on this cq */ continue; } diff --git a/src/core/lib/surface/completion_queue.h b/src/core/lib/surface/completion_queue.h index e9472333071..af444825136 100644 --- a/src/core/lib/surface/completion_queue.h +++ b/src/core/lib/surface/completion_queue.h @@ -30,8 +30,10 @@ extern grpc_tracer_flag grpc_cq_pluck_trace; extern grpc_tracer_flag grpc_cq_event_timeout_trace; extern grpc_tracer_flag grpc_trace_operation_failures; + #ifndef NDEBUG extern grpc_tracer_flag grpc_trace_pending_tags; +extern grpc_tracer_flag grpc_trace_cq_refcount; #endif #ifdef __cplusplus @@ -52,9 +54,7 @@ typedef struct grpc_cq_completion { uintptr_t next; } grpc_cq_completion; -//#define GRPC_CQ_REF_COUNT_DEBUG - -#ifdef GRPC_CQ_REF_COUNT_DEBUG +#ifndef NDEBUG void grpc_cq_internal_ref(grpc_completion_queue *cc, const char *reason, const char *file, int line); void grpc_cq_internal_unref(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc, diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index 01a1f33db2f..14a86bfa0a8 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -126,18 +126,23 @@ void grpc_init(void) { grpc_register_tracer("channel_stack_builder", &grpc_trace_channel_stack_builder); grpc_register_tracer("http1", &grpc_http1_trace); - grpc_register_tracer("queue_pluck", &grpc_cq_pluck_trace); + grpc_register_tracer("queue_pluck", &grpc_cq_pluck_trace); // default on grpc_register_tracer("combiner", &grpc_combiner_trace); grpc_register_tracer("server_channel", &grpc_server_channel_trace); grpc_register_tracer("bdp_estimator", &grpc_bdp_estimator_trace); - // Default pluck trace to 1 - grpc_register_tracer("queue_timeout", &grpc_cq_event_timeout_trace); - // Default timeout trace to 1 + grpc_register_tracer("queue_timeout", + &grpc_cq_event_timeout_trace); // default on grpc_register_tracer("op_failure", &grpc_trace_operation_failures); grpc_register_tracer("resource_quota", &grpc_resource_quota_trace); grpc_register_tracer("call_error", &grpc_call_error_trace); #ifndef NDEBUG grpc_register_tracer("pending_tags", &grpc_trace_pending_tags); + grpc_register_tracer("queue_refcount", &grpc_trace_cq_refcount); + grpc_register_tracer("closure", &grpc_trace_closure); + grpc_register_tracer("error_refcount", &grpc_trace_error_refcount); + grpc_register_tracer("stream_refcount", &grpc_trace_stream_refcount); + grpc_register_tracer("fd_refcount", &grpc_trace_fd_refcount); + grpc_register_tracer("metadata", &grpc_trace_metadata); #endif grpc_security_pre_init(); grpc_iomgr_init(&exec_ctx); diff --git a/src/core/lib/surface/init_secure.c b/src/core/lib/surface/init_secure.c index fb6635716d1..7dbea581d01 100644 --- a/src/core/lib/surface/init_secure.c +++ b/src/core/lib/surface/init_secure.c @@ -32,9 +32,19 @@ #include "src/core/lib/surface/channel_init.h" #include "src/core/tsi/transport_security_interface.h" +#ifndef NDEBUG +#include "src/core/lib/security/context/security_context.h" +#endif + void grpc_security_pre_init(void) { grpc_register_tracer("secure_endpoint", &grpc_trace_secure_endpoint); grpc_register_tracer("transport_security", &tsi_tracing_enabled); +#ifndef NDEBUG + grpc_register_tracer("auth_context_refcount", + &grpc_trace_auth_context_refcount); + grpc_register_tracer("security_connector_refcount", + &grpc_trace_security_connector_refcount); +#endif } static bool maybe_prepend_client_auth_filter( diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 592ee1ff4d9..19177a46c96 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -475,6 +475,7 @@ static void publish_call(grpc_exec_ctx *exec_ctx, grpc_server *server, *rc->data.registered.deadline = calld->deadline; if (rc->data.registered.optional_payload) { *rc->data.registered.optional_payload = calld->payload; + calld->payload = NULL; } break; default: @@ -878,6 +879,7 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_slice_unref_internal(exec_ctx, calld->path); } grpc_metadata_array_destroy(&calld->initial_metadata); + grpc_byte_buffer_destroy(calld->payload); gpr_mu_destroy(&calld->mu_state); diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c index 94917307193..87a2abf3443 100644 --- a/src/core/lib/transport/metadata.c +++ b/src/core/lib/transport/metadata.c @@ -47,7 +47,8 @@ * used to determine which kind of element a pointer refers to. */ -#ifdef GRPC_METADATA_REFCOUNT_DEBUG +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_metadata = GRPC_TRACER_INITIALIZER(false); #define DEBUG_ARGS , const char *file, int line #define FWD_DEBUG_ARGS , file, line #define REF_MD_LOCKED(shard, s) ref_md_locked((shard), (s), __FILE__, __LINE__) @@ -144,15 +145,17 @@ static int is_mdelem_static(grpc_mdelem e) { static void ref_md_locked(mdtab_shard *shard, interned_metadata *md DEBUG_ARGS) { -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(md->key); - char *value_str = grpc_slice_to_c_string(md->value); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), - gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(md->key); + char *value_str = grpc_slice_to_c_string(md->value); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "ELM REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", (void *)md, + gpr_atm_no_barrier_load(&md->refcnt), + gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif if (0 == gpr_atm_no_barrier_fetch_add(&md->refcnt, 1)) { gpr_atm_no_barrier_fetch_add(&shard->free_estimate, -1); @@ -243,13 +246,16 @@ grpc_mdelem grpc_mdelem_create( allocated->key = grpc_slice_ref_internal(key); allocated->value = grpc_slice_ref_internal(value); gpr_atm_rel_store(&allocated->refcnt, 1); -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(allocated->key); - char *value_str = grpc_slice_to_c_string(allocated->value); - gpr_log(GPR_DEBUG, "ELM ALLOC:%p:%zu: '%s' = '%s'", (void *)allocated, - gpr_atm_no_barrier_load(&allocated->refcnt), key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(allocated->key); + char *value_str = grpc_slice_to_c_string(allocated->value); + gpr_log(GPR_DEBUG, "ELM ALLOC:%p:%" PRIdPTR ": '%s' = '%s'", + (void *)allocated, gpr_atm_no_barrier_load(&allocated->refcnt), + key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif return GRPC_MAKE_MDELEM(allocated, GRPC_MDELEM_STORAGE_ALLOCATED); } @@ -294,13 +300,15 @@ grpc_mdelem grpc_mdelem_create( md->bucket_next = shard->elems[idx]; shard->elems[idx] = md; gpr_mu_init(&md->mu_user_data); -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(md->key); - char *value_str = grpc_slice_to_c_string(md->value); - gpr_log(GPR_DEBUG, "ELM NEW:%p:%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(md->key); + char *value_str = grpc_slice_to_c_string(md->value); + gpr_log(GPR_DEBUG, "ELM NEW:%p:%" PRIdPTR ": '%s' = '%s'", (void *)md, + gpr_atm_no_barrier_load(&md->refcnt), key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif shard->count++; @@ -356,15 +364,17 @@ grpc_mdelem grpc_mdelem_ref(grpc_mdelem gmd DEBUG_ARGS) { break; case GRPC_MDELEM_STORAGE_INTERNED: { interned_metadata *md = (interned_metadata *)GRPC_MDELEM_DATA(gmd); -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(md->key); - char *value_str = grpc_slice_to_c_string(md->value); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), - gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(md->key); + char *value_str = grpc_slice_to_c_string(md->value); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "ELM REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", + (void *)md, gpr_atm_no_barrier_load(&md->refcnt), + gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif /* we can assume the ref count is >= 1 as the application is calling this function - meaning that no adjustment to mdtab_free is necessary, @@ -376,15 +386,17 @@ grpc_mdelem grpc_mdelem_ref(grpc_mdelem gmd DEBUG_ARGS) { } case GRPC_MDELEM_STORAGE_ALLOCATED: { allocated_metadata *md = (allocated_metadata *)GRPC_MDELEM_DATA(gmd); -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(md->key); - char *value_str = grpc_slice_to_c_string(md->value); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), - gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(md->key); + char *value_str = grpc_slice_to_c_string(md->value); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "ELM REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", + (void *)md, gpr_atm_no_barrier_load(&md->refcnt), + gpr_atm_no_barrier_load(&md->refcnt) + 1, key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif /* we can assume the ref count is >= 1 as the application is calling this function - meaning that no adjustment to mdtab_free is necessary, @@ -404,15 +416,17 @@ void grpc_mdelem_unref(grpc_exec_ctx *exec_ctx, grpc_mdelem gmd DEBUG_ARGS) { break; case GRPC_MDELEM_STORAGE_INTERNED: { interned_metadata *md = (interned_metadata *)GRPC_MDELEM_DATA(gmd); -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(md->key); - char *value_str = grpc_slice_to_c_string(md->value); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM UNREF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), - gpr_atm_no_barrier_load(&md->refcnt) - 1, key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(md->key); + char *value_str = grpc_slice_to_c_string(md->value); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "ELM UNREF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", + (void *)md, gpr_atm_no_barrier_load(&md->refcnt), + gpr_atm_no_barrier_load(&md->refcnt) - 1, key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif uint32_t hash = GRPC_MDSTR_KV_HASH(grpc_slice_hash(md->key), grpc_slice_hash(md->value)); @@ -428,15 +442,17 @@ void grpc_mdelem_unref(grpc_exec_ctx *exec_ctx, grpc_mdelem gmd DEBUG_ARGS) { } case GRPC_MDELEM_STORAGE_ALLOCATED: { allocated_metadata *md = (allocated_metadata *)GRPC_MDELEM_DATA(gmd); -#ifdef GRPC_METADATA_REFCOUNT_DEBUG - char *key_str = grpc_slice_to_c_string(md->key); - char *value_str = grpc_slice_to_c_string(md->value); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM UNREF:%p:%zu->%zu: '%s' = '%s'", (void *)md, - gpr_atm_no_barrier_load(&md->refcnt), - gpr_atm_no_barrier_load(&md->refcnt) - 1, key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); +#ifndef NDEBUG + if (GRPC_TRACER_ON(grpc_trace_metadata)) { + char *key_str = grpc_slice_to_c_string(md->key); + char *value_str = grpc_slice_to_c_string(md->value); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "ELM UNREF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", + (void *)md, gpr_atm_no_barrier_load(&md->refcnt), + gpr_atm_no_barrier_load(&md->refcnt) - 1, key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } #endif const gpr_atm prev_refcount = gpr_atm_full_fetch_add(&md->refcnt, -1); GPR_ASSERT(prev_refcount >= 1); diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h index 5e1afecd2e5..974469e436f 100644 --- a/src/core/lib/transport/metadata.h +++ b/src/core/lib/transport/metadata.h @@ -25,6 +25,10 @@ #include "src/core/lib/iomgr/exec_ctx.h" +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_metadata; +#endif + #ifdef __cplusplus extern "C" { #endif @@ -132,9 +136,7 @@ void *grpc_mdelem_get_user_data(grpc_mdelem md, void *grpc_mdelem_set_user_data(grpc_mdelem md, void (*destroy_func)(void *), void *user_data); -/* Reference counting */ -//#define GRPC_METADATA_REFCOUNT_DEBUG -#ifdef GRPC_METADATA_REFCOUNT_DEBUG +#ifndef NDEBUG #define GRPC_MDELEM_REF(s) grpc_mdelem_ref((s), __FILE__, __LINE__) #define GRPC_MDELEM_UNREF(exec_ctx, s) \ grpc_mdelem_unref((exec_ctx), (s), __FILE__, __LINE__) diff --git a/src/core/lib/transport/transport.c b/src/core/lib/transport/transport.c index c2afedec585..6a9eba110d1 100644 --- a/src/core/lib/transport/transport.c +++ b/src/core/lib/transport/transport.c @@ -31,25 +31,33 @@ #include "src/core/lib/support/string.h" #include "src/core/lib/transport/transport_impl.h" -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG +grpc_tracer_flag grpc_trace_stream_refcount = GRPC_TRACER_INITIALIZER(false); +#endif + +#ifndef NDEBUG void grpc_stream_ref(grpc_stream_refcount *refcount, const char *reason) { - gpr_atm val = gpr_atm_no_barrier_load(&refcount->refs.count); - gpr_log(GPR_DEBUG, "%s %p:%p REF %" PRIdPTR "->%" PRIdPTR " %s", - refcount->object_type, refcount, refcount->destroy.cb_arg, val, - val + 1, reason); + if (GRPC_TRACER_ON(grpc_trace_stream_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&refcount->refs.count); + gpr_log(GPR_DEBUG, "%s %p:%p REF %" PRIdPTR "->%" PRIdPTR " %s", + refcount->object_type, refcount, refcount->destroy.cb_arg, val, + val + 1, reason); + } #else void grpc_stream_ref(grpc_stream_refcount *refcount) { #endif gpr_ref_non_zero(&refcount->refs); } -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_stream_unref(grpc_exec_ctx *exec_ctx, grpc_stream_refcount *refcount, const char *reason) { - gpr_atm val = gpr_atm_no_barrier_load(&refcount->refs.count); - gpr_log(GPR_DEBUG, "%s %p:%p UNREF %" PRIdPTR "->%" PRIdPTR " %s", - refcount->object_type, refcount, refcount->destroy.cb_arg, val, - val - 1, reason); + if (GRPC_TRACER_ON(grpc_trace_stream_refcount)) { + gpr_atm val = gpr_atm_no_barrier_load(&refcount->refs.count); + gpr_log(GPR_DEBUG, "%s %p:%p UNREF %" PRIdPTR "->%" PRIdPTR " %s", + refcount->object_type, refcount, refcount->destroy.cb_arg, val, + val - 1, reason); + } #else void grpc_stream_unref(grpc_exec_ctx *exec_ctx, grpc_stream_refcount *refcount) { @@ -74,7 +82,7 @@ void grpc_stream_unref(grpc_exec_ctx *exec_ctx, offsetof(grpc_stream_refcount, slice_refcount))) static void slice_stream_ref(void *p) { -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG grpc_stream_ref(STREAM_REF_FROM_SLICE_REF(p), "slice"); #else grpc_stream_ref(STREAM_REF_FROM_SLICE_REF(p)); @@ -82,7 +90,7 @@ static void slice_stream_ref(void *p) { } static void slice_stream_unref(grpc_exec_ctx *exec_ctx, void *p) { -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG grpc_stream_unref(exec_ctx, STREAM_REF_FROM_SLICE_REF(p), "slice"); #else grpc_stream_unref(exec_ctx, STREAM_REF_FROM_SLICE_REF(p)); @@ -102,7 +110,7 @@ static const grpc_slice_refcount_vtable stream_ref_slice_vtable = { .eq = grpc_slice_default_eq_impl, .hash = grpc_slice_default_hash_impl}; -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_stream_ref_init(grpc_stream_refcount *refcount, int initial_refs, grpc_iomgr_cb_func cb, void *cb_arg, const char *object_type) { @@ -198,6 +206,11 @@ grpc_endpoint *grpc_transport_get_endpoint(grpc_exec_ctx *exec_ctx, return transport->vtable->get_endpoint(exec_ctx, transport); } +// grpc_transport_stream_op_batch_finish_with_failure +// is a function that must always unref cancel_error +// though it lives in lib, it handles transport stream ops sure +// it's grpc_transport_stream_op_batch_finish_with_failure + void grpc_transport_stream_op_batch_finish_with_failure( grpc_exec_ctx *exec_ctx, grpc_transport_stream_op_batch *op, grpc_error *error) { diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index d231157c874..84e53e683ac 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -42,18 +42,20 @@ typedef struct grpc_transport grpc_transport; for a stream. */ typedef struct grpc_stream grpc_stream; -//#define GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG +extern grpc_tracer_flag grpc_trace_stream_refcount; +#endif typedef struct grpc_stream_refcount { gpr_refcount refs; grpc_closure destroy; -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG const char *object_type; #endif grpc_slice_refcount slice_refcount; } grpc_stream_refcount; -#ifdef GRPC_STREAM_REFCOUNT_DEBUG +#ifndef NDEBUG void grpc_stream_ref_init(grpc_stream_refcount *refcount, int initial_refs, grpc_iomgr_cb_func cb, void *cb_arg, const char *object_type); @@ -165,6 +167,10 @@ struct grpc_transport_stream_op_batch_payload { uint32_t *recv_flags; /** Should be enqueued when initial metadata is ready to be processed. */ grpc_closure *recv_initial_metadata_ready; + // If not NULL, will be set to true if trailing metadata is + // immediately available. This may be a signal that we received a + // Trailers-Only response. + bool *trailing_metadata_available; } recv_initial_metadata; struct { @@ -192,6 +198,8 @@ struct grpc_transport_stream_op_batch_payload { grpc_chttp2_grpc_status_to_http2_error. Send a RST_STREAM with this error. */ struct { + // Error contract: the transport that gets this op must cause cancel_error + // to be unref'ed after processing it grpc_error *cancel_error; } cancel_stream; @@ -206,9 +214,13 @@ typedef struct grpc_transport_op { /** connectivity monitoring - set connectivity_state to NULL to unsubscribe */ grpc_closure *on_connectivity_state_change; grpc_connectivity_state *connectivity_state; - /** should the transport be disconnected */ + /** should the transport be disconnected + * Error contract: the transport that gets this op must cause + * disconnect_with_error to be unref'ed after processing it */ grpc_error *disconnect_with_error; - /** what should the goaway contain? */ + /** what should the goaway contain? + * Error contract: the transport that gets this op must cause + * goaway_error to be unref'ed after processing it */ grpc_error *goaway_error; /** set the callback for accepting new streams; this is a permanent callback, unlike the other one-shot closures. diff --git a/src/cpp/common/channel_filter.h b/src/cpp/common/channel_filter.h index 1b6ace6b130..5d629f7c14b 100644 --- a/src/cpp/common/channel_filter.h +++ b/src/cpp/common/channel_filter.h @@ -208,38 +208,45 @@ class TransportStreamOpBatch { /// Represents channel data. class ChannelData { public: + ChannelData() {} virtual ~ChannelData() {} - /// Initializes the call data. - virtual grpc_error *Init(grpc_exec_ctx *exec_ctx, + // TODO(roth): Come up with a more C++-like API for the channel element. + + /// Initializes the channel data. + virtual grpc_error *Init(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_channel_element_args *args) { return GRPC_ERROR_NONE; } - // TODO(roth): Find a way to avoid passing elem into these methods. + // Called before destruction. + virtual void Destroy(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {} virtual void StartTransportOp(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, TransportOp *op); virtual void GetInfo(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, const grpc_channel_info *channel_info); - - protected: - ChannelData() {} }; /// Represents call data. class CallData { public: + CallData() {} virtual ~CallData() {} + // TODO(roth): Come up with a more C++-like API for the call element. + /// Initializes the call data. - virtual grpc_error *Init(grpc_exec_ctx *exec_ctx, ChannelData *channel_data, + virtual grpc_error *Init(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_element_args *args) { return GRPC_ERROR_NONE; } - // TODO(roth): Find a way to avoid passing elem into these methods. + // Called before destruction. + virtual void Destroy(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, + const grpc_call_final_info *final_info, + grpc_closure *then_call_closure) {} /// Starts a new stream operation. virtual void StartTransportStreamOpBatch(grpc_exec_ctx *exec_ctx, @@ -253,9 +260,6 @@ class CallData { /// Gets the peer name. virtual char *GetPeer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem); - - protected: - CallData() {} }; namespace internal { @@ -271,19 +275,24 @@ class ChannelFilter final { static grpc_error *InitChannelElement(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_channel_element_args *args) { + // Construct the object in the already-allocated memory. ChannelDataType *channel_data = new (elem->channel_data) ChannelDataType(); - return channel_data->Init(exec_ctx, args); + return channel_data->Init(exec_ctx, elem, args); } static void DestroyChannelElement(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) { - reinterpret_cast(elem->channel_data)->~ChannelDataType(); + ChannelDataType *channel_data = + reinterpret_cast(elem->channel_data); + channel_data->Destroy(exec_ctx, elem); + channel_data->~ChannelDataType(); } static void StartTransportOp(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_transport_op *op) { - ChannelDataType *channel_data = (ChannelDataType *)elem->channel_data; + ChannelDataType *channel_data = + reinterpret_cast(elem->channel_data); TransportOp op_wrapper(op); channel_data->StartTransportOp(exec_ctx, elem, &op_wrapper); } @@ -291,7 +300,8 @@ class ChannelFilter final { static void GetChannelInfo(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, const grpc_channel_info *channel_info) { - ChannelDataType *channel_data = (ChannelDataType *)elem->channel_data; + ChannelDataType *channel_data = + reinterpret_cast(elem->channel_data); channel_data->GetInfo(exec_ctx, elem, channel_info); } @@ -300,24 +310,24 @@ class ChannelFilter final { static grpc_error *InitCallElement(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_element_args *args) { - ChannelDataType *channel_data = (ChannelDataType *)elem->channel_data; // Construct the object in the already-allocated memory. CallDataType *call_data = new (elem->call_data) CallDataType(); - return call_data->Init(exec_ctx, channel_data, args); + return call_data->Init(exec_ctx, elem, args); } static void DestroyCallElement(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_final_info *final_info, grpc_closure *then_call_closure) { - GPR_ASSERT(then_call_closure == NULL); - reinterpret_cast(elem->call_data)->~CallDataType(); + CallDataType *call_data = reinterpret_cast(elem->call_data); + call_data->Destroy(exec_ctx, elem, final_info, then_call_closure); + call_data->~CallDataType(); } static void StartTransportStreamOpBatch(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op_batch *op) { - CallDataType *call_data = (CallDataType *)elem->call_data; + CallDataType *call_data = reinterpret_cast(elem->call_data); TransportStreamOpBatch op_wrapper(op); call_data->StartTransportStreamOpBatch(exec_ctx, elem, &op_wrapper); } @@ -325,12 +335,12 @@ class ChannelFilter final { static void SetPollsetOrPollsetSet(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_polling_entity *pollent) { - CallDataType *call_data = (CallDataType *)elem->call_data; + CallDataType *call_data = reinterpret_cast(elem->call_data); call_data->SetPollsetOrPollsetSet(exec_ctx, elem, pollent); } static char *GetPeer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { - CallDataType *call_data = (CallDataType *)elem->call_data; + CallDataType *call_data = reinterpret_cast(elem->call_data); return call_data->GetPeer(exec_ctx, elem); } }; diff --git a/src/csharp/Grpc.Core.Tests/ServerTest.cs b/src/csharp/Grpc.Core.Tests/ServerTest.cs index f6343f2a138..884414792d3 100644 --- a/src/csharp/Grpc.Core.Tests/ServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ServerTest.cs @@ -17,6 +17,7 @@ #endregion using System; +using System.IO; using System.Linq; using Grpc.Core; using Grpc.Core.Internal; @@ -65,6 +66,21 @@ namespace Grpc.Core.Tests server.ShutdownAsync().Wait(); } + [Test] + public void StartThrowsWithUnboundPorts() + { + int twiceBoundPort = 9999; + Server server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) }) + { + Ports = { + new ServerPort("localhost", twiceBoundPort, ServerCredentials.Insecure), + new ServerPort("localhost", twiceBoundPort, ServerCredentials.Insecure) + } + }; + Assert.Throws(typeof(IOException), () => server.Start()); + server.ShutdownAsync().Wait(); + } + [Test] public void CannotModifyAfterStarted() { diff --git a/src/csharp/Grpc.Core/Server.cs b/src/csharp/Grpc.Core/Server.cs index 462713e6bb1..77ad876bdf6 100644 --- a/src/csharp/Grpc.Core/Server.cs +++ b/src/csharp/Grpc.Core/Server.cs @@ -19,6 +19,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading.Tasks; using Grpc.Core.Internal; @@ -140,6 +141,7 @@ namespace Grpc.Core /// /// Starts the server. + /// Throws IOException if not successful. /// public void Start() { @@ -148,7 +150,8 @@ namespace Grpc.Core GrpcPreconditions.CheckState(!startRequested); GrpcPreconditions.CheckState(!shutdownRequested); startRequested = true; - + + CheckPortsBoundSuccessfully(); handle.Start(); for (int i = 0; i < requestCallTokensPerCq; i++) @@ -301,6 +304,22 @@ namespace Grpc.Core } } + /// + /// Checks that all ports have been bound successfully. + /// + private void CheckPortsBoundSuccessfully() + { + lock (myLock) + { + var unboundPort = ports.FirstOrDefault(port => port.BoundPort == 0); + if (unboundPort != null) + { + throw new IOException( + string.Format("Failed to bind port \"{0}:{1}\"", unboundPort.Host, unboundPort.Port)); + } + } + } + private void DisposeHandle() { var activeCallCount = activeCallCounter.Count; diff --git a/src/csharp/Grpc.IntegrationTesting/Control.cs b/src/csharp/Grpc.IntegrationTesting/Control.cs index 6c0176fb43f..d62b5a1c5b4 100644 --- a/src/csharp/Grpc.IntegrationTesting/Control.cs +++ b/src/csharp/Grpc.IntegrationTesting/Control.cs @@ -32,7 +32,7 @@ namespace Grpc.Testing { "U2VjdXJpdHlQYXJhbXMSEwoLdXNlX3Rlc3RfY2EYASABKAgSHAoUc2VydmVy", "X2hvc3Rfb3ZlcnJpZGUYAiABKAkiTQoKQ2hhbm5lbEFyZxIMCgRuYW1lGAEg", "ASgJEhMKCXN0cl92YWx1ZRgCIAEoCUgAEhMKCWludF92YWx1ZRgDIAEoBUgA", - "QgcKBXZhbHVlIqAECgxDbGllbnRDb25maWcSFgoOc2VydmVyX3RhcmdldHMY", + "QgcKBXZhbHVlItUECgxDbGllbnRDb25maWcSFgoOc2VydmVyX3RhcmdldHMY", "ASADKAkSLQoLY2xpZW50X3R5cGUYAiABKA4yGC5ncnBjLnRlc3RpbmcuQ2xp", "ZW50VHlwZRI1Cg9zZWN1cml0eV9wYXJhbXMYAyABKAsyHC5ncnBjLnRlc3Rp", "bmcuU2VjdXJpdHlQYXJhbXMSJAocb3V0c3RhbmRpbmdfcnBjc19wZXJfY2hh", @@ -44,52 +44,57 @@ namespace Grpc.Testing { "cxgMIAEoCzIdLmdycGMudGVzdGluZy5IaXN0b2dyYW1QYXJhbXMSEQoJY29y", "ZV9saXN0GA0gAygFEhIKCmNvcmVfbGltaXQYDiABKAUSGAoQb3RoZXJfY2xp", "ZW50X2FwaRgPIAEoCRIuCgxjaGFubmVsX2FyZ3MYECADKAsyGC5ncnBjLnRl", - "c3RpbmcuQ2hhbm5lbEFyZyI4CgxDbGllbnRTdGF0dXMSKAoFc3RhdHMYASAB", - "KAsyGS5ncnBjLnRlc3RpbmcuQ2xpZW50U3RhdHMiFQoETWFyaxINCgVyZXNl", - "dBgBIAEoCCJoCgpDbGllbnRBcmdzEisKBXNldHVwGAEgASgLMhouZ3JwYy50", - "ZXN0aW5nLkNsaWVudENvbmZpZ0gAEiIKBG1hcmsYAiABKAsyEi5ncnBjLnRl", - "c3RpbmcuTWFya0gAQgkKB2FyZ3R5cGUitAIKDFNlcnZlckNvbmZpZxItCgtz", - "ZXJ2ZXJfdHlwZRgBIAEoDjIYLmdycGMudGVzdGluZy5TZXJ2ZXJUeXBlEjUK", - "D3NlY3VyaXR5X3BhcmFtcxgCIAEoCzIcLmdycGMudGVzdGluZy5TZWN1cml0", - "eVBhcmFtcxIMCgRwb3J0GAQgASgFEhwKFGFzeW5jX3NlcnZlcl90aHJlYWRz", - "GAcgASgFEhIKCmNvcmVfbGltaXQYCCABKAUSMwoOcGF5bG9hZF9jb25maWcY", - "CSABKAsyGy5ncnBjLnRlc3RpbmcuUGF5bG9hZENvbmZpZxIRCgljb3JlX2xp", - "c3QYCiADKAUSGAoQb3RoZXJfc2VydmVyX2FwaRgLIAEoCRIcChNyZXNvdXJj", - "ZV9xdW90YV9zaXplGOkHIAEoBSJoCgpTZXJ2ZXJBcmdzEisKBXNldHVwGAEg", - "ASgLMhouZ3JwYy50ZXN0aW5nLlNlcnZlckNvbmZpZ0gAEiIKBG1hcmsYAiAB", - "KAsyEi5ncnBjLnRlc3RpbmcuTWFya0gAQgkKB2FyZ3R5cGUiVQoMU2VydmVy", - "U3RhdHVzEigKBXN0YXRzGAEgASgLMhkuZ3JwYy50ZXN0aW5nLlNlcnZlclN0", - "YXRzEgwKBHBvcnQYAiABKAUSDQoFY29yZXMYAyABKAUiDQoLQ29yZVJlcXVl", - "c3QiHQoMQ29yZVJlc3BvbnNlEg0KBWNvcmVzGAEgASgFIgYKBFZvaWQi/QEK", - "CFNjZW5hcmlvEgwKBG5hbWUYASABKAkSMQoNY2xpZW50X2NvbmZpZxgCIAEo", - "CzIaLmdycGMudGVzdGluZy5DbGllbnRDb25maWcSEwoLbnVtX2NsaWVudHMY", - "AyABKAUSMQoNc2VydmVyX2NvbmZpZxgEIAEoCzIaLmdycGMudGVzdGluZy5T", - "ZXJ2ZXJDb25maWcSEwoLbnVtX3NlcnZlcnMYBSABKAUSFgoOd2FybXVwX3Nl", - "Y29uZHMYBiABKAUSGQoRYmVuY2htYXJrX3NlY29uZHMYByABKAUSIAoYc3Bh", - "d25fbG9jYWxfd29ya2VyX2NvdW50GAggASgFIjYKCVNjZW5hcmlvcxIpCglz", - "Y2VuYXJpb3MYASADKAsyFi5ncnBjLnRlc3RpbmcuU2NlbmFyaW8i+AIKFVNj", - "ZW5hcmlvUmVzdWx0U3VtbWFyeRILCgNxcHMYASABKAESGwoTcXBzX3Blcl9z", - "ZXJ2ZXJfY29yZRgCIAEoARIaChJzZXJ2ZXJfc3lzdGVtX3RpbWUYAyABKAES", - "GAoQc2VydmVyX3VzZXJfdGltZRgEIAEoARIaChJjbGllbnRfc3lzdGVtX3Rp", - "bWUYBSABKAESGAoQY2xpZW50X3VzZXJfdGltZRgGIAEoARISCgpsYXRlbmN5", - "XzUwGAcgASgBEhIKCmxhdGVuY3lfOTAYCCABKAESEgoKbGF0ZW5jeV85NRgJ", - "IAEoARISCgpsYXRlbmN5Xzk5GAogASgBEhMKC2xhdGVuY3lfOTk5GAsgASgB", - "EhgKEHNlcnZlcl9jcHVfdXNhZ2UYDCABKAESJgoec3VjY2Vzc2Z1bF9yZXF1", - "ZXN0c19wZXJfc2Vjb25kGA0gASgBEiIKGmZhaWxlZF9yZXF1ZXN0c19wZXJf", - "c2Vjb25kGA4gASgBIoMDCg5TY2VuYXJpb1Jlc3VsdBIoCghzY2VuYXJpbxgB", - "IAEoCzIWLmdycGMudGVzdGluZy5TY2VuYXJpbxIuCglsYXRlbmNpZXMYAiAB", - "KAsyGy5ncnBjLnRlc3RpbmcuSGlzdG9ncmFtRGF0YRIvCgxjbGllbnRfc3Rh", - "dHMYAyADKAsyGS5ncnBjLnRlc3RpbmcuQ2xpZW50U3RhdHMSLwoMc2VydmVy", - "X3N0YXRzGAQgAygLMhkuZ3JwYy50ZXN0aW5nLlNlcnZlclN0YXRzEhQKDHNl", - "cnZlcl9jb3JlcxgFIAMoBRI0CgdzdW1tYXJ5GAYgASgLMiMuZ3JwYy50ZXN0", - "aW5nLlNjZW5hcmlvUmVzdWx0U3VtbWFyeRIWCg5jbGllbnRfc3VjY2VzcxgH", - "IAMoCBIWCg5zZXJ2ZXJfc3VjY2VzcxgIIAMoCBI5Cg9yZXF1ZXN0X3Jlc3Vs", - "dHMYCSADKAsyIC5ncnBjLnRlc3RpbmcuUmVxdWVzdFJlc3VsdENvdW50KkEK", - "CkNsaWVudFR5cGUSDwoLU1lOQ19DTElFTlQQABIQCgxBU1lOQ19DTElFTlQQ", - "ARIQCgxPVEhFUl9DTElFTlQQAipbCgpTZXJ2ZXJUeXBlEg8KC1NZTkNfU0VS", - "VkVSEAASEAoMQVNZTkNfU0VSVkVSEAESGAoUQVNZTkNfR0VORVJJQ19TRVJW", - "RVIQAhIQCgxPVEhFUl9TRVJWRVIQAyojCgdScGNUeXBlEgkKBVVOQVJZEAAS", - "DQoJU1RSRUFNSU5HEAFiBnByb3RvMw==")); + "c3RpbmcuQ2hhbm5lbEFyZxIWCg50aHJlYWRzX3Blcl9jcRgRIAEoBRIbChNt", + "ZXNzYWdlc19wZXJfc3RyZWFtGBIgASgFIjgKDENsaWVudFN0YXR1cxIoCgVz", + "dGF0cxgBIAEoCzIZLmdycGMudGVzdGluZy5DbGllbnRTdGF0cyIVCgRNYXJr", + "Eg0KBXJlc2V0GAEgASgIImgKCkNsaWVudEFyZ3MSKwoFc2V0dXAYASABKAsy", + "Gi5ncnBjLnRlc3RpbmcuQ2xpZW50Q29uZmlnSAASIgoEbWFyaxgCIAEoCzIS", + "LmdycGMudGVzdGluZy5NYXJrSABCCQoHYXJndHlwZSLMAgoMU2VydmVyQ29u", + "ZmlnEi0KC3NlcnZlcl90eXBlGAEgASgOMhguZ3JwYy50ZXN0aW5nLlNlcnZl", + "clR5cGUSNQoPc2VjdXJpdHlfcGFyYW1zGAIgASgLMhwuZ3JwYy50ZXN0aW5n", + "LlNlY3VyaXR5UGFyYW1zEgwKBHBvcnQYBCABKAUSHAoUYXN5bmNfc2VydmVy", + "X3RocmVhZHMYByABKAUSEgoKY29yZV9saW1pdBgIIAEoBRIzCg5wYXlsb2Fk", + "X2NvbmZpZxgJIAEoCzIbLmdycGMudGVzdGluZy5QYXlsb2FkQ29uZmlnEhEK", + "CWNvcmVfbGlzdBgKIAMoBRIYChBvdGhlcl9zZXJ2ZXJfYXBpGAsgASgJEhYK", + "DnRocmVhZHNfcGVyX2NxGAwgASgFEhwKE3Jlc291cmNlX3F1b3RhX3NpemUY", + "6QcgASgFImgKClNlcnZlckFyZ3MSKwoFc2V0dXAYASABKAsyGi5ncnBjLnRl", + "c3RpbmcuU2VydmVyQ29uZmlnSAASIgoEbWFyaxgCIAEoCzISLmdycGMudGVz", + "dGluZy5NYXJrSABCCQoHYXJndHlwZSJVCgxTZXJ2ZXJTdGF0dXMSKAoFc3Rh", + "dHMYASABKAsyGS5ncnBjLnRlc3RpbmcuU2VydmVyU3RhdHMSDAoEcG9ydBgC", + "IAEoBRINCgVjb3JlcxgDIAEoBSINCgtDb3JlUmVxdWVzdCIdCgxDb3JlUmVz", + "cG9uc2USDQoFY29yZXMYASABKAUiBgoEVm9pZCL9AQoIU2NlbmFyaW8SDAoE", + "bmFtZRgBIAEoCRIxCg1jbGllbnRfY29uZmlnGAIgASgLMhouZ3JwYy50ZXN0", + "aW5nLkNsaWVudENvbmZpZxITCgtudW1fY2xpZW50cxgDIAEoBRIxCg1zZXJ2", + "ZXJfY29uZmlnGAQgASgLMhouZ3JwYy50ZXN0aW5nLlNlcnZlckNvbmZpZxIT", + "CgtudW1fc2VydmVycxgFIAEoBRIWCg53YXJtdXBfc2Vjb25kcxgGIAEoBRIZ", + "ChFiZW5jaG1hcmtfc2Vjb25kcxgHIAEoBRIgChhzcGF3bl9sb2NhbF93b3Jr", + "ZXJfY291bnQYCCABKAUiNgoJU2NlbmFyaW9zEikKCXNjZW5hcmlvcxgBIAMo", + "CzIWLmdycGMudGVzdGluZy5TY2VuYXJpbyK8AwoVU2NlbmFyaW9SZXN1bHRT", + "dW1tYXJ5EgsKA3FwcxgBIAEoARIbChNxcHNfcGVyX3NlcnZlcl9jb3JlGAIg", + "ASgBEhoKEnNlcnZlcl9zeXN0ZW1fdGltZRgDIAEoARIYChBzZXJ2ZXJfdXNl", + "cl90aW1lGAQgASgBEhoKEmNsaWVudF9zeXN0ZW1fdGltZRgFIAEoARIYChBj", + "bGllbnRfdXNlcl90aW1lGAYgASgBEhIKCmxhdGVuY3lfNTAYByABKAESEgoK", + "bGF0ZW5jeV85MBgIIAEoARISCgpsYXRlbmN5Xzk1GAkgASgBEhIKCmxhdGVu", + "Y3lfOTkYCiABKAESEwoLbGF0ZW5jeV85OTkYCyABKAESGAoQc2VydmVyX2Nw", + "dV91c2FnZRgMIAEoARImCh5zdWNjZXNzZnVsX3JlcXVlc3RzX3Blcl9zZWNv", + "bmQYDSABKAESIgoaZmFpbGVkX3JlcXVlc3RzX3Blcl9zZWNvbmQYDiABKAES", + "IAoYY2xpZW50X3BvbGxzX3Blcl9yZXF1ZXN0GA8gASgBEiAKGHNlcnZlcl9w", + "b2xsc19wZXJfcmVxdWVzdBgQIAEoASKDAwoOU2NlbmFyaW9SZXN1bHQSKAoI", + "c2NlbmFyaW8YASABKAsyFi5ncnBjLnRlc3RpbmcuU2NlbmFyaW8SLgoJbGF0", + "ZW5jaWVzGAIgASgLMhsuZ3JwYy50ZXN0aW5nLkhpc3RvZ3JhbURhdGESLwoM", + "Y2xpZW50X3N0YXRzGAMgAygLMhkuZ3JwYy50ZXN0aW5nLkNsaWVudFN0YXRz", + "Ei8KDHNlcnZlcl9zdGF0cxgEIAMoCzIZLmdycGMudGVzdGluZy5TZXJ2ZXJT", + "dGF0cxIUCgxzZXJ2ZXJfY29yZXMYBSADKAUSNAoHc3VtbWFyeRgGIAEoCzIj", + "LmdycGMudGVzdGluZy5TY2VuYXJpb1Jlc3VsdFN1bW1hcnkSFgoOY2xpZW50", + "X3N1Y2Nlc3MYByADKAgSFgoOc2VydmVyX3N1Y2Nlc3MYCCADKAgSOQoPcmVx", + "dWVzdF9yZXN1bHRzGAkgAygLMiAuZ3JwYy50ZXN0aW5nLlJlcXVlc3RSZXN1", + "bHRDb3VudCpBCgpDbGllbnRUeXBlEg8KC1NZTkNfQ0xJRU5UEAASEAoMQVNZ", + "TkNfQ0xJRU5UEAESEAoMT1RIRVJfQ0xJRU5UEAIqWwoKU2VydmVyVHlwZRIP", + "CgtTWU5DX1NFUlZFUhAAEhAKDEFTWU5DX1NFUlZFUhABEhgKFEFTWU5DX0dF", + "TkVSSUNfU0VSVkVSEAISEAoMT1RIRVJfU0VSVkVSEAMqcgoHUnBjVHlwZRIJ", + "CgVVTkFSWRAAEg0KCVNUUkVBTUlORxABEhkKFVNUUkVBTUlOR19GUk9NX0NM", + "SUVOVBACEhkKFVNUUkVBTUlOR19GUk9NX1NFUlZFUhADEhcKE1NUUkVBTUlO", + "R19CT1RIX1dBWVMQBGIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Grpc.Testing.PayloadsReflection.Descriptor, global::Grpc.Testing.StatsReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Grpc.Testing.ClientType), typeof(global::Grpc.Testing.ServerType), typeof(global::Grpc.Testing.RpcType), }, new pbr::GeneratedClrTypeInfo[] { @@ -98,11 +103,11 @@ namespace Grpc.Testing { new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.LoadParams), global::Grpc.Testing.LoadParams.Parser, new[]{ "ClosedLoop", "Poisson" }, new[]{ "Load" }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SecurityParams), global::Grpc.Testing.SecurityParams.Parser, new[]{ "UseTestCa", "ServerHostOverride" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ChannelArg), global::Grpc.Testing.ChannelArg.Parser, new[]{ "Name", "StrValue", "IntValue" }, new[]{ "Value" }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit", "OtherClientApi", "ChannelArgs" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit", "OtherClientApi", "ChannelArgs", "ThreadsPerCq", "MessagesPerStream" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientStatus), global::Grpc.Testing.ClientStatus.Parser, new[]{ "Stats" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Mark), global::Grpc.Testing.Mark.Parser, new[]{ "Reset" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientArgs), global::Grpc.Testing.ClientArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerConfig), global::Grpc.Testing.ServerConfig.Parser, new[]{ "ServerType", "SecurityParams", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig", "CoreList", "OtherServerApi", "ResourceQuotaSize" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerConfig), global::Grpc.Testing.ServerConfig.Parser, new[]{ "ServerType", "SecurityParams", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig", "CoreList", "OtherServerApi", "ThreadsPerCq", "ResourceQuotaSize" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerArgs), global::Grpc.Testing.ServerArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerStatus), global::Grpc.Testing.ServerStatus.Parser, new[]{ "Stats", "Port", "Cores" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.CoreRequest), global::Grpc.Testing.CoreRequest.Parser, null, null, null, null), @@ -110,7 +115,7 @@ namespace Grpc.Testing { new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Void), global::Grpc.Testing.Void.Parser, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Scenario), global::Grpc.Testing.Scenario.Parser, new[]{ "Name", "ClientConfig", "NumClients", "ServerConfig", "NumServers", "WarmupSeconds", "BenchmarkSeconds", "SpawnLocalWorkerCount" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Scenarios), global::Grpc.Testing.Scenarios.Parser, new[]{ "Scenarios_" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ScenarioResultSummary), global::Grpc.Testing.ScenarioResultSummary.Parser, new[]{ "Qps", "QpsPerServerCore", "ServerSystemTime", "ServerUserTime", "ClientSystemTime", "ClientUserTime", "Latency50", "Latency90", "Latency95", "Latency99", "Latency999", "ServerCpuUsage", "SuccessfulRequestsPerSecond", "FailedRequestsPerSecond" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ScenarioResultSummary), global::Grpc.Testing.ScenarioResultSummary.Parser, new[]{ "Qps", "QpsPerServerCore", "ServerSystemTime", "ServerUserTime", "ClientSystemTime", "ClientUserTime", "Latency50", "Latency90", "Latency95", "Latency99", "Latency999", "ServerCpuUsage", "SuccessfulRequestsPerSecond", "FailedRequestsPerSecond", "ClientPollsPerRequest", "ServerPollsPerRequest" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ScenarioResult), global::Grpc.Testing.ScenarioResult.Parser, new[]{ "Scenario", "Latencies", "ClientStats", "ServerStats", "ServerCores", "Summary", "ClientSuccess", "ServerSuccess", "RequestResults" }, null, null, null) })); } @@ -144,6 +149,9 @@ namespace Grpc.Testing { public enum RpcType { [pbr::OriginalName("UNARY")] Unary = 0, [pbr::OriginalName("STREAMING")] Streaming = 1, + [pbr::OriginalName("STREAMING_FROM_CLIENT")] StreamingFromClient = 2, + [pbr::OriginalName("STREAMING_FROM_SERVER")] StreamingFromServer = 3, + [pbr::OriginalName("STREAMING_BOTH_WAYS")] StreamingBothWays = 4, } #endregion @@ -942,6 +950,8 @@ namespace Grpc.Testing { coreLimit_ = other.coreLimit_; otherClientApi_ = other.otherClientApi_; channelArgs_ = other.channelArgs_.Clone(); + threadsPerCq_ = other.threadsPerCq_; + messagesPerStream_ = other.messagesPerStream_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1123,6 +1133,34 @@ namespace Grpc.Testing { get { return channelArgs_; } } + /// Field number for the "threads_per_cq" field. + public const int ThreadsPerCqFieldNumber = 17; + private int threadsPerCq_; + /// + /// Number of threads that share each completion queue + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ThreadsPerCq { + get { return threadsPerCq_; } + set { + threadsPerCq_ = value; + } + } + + /// Field number for the "messages_per_stream" field. + public const int MessagesPerStreamFieldNumber = 18; + private int messagesPerStream_; + /// + /// Number of messages on a stream before it gets finished/restarted + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int MessagesPerStream { + get { return messagesPerStream_; } + set { + messagesPerStream_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ClientConfig); @@ -1150,6 +1188,8 @@ namespace Grpc.Testing { if (CoreLimit != other.CoreLimit) return false; if (OtherClientApi != other.OtherClientApi) return false; if(!channelArgs_.Equals(other.channelArgs_)) return false; + if (ThreadsPerCq != other.ThreadsPerCq) return false; + if (MessagesPerStream != other.MessagesPerStream) return false; return true; } @@ -1170,6 +1210,8 @@ namespace Grpc.Testing { if (CoreLimit != 0) hash ^= CoreLimit.GetHashCode(); if (OtherClientApi.Length != 0) hash ^= OtherClientApi.GetHashCode(); hash ^= channelArgs_.GetHashCode(); + if (ThreadsPerCq != 0) hash ^= ThreadsPerCq.GetHashCode(); + if (MessagesPerStream != 0) hash ^= MessagesPerStream.GetHashCode(); return hash; } @@ -1227,6 +1269,14 @@ namespace Grpc.Testing { output.WriteString(OtherClientApi); } channelArgs_.WriteTo(output, _repeated_channelArgs_codec); + if (ThreadsPerCq != 0) { + output.WriteRawTag(136, 1); + output.WriteInt32(ThreadsPerCq); + } + if (MessagesPerStream != 0) { + output.WriteRawTag(144, 1); + output.WriteInt32(MessagesPerStream); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1268,6 +1318,12 @@ namespace Grpc.Testing { size += 1 + pb::CodedOutputStream.ComputeStringSize(OtherClientApi); } size += channelArgs_.CalculateSize(_repeated_channelArgs_codec); + if (ThreadsPerCq != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(ThreadsPerCq); + } + if (MessagesPerStream != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(MessagesPerStream); + } return size; } @@ -1324,6 +1380,12 @@ namespace Grpc.Testing { OtherClientApi = other.OtherClientApi; } channelArgs_.Add(other.channelArgs_); + if (other.ThreadsPerCq != 0) { + ThreadsPerCq = other.ThreadsPerCq; + } + if (other.MessagesPerStream != 0) { + MessagesPerStream = other.MessagesPerStream; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1403,6 +1465,14 @@ namespace Grpc.Testing { channelArgs_.AddEntriesFrom(input, _repeated_channelArgs_codec); break; } + case 136: { + ThreadsPerCq = input.ReadInt32(); + break; + } + case 144: { + MessagesPerStream = input.ReadInt32(); + break; + } } } } @@ -1873,6 +1943,7 @@ namespace Grpc.Testing { PayloadConfig = other.payloadConfig_ != null ? other.PayloadConfig.Clone() : null; coreList_ = other.coreList_.Clone(); otherServerApi_ = other.otherServerApi_; + threadsPerCq_ = other.threadsPerCq_; resourceQuotaSize_ = other.resourceQuotaSize_; } @@ -1989,6 +2060,20 @@ namespace Grpc.Testing { } } + /// Field number for the "threads_per_cq" field. + public const int ThreadsPerCqFieldNumber = 12; + private int threadsPerCq_; + /// + /// Number of threads that share each completion queue + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ThreadsPerCq { + get { return threadsPerCq_; } + set { + threadsPerCq_ = value; + } + } + /// Field number for the "resource_quota_size" field. public const int ResourceQuotaSizeFieldNumber = 1001; private int resourceQuotaSize_; @@ -2024,6 +2109,7 @@ namespace Grpc.Testing { if (!object.Equals(PayloadConfig, other.PayloadConfig)) return false; if(!coreList_.Equals(other.coreList_)) return false; if (OtherServerApi != other.OtherServerApi) return false; + if (ThreadsPerCq != other.ThreadsPerCq) return false; if (ResourceQuotaSize != other.ResourceQuotaSize) return false; return true; } @@ -2039,6 +2125,7 @@ namespace Grpc.Testing { if (payloadConfig_ != null) hash ^= PayloadConfig.GetHashCode(); hash ^= coreList_.GetHashCode(); if (OtherServerApi.Length != 0) hash ^= OtherServerApi.GetHashCode(); + if (ThreadsPerCq != 0) hash ^= ThreadsPerCq.GetHashCode(); if (ResourceQuotaSize != 0) hash ^= ResourceQuotaSize.GetHashCode(); return hash; } @@ -2079,6 +2166,10 @@ namespace Grpc.Testing { output.WriteRawTag(90); output.WriteString(OtherServerApi); } + if (ThreadsPerCq != 0) { + output.WriteRawTag(96); + output.WriteInt32(ThreadsPerCq); + } if (ResourceQuotaSize != 0) { output.WriteRawTag(200, 62); output.WriteInt32(ResourceQuotaSize); @@ -2110,6 +2201,9 @@ namespace Grpc.Testing { if (OtherServerApi.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(OtherServerApi); } + if (ThreadsPerCq != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ThreadsPerCq); + } if (ResourceQuotaSize != 0) { size += 2 + pb::CodedOutputStream.ComputeInt32Size(ResourceQuotaSize); } @@ -2149,6 +2243,9 @@ namespace Grpc.Testing { if (other.OtherServerApi.Length != 0) { OtherServerApi = other.OtherServerApi; } + if (other.ThreadsPerCq != 0) { + ThreadsPerCq = other.ThreadsPerCq; + } if (other.ResourceQuotaSize != 0) { ResourceQuotaSize = other.ResourceQuotaSize; } @@ -2201,6 +2298,10 @@ namespace Grpc.Testing { OtherServerApi = input.ReadString(); break; } + case 96: { + ThreadsPerCq = input.ReadInt32(); + break; + } case 8008: { ResourceQuotaSize = input.ReadInt32(); break; @@ -3386,6 +3487,8 @@ namespace Grpc.Testing { serverCpuUsage_ = other.serverCpuUsage_; successfulRequestsPerSecond_ = other.successfulRequestsPerSecond_; failedRequestsPerSecond_ = other.failedRequestsPerSecond_; + clientPollsPerRequest_ = other.clientPollsPerRequest_; + serverPollsPerRequest_ = other.serverPollsPerRequest_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3574,6 +3677,31 @@ namespace Grpc.Testing { } } + /// Field number for the "client_polls_per_request" field. + public const int ClientPollsPerRequestFieldNumber = 15; + private double clientPollsPerRequest_; + /// + /// Number of polls called inside completion queue per request + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double ClientPollsPerRequest { + get { return clientPollsPerRequest_; } + set { + clientPollsPerRequest_ = value; + } + } + + /// Field number for the "server_polls_per_request" field. + public const int ServerPollsPerRequestFieldNumber = 16; + private double serverPollsPerRequest_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double ServerPollsPerRequest { + get { return serverPollsPerRequest_; } + set { + serverPollsPerRequest_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ScenarioResultSummary); @@ -3601,6 +3729,8 @@ namespace Grpc.Testing { if (ServerCpuUsage != other.ServerCpuUsage) return false; if (SuccessfulRequestsPerSecond != other.SuccessfulRequestsPerSecond) return false; if (FailedRequestsPerSecond != other.FailedRequestsPerSecond) return false; + if (ClientPollsPerRequest != other.ClientPollsPerRequest) return false; + if (ServerPollsPerRequest != other.ServerPollsPerRequest) return false; return true; } @@ -3621,6 +3751,8 @@ namespace Grpc.Testing { if (ServerCpuUsage != 0D) hash ^= ServerCpuUsage.GetHashCode(); if (SuccessfulRequestsPerSecond != 0D) hash ^= SuccessfulRequestsPerSecond.GetHashCode(); if (FailedRequestsPerSecond != 0D) hash ^= FailedRequestsPerSecond.GetHashCode(); + if (ClientPollsPerRequest != 0D) hash ^= ClientPollsPerRequest.GetHashCode(); + if (ServerPollsPerRequest != 0D) hash ^= ServerPollsPerRequest.GetHashCode(); return hash; } @@ -3687,6 +3819,14 @@ namespace Grpc.Testing { output.WriteRawTag(113); output.WriteDouble(FailedRequestsPerSecond); } + if (ClientPollsPerRequest != 0D) { + output.WriteRawTag(121); + output.WriteDouble(ClientPollsPerRequest); + } + if (ServerPollsPerRequest != 0D) { + output.WriteRawTag(129, 1); + output.WriteDouble(ServerPollsPerRequest); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3734,6 +3874,12 @@ namespace Grpc.Testing { if (FailedRequestsPerSecond != 0D) { size += 1 + 8; } + if (ClientPollsPerRequest != 0D) { + size += 1 + 8; + } + if (ServerPollsPerRequest != 0D) { + size += 2 + 8; + } return size; } @@ -3784,6 +3930,12 @@ namespace Grpc.Testing { if (other.FailedRequestsPerSecond != 0D) { FailedRequestsPerSecond = other.FailedRequestsPerSecond; } + if (other.ClientPollsPerRequest != 0D) { + ClientPollsPerRequest = other.ClientPollsPerRequest; + } + if (other.ServerPollsPerRequest != 0D) { + ServerPollsPerRequest = other.ServerPollsPerRequest; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3850,6 +4002,14 @@ namespace Grpc.Testing { FailedRequestsPerSecond = input.ReadDouble(); break; } + case 121: { + ClientPollsPerRequest = input.ReadDouble(); + break; + } + case 129: { + ServerPollsPerRequest = input.ReadDouble(); + break; + } } } } diff --git a/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs b/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs new file mode 100644 index 00000000000..be996f91e03 --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs @@ -0,0 +1,112 @@ +#region Copyright notice and license + +// Copyright 2015-2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Google.Protobuf; +using Grpc.Core; +using Grpc.Core.Utils; +using Grpc.Testing; +using NUnit.Framework; + +namespace Grpc.IntegrationTesting +{ + /// + /// Shows how to attach custom error details as a binary trailer. + /// + public class CustomErrorDetailsTest + { + const string DebugInfoTrailerName = "debug-info-bin"; + const string ExceptionDetail = "Exception thrown on purpose."; + const string Host = "localhost"; + Server server; + Channel channel; + TestService.TestServiceClient client; + + [TestFixtureSetUp] + public void Init() + { + // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755 + server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) }) + { + Services = { TestService.BindService(new CustomErrorDetailsTestServiceImpl()) }, + Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } } + }; + server.Start(); + + channel = new Channel(Host, server.Ports.Single().BoundPort, ChannelCredentials.Insecure); + client = new TestService.TestServiceClient(channel); + } + + [TestFixtureTearDown] + public void Cleanup() + { + channel.ShutdownAsync().Wait(); + server.ShutdownAsync().Wait(); + } + + [Test] + public async Task UnaryCall() + { + var call = client.UnaryCallAsync(new SimpleRequest { ResponseSize = 10 }); + + try + { + await call.ResponseAsync; + Assert.Fail(); + } + catch (RpcException e) + { + Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode); + var debugInfo = GetDebugInfo(call.GetTrailers()); + Assert.AreEqual(debugInfo.Detail, ExceptionDetail); + Assert.IsNotEmpty(debugInfo.StackEntries); + } + } + + private DebugInfo GetDebugInfo(Metadata trailers) + { + var entry = trailers.First((e) => e.Key == DebugInfoTrailerName); + return DebugInfo.Parser.ParseFrom(entry.ValueBytes); + } + + private class CustomErrorDetailsTestServiceImpl : TestService.TestServiceBase + { + public override async Task UnaryCall(SimpleRequest request, ServerCallContext context) + { + try + { + throw new ArgumentException(ExceptionDetail); + } + catch (Exception e) + { + // Fill debug info with some structured details about the failure. + var debugInfo = new DebugInfo(); + debugInfo.Detail = e.Message; + debugInfo.StackEntries.AddRange(e.StackTrace.Split(new[] { Environment.NewLine }, StringSplitOptions.None)); + context.ResponseTrailers.Add(DebugInfoTrailerName, debugInfo.ToByteArray()); + throw new RpcException(new Status(StatusCode.Unknown, "The handler threw exception.")); + } + } + } + } +} diff --git a/src/csharp/Grpc.IntegrationTesting/EchoMessages.cs b/src/csharp/Grpc.IntegrationTesting/EchoMessages.cs new file mode 100644 index 00000000000..b2fe73acdf4 --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting/EchoMessages.cs @@ -0,0 +1,1354 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: src/proto/grpc/testing/echo_messages.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Grpc.Testing { + + /// Holder for reflection information generated from src/proto/grpc/testing/echo_messages.proto + public static partial class EchoMessagesReflection { + + #region Descriptor + /// File descriptor for src/proto/grpc/testing/echo_messages.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static EchoMessagesReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CipzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL2VjaG9fbWVzc2FnZXMucHJvdG8S", + "DGdycGMudGVzdGluZyIyCglEZWJ1Z0luZm8SFQoNc3RhY2tfZW50cmllcxgB", + "IAMoCRIOCgZkZXRhaWwYAiABKAkiUAoLRXJyb3JTdGF0dXMSDAoEY29kZRgB", + "IAEoBRIVCg1lcnJvcl9tZXNzYWdlGAIgASgJEhwKFGJpbmFyeV9lcnJvcl9k", + "ZXRhaWxzGAMgASgJIskDCg1SZXF1ZXN0UGFyYW1zEhUKDWVjaG9fZGVhZGxp", + "bmUYASABKAgSHgoWY2xpZW50X2NhbmNlbF9hZnRlcl91cxgCIAEoBRIeChZz", + "ZXJ2ZXJfY2FuY2VsX2FmdGVyX3VzGAMgASgFEhUKDWVjaG9fbWV0YWRhdGEY", + "BCABKAgSGgoSY2hlY2tfYXV0aF9jb250ZXh0GAUgASgIEh8KF3Jlc3BvbnNl", + "X21lc3NhZ2VfbGVuZ3RoGAYgASgFEhEKCWVjaG9fcGVlchgHIAEoCBIgChhl", + "eHBlY3RlZF9jbGllbnRfaWRlbnRpdHkYCCABKAkSHAoUc2tpcF9jYW5jZWxs", + "ZWRfY2hlY2sYCSABKAgSKAogZXhwZWN0ZWRfdHJhbnNwb3J0X3NlY3VyaXR5", + "X3R5cGUYCiABKAkSKwoKZGVidWdfaW5mbxgLIAEoCzIXLmdycGMudGVzdGlu", + "Zy5EZWJ1Z0luZm8SEgoKc2VydmVyX2RpZRgMIAEoCBIcChRiaW5hcnlfZXJy", + "b3JfZGV0YWlscxgNIAEoCRIxCg5leHBlY3RlZF9lcnJvchgOIAEoCzIZLmdy", + "cGMudGVzdGluZy5FcnJvclN0YXR1cyJKCgtFY2hvUmVxdWVzdBIPCgdtZXNz", + "YWdlGAEgASgJEioKBXBhcmFtGAIgASgLMhsuZ3JwYy50ZXN0aW5nLlJlcXVl", + "c3RQYXJhbXMiRgoOUmVzcG9uc2VQYXJhbXMSGAoQcmVxdWVzdF9kZWFkbGlu", + "ZRgBIAEoAxIMCgRob3N0GAIgASgJEgwKBHBlZXIYAyABKAkiTAoMRWNob1Jl", + "c3BvbnNlEg8KB21lc3NhZ2UYASABKAkSKwoFcGFyYW0YAiABKAsyHC5ncnBj", + "LnRlc3RpbmcuUmVzcG9uc2VQYXJhbXNiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.DebugInfo), global::Grpc.Testing.DebugInfo.Parser, new[]{ "StackEntries", "Detail" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ErrorStatus), global::Grpc.Testing.ErrorStatus.Parser, new[]{ "Code", "ErrorMessage", "BinaryErrorDetails" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.RequestParams), global::Grpc.Testing.RequestParams.Parser, new[]{ "EchoDeadline", "ClientCancelAfterUs", "ServerCancelAfterUs", "EchoMetadata", "CheckAuthContext", "ResponseMessageLength", "EchoPeer", "ExpectedClientIdentity", "SkipCancelledCheck", "ExpectedTransportSecurityType", "DebugInfo", "ServerDie", "BinaryErrorDetails", "ExpectedError" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.EchoRequest), global::Grpc.Testing.EchoRequest.Parser, new[]{ "Message", "Param" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ResponseParams), global::Grpc.Testing.ResponseParams.Parser, new[]{ "RequestDeadline", "Host", "Peer" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.EchoResponse), global::Grpc.Testing.EchoResponse.Parser, new[]{ "Message", "Param" }, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// Message to be echoed back serialized in trailer. + /// + public sealed partial class DebugInfo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DebugInfo()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.EchoMessagesReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DebugInfo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DebugInfo(DebugInfo other) : this() { + stackEntries_ = other.stackEntries_.Clone(); + detail_ = other.detail_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DebugInfo Clone() { + return new DebugInfo(this); + } + + /// Field number for the "stack_entries" field. + public const int StackEntriesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_stackEntries_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField stackEntries_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField StackEntries { + get { return stackEntries_; } + } + + /// Field number for the "detail" field. + public const int DetailFieldNumber = 2; + private string detail_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Detail { + get { return detail_; } + set { + detail_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DebugInfo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DebugInfo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!stackEntries_.Equals(other.stackEntries_)) return false; + if (Detail != other.Detail) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= stackEntries_.GetHashCode(); + if (Detail.Length != 0) hash ^= Detail.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + stackEntries_.WriteTo(output, _repeated_stackEntries_codec); + if (Detail.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Detail); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += stackEntries_.CalculateSize(_repeated_stackEntries_codec); + if (Detail.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Detail); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DebugInfo other) { + if (other == null) { + return; + } + stackEntries_.Add(other.stackEntries_); + if (other.Detail.Length != 0) { + Detail = other.Detail; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + stackEntries_.AddEntriesFrom(input, _repeated_stackEntries_codec); + break; + } + case 18: { + Detail = input.ReadString(); + break; + } + } + } + } + + } + + /// + /// Error status client expects to see. + /// + public sealed partial class ErrorStatus : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ErrorStatus()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.EchoMessagesReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ErrorStatus() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ErrorStatus(ErrorStatus other) : this() { + code_ = other.code_; + errorMessage_ = other.errorMessage_; + binaryErrorDetails_ = other.binaryErrorDetails_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ErrorStatus Clone() { + return new ErrorStatus(this); + } + + /// Field number for the "code" field. + public const int CodeFieldNumber = 1; + private int code_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Code { + get { return code_; } + set { + code_ = value; + } + } + + /// Field number for the "error_message" field. + public const int ErrorMessageFieldNumber = 2; + private string errorMessage_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ErrorMessage { + get { return errorMessage_; } + set { + errorMessage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "binary_error_details" field. + public const int BinaryErrorDetailsFieldNumber = 3; + private string binaryErrorDetails_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BinaryErrorDetails { + get { return binaryErrorDetails_; } + set { + binaryErrorDetails_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ErrorStatus); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ErrorStatus other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Code != other.Code) return false; + if (ErrorMessage != other.ErrorMessage) return false; + if (BinaryErrorDetails != other.BinaryErrorDetails) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Code != 0) hash ^= Code.GetHashCode(); + if (ErrorMessage.Length != 0) hash ^= ErrorMessage.GetHashCode(); + if (BinaryErrorDetails.Length != 0) hash ^= BinaryErrorDetails.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Code != 0) { + output.WriteRawTag(8); + output.WriteInt32(Code); + } + if (ErrorMessage.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ErrorMessage); + } + if (BinaryErrorDetails.Length != 0) { + output.WriteRawTag(26); + output.WriteString(BinaryErrorDetails); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Code != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + } + if (ErrorMessage.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ErrorMessage); + } + if (BinaryErrorDetails.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BinaryErrorDetails); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ErrorStatus other) { + if (other == null) { + return; + } + if (other.Code != 0) { + Code = other.Code; + } + if (other.ErrorMessage.Length != 0) { + ErrorMessage = other.ErrorMessage; + } + if (other.BinaryErrorDetails.Length != 0) { + BinaryErrorDetails = other.BinaryErrorDetails; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + Code = input.ReadInt32(); + break; + } + case 18: { + ErrorMessage = input.ReadString(); + break; + } + case 26: { + BinaryErrorDetails = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class RequestParams : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RequestParams()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.EchoMessagesReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RequestParams() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RequestParams(RequestParams other) : this() { + echoDeadline_ = other.echoDeadline_; + clientCancelAfterUs_ = other.clientCancelAfterUs_; + serverCancelAfterUs_ = other.serverCancelAfterUs_; + echoMetadata_ = other.echoMetadata_; + checkAuthContext_ = other.checkAuthContext_; + responseMessageLength_ = other.responseMessageLength_; + echoPeer_ = other.echoPeer_; + expectedClientIdentity_ = other.expectedClientIdentity_; + skipCancelledCheck_ = other.skipCancelledCheck_; + expectedTransportSecurityType_ = other.expectedTransportSecurityType_; + DebugInfo = other.debugInfo_ != null ? other.DebugInfo.Clone() : null; + serverDie_ = other.serverDie_; + binaryErrorDetails_ = other.binaryErrorDetails_; + ExpectedError = other.expectedError_ != null ? other.ExpectedError.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RequestParams Clone() { + return new RequestParams(this); + } + + /// Field number for the "echo_deadline" field. + public const int EchoDeadlineFieldNumber = 1; + private bool echoDeadline_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool EchoDeadline { + get { return echoDeadline_; } + set { + echoDeadline_ = value; + } + } + + /// Field number for the "client_cancel_after_us" field. + public const int ClientCancelAfterUsFieldNumber = 2; + private int clientCancelAfterUs_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ClientCancelAfterUs { + get { return clientCancelAfterUs_; } + set { + clientCancelAfterUs_ = value; + } + } + + /// Field number for the "server_cancel_after_us" field. + public const int ServerCancelAfterUsFieldNumber = 3; + private int serverCancelAfterUs_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ServerCancelAfterUs { + get { return serverCancelAfterUs_; } + set { + serverCancelAfterUs_ = value; + } + } + + /// Field number for the "echo_metadata" field. + public const int EchoMetadataFieldNumber = 4; + private bool echoMetadata_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool EchoMetadata { + get { return echoMetadata_; } + set { + echoMetadata_ = value; + } + } + + /// Field number for the "check_auth_context" field. + public const int CheckAuthContextFieldNumber = 5; + private bool checkAuthContext_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool CheckAuthContext { + get { return checkAuthContext_; } + set { + checkAuthContext_ = value; + } + } + + /// Field number for the "response_message_length" field. + public const int ResponseMessageLengthFieldNumber = 6; + private int responseMessageLength_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ResponseMessageLength { + get { return responseMessageLength_; } + set { + responseMessageLength_ = value; + } + } + + /// Field number for the "echo_peer" field. + public const int EchoPeerFieldNumber = 7; + private bool echoPeer_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool EchoPeer { + get { return echoPeer_; } + set { + echoPeer_ = value; + } + } + + /// Field number for the "expected_client_identity" field. + public const int ExpectedClientIdentityFieldNumber = 8; + private string expectedClientIdentity_ = ""; + /// + /// will force check_auth_context. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ExpectedClientIdentity { + get { return expectedClientIdentity_; } + set { + expectedClientIdentity_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "skip_cancelled_check" field. + public const int SkipCancelledCheckFieldNumber = 9; + private bool skipCancelledCheck_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool SkipCancelledCheck { + get { return skipCancelledCheck_; } + set { + skipCancelledCheck_ = value; + } + } + + /// Field number for the "expected_transport_security_type" field. + public const int ExpectedTransportSecurityTypeFieldNumber = 10; + private string expectedTransportSecurityType_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ExpectedTransportSecurityType { + get { return expectedTransportSecurityType_; } + set { + expectedTransportSecurityType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "debug_info" field. + public const int DebugInfoFieldNumber = 11; + private global::Grpc.Testing.DebugInfo debugInfo_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Grpc.Testing.DebugInfo DebugInfo { + get { return debugInfo_; } + set { + debugInfo_ = value; + } + } + + /// Field number for the "server_die" field. + public const int ServerDieFieldNumber = 12; + private bool serverDie_; + /// + /// Server should not see a request with this set. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool ServerDie { + get { return serverDie_; } + set { + serverDie_ = value; + } + } + + /// Field number for the "binary_error_details" field. + public const int BinaryErrorDetailsFieldNumber = 13; + private string binaryErrorDetails_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BinaryErrorDetails { + get { return binaryErrorDetails_; } + set { + binaryErrorDetails_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "expected_error" field. + public const int ExpectedErrorFieldNumber = 14; + private global::Grpc.Testing.ErrorStatus expectedError_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Grpc.Testing.ErrorStatus ExpectedError { + get { return expectedError_; } + set { + expectedError_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RequestParams); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RequestParams other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (EchoDeadline != other.EchoDeadline) return false; + if (ClientCancelAfterUs != other.ClientCancelAfterUs) return false; + if (ServerCancelAfterUs != other.ServerCancelAfterUs) return false; + if (EchoMetadata != other.EchoMetadata) return false; + if (CheckAuthContext != other.CheckAuthContext) return false; + if (ResponseMessageLength != other.ResponseMessageLength) return false; + if (EchoPeer != other.EchoPeer) return false; + if (ExpectedClientIdentity != other.ExpectedClientIdentity) return false; + if (SkipCancelledCheck != other.SkipCancelledCheck) return false; + if (ExpectedTransportSecurityType != other.ExpectedTransportSecurityType) return false; + if (!object.Equals(DebugInfo, other.DebugInfo)) return false; + if (ServerDie != other.ServerDie) return false; + if (BinaryErrorDetails != other.BinaryErrorDetails) return false; + if (!object.Equals(ExpectedError, other.ExpectedError)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (EchoDeadline != false) hash ^= EchoDeadline.GetHashCode(); + if (ClientCancelAfterUs != 0) hash ^= ClientCancelAfterUs.GetHashCode(); + if (ServerCancelAfterUs != 0) hash ^= ServerCancelAfterUs.GetHashCode(); + if (EchoMetadata != false) hash ^= EchoMetadata.GetHashCode(); + if (CheckAuthContext != false) hash ^= CheckAuthContext.GetHashCode(); + if (ResponseMessageLength != 0) hash ^= ResponseMessageLength.GetHashCode(); + if (EchoPeer != false) hash ^= EchoPeer.GetHashCode(); + if (ExpectedClientIdentity.Length != 0) hash ^= ExpectedClientIdentity.GetHashCode(); + if (SkipCancelledCheck != false) hash ^= SkipCancelledCheck.GetHashCode(); + if (ExpectedTransportSecurityType.Length != 0) hash ^= ExpectedTransportSecurityType.GetHashCode(); + if (debugInfo_ != null) hash ^= DebugInfo.GetHashCode(); + if (ServerDie != false) hash ^= ServerDie.GetHashCode(); + if (BinaryErrorDetails.Length != 0) hash ^= BinaryErrorDetails.GetHashCode(); + if (expectedError_ != null) hash ^= ExpectedError.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (EchoDeadline != false) { + output.WriteRawTag(8); + output.WriteBool(EchoDeadline); + } + if (ClientCancelAfterUs != 0) { + output.WriteRawTag(16); + output.WriteInt32(ClientCancelAfterUs); + } + if (ServerCancelAfterUs != 0) { + output.WriteRawTag(24); + output.WriteInt32(ServerCancelAfterUs); + } + if (EchoMetadata != false) { + output.WriteRawTag(32); + output.WriteBool(EchoMetadata); + } + if (CheckAuthContext != false) { + output.WriteRawTag(40); + output.WriteBool(CheckAuthContext); + } + if (ResponseMessageLength != 0) { + output.WriteRawTag(48); + output.WriteInt32(ResponseMessageLength); + } + if (EchoPeer != false) { + output.WriteRawTag(56); + output.WriteBool(EchoPeer); + } + if (ExpectedClientIdentity.Length != 0) { + output.WriteRawTag(66); + output.WriteString(ExpectedClientIdentity); + } + if (SkipCancelledCheck != false) { + output.WriteRawTag(72); + output.WriteBool(SkipCancelledCheck); + } + if (ExpectedTransportSecurityType.Length != 0) { + output.WriteRawTag(82); + output.WriteString(ExpectedTransportSecurityType); + } + if (debugInfo_ != null) { + output.WriteRawTag(90); + output.WriteMessage(DebugInfo); + } + if (ServerDie != false) { + output.WriteRawTag(96); + output.WriteBool(ServerDie); + } + if (BinaryErrorDetails.Length != 0) { + output.WriteRawTag(106); + output.WriteString(BinaryErrorDetails); + } + if (expectedError_ != null) { + output.WriteRawTag(114); + output.WriteMessage(ExpectedError); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (EchoDeadline != false) { + size += 1 + 1; + } + if (ClientCancelAfterUs != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ClientCancelAfterUs); + } + if (ServerCancelAfterUs != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ServerCancelAfterUs); + } + if (EchoMetadata != false) { + size += 1 + 1; + } + if (CheckAuthContext != false) { + size += 1 + 1; + } + if (ResponseMessageLength != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ResponseMessageLength); + } + if (EchoPeer != false) { + size += 1 + 1; + } + if (ExpectedClientIdentity.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ExpectedClientIdentity); + } + if (SkipCancelledCheck != false) { + size += 1 + 1; + } + if (ExpectedTransportSecurityType.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ExpectedTransportSecurityType); + } + if (debugInfo_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DebugInfo); + } + if (ServerDie != false) { + size += 1 + 1; + } + if (BinaryErrorDetails.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BinaryErrorDetails); + } + if (expectedError_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExpectedError); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RequestParams other) { + if (other == null) { + return; + } + if (other.EchoDeadline != false) { + EchoDeadline = other.EchoDeadline; + } + if (other.ClientCancelAfterUs != 0) { + ClientCancelAfterUs = other.ClientCancelAfterUs; + } + if (other.ServerCancelAfterUs != 0) { + ServerCancelAfterUs = other.ServerCancelAfterUs; + } + if (other.EchoMetadata != false) { + EchoMetadata = other.EchoMetadata; + } + if (other.CheckAuthContext != false) { + CheckAuthContext = other.CheckAuthContext; + } + if (other.ResponseMessageLength != 0) { + ResponseMessageLength = other.ResponseMessageLength; + } + if (other.EchoPeer != false) { + EchoPeer = other.EchoPeer; + } + if (other.ExpectedClientIdentity.Length != 0) { + ExpectedClientIdentity = other.ExpectedClientIdentity; + } + if (other.SkipCancelledCheck != false) { + SkipCancelledCheck = other.SkipCancelledCheck; + } + if (other.ExpectedTransportSecurityType.Length != 0) { + ExpectedTransportSecurityType = other.ExpectedTransportSecurityType; + } + if (other.debugInfo_ != null) { + if (debugInfo_ == null) { + debugInfo_ = new global::Grpc.Testing.DebugInfo(); + } + DebugInfo.MergeFrom(other.DebugInfo); + } + if (other.ServerDie != false) { + ServerDie = other.ServerDie; + } + if (other.BinaryErrorDetails.Length != 0) { + BinaryErrorDetails = other.BinaryErrorDetails; + } + if (other.expectedError_ != null) { + if (expectedError_ == null) { + expectedError_ = new global::Grpc.Testing.ErrorStatus(); + } + ExpectedError.MergeFrom(other.ExpectedError); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + EchoDeadline = input.ReadBool(); + break; + } + case 16: { + ClientCancelAfterUs = input.ReadInt32(); + break; + } + case 24: { + ServerCancelAfterUs = input.ReadInt32(); + break; + } + case 32: { + EchoMetadata = input.ReadBool(); + break; + } + case 40: { + CheckAuthContext = input.ReadBool(); + break; + } + case 48: { + ResponseMessageLength = input.ReadInt32(); + break; + } + case 56: { + EchoPeer = input.ReadBool(); + break; + } + case 66: { + ExpectedClientIdentity = input.ReadString(); + break; + } + case 72: { + SkipCancelledCheck = input.ReadBool(); + break; + } + case 82: { + ExpectedTransportSecurityType = input.ReadString(); + break; + } + case 90: { + if (debugInfo_ == null) { + debugInfo_ = new global::Grpc.Testing.DebugInfo(); + } + input.ReadMessage(debugInfo_); + break; + } + case 96: { + ServerDie = input.ReadBool(); + break; + } + case 106: { + BinaryErrorDetails = input.ReadString(); + break; + } + case 114: { + if (expectedError_ == null) { + expectedError_ = new global::Grpc.Testing.ErrorStatus(); + } + input.ReadMessage(expectedError_); + break; + } + } + } + } + + } + + public sealed partial class EchoRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EchoRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.EchoMessagesReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EchoRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EchoRequest(EchoRequest other) : this() { + message_ = other.message_; + Param = other.param_ != null ? other.Param.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EchoRequest Clone() { + return new EchoRequest(this); + } + + /// Field number for the "message" field. + public const int MessageFieldNumber = 1; + private string message_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Message { + get { return message_; } + set { + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "param" field. + public const int ParamFieldNumber = 2; + private global::Grpc.Testing.RequestParams param_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Grpc.Testing.RequestParams Param { + get { return param_; } + set { + param_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as EchoRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(EchoRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Message != other.Message) return false; + if (!object.Equals(Param, other.Param)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Message.Length != 0) hash ^= Message.GetHashCode(); + if (param_ != null) hash ^= Param.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Message.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Message); + } + if (param_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Param); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + if (param_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Param); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(EchoRequest other) { + if (other == null) { + return; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + if (other.param_ != null) { + if (param_ == null) { + param_ = new global::Grpc.Testing.RequestParams(); + } + Param.MergeFrom(other.Param); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Message = input.ReadString(); + break; + } + case 18: { + if (param_ == null) { + param_ = new global::Grpc.Testing.RequestParams(); + } + input.ReadMessage(param_); + break; + } + } + } + } + + } + + public sealed partial class ResponseParams : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResponseParams()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.EchoMessagesReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResponseParams() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResponseParams(ResponseParams other) : this() { + requestDeadline_ = other.requestDeadline_; + host_ = other.host_; + peer_ = other.peer_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResponseParams Clone() { + return new ResponseParams(this); + } + + /// Field number for the "request_deadline" field. + public const int RequestDeadlineFieldNumber = 1; + private long requestDeadline_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long RequestDeadline { + get { return requestDeadline_; } + set { + requestDeadline_ = value; + } + } + + /// Field number for the "host" field. + public const int HostFieldNumber = 2; + private string host_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Host { + get { return host_; } + set { + host_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "peer" field. + public const int PeerFieldNumber = 3; + private string peer_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Peer { + get { return peer_; } + set { + peer_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ResponseParams); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ResponseParams other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (RequestDeadline != other.RequestDeadline) return false; + if (Host != other.Host) return false; + if (Peer != other.Peer) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (RequestDeadline != 0L) hash ^= RequestDeadline.GetHashCode(); + if (Host.Length != 0) hash ^= Host.GetHashCode(); + if (Peer.Length != 0) hash ^= Peer.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (RequestDeadline != 0L) { + output.WriteRawTag(8); + output.WriteInt64(RequestDeadline); + } + if (Host.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Host); + } + if (Peer.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Peer); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (RequestDeadline != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(RequestDeadline); + } + if (Host.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Host); + } + if (Peer.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Peer); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ResponseParams other) { + if (other == null) { + return; + } + if (other.RequestDeadline != 0L) { + RequestDeadline = other.RequestDeadline; + } + if (other.Host.Length != 0) { + Host = other.Host; + } + if (other.Peer.Length != 0) { + Peer = other.Peer; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + RequestDeadline = input.ReadInt64(); + break; + } + case 18: { + Host = input.ReadString(); + break; + } + case 26: { + Peer = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class EchoResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EchoResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.EchoMessagesReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EchoResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EchoResponse(EchoResponse other) : this() { + message_ = other.message_; + Param = other.param_ != null ? other.Param.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EchoResponse Clone() { + return new EchoResponse(this); + } + + /// Field number for the "message" field. + public const int MessageFieldNumber = 1; + private string message_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Message { + get { return message_; } + set { + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "param" field. + public const int ParamFieldNumber = 2; + private global::Grpc.Testing.ResponseParams param_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Grpc.Testing.ResponseParams Param { + get { return param_; } + set { + param_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as EchoResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(EchoResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Message != other.Message) return false; + if (!object.Equals(Param, other.Param)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Message.Length != 0) hash ^= Message.GetHashCode(); + if (param_ != null) hash ^= Param.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Message.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Message); + } + if (param_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Param); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + if (param_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Param); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(EchoResponse other) { + if (other == null) { + return; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + if (other.param_ != null) { + if (param_ == null) { + param_ = new global::Grpc.Testing.ResponseParams(); + } + Param.MergeFrom(other.Param); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Message = input.ReadString(); + break; + } + case 18: { + if (param_ == null) { + param_ = new global::Grpc.Testing.ResponseParams(); + } + input.ReadMessage(param_); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/csharp/Grpc.IntegrationTesting/Services.cs b/src/csharp/Grpc.IntegrationTesting/Services.cs index bf36a0253b5..7a0845dffb0 100644 --- a/src/csharp/Grpc.IntegrationTesting/Services.cs +++ b/src/csharp/Grpc.IntegrationTesting/Services.cs @@ -24,20 +24,28 @@ namespace Grpc.Testing { string.Concat( "CiVzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL3NlcnZpY2VzLnByb3RvEgxncnBj", "LnRlc3RpbmcaJXNyYy9wcm90by9ncnBjL3Rlc3RpbmcvbWVzc2FnZXMucHJv", - "dG8aJHNyYy9wcm90by9ncnBjL3Rlc3RpbmcvY29udHJvbC5wcm90bzKqAQoQ", - "QmVuY2htYXJrU2VydmljZRJGCglVbmFyeUNhbGwSGy5ncnBjLnRlc3Rpbmcu", - "U2ltcGxlUmVxdWVzdBocLmdycGMudGVzdGluZy5TaW1wbGVSZXNwb25zZRJO", - "Cg1TdHJlYW1pbmdDYWxsEhsuZ3JwYy50ZXN0aW5nLlNpbXBsZVJlcXVlc3Qa", - "HC5ncnBjLnRlc3RpbmcuU2ltcGxlUmVzcG9uc2UoATABMpcCCg1Xb3JrZXJT", - "ZXJ2aWNlEkUKCVJ1blNlcnZlchIYLmdycGMudGVzdGluZy5TZXJ2ZXJBcmdz", - "GhouZ3JwYy50ZXN0aW5nLlNlcnZlclN0YXR1cygBMAESRQoJUnVuQ2xpZW50", - "EhguZ3JwYy50ZXN0aW5nLkNsaWVudEFyZ3MaGi5ncnBjLnRlc3RpbmcuQ2xp", - "ZW50U3RhdHVzKAEwARJCCglDb3JlQ291bnQSGS5ncnBjLnRlc3RpbmcuQ29y", - "ZVJlcXVlc3QaGi5ncnBjLnRlc3RpbmcuQ29yZVJlc3BvbnNlEjQKClF1aXRX", - "b3JrZXISEi5ncnBjLnRlc3RpbmcuVm9pZBoSLmdycGMudGVzdGluZy5Wb2lk", - "YgZwcm90bzM=")); + "dG8aJHNyYy9wcm90by9ncnBjL3Rlc3RpbmcvY29udHJvbC5wcm90bxoic3Jj", + "L3Byb3RvL2dycGMvdGVzdGluZy9zdGF0cy5wcm90bzKmAwoQQmVuY2htYXJr", + "U2VydmljZRJGCglVbmFyeUNhbGwSGy5ncnBjLnRlc3RpbmcuU2ltcGxlUmVx", + "dWVzdBocLmdycGMudGVzdGluZy5TaW1wbGVSZXNwb25zZRJOCg1TdHJlYW1p", + "bmdDYWxsEhsuZ3JwYy50ZXN0aW5nLlNpbXBsZVJlcXVlc3QaHC5ncnBjLnRl", + "c3RpbmcuU2ltcGxlUmVzcG9uc2UoATABElIKE1N0cmVhbWluZ0Zyb21DbGll", + "bnQSGy5ncnBjLnRlc3RpbmcuU2ltcGxlUmVxdWVzdBocLmdycGMudGVzdGlu", + "Zy5TaW1wbGVSZXNwb25zZSgBElIKE1N0cmVhbWluZ0Zyb21TZXJ2ZXISGy5n", + "cnBjLnRlc3RpbmcuU2ltcGxlUmVxdWVzdBocLmdycGMudGVzdGluZy5TaW1w", + "bGVSZXNwb25zZTABElIKEVN0cmVhbWluZ0JvdGhXYXlzEhsuZ3JwYy50ZXN0", + "aW5nLlNpbXBsZVJlcXVlc3QaHC5ncnBjLnRlc3RpbmcuU2ltcGxlUmVzcG9u", + "c2UoATABMpcCCg1Xb3JrZXJTZXJ2aWNlEkUKCVJ1blNlcnZlchIYLmdycGMu", + "dGVzdGluZy5TZXJ2ZXJBcmdzGhouZ3JwYy50ZXN0aW5nLlNlcnZlclN0YXR1", + "cygBMAESRQoJUnVuQ2xpZW50EhguZ3JwYy50ZXN0aW5nLkNsaWVudEFyZ3Ma", + "Gi5ncnBjLnRlc3RpbmcuQ2xpZW50U3RhdHVzKAEwARJCCglDb3JlQ291bnQS", + "GS5ncnBjLnRlc3RpbmcuQ29yZVJlcXVlc3QaGi5ncnBjLnRlc3RpbmcuQ29y", + "ZVJlc3BvbnNlEjQKClF1aXRXb3JrZXISEi5ncnBjLnRlc3RpbmcuVm9pZBoS", + "LmdycGMudGVzdGluZy5Wb2lkMl4KGFJlcG9ydFFwc1NjZW5hcmlvU2Vydmlj", + "ZRJCCg5SZXBvcnRTY2VuYXJpbxIcLmdycGMudGVzdGluZy5TY2VuYXJpb1Jl", + "c3VsdBoSLmdycGMudGVzdGluZy5Wb2lkYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Grpc.Testing.MessagesReflection.Descriptor, global::Grpc.Testing.ControlReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Grpc.Testing.MessagesReflection.Descriptor, global::Grpc.Testing.ControlReflection.Descriptor, global::Grpc.Testing.StatsReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null)); } #endregion diff --git a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs index 143c9ac9fcc..bd5971e296f 100644 --- a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs @@ -46,6 +46,27 @@ namespace Grpc.Testing { __Marshaller_SimpleRequest, __Marshaller_SimpleResponse); + static readonly grpc::Method __Method_StreamingFromClient = new grpc::Method( + grpc::MethodType.ClientStreaming, + __ServiceName, + "StreamingFromClient", + __Marshaller_SimpleRequest, + __Marshaller_SimpleResponse); + + static readonly grpc::Method __Method_StreamingFromServer = new grpc::Method( + grpc::MethodType.ServerStreaming, + __ServiceName, + "StreamingFromServer", + __Marshaller_SimpleRequest, + __Marshaller_SimpleResponse); + + static readonly grpc::Method __Method_StreamingBothWays = new grpc::Method( + grpc::MethodType.DuplexStreaming, + __ServiceName, + "StreamingBothWays", + __Marshaller_SimpleRequest, + __Marshaller_SimpleResponse); + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { @@ -68,8 +89,9 @@ namespace Grpc.Testing { } /// - /// One request followed by one response. - /// The server returns the client payload as-is. + /// Repeated sequence of one request followed by one response. + /// Should be called streaming ping-pong + /// The server returns the client payload as-is on each response /// /// Used for reading requests from the client. /// Used for sending responses back to the client. @@ -80,6 +102,44 @@ namespace Grpc.Testing { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } + /// + /// Single-sided unbounded streaming from client to server + /// The server returns the client payload as-is once the client does WritesDone + /// + /// Used for reading requests from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task StreamingFromClient(grpc::IAsyncStreamReader requestStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Single-sided unbounded streaming from server to client + /// The server repeatedly returns the client payload as-is + /// + /// The request received from the client. + /// Used for sending responses back to the client. + /// The context of the server-side call handler being invoked. + /// A task indicating completion of the handler. + public virtual global::System.Threading.Tasks.Task StreamingFromServer(global::Grpc.Testing.SimpleRequest request, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Two-sided unbounded streaming between server to client + /// Both sides send the content of their own choice to the other + /// + /// Used for reading requests from the client. + /// Used for sending responses back to the client. + /// The context of the server-side call handler being invoked. + /// A task indicating completion of the handler. + public virtual global::System.Threading.Tasks.Task StreamingBothWays(grpc::IAsyncStreamReader requestStream, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + } /// Client for BenchmarkService @@ -154,8 +214,9 @@ namespace Grpc.Testing { return CallInvoker.AsyncUnaryCall(__Method_UnaryCall, null, options, request); } /// - /// One request followed by one response. - /// The server returns the client payload as-is. + /// Repeated sequence of one request followed by one response. + /// Should be called streaming ping-pong + /// The server returns the client payload as-is on each response /// /// The initial metadata to send with the call. This parameter is optional. /// An optional deadline for the call. The call will be cancelled if deadline is hit. @@ -166,8 +227,9 @@ namespace Grpc.Testing { return StreamingCall(new grpc::CallOptions(headers, deadline, cancellationToken)); } /// - /// One request followed by one response. - /// The server returns the client payload as-is. + /// Repeated sequence of one request followed by one response. + /// Should be called streaming ping-pong + /// The server returns the client payload as-is on each response /// /// The options for the call. /// The call object. @@ -175,6 +237,74 @@ namespace Grpc.Testing { { return CallInvoker.AsyncDuplexStreamingCall(__Method_StreamingCall, null, options); } + /// + /// Single-sided unbounded streaming from client to server + /// The server returns the client payload as-is once the client does WritesDone + /// + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncClientStreamingCall StreamingFromClient(grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return StreamingFromClient(new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Single-sided unbounded streaming from client to server + /// The server returns the client payload as-is once the client does WritesDone + /// + /// The options for the call. + /// The call object. + public virtual grpc::AsyncClientStreamingCall StreamingFromClient(grpc::CallOptions options) + { + return CallInvoker.AsyncClientStreamingCall(__Method_StreamingFromClient, null, options); + } + /// + /// Single-sided unbounded streaming from server to client + /// The server repeatedly returns the client payload as-is + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncServerStreamingCall StreamingFromServer(global::Grpc.Testing.SimpleRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return StreamingFromServer(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Single-sided unbounded streaming from server to client + /// The server repeatedly returns the client payload as-is + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncServerStreamingCall StreamingFromServer(global::Grpc.Testing.SimpleRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncServerStreamingCall(__Method_StreamingFromServer, null, options, request); + } + /// + /// Two-sided unbounded streaming between server to client + /// Both sides send the content of their own choice to the other + /// + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncDuplexStreamingCall StreamingBothWays(grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return StreamingBothWays(new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Two-sided unbounded streaming between server to client + /// Both sides send the content of their own choice to the other + /// + /// The options for the call. + /// The call object. + public virtual grpc::AsyncDuplexStreamingCall StreamingBothWays(grpc::CallOptions options) + { + return CallInvoker.AsyncDuplexStreamingCall(__Method_StreamingBothWays, null, options); + } /// Creates a new instance of client from given ClientBaseConfiguration. protected override BenchmarkServiceClient NewInstance(ClientBaseConfiguration configuration) { @@ -188,7 +318,10 @@ namespace Grpc.Testing { { return grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) - .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build(); + .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall) + .AddMethod(__Method_StreamingFromClient, serviceImpl.StreamingFromClient) + .AddMethod(__Method_StreamingFromServer, serviceImpl.StreamingFromServer) + .AddMethod(__Method_StreamingBothWays, serviceImpl.StreamingBothWays).Build(); } } @@ -489,5 +622,124 @@ namespace Grpc.Testing { } } + public static partial class ReportQpsScenarioService + { + static readonly string __ServiceName = "grpc.testing.ReportQpsScenarioService"; + + static readonly grpc::Marshaller __Marshaller_ScenarioResult = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ScenarioResult.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Void = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.Void.Parser.ParseFrom); + + static readonly grpc::Method __Method_ReportScenario = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "ReportScenario", + __Marshaller_ScenarioResult, + __Marshaller_Void); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[2]; } + } + + /// Base class for server-side implementations of ReportQpsScenarioService + public abstract partial class ReportQpsScenarioServiceBase + { + /// + /// Report results of a QPS test benchmark scenario. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task ReportScenario(global::Grpc.Testing.ScenarioResult request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for ReportQpsScenarioService + public partial class ReportQpsScenarioServiceClient : grpc::ClientBase + { + /// Creates a new client for ReportQpsScenarioService + /// The channel to use to make remote calls. + public ReportQpsScenarioServiceClient(grpc::Channel channel) : base(channel) + { + } + /// Creates a new client for ReportQpsScenarioService that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public ReportQpsScenarioServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected ReportQpsScenarioServiceClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected ReportQpsScenarioServiceClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Report results of a QPS test benchmark scenario. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Grpc.Testing.Void ReportScenario(global::Grpc.Testing.ScenarioResult request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return ReportScenario(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Report results of a QPS test benchmark scenario. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Grpc.Testing.Void ReportScenario(global::Grpc.Testing.ScenarioResult request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_ReportScenario, null, options, request); + } + /// + /// Report results of a QPS test benchmark scenario. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall ReportScenarioAsync(global::Grpc.Testing.ScenarioResult request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return ReportScenarioAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Report results of a QPS test benchmark scenario. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall ReportScenarioAsync(global::Grpc.Testing.ScenarioResult request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_ReportScenario, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override ReportQpsScenarioServiceClient NewInstance(ClientBaseConfiguration configuration) + { + return new ReportQpsScenarioServiceClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(ReportQpsScenarioServiceBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_ReportScenario, serviceImpl.ReportScenario).Build(); + } + + } } #endregion diff --git a/src/csharp/Grpc.IntegrationTesting/Stats.cs b/src/csharp/Grpc.IntegrationTesting/Stats.cs index 79ff220436a..23b56df6bdb 100644 --- a/src/csharp/Grpc.IntegrationTesting/Stats.cs +++ b/src/csharp/Grpc.IntegrationTesting/Stats.cs @@ -23,27 +23,28 @@ namespace Grpc.Testing { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiJzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL3N0YXRzLnByb3RvEgxncnBjLnRl", - "c3RpbmciegoLU2VydmVyU3RhdHMSFAoMdGltZV9lbGFwc2VkGAEgASgBEhEK", - "CXRpbWVfdXNlchgCIAEoARITCgt0aW1lX3N5c3RlbRgDIAEoARIWCg50b3Rh", - "bF9jcHVfdGltZRgEIAEoBBIVCg1pZGxlX2NwdV90aW1lGAUgASgEIjsKD0hp", - "c3RvZ3JhbVBhcmFtcxISCgpyZXNvbHV0aW9uGAEgASgBEhQKDG1heF9wb3Nz", - "aWJsZRgCIAEoASJ3Cg1IaXN0b2dyYW1EYXRhEg4KBmJ1Y2tldBgBIAMoDRIQ", - "CghtaW5fc2VlbhgCIAEoARIQCghtYXhfc2VlbhgDIAEoARILCgNzdW0YBCAB", - "KAESFgoOc3VtX29mX3NxdWFyZXMYBSABKAESDQoFY291bnQYBiABKAEiOAoS", - "UmVxdWVzdFJlc3VsdENvdW50EhMKC3N0YXR1c19jb2RlGAEgASgFEg0KBWNv", - "dW50GAIgASgDIrYBCgtDbGllbnRTdGF0cxIuCglsYXRlbmNpZXMYASABKAsy", - "Gy5ncnBjLnRlc3RpbmcuSGlzdG9ncmFtRGF0YRIUCgx0aW1lX2VsYXBzZWQY", - "AiABKAESEQoJdGltZV91c2VyGAMgASgBEhMKC3RpbWVfc3lzdGVtGAQgASgB", - "EjkKD3JlcXVlc3RfcmVzdWx0cxgFIAMoCzIgLmdycGMudGVzdGluZy5SZXF1", - "ZXN0UmVzdWx0Q291bnRiBnByb3RvMw==")); + "c3RpbmcikQEKC1NlcnZlclN0YXRzEhQKDHRpbWVfZWxhcHNlZBgBIAEoARIR", + "Cgl0aW1lX3VzZXIYAiABKAESEwoLdGltZV9zeXN0ZW0YAyABKAESFgoOdG90", + "YWxfY3B1X3RpbWUYBCABKAQSFQoNaWRsZV9jcHVfdGltZRgFIAEoBBIVCg1j", + "cV9wb2xsX2NvdW50GAYgASgEIjsKD0hpc3RvZ3JhbVBhcmFtcxISCgpyZXNv", + "bHV0aW9uGAEgASgBEhQKDG1heF9wb3NzaWJsZRgCIAEoASJ3Cg1IaXN0b2dy", + "YW1EYXRhEg4KBmJ1Y2tldBgBIAMoDRIQCghtaW5fc2VlbhgCIAEoARIQCght", + "YXhfc2VlbhgDIAEoARILCgNzdW0YBCABKAESFgoOc3VtX29mX3NxdWFyZXMY", + "BSABKAESDQoFY291bnQYBiABKAEiOAoSUmVxdWVzdFJlc3VsdENvdW50EhMK", + "C3N0YXR1c19jb2RlGAEgASgFEg0KBWNvdW50GAIgASgDIs0BCgtDbGllbnRT", + "dGF0cxIuCglsYXRlbmNpZXMYASABKAsyGy5ncnBjLnRlc3RpbmcuSGlzdG9n", + "cmFtRGF0YRIUCgx0aW1lX2VsYXBzZWQYAiABKAESEQoJdGltZV91c2VyGAMg", + "ASgBEhMKC3RpbWVfc3lzdGVtGAQgASgBEjkKD3JlcXVlc3RfcmVzdWx0cxgF", + "IAMoCzIgLmdycGMudGVzdGluZy5SZXF1ZXN0UmVzdWx0Q291bnQSFQoNY3Ff", + "cG9sbF9jb3VudBgGIAEoBGIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerStats), global::Grpc.Testing.ServerStats.Parser, new[]{ "TimeElapsed", "TimeUser", "TimeSystem", "TotalCpuTime", "IdleCpuTime" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerStats), global::Grpc.Testing.ServerStats.Parser, new[]{ "TimeElapsed", "TimeUser", "TimeSystem", "TotalCpuTime", "IdleCpuTime", "CqPollCount" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.HistogramParams), global::Grpc.Testing.HistogramParams.Parser, new[]{ "Resolution", "MaxPossible" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.HistogramData), global::Grpc.Testing.HistogramData.Parser, new[]{ "Bucket", "MinSeen", "MaxSeen", "Sum", "SumOfSquares", "Count" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.RequestResultCount), global::Grpc.Testing.RequestResultCount.Parser, new[]{ "StatusCode", "Count" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientStats), global::Grpc.Testing.ClientStats.Parser, new[]{ "Latencies", "TimeElapsed", "TimeUser", "TimeSystem", "RequestResults" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientStats), global::Grpc.Testing.ClientStats.Parser, new[]{ "Latencies", "TimeElapsed", "TimeUser", "TimeSystem", "RequestResults", "CqPollCount" }, null, null, null) })); } #endregion @@ -79,6 +80,7 @@ namespace Grpc.Testing { timeSystem_ = other.timeSystem_; totalCpuTime_ = other.totalCpuTime_; idleCpuTime_ = other.idleCpuTime_; + cqPollCount_ = other.cqPollCount_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -157,6 +159,20 @@ namespace Grpc.Testing { } } + /// Field number for the "cq_poll_count" field. + public const int CqPollCountFieldNumber = 6; + private ulong cqPollCount_; + /// + /// Number of polls called inside completion queue + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong CqPollCount { + get { return cqPollCount_; } + set { + cqPollCount_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ServerStats); @@ -175,6 +191,7 @@ namespace Grpc.Testing { if (TimeSystem != other.TimeSystem) return false; if (TotalCpuTime != other.TotalCpuTime) return false; if (IdleCpuTime != other.IdleCpuTime) return false; + if (CqPollCount != other.CqPollCount) return false; return true; } @@ -186,6 +203,7 @@ namespace Grpc.Testing { if (TimeSystem != 0D) hash ^= TimeSystem.GetHashCode(); if (TotalCpuTime != 0UL) hash ^= TotalCpuTime.GetHashCode(); if (IdleCpuTime != 0UL) hash ^= IdleCpuTime.GetHashCode(); + if (CqPollCount != 0UL) hash ^= CqPollCount.GetHashCode(); return hash; } @@ -216,6 +234,10 @@ namespace Grpc.Testing { output.WriteRawTag(40); output.WriteUInt64(IdleCpuTime); } + if (CqPollCount != 0UL) { + output.WriteRawTag(48); + output.WriteUInt64(CqPollCount); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -236,6 +258,9 @@ namespace Grpc.Testing { if (IdleCpuTime != 0UL) { size += 1 + pb::CodedOutputStream.ComputeUInt64Size(IdleCpuTime); } + if (CqPollCount != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(CqPollCount); + } return size; } @@ -259,6 +284,9 @@ namespace Grpc.Testing { if (other.IdleCpuTime != 0UL) { IdleCpuTime = other.IdleCpuTime; } + if (other.CqPollCount != 0UL) { + CqPollCount = other.CqPollCount; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -289,6 +317,10 @@ namespace Grpc.Testing { IdleCpuTime = input.ReadUInt64(); break; } + case 48: { + CqPollCount = input.ReadUInt64(); + break; + } } } } @@ -876,6 +908,7 @@ namespace Grpc.Testing { timeUser_ = other.timeUser_; timeSystem_ = other.timeSystem_; requestResults_ = other.requestResults_.Clone(); + cqPollCount_ = other.cqPollCount_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -946,6 +979,20 @@ namespace Grpc.Testing { get { return requestResults_; } } + /// Field number for the "cq_poll_count" field. + public const int CqPollCountFieldNumber = 6; + private ulong cqPollCount_; + /// + /// Number of polls called inside completion queue + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong CqPollCount { + get { return cqPollCount_; } + set { + cqPollCount_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ClientStats); @@ -964,6 +1011,7 @@ namespace Grpc.Testing { if (TimeUser != other.TimeUser) return false; if (TimeSystem != other.TimeSystem) return false; if(!requestResults_.Equals(other.requestResults_)) return false; + if (CqPollCount != other.CqPollCount) return false; return true; } @@ -975,6 +1023,7 @@ namespace Grpc.Testing { if (TimeUser != 0D) hash ^= TimeUser.GetHashCode(); if (TimeSystem != 0D) hash ^= TimeSystem.GetHashCode(); hash ^= requestResults_.GetHashCode(); + if (CqPollCount != 0UL) hash ^= CqPollCount.GetHashCode(); return hash; } @@ -1002,6 +1051,10 @@ namespace Grpc.Testing { output.WriteDouble(TimeSystem); } requestResults_.WriteTo(output, _repeated_requestResults_codec); + if (CqPollCount != 0UL) { + output.WriteRawTag(48); + output.WriteUInt64(CqPollCount); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1020,6 +1073,9 @@ namespace Grpc.Testing { size += 1 + 8; } size += requestResults_.CalculateSize(_repeated_requestResults_codec); + if (CqPollCount != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(CqPollCount); + } return size; } @@ -1044,6 +1100,9 @@ namespace Grpc.Testing { TimeSystem = other.TimeSystem; } requestResults_.Add(other.requestResults_); + if (other.CqPollCount != 0UL) { + CqPollCount = other.CqPollCount; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1077,6 +1136,10 @@ namespace Grpc.Testing { requestResults_.AddEntriesFrom(input, _repeated_requestResults_codec); break; } + case 48: { + CqPollCount = input.ReadUInt64(); + break; + } } } } diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index f5c00303095..aebce364c58 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -398,8 +398,14 @@ GPR_EXPORT grpc_call *GPR_CALLTYPE grpcsharp_channel_create_call( host_slice = grpc_slice_from_copied_string(host); host_slice_ptr = &host_slice; } - return grpc_channel_create_call(channel, parent_call, propagation_mask, cq, - method_slice, host_slice_ptr, deadline, NULL); + grpc_call *ret = + grpc_channel_create_call(channel, parent_call, propagation_mask, cq, + method_slice, host_slice_ptr, deadline, NULL); + grpc_slice_unref(method_slice); + if (host != NULL) { + grpc_slice_unref(host_slice); + } + return ret; } GPR_EXPORT grpc_connectivity_state GPR_CALLTYPE @@ -790,7 +796,9 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server( ops[nops].reserved = NULL; nops++; } - return grpcsharp_call_start_batch(call, ops, nops, ctx, NULL); + grpc_call_error ret = grpcsharp_call_start_batch(call, ops, nops, ctx, NULL); + grpc_slice_unref(status_details_slice); + return ret; } GPR_EXPORT grpc_call_error GPR_CALLTYPE diff --git a/src/csharp/generate_proto_csharp.sh b/src/csharp/generate_proto_csharp.sh index 8caaaabe0f5..1a1adbbae56 100755 --- a/src/csharp/generate_proto_csharp.sh +++ b/src/csharp/generate_proto_csharp.sh @@ -37,4 +37,4 @@ $PROTOC --plugin=$PLUGIN --csharp_out=$REFLECTION_DIR --grpc_out=$REFLECTION_DIR # don't match the package names. Setting -I to the correct value src/proto # breaks the code generation. $PROTOC --plugin=$PLUGIN --csharp_out=$TESTING_DIR --grpc_out=$TESTING_DIR \ - -I . src/proto/grpc/testing/{control,empty,messages,metrics,payloads,services,stats,test}.proto + -I . src/proto/grpc/testing/{control,echo_messages,empty,messages,metrics,payloads,services,stats,test}.proto diff --git a/src/csharp/tests.json b/src/csharp/tests.json index 707d140f62c..bc6adbbfe8b 100644 --- a/src/csharp/tests.json +++ b/src/csharp/tests.json @@ -42,6 +42,7 @@ "Grpc.HealthCheck.Tests.HealthServiceImplTest" ], "Grpc.IntegrationTesting": [ + "Grpc.IntegrationTesting.CustomErrorDetailsTest", "Grpc.IntegrationTesting.GeneratedClientTest", "Grpc.IntegrationTesting.GeneratedServiceBaseTest", "Grpc.IntegrationTesting.HistogramTest", diff --git a/src/node/src/grpc_extension.js b/src/node/src/grpc_extension.js index c13bf819ded..af43eacad2d 100644 --- a/src/node/src/grpc_extension.js +++ b/src/node/src/grpc_extension.js @@ -16,6 +16,13 @@ * */ +/** + * @module + * @private + */ + +'use strict'; + var binary = require('node-pre-gyp/lib/pre-binding'); var path = require('path'); var binding_path = diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index 8c750ea4842..d58d18057e4 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -1363,3 +1363,50 @@ describe('Cancelling surface client', function() { call.cancel(); }); }); +describe('Client reconnect', function() { + var server; + var Client; + var client; + var port; + beforeEach(function() { + var test_proto = ProtoBuf.loadProtoFile(__dirname + '/echo_service.proto'); + var echo_service = test_proto.lookup('EchoService'); + Client = grpc.loadObject(echo_service); + server = new grpc.Server(); + server.addService(Client.service, { + echo: function(call, callback) { + callback(null, call.request); + } + }); + port = server.bind('localhost:0', server_insecure_creds); + client = new Client('localhost:' + port, grpc.credentials.createInsecure()); + server.start(); + }); + afterEach(function() { + server.forceShutdown(); + }); + it('should reconnect after server restart', function(done) { + client.echo({value: 'test value', value2: 3}, function(error, response) { + assert.ifError(error); + assert.deepEqual(response, {value: 'test value', value2: 3}); + server.tryShutdown(function() { + server = new grpc.Server(); + server.addService(Client.service, { + echo: function(call, callback) { + callback(null, call.request); + } + }); + server.bind('localhost:' + port, server_insecure_creds); + server.start(); + client.echo(undefined, function(error, response) { + if (error) { + console.log(error); + } + assert.ifError(error); + assert.deepEqual(response, {value: '', value2: 0}); + done(); + }); + }); + }); + }); +}); diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 8c5bcf1c8b1..178a446c8b4 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -163,6 +163,12 @@ extern id const kGRPCTrailersKey; /** Represents a single gRPC remote call. */ @interface GRPCCall : GRXWriter +/** + * The authority for the RPC. If nil, the default authority will be used. This property must be nil + * when Cronet transport is enabled. + */ +@property (atomic, readwrite) NSString *serverName; + /** * The container of the request headers of an RPC conforms to this protocol, which is a subset of * NSMutableDictionary's interface. It will become a NSMutableDictionary later on. diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 6ba401def44..872362419eb 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -425,7 +425,7 @@ static NSMutableDictionary *callFlags; _responseWriteable = [[GRXConcurrentWriteable alloc] initWithWriteable:writeable dispatchQueue:_responseQueue]; - _wrappedCall = [[GRPCWrappedCall alloc] initWithHost:_host path:_path]; + _wrappedCall = [[GRPCWrappedCall alloc] initWithHost:_host serverName:_serverName path:_path]; NSAssert(_wrappedCall, @"Error allocating RPC objects. Low memory?"); [self sendHeaders:_requestHeaders]; diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCChannel.h index e4dfbca38dc..e2aa5bd036f 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.h +++ b/src/objective-c/GRPCClient/private/GRPCChannel.h @@ -62,5 +62,6 @@ struct grpc_channel_credentials; channelArgs:(nullable NSDictionary *)channelArgs; - (nullable grpc_call *)unmanagedCallWithPath:(nonnull NSString *)path + serverName:(nonnull NSString *)serverName completionQueue:(nonnull GRPCCompletionQueue *)queue; @end diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index 79fe7c6e058..52dbc70b997 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -181,13 +181,24 @@ static grpc_channel_args *BuildChannelArgs(NSDictionary *dictionary) { } - (grpc_call *)unmanagedCallWithPath:(NSString *)path + serverName:(NSString *)serverName completionQueue:(GRPCCompletionQueue *)queue { - return grpc_channel_create_call(_unmanagedChannel, - NULL, GRPC_PROPAGATE_DEFAULTS, - queue.unmanagedQueue, - grpc_slice_from_copied_string(path.UTF8String), - NULL, // Passing NULL for host - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + grpc_slice host_slice; + if (serverName) { + host_slice = grpc_slice_from_copied_string(serverName.UTF8String); + } + grpc_slice path_slice = grpc_slice_from_copied_string(path.UTF8String); + grpc_call *call = grpc_channel_create_call(_unmanagedChannel, + NULL, GRPC_PROPAGATE_DEFAULTS, + queue.unmanagedQueue, + path_slice, + serverName ? &host_slice : NULL, + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + if (serverName) { + grpc_slice_unref(host_slice); + } + grpc_slice_unref(path_slice); + return call; } @end diff --git a/src/objective-c/GRPCClient/private/GRPCHost.h b/src/objective-c/GRPCClient/private/GRPCHost.h index 4b1f780dd21..0c1d7152405 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.h +++ b/src/objective-c/GRPCClient/private/GRPCHost.h @@ -54,6 +54,7 @@ struct grpc_channel_credentials; /** Create a grpc_call object to the provided path on this host. */ - (nullable struct grpc_call *)unmanagedCallWithPath:(NSString *)path + serverName:(NSString *)serverName completionQueue:(GRPCCompletionQueue *)queue; // TODO: There's a race when a new RPC is coming through just as an existing one is getting diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m index 5b4d647a1a2..23794c1fed2 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCHost.m @@ -120,6 +120,7 @@ static GRPCConnectivityMonitor *connectivityMonitor = nil; } - (nullable grpc_call *)unmanagedCallWithPath:(NSString *)path + serverName:(NSString *)serverName completionQueue:(GRPCCompletionQueue *)queue { GRPCChannel *channel; // This is racing -[GRPCHost disconnect]. @@ -129,7 +130,7 @@ static GRPCConnectivityMonitor *connectivityMonitor = nil; } channel = _channel; } - return [channel unmanagedCallWithPath:path completionQueue:queue]; + return [channel unmanagedCallWithPath:path serverName:serverName completionQueue:queue]; } - (BOOL)setTLSPEMRootCerts:(nullable NSString *)pemRootCerts diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.h b/src/objective-c/GRPCClient/private/GRPCWrappedCall.h index ed245ff7ed2..64075591a37 100644 --- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.h +++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.h @@ -75,6 +75,7 @@ @interface GRPCWrappedCall : NSObject - (instancetype)initWithHost:(NSString *)host + serverName:(NSString *)serverName path:(NSString *)path NS_DESIGNATED_INITIALIZER; - (void)startBatchWithOperations:(NSArray *)ops errorHandler:(void(^)())errorHandler; diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m index 8c8b0b2570e..9802465001b 100644 --- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m +++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m @@ -75,6 +75,10 @@ } - (void)dealloc { + for (int i = 0; i < _op.data.send_initial_metadata.count; i++) { + grpc_slice_unref(_op.data.send_initial_metadata.metadata[i].key); + grpc_slice_unref(_op.data.send_initial_metadata.metadata[i].value); + } gpr_free(_op.data.send_initial_metadata.metadata); } @@ -232,10 +236,11 @@ } - (instancetype)init { - return [self initWithHost:nil path:nil]; + return [self initWithHost:nil serverName:nil path:nil]; } - (instancetype)initWithHost:(NSString *)host + serverName:(NSString *)serverName path:(NSString *)path { if (!path || !host) { [NSException raise:NSInvalidArgumentException @@ -248,7 +253,7 @@ // queue. Currently we use a singleton queue. _queue = [GRPCCompletionQueue completionQueue]; - _call = [[GRPCHost hostWithAddress:host] unmanagedCallWithPath:path completionQueue:_queue]; + _call = [[GRPCHost hostWithAddress:host] unmanagedCallWithPath:path serverName:serverName completionQueue:_queue]; if (_call == NULL) { return nil; } diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 2e8f0f2b64c..744028b2ca0 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.5.0" +#define PHP_GRPC_VERSION "1.5.0dev" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index 1562c3e24dc..cf4ce0941ba 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -849,7 +849,10 @@ def _poll_connectivity(state, channel, initial_try_to_connect): _common.CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY[ connectivity]) if not state.delivering: - callbacks = _deliveries(state) + # NOTE(nathaniel): The field is only ever used as a + # sequence so it's fine that both lists and tuples are + # assigned to it. + callbacks = _deliveries(state) # pylint: disable=redefined-variable-type if callbacks: _spawn_delivery(state, callbacks) diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index 9e2d40b67d1..cd59b07c04c 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -16,10 +16,11 @@ import collections import enum import logging -import six import threading import time +import six + import grpc from grpc import _common from grpc._cython import cygrpc diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 48782174a7c..5819a624f7c 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -39,7 +39,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/support/log_windows.c', 'src/core/lib/support/mpscq.c', 'src/core/lib/support/murmur_hash.c', - 'src/core/lib/support/stack_lockfree.c', 'src/core/lib/support/string.c', 'src/core/lib/support/string_posix.c', 'src/core/lib/support/string_util_windows.c', @@ -312,6 +311,7 @@ CORE_SOURCE_FILES = [ 'src/core/plugin_registry/grpc_plugin_registry.c', 'src/boringssl/err_data.c', 'third_party/boringssl/crypto/aes/aes.c', + 'third_party/boringssl/crypto/aes/key_wrap.c', 'third_party/boringssl/crypto/aes/mode_wrappers.c', 'third_party/boringssl/crypto/asn1/a_bitstr.c', 'third_party/boringssl/crypto/asn1/a_bool.c', @@ -343,12 +343,12 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/asn1/tasn_new.c', 'third_party/boringssl/crypto/asn1/tasn_typ.c', 'third_party/boringssl/crypto/asn1/tasn_utl.c', + 'third_party/boringssl/crypto/asn1/time_support.c', 'third_party/boringssl/crypto/asn1/x_bignum.c', 'third_party/boringssl/crypto/asn1/x_long.c', 'third_party/boringssl/crypto/base64/base64.c', 'third_party/boringssl/crypto/bio/bio.c', 'third_party/boringssl/crypto/bio/bio_mem.c', - 'third_party/boringssl/crypto/bio/buffer.c', 'third_party/boringssl/crypto/bio/connect.c', 'third_party/boringssl/crypto/bio/fd.c', 'third_party/boringssl/crypto/bio/file.c', @@ -455,12 +455,7 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/modes/ctr.c', 'third_party/boringssl/crypto/modes/gcm.c', 'third_party/boringssl/crypto/modes/ofb.c', - 'third_party/boringssl/crypto/newhope/error_correction.c', - 'third_party/boringssl/crypto/newhope/newhope.c', - 'third_party/boringssl/crypto/newhope/ntt.c', - 'third_party/boringssl/crypto/newhope/poly.c', - 'third_party/boringssl/crypto/newhope/precomp.c', - 'third_party/boringssl/crypto/newhope/reduce.c', + 'third_party/boringssl/crypto/modes/polyval.c', 'third_party/boringssl/crypto/obj/obj.c', 'third_party/boringssl/crypto/obj/obj_xref.c', 'third_party/boringssl/crypto/pem/pem_all.c', @@ -471,14 +466,15 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/pem/pem_pkey.c', 'third_party/boringssl/crypto/pem/pem_x509.c', 'third_party/boringssl/crypto/pem/pem_xaux.c', - 'third_party/boringssl/crypto/pkcs8/p5_pbe.c', 'third_party/boringssl/crypto/pkcs8/p5_pbev2.c', 'third_party/boringssl/crypto/pkcs8/p8_pkey.c', 'third_party/boringssl/crypto/pkcs8/pkcs8.c', 'third_party/boringssl/crypto/poly1305/poly1305.c', 'third_party/boringssl/crypto/poly1305/poly1305_arm.c', 'third_party/boringssl/crypto/poly1305/poly1305_vec.c', + 'third_party/boringssl/crypto/pool/pool.c', 'third_party/boringssl/crypto/rand/deterministic.c', + 'third_party/boringssl/crypto/rand/fuchsia.c', 'third_party/boringssl/crypto/rand/rand.c', 'third_party/boringssl/crypto/rand/urandom.c', 'third_party/boringssl/crypto/rand/windows.c', @@ -490,6 +486,7 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/rsa/rsa.c', 'third_party/boringssl/crypto/rsa/rsa_asn1.c', 'third_party/boringssl/crypto/rsa/rsa_impl.c', + 'third_party/boringssl/crypto/sha/sha1-altivec.c', 'third_party/boringssl/crypto/sha/sha1.c', 'third_party/boringssl/crypto/sha/sha256.c', 'third_party/boringssl/crypto/sha/sha512.c', @@ -498,7 +495,6 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/thread_none.c', 'third_party/boringssl/crypto/thread_pthread.c', 'third_party/boringssl/crypto/thread_win.c', - 'third_party/boringssl/crypto/time_support.c', 'third_party/boringssl/crypto/x509/a_digest.c', 'third_party/boringssl/crypto/x509/a_sign.c', 'third_party/boringssl/crypto/x509/a_strex.c', @@ -582,6 +578,7 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/crypto/x509v3/v3_skey.c', 'third_party/boringssl/crypto/x509v3/v3_sxnet.c', 'third_party/boringssl/crypto/x509v3/v3_utl.c', + 'third_party/boringssl/ssl/bio_ssl.c', 'third_party/boringssl/ssl/custom_extensions.c', 'third_party/boringssl/ssl/d1_both.c', 'third_party/boringssl/ssl/d1_lib.c', @@ -592,7 +589,6 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/ssl/handshake_client.c', 'third_party/boringssl/ssl/handshake_server.c', 'third_party/boringssl/ssl/s3_both.c', - 'third_party/boringssl/ssl/s3_enc.c', 'third_party/boringssl/ssl/s3_lib.c', 'third_party/boringssl/ssl/s3_pkt.c', 'third_party/boringssl/ssl/ssl_aead_ctx.c', @@ -603,9 +599,12 @@ CORE_SOURCE_FILES = [ 'third_party/boringssl/ssl/ssl_ecdh.c', 'third_party/boringssl/ssl/ssl_file.c', 'third_party/boringssl/ssl/ssl_lib.c', - 'third_party/boringssl/ssl/ssl_rsa.c', + 'third_party/boringssl/ssl/ssl_privkey.c', + 'third_party/boringssl/ssl/ssl_privkey_cc.cc', 'third_party/boringssl/ssl/ssl_session.c', 'third_party/boringssl/ssl/ssl_stat.c', + 'third_party/boringssl/ssl/ssl_transcript.c', + 'third_party/boringssl/ssl/ssl_x509.c', 'third_party/boringssl/ssl/t1_enc.c', 'third_party/boringssl/ssl/t1_lib.c', 'third_party/boringssl/ssl/tls13_both.c', diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index ef0faccb2e8..850404baade 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -73,6 +73,11 @@ set(PACKAGE_TARNAME "<%text>${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") project(<%text>${PACKAGE_NAME} C CXX) + + set(gRPC_INSTALL_BINDIR "<%text>${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") + set(gRPC_INSTALL_LIBDIR "<%text>${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") + set(gRPC_INSTALL_INCLUDEDIR "<%text>${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") + set(gRPC_INSTALL_CMAKEDIR "<%text>${CMAKE_INSTALL_PREFIX}/lib/cmake/${PACKAGE_NAME}" CACHE PATH "Installation directory for cmake config files") # Options option(gRPC_BUILD_TESTS "Build tests" OFF) @@ -97,6 +102,9 @@ set(gRPC_PROTOBUF_PROVIDER "module" CACHE STRING "Provider of protobuf library") set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package") + set(gRPC_PROTOBUF_PACKAGE_TYPE "" CACHE STRING "Algorithm for searching protobuf package") + set_property(CACHE gRPC_PROTOBUF_PACKAGE_TYPE PROPERTY STRINGS "CONFIG" "MODULE") + set(gRPC_GFLAGS_PROVIDER "module" CACHE STRING "Provider of gflags library") set_property(CACHE gRPC_GFLAGS_PROVIDER PROPERTY STRINGS "module" "package") @@ -143,6 +151,9 @@ endif() set(ZLIB_INCLUDE_DIR "<%text>${ZLIB_ROOT_DIR}") if(EXISTS "<%text>${ZLIB_ROOT_DIR}/CMakeLists.txt") + # TODO(jtattermusch): workaround for https://github.com/madler/zlib/issues/218 + include_directories(<%text>${ZLIB_INCLUDE_DIR}) + add_subdirectory(<%text>${ZLIB_ROOT_DIR} third_party/zlib) if(TARGET zlibstatic) set(_gRPC_ZLIB_LIBRARIES zlibstatic) @@ -204,6 +215,11 @@ if(NOT protobuf_BUILD_TESTS) set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests") endif() + # Disable building protobuf with zlib. Building protobuf with zlib breaks + # the build if zlib is not installed on the system. + if(NOT protobuf_WITH_ZLIB) + set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib.") + endif() if(NOT PROTOBUF_ROOT_DIR) set(PROTOBUF_ROOT_DIR <%text>${CMAKE_CURRENT_SOURCE_DIR}/third_party/protobuf) endif() @@ -228,21 +244,27 @@ set(gRPC_INSTALL FALSE) endif() elseif("<%text>${gRPC_PROTOBUF_PROVIDER}" STREQUAL "package") - find_package(protobuf CONFIG) - if(protobuf_FOUND) + find_package(Protobuf <%text>${gRPC_PROTOBUF_PACKAGE_TYPE}) + if(Protobuf_FOUND OR PROTOBUF_FOUND) if(TARGET protobuf::<%text>${_gRPC_PROTOBUF_LIBRARY_NAME}) set(_gRPC_PROTOBUF_LIBRARIES protobuf::<%text>${_gRPC_PROTOBUF_LIBRARY_NAME}) + else() + set(_gRPC_PROTOBUF_LIBRARIES <%text>${PROTOBUF_LIBRARIES}) endif() if(TARGET protobuf::libprotoc) set(_gRPC_PROTOBUF_PROTOC_LIBRARIES protobuf::libprotoc) + else() + set(_gRPC_PROTOBUF_PROTOC_LIBRARIES <%text>${PROTOBUF_PROTOC_LIBRARIES}) endif() if(TARGET protobuf::protoc) set(_gRPC_PROTOBUF_PROTOC protobuf::protoc) + else() + set(_gRPC_PROTOBUF_PROTOC <%text>${PROTOBUF_PROTOC_EXECUTABLE}) endif() - set(_gRPC_FIND_PROTOBUF "if(NOT protobuf_FOUND)\n find_package(protobuf CONFIG)\nendif()") - else() - find_package(Protobuf MODULE) - set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND)\n find_package(Protobuf)\nendif()") + set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND)\n find_package(Protobuf <%text>${gRPC_PROTOBUF_PACKAGE_TYPE})\nendif()") + endif() + if(PROTOBUF_FOUND) + include_directories(<%text>${PROTOBUF_INCLUDE_DIRS}) endif() set(PROTOBUF_WELLKNOWN_IMPORT_DIR /usr/local/include) endif() @@ -327,11 +349,6 @@ set(_gRPC_BASELIB_LIBRARIES wsock32 ws2_32) endif() - include(GNUInstallDirs) - if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR) - set(CMAKE_INSTALL_CMAKEDIR "<%text>${CMAKE_INSTALL_LIBDIR}/cmake/gRPC") - endif() - # Create directory for generated .proto files set(_gRPC_PROTO_GENS_DIR <%text>${CMAKE_BINARY_DIR}/gens) file(MAKE_DIRECTORY <%text>${_gRPC_PROTO_GENS_DIR}) @@ -492,7 +509,7 @@ ) if (gRPC_INSTALL) install(FILES <%text>${CMAKE_CURRENT_BINARY_DIR}/${lib.name}.pdb - DESTINATION <%text>${CMAKE_INSTALL_LIBDIR} OPTIONAL + DESTINATION <%text>${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() @@ -506,8 +523,8 @@ % endfor target_include_directories(${lib.name} + PUBLIC <%text>$ $ PRIVATE <%text>${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE <%text>${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE <%text>${BORINGSSL_ROOT_DIR}/include PRIVATE <%text>${PROTOBUF_ROOT_DIR}/src PRIVATE <%text>${ZLIB_INCLUDE_DIR} @@ -546,7 +563,7 @@ string(REPLACE "include/" "" _path <%text>${_hdr}) get_filename_component(_path <%text>${_path} PATH) install(FILES <%text>${_hdr} - DESTINATION "<%text>${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + DESTINATION "<%text>${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() % endif @@ -614,16 +631,16 @@ <%def name="cc_install(tgt)"> if (gRPC_INSTALL) install(TARGETS ${tgt.name} EXPORT gRPCTargets - RUNTIME DESTINATION <%text>${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION <%text>${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION <%text>${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION <%text>${gRPC_INSTALL_BINDIR} + LIBRARY DESTINATION <%text>${gRPC_INSTALL_LIBDIR} + ARCHIVE DESTINATION <%text>${gRPC_INSTALL_LIBDIR} ) endif() if (gRPC_INSTALL) install(EXPORT gRPCTargets - DESTINATION <%text>${CMAKE_INSTALL_CMAKEDIR} + DESTINATION <%text>${gRPC_INSTALL_CMAKEDIR} NAMESPACE gRPC:: ) endif() @@ -632,6 +649,6 @@ configure_file(tools/cmake/<%text>${_config}.cmake.in <%text>${_config}.cmake @ONLY) install(FILES <%text>${CMAKE_CURRENT_BINARY_DIR}/${_config}.cmake - DESTINATION <%text>${CMAKE_INSTALL_CMAKEDIR} + DESTINATION <%text>${gRPC_INSTALL_CMAKEDIR} ) endforeach() diff --git a/templates/Makefile.template b/templates/Makefile.template index 59a0aaa7cf7..051a475d476 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -212,6 +212,9 @@ CFLAGS += -std=c99 -Wsign-conversion -Wconversion ${' '.join(warning_var('$(W_%s)', warning) for warning in PREFERRED_WARNINGS)} CXXFLAGS += -std=c++11 + ifeq ($(SYSTEM),Darwin) + CXXFLAGS += -stdlib=libc++ + endif % for arg in ['CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'LDFLAGS', 'DEFINES']: % if defaults.get('global', []).get(arg, None) is not None: ${arg} += ${defaults.get('global').get(arg)} diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index 935943158d9..b304011fdc9 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -105,6 +105,15 @@ ] }, { 'conditions': [ + ["target_arch=='ia32'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] + }], + ["target_arch=='x64'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] + }], + ["target_arch=='arm'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] + }], ['grpc_alpn=="true"', { 'defines': [ 'TSI_OPENSSL_ALPN_SUPPORT=1' @@ -117,17 +126,6 @@ ], 'include_dirs': [ '<(node_root_dir)/deps/openssl/openssl/include', - ], - 'conditions': [ - ["target_arch=='ia32'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] - }], - ["target_arch=='x64'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] - }], - ["target_arch=='arm'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] - }] ] }], ['OS == "win"', { @@ -167,6 +165,7 @@ % if lib.name in module.transitive_deps and lib.name == 'boringssl': { 'cflags': [ + '-std=c++11', '-std=c99', '-Wall', '-Werror' @@ -183,12 +182,23 @@ % for source in lib.src: '${source}', % endfor - ] + ], + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'MACOSX_DEPLOYMENT_TARGET': '10.9', + 'OTHER_CPLUSPLUSFLAGS': [ + '-stdlib=libc++', + '-std=c++11' + ], + } + }], + ], }, % endif % endfor % endfor - ] + ], }], ['OS == "win" and runtime!="electron"', { 'targets': [ diff --git a/templates/config.w32.template b/templates/config.w32.template index c822eae097a..4edef963f2c 100644 --- a/templates/config.w32.template +++ b/templates/config.w32.template @@ -28,4 +28,40 @@ "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+ "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ "/I"+configure_module_dirname+"\\third_party\\zlib"); + <% + dirs = {} + for lib in libs: + if lib.name in php_config_m4.get('deps', []) and lib.name != 'ares': + for source in lib.src: + tmp = source + prev = '' + while (True): + idx = tmp.find('/'); + if (idx == -1): + break + dirs[prev + '\\\\' + tmp[:idx]] = 1 + prev += ('\\\\' + tmp[:idx]); + tmp = tmp[idx+1:] + + dirs['\\\\src'] = 1; + dirs['\\\\src\\\\php'] = 1; + dirs['\\\\src\\\\php\\\\ext'] = 1; + dirs['\\\\src\\\\php\\\\ext\\\\grpc'] = 1; + dirs = dirs.keys() + dirs.sort() + %> + base_dir = get_define('BUILD_DIR'); + FSO.CreateFolder(base_dir+"\\ext"); + FSO.CreateFolder(base_dir+"\\ext\\grpc"); + % for dir in dirs: + FSO.CreateFolder(base_dir+"\\ext\\grpc${dir}"); + % endfor + _build_dirs = new Array(); + for (i = 0; i < build_dirs.length; i++) { + if (build_dirs[i].indexOf('grpc') == -1) { + _build_dirs[_build_dirs.length] = build_dirs[i]; + } + } + build_dirs = _build_dirs; + } diff --git a/templates/package.json.template b/templates/package.json.template index f573c43e29c..92b2332760c 100644 --- a/templates/package.json.template +++ b/templates/package.json.template @@ -35,7 +35,7 @@ "arguejs": "^0.2.3", "lodash": "^4.15.0", "nan": "^2.0.0", - "node-pre-gyp": "^0.6.0", + "node-pre-gyp": "^0.6.35", "protobufjs": "^5.0.0" }, "devDependencies": { diff --git a/templates/src/php/ext/grpc/version.h.template b/templates/src/php/ext/grpc/version.h.template index 8436e02053e..0a7cfb341b3 100644 --- a/templates/src/php/ext/grpc/version.h.template +++ b/templates/src/php/ext/grpc/version.h.template @@ -22,6 +22,6 @@ #ifndef VERSION_H #define VERSION_H - #define PHP_GRPC_VERSION "${settings.php_version.php_composer()}" + #define PHP_GRPC_VERSION "${settings.php_version.php()}" #endif /* VERSION_H */ diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template new file mode 100644 index 00000000000..3f5b6cf6ce6 --- /dev/null +++ b/templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template @@ -0,0 +1,78 @@ +%YAML 1.2 +--- | + # Copyright 2017 gRPC authors. + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + + FROM debian:jessie + + # Install JDK 8 and Git + RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && ${'\\'} + echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list && ${'\\'} + echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list && ${'\\'} + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 + RUN apt-get update && apt-get -y install ${'\\'} + git ${'\\'} + libapr1 ${'\\'} + oracle-java8-installer ${'\\'} + && ${'\\'} + apt-get clean && rm -r /var/cache/oracle-jdk8-installer/ + ENV JAVA_HOME /usr/lib/jvm/java-8-oracle + ENV PATH $PATH:$JAVA_HOME/bin + + # Install protobuf + RUN apt-get update && apt-get install -y ${'\\'} + autoconf ${'\\'} + build-essential ${'\\'} + curl ${'\\'} + gcc ${'\\'} + libtool ${'\\'} + unzip ${'\\'} + && ${'\\'} + apt-get clean + WORKDIR / + RUN git clone https://github.com/google/protobuf.git + WORKDIR /protobuf + RUN git checkout v3.3.1 && ${'\\'} + ./autogen.sh && ${'\\'} + ./configure && ${'\\'} + make && ${'\\'} + make check && ${'\\'} + make install + + # Install gcloud command line tools + ENV CLOUD_SDK_REPO "cloud-sdk-jessie" + RUN echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && ${'\\'} + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && ${'\\'} + apt-get update && apt-get install -y google-cloud-sdk && apt-get clean && ${'\\'} + gcloud config set component_manager/disable_update_check true + + # Download and install grpc-java + WORKDIR / + RUN git clone https://github.com/grpc/grpc-java.git + WORKDIR /grpc-java + RUN ./gradlew install + + # Setup the Android SDK licenses + ENV ANDROID_HOME "/grpc-java/android-interop-testing/.android" + RUN mkdir -p "<%text>${ANDROID_HOME}/licenses" + RUN echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "<%text>${ANDROID_HOME}/licenses/android-sdk-license" + RUN echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "<%text>${ANDROID_HOME}/licenses/android-sdk-preview-license" + + # Build the Android interop apks + WORKDIR /grpc-java/android-interop-testing + RUN ../gradlew assembleDebug + RUN ../gradlew assembleDebugAndroidTest + + # Define the default command. + CMD ["bash"] diff --git a/test/core/end2end/fixtures/http_proxy_fixture.c b/test/core/end2end/fixtures/http_proxy_fixture.c index 248f721cbb3..54693c49001 100644 --- a/test/core/end2end/fixtures/http_proxy_fixture.c +++ b/test/core/end2end/fixtures/http_proxy_fixture.c @@ -493,7 +493,7 @@ void grpc_end2end_http_proxy_destroy(grpc_end2end_http_proxy* proxy) { grpc_pollset_shutdown(&exec_ctx, proxy->pollset, GRPC_CLOSURE_CREATE(destroy_pollset, proxy->pollset, grpc_schedule_on_exec_ctx)); - grpc_combiner_unref(&exec_ctx, proxy->combiner); + GRPC_COMBINER_UNREF(&exec_ctx, proxy->combiner, "test"); gpr_free(proxy); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/end2end/tests/bad_ping.c b/test/core/end2end/tests/bad_ping.c index 78032a6b5fd..12aceda6881 100644 --- a/test/core/end2end/tests/bad_ping.c +++ b/test/core/end2end/tests/bad_ping.c @@ -81,7 +81,10 @@ static void test_bad_ping(grpc_end2end_test_config config) { .value.integer = 300000 /* 5 minutes */}, {.type = GRPC_ARG_INTEGER, .key = GRPC_ARG_HTTP2_MAX_PING_STRIKES, - .value.integer = MAX_PING_STRIKES}}; + .value.integer = MAX_PING_STRIKES}, + {.type = GRPC_ARG_INTEGER, + .key = GRPC_ARG_HTTP2_BDP_PROBE, + .value.integer = 0}}; grpc_channel_args client_args = {.num_args = GPR_ARRAY_SIZE(client_a), .args = client_a}; grpc_channel_args server_args = {.num_args = GPR_ARRAY_SIZE(server_a), diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 35e2fd13ddf..429717a7be0 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -274,11 +274,12 @@ static void request_with_payload_template( grpc_compression_algorithm expected_algorithm_from_client, grpc_compression_algorithm expected_algorithm_from_server, grpc_metadata *client_init_metadata, bool set_server_level, - grpc_compression_level server_compression_level) { + grpc_compression_level server_compression_level, + bool send_message_before_initial_metadata) { grpc_call *c; grpc_call *s; grpc_slice request_payload_slice; - grpc_byte_buffer *request_payload; + grpc_byte_buffer *request_payload = NULL; grpc_channel_args *client_args; grpc_channel_args *server_args; grpc_end2end_test_fixture f; @@ -330,6 +331,20 @@ static void request_with_payload_template( grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + if (send_message_before_initial_metadata) { + request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload; + op->flags = client_send_flags_bitmask; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(2), true); + } + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; @@ -394,23 +409,21 @@ static void request_with_payload_template( GPR_ASSERT(GRPC_CALL_OK == error); for (int i = 0; i < 2; i++) { - request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1); - memset(ops, 0, sizeof(ops)); - op = ops; - op->op = GRPC_OP_SEND_MESSAGE; - op->data.send_message.send_message = request_payload; - op->flags = client_send_flags_bitmask; - op->reserved = NULL; - op++; - op->op = GRPC_OP_RECV_MESSAGE; - op->data.recv_message.recv_message = &response_payload_recv; - op->flags = 0; - op->reserved = NULL; - op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); - GPR_ASSERT(GRPC_CALL_OK == error); + if (i > 0 || !send_message_before_initial_metadata) { + request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload; + op->flags = client_send_flags_bitmask; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(2), 1); + } memset(ops, 0, sizeof(ops)); op = ops; @@ -421,6 +434,7 @@ static void request_with_payload_template( op++; error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(102), 1); cq_verify(cqv); @@ -438,8 +452,19 @@ static void request_with_payload_template( op++; error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &response_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(103), 1); - CQ_EXPECT_COMPLETION(cqv, tag(2), 1); + CQ_EXPECT_COMPLETION(cqv, tag(3), 1); cq_verify(cqv); GPR_ASSERT(response_payload_recv->type == GRPC_BB_RAW); @@ -469,7 +494,7 @@ static void request_with_payload_template( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), NULL); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -486,7 +511,7 @@ static void request_with_payload_template( GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); - CQ_EXPECT_COMPLETION(cqv, tag(3), 1); + CQ_EXPECT_COMPLETION(cqv, tag(4), 1); CQ_EXPECT_COMPLETION(cqv, tag(101), 1); CQ_EXPECT_COMPLETION(cqv, tag(104), 1); cq_verify(cqv); @@ -526,7 +551,7 @@ static void test_invoke_request_with_exceptionally_uncompressed_payload( config, "test_invoke_request_with_exceptionally_uncompressed_payload", GRPC_WRITE_NO_COMPRESS, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, NULL, false, - /* ignored */ GRPC_COMPRESS_LEVEL_NONE); + /* ignored */ GRPC_COMPRESS_LEVEL_NONE, false); } static void test_invoke_request_with_uncompressed_payload( @@ -534,7 +559,8 @@ static void test_invoke_request_with_uncompressed_payload( request_with_payload_template( config, "test_invoke_request_with_uncompressed_payload", 0, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, - GRPC_COMPRESS_NONE, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE); + GRPC_COMPRESS_NONE, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, + false); } static void test_invoke_request_with_compressed_payload( @@ -542,7 +568,17 @@ static void test_invoke_request_with_compressed_payload( request_with_payload_template( config, "test_invoke_request_with_compressed_payload", 0, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, - GRPC_COMPRESS_GZIP, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE); + GRPC_COMPRESS_GZIP, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, + false); +} + +static void test_invoke_request_with_send_message_before_initial_metadata( + grpc_end2end_test_config config) { + request_with_payload_template( + config, "test_invoke_request_with_compressed_payload", 0, + GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, + GRPC_COMPRESS_GZIP, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, + true); } static void test_invoke_request_with_server_level( @@ -550,7 +586,7 @@ static void test_invoke_request_with_server_level( request_with_payload_template( config, "test_invoke_request_with_server_level", 0, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE /* ignored */, - NULL, true, GRPC_COMPRESS_LEVEL_HIGH); + NULL, true, GRPC_COMPRESS_LEVEL_HIGH, false); } static void test_invoke_request_with_compressed_payload_md_override( @@ -574,21 +610,21 @@ static void test_invoke_request_with_compressed_payload_md_override( config, "test_invoke_request_with_compressed_payload_md_override_1", 0, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_NONE, &gzip_compression_override, false, - /*ignored*/ GRPC_COMPRESS_LEVEL_NONE); + /*ignored*/ GRPC_COMPRESS_LEVEL_NONE, false); /* Channel default DEFLATE, call override to GZIP */ request_with_payload_template( config, "test_invoke_request_with_compressed_payload_md_override_2", 0, GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_NONE, &gzip_compression_override, false, - /*ignored*/ GRPC_COMPRESS_LEVEL_NONE); + /*ignored*/ GRPC_COMPRESS_LEVEL_NONE, false); /* Channel default DEFLATE, call override to NONE (aka IDENTITY) */ request_with_payload_template( config, "test_invoke_request_with_compressed_payload_md_override_3", 0, GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, &identity_compression_override, false, - /*ignored*/ GRPC_COMPRESS_LEVEL_NONE); + /*ignored*/ GRPC_COMPRESS_LEVEL_NONE, false); } static void test_invoke_request_with_disabled_algorithm( @@ -602,6 +638,7 @@ void compressed_payload(grpc_end2end_test_config config) { test_invoke_request_with_exceptionally_uncompressed_payload(config); test_invoke_request_with_uncompressed_payload(config); test_invoke_request_with_compressed_payload(config); + test_invoke_request_with_send_message_before_initial_metadata(config); test_invoke_request_with_server_level(config); test_invoke_request_with_compressed_payload_md_override(config); test_invoke_request_with_disabled_algorithm(config); diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index b85af6685e2..01eb8d365e6 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -68,11 +68,11 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), - grpc_timeout_seconds_to_deadline(5), - NULL) - .type == GRPC_OP_COMPLETE); + grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); + grpc_event ev = grpc_completion_queue_next( + f->cq, grpc_timeout_seconds_to_deadline(5), NULL); + GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); + GPR_ASSERT(ev.tag == tag(1000)); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/support/BUILD b/test/core/support/BUILD index 37870d922d3..298eebd9b8a 100644 --- a/test/core/support/BUILD +++ b/test/core/support/BUILD @@ -126,16 +126,6 @@ grpc_cc_test( ], ) -grpc_cc_test( - name = "stack_lockfree_test", - srcs = ["stack_lockfree_test.c"], - language = "C", - deps = [ - "//:gpr", - "//test/core/util:gpr_test_util", - ], -) - grpc_cc_test( name = "string_test", srcs = ["string_test.c"], diff --git a/test/core/support/stack_lockfree_test.c b/test/core/support/stack_lockfree_test.c deleted file mode 100644 index 4b1f60ce014..00000000000 --- a/test/core/support/stack_lockfree_test.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "src/core/lib/support/stack_lockfree.h" - -#include - -#include -#include -#include -#include -#include "test/core/util/test_config.h" - -/* max stack size supported */ -#define MAX_STACK_SIZE 65534 - -#define MAX_THREADS 32 - -static void test_serial_sized(size_t size) { - gpr_stack_lockfree *stack = gpr_stack_lockfree_create(size); - size_t i; - size_t j; - - /* First try popping empty */ - GPR_ASSERT(gpr_stack_lockfree_pop(stack) == -1); - - /* Now add one item and check it */ - gpr_stack_lockfree_push(stack, 3); - GPR_ASSERT(gpr_stack_lockfree_pop(stack) == 3); - GPR_ASSERT(gpr_stack_lockfree_pop(stack) == -1); - - /* Now add repeatedly more items and check them */ - for (i = 1; i < size; i *= 2) { - for (j = 0; j <= i; j++) { - GPR_ASSERT(gpr_stack_lockfree_push(stack, (int)j) == (j == 0)); - } - for (j = 0; j <= i; j++) { - GPR_ASSERT(gpr_stack_lockfree_pop(stack) == (int)(i - j)); - } - GPR_ASSERT(gpr_stack_lockfree_pop(stack) == -1); - } - - gpr_stack_lockfree_destroy(stack); -} - -static void test_serial() { - size_t i; - for (i = 128; i < MAX_STACK_SIZE; i *= 2) { - test_serial_sized(i); - } - test_serial_sized(MAX_STACK_SIZE); -} - -struct test_arg { - gpr_stack_lockfree *stack; - int stack_size; - int nthreads; - int rank; - int sum; -}; - -static void test_mt_body(void *v) { - struct test_arg *arg = (struct test_arg *)v; - int lo, hi; - int i; - int res; - lo = arg->rank * arg->stack_size / arg->nthreads; - hi = (arg->rank + 1) * arg->stack_size / arg->nthreads; - for (i = lo; i < hi; i++) { - gpr_stack_lockfree_push(arg->stack, i); - if ((res = gpr_stack_lockfree_pop(arg->stack)) != -1) { - arg->sum += res; - } - } - while ((res = gpr_stack_lockfree_pop(arg->stack)) != -1) { - arg->sum += res; - } -} - -static void test_mt_sized(size_t size, int nth) { - gpr_stack_lockfree *stack; - struct test_arg args[MAX_THREADS]; - gpr_thd_id thds[MAX_THREADS]; - int sum; - int i; - gpr_thd_options options = gpr_thd_options_default(); - - stack = gpr_stack_lockfree_create(size); - for (i = 0; i < nth; i++) { - args[i].stack = stack; - args[i].stack_size = (int)size; - args[i].nthreads = nth; - args[i].rank = i; - args[i].sum = 0; - } - gpr_thd_options_set_joinable(&options); - for (i = 0; i < nth; i++) { - GPR_ASSERT(gpr_thd_new(&thds[i], test_mt_body, &args[i], &options)); - } - sum = 0; - for (i = 0; i < nth; i++) { - gpr_thd_join(thds[i]); - sum = sum + args[i].sum; - } - GPR_ASSERT((unsigned)sum == ((unsigned)size * (size - 1)) / 2); - gpr_stack_lockfree_destroy(stack); -} - -static void test_mt() { - size_t size; - int nth; - for (nth = 1; nth < MAX_THREADS; nth++) { - for (size = 128; size < MAX_STACK_SIZE; size *= 2) { - test_mt_sized(size, nth); - } - test_mt_sized(MAX_STACK_SIZE, nth); - } -} - -int main(int argc, char **argv) { - grpc_test_init(argc, argv); - test_serial(); - test_mt(); - return 0; -} diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.c index a12f31a048b..ed51dd18592 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.c +++ b/test/core/transport/chttp2/hpack_encoder_test.c @@ -95,7 +95,8 @@ static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, bool eof, .max_frame_size = 16384, .stats = &stats, }; - grpc_chttp2_encode_header(exec_ctx, &g_compressor, &b, &hopt, &output); + grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt, + &output); merged = grpc_slice_merge(output.slices, output.count); grpc_slice_buffer_destroy_internal(exec_ctx, &output); grpc_metadata_batch_destroy(exec_ctx, &b); @@ -213,7 +214,8 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx, .use_true_binary_metadata = false, .max_frame_size = 16384, .stats = &stats}; - grpc_chttp2_encode_header(exec_ctx, &g_compressor, &b, &hopt, &output); + grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt, + &output); grpc_slice_buffer_destroy_internal(exec_ctx, &output); grpc_metadata_batch_destroy(exec_ctx, &b); diff --git a/test/cpp/common/alarm_cpp_test.cc b/test/cpp/common/alarm_cpp_test.cc index 3e4999994a1..ce4168843cd 100644 --- a/test/cpp/common/alarm_cpp_test.cc +++ b/test/cpp/common/alarm_cpp_test.cc @@ -40,6 +40,37 @@ TEST(AlarmTest, RegularExpiry) { EXPECT_EQ(junk, output_tag); } +TEST(AlarmTest, MoveConstructor) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + Alarm first(&cq, grpc_timeout_seconds_to_deadline(1), junk); + Alarm second(std::move(first)); + void* output_tag; + bool ok; + const CompletionQueue::NextStatus status = cq.AsyncNext( + (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_TRUE(ok); + EXPECT_EQ(junk, output_tag); +} + +TEST(AlarmTest, MoveAssignment) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + Alarm first(&cq, grpc_timeout_seconds_to_deadline(1), junk); + Alarm second(std::move(first)); + first = std::move(second); + + void* output_tag; + bool ok; + const CompletionQueue::NextStatus status = cq.AsyncNext( + (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); + + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_TRUE(ok); + EXPECT_EQ(junk, output_tag); +} + TEST(AlarmTest, RegularExpiryChrono) { CompletionQueue cq; void* junk = reinterpret_cast(1618033); diff --git a/test/cpp/common/channel_filter_test.cc b/test/cpp/common/channel_filter_test.cc index e747e633a02..638518107bb 100644 --- a/test/cpp/common/channel_filter_test.cc +++ b/test/cpp/common/channel_filter_test.cc @@ -28,7 +28,7 @@ class MyChannelData : public ChannelData { public: MyChannelData() {} - grpc_error* Init(grpc_exec_ctx* exec_ctx, + grpc_error* Init(grpc_exec_ctx* exec_ctx, grpc_channel_element* elem, grpc_channel_element_args* args) override { (void)args->channel_args; // Make sure field is available. return GRPC_ERROR_NONE; @@ -39,7 +39,7 @@ class MyCallData : public CallData { public: MyCallData() {} - grpc_error* Init(grpc_exec_ctx* exec_ctx, ChannelData* channel_data, + grpc_error* Init(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, const grpc_call_element_args* args) override { (void)args->path; // Make sure field is available. return GRPC_ERROR_NONE; diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index 776d94d3b61..f71e557450d 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -97,9 +97,12 @@ class ClientLbEnd2endTest : public ::testing::Test { } } - void StartServers(int num_servers) { - for (int i = 0; i < num_servers; ++i) { - servers_.emplace_back(new ServerData(server_host_)); + void StartServers(size_t num_servers, + std::vector ports = std::vector()) { + for (size_t i = 0; i < num_servers; ++i) { + int port = 0; + if (ports.size() == num_servers) port = ports[i]; + servers_.emplace_back(new ServerData(server_host_, port)); } } @@ -146,14 +149,18 @@ class ClientLbEnd2endTest : public ::testing::Test { stub_ = grpc::testing::EchoTestService::NewStub(channel_); } - void SendRpc() { + void SendRpc(bool expect_ok = true) { EchoRequest request; EchoResponse response; request.set_message("Live long and prosper."); ClientContext context; Status status = stub_->Echo(&context, request, &response); - EXPECT_TRUE(status.ok()); - EXPECT_EQ(response.message(), request.message()); + if (expect_ok) { + EXPECT_TRUE(status.ok()); + EXPECT_EQ(response.message(), request.message()); + } else { + EXPECT_FALSE(status.ok()); + } } struct ServerData { @@ -162,8 +169,8 @@ class ClientLbEnd2endTest : public ::testing::Test { MyTestServiceImpl service_; std::unique_ptr thread_; - explicit ServerData(const grpc::string& server_host) { - port_ = grpc_pick_unused_port_or_die(); + explicit ServerData(const grpc::string& server_host, int port = 0) { + port_ = port > 0 ? port : grpc_pick_unused_port_or_die(); gpr_log(GPR_INFO, "starting server on port %d", port_); std::mutex mu; std::condition_variable cond; @@ -187,9 +194,9 @@ class ClientLbEnd2endTest : public ::testing::Test { cond->notify_one(); } - void Shutdown() { + void Shutdown(bool join = true) { server_->Shutdown(); - thread_->join(); + if (join) thread_->join(); } }; @@ -456,6 +463,39 @@ TEST_F(ClientLbEnd2endTest, RoundRobinManyUpdates) { EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName()); } +TEST_F(ClientLbEnd2endTest, RoundRobinReconnect) { + // Start servers and send one RPC per server. + const int kNumServers = 1; + std::vector ports; + ports.push_back(grpc_pick_unused_port_or_die()); + StartServers(kNumServers, ports); + ResetStub("round_robin"); + SetNextResolution(ports); + // Send one RPC per backend and make sure they are used in order. + // Note: This relies on the fact that the subchannels are reported in + // state READY in the order in which the addresses are specified, + // which is only true because the backends are all local. + for (size_t i = 0; i < servers_.size(); ++i) { + SendRpc(); + EXPECT_EQ(1, servers_[i]->service_.request_count()) << "for backend #" << i; + } + // Check LB policy name for the channel. + EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName()); + + // Kill all servers + for (size_t i = 0; i < servers_.size(); ++i) { + servers_[i]->Shutdown(false); + } + // Client request should fail. + SendRpc(false); + + // Bring servers back up on the same port (we aren't recreating the channel). + StartServers(kNumServers, ports); + + // Client request should succeed. + SendRpc(); +} + } // namespace } // namespace testing } // namespace grpc diff --git a/test/cpp/end2end/filter_end2end_test.cc b/test/cpp/end2end/filter_end2end_test.cc index bf5a9c227aa..f260ea0016d 100644 --- a/test/cpp/end2end/filter_end2end_test.cc +++ b/test/cpp/end2end/filter_end2end_test.cc @@ -100,7 +100,8 @@ int GetCallCounterValue() { class ChannelDataImpl : public ChannelData { public: - grpc_error* Init(grpc_exec_ctx* exec_ctx, grpc_channel_element_args* args) { + grpc_error* Init(grpc_exec_ctx* exec_ctx, grpc_channel_element* elem, + grpc_channel_element_args* args) { IncrementConnectionCounter(); return GRPC_ERROR_NONE; } diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 3457fd77cfb..adbfa4d7967 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -82,7 +82,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State &state) { (size_t)state.range(1), &stats, }; - grpc_chttp2_encode_header(&exec_ctx, &c, &b, &hopt, &outbuf); + grpc_chttp2_encode_header(&exec_ctx, &c, NULL, 0, &b, &hopt, &outbuf); if (!logged_representative_output && state.iterations() > 3) { logged_representative_output = true; for (size_t i = 0; i < outbuf.count; i++) { diff --git a/test/cpp/util/grpc_tool.cc b/test/cpp/util/grpc_tool.cc index af0afa9b554..bb6f8780202 100644 --- a/test/cpp/util/grpc_tool.cc +++ b/test/cpp/util/grpc_tool.cc @@ -445,12 +445,10 @@ bool GrpcTool::CallMethod(int argc, const char** argv, bool print_mode = false; std::shared_ptr channel = - FLAGS_remotedb - ? grpc::CreateChannel(server_address, cred.GetCredentials()) - : nullptr; + grpc::CreateChannel(server_address, cred.GetCredentials()); - parser.reset(new grpc::testing::ProtoFileParser(channel, FLAGS_proto_path, - FLAGS_protofiles)); + parser.reset(new grpc::testing::ProtoFileParser( + FLAGS_remotedb ? channel : nullptr, FLAGS_proto_path, FLAGS_protofiles)); if (FLAGS_binary_input) { formatted_method_name = method_name; diff --git a/test/distrib/node/run_distrib_test.sh b/test/distrib/node/run_distrib_test.sh index bfd4ce9b930..a806f84f7c9 100755 --- a/test/distrib/node/run_distrib_test.sh +++ b/test/distrib/node/run_distrib_test.sh @@ -34,8 +34,8 @@ npm install -g node-static STATIC_SERVER=127.0.0.1 # If port_server is running, get port from that. Otherwise, assume we're in -# docker and use 8080 -STATIC_PORT=$(curl 'localhost:32767/get' || echo '8080') +# docker and use 12345 +STATIC_PORT=$(curl 'localhost:32767/get' || echo '12345') # Serves the input_artifacts directory statically at localhost: static "$EXTERNAL_GIT_ROOT/input_artifacts" -a $STATIC_SERVER -p $STATIC_PORT & diff --git a/third_party/cares/cares.BUILD b/third_party/cares/cares.BUILD index 3583720ef3d..978e9b1ed9d 100644 --- a/third_party/cares/cares.BUILD +++ b/third_party/cares/cares.BUILD @@ -78,6 +78,7 @@ cc_library( "cares/ares_version.h", "cares/bitncmp.h", "cares/config-win32.h", + "cares/nameser.h", "cares/setup_once.h", ] + select({ ":darwin": ["config_darwin/ares_config.h"], diff --git a/third_party/rake-compiler-dock/Dockerfile b/third_party/rake-compiler-dock/Dockerfile index 475c6a8d3db..e7165b7e69b 100644 --- a/third_party/rake-compiler-dock/Dockerfile +++ b/third_party/rake-compiler-dock/Dockerfile @@ -213,4 +213,6 @@ RUN echo '!' > /usr/local/rake-compiler/ruby/i686-linux-gnu/ruby-2.4.0/lib ENV RUBY_CC_VERSION 2.4.0:2.3.0:2.2.2:2.1.5:2.0.0 +RUN apt-get install -y g++-multilib + CMD bash diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 4179bf1cb84..6ecacede71a 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -72,7 +72,6 @@ LICENSE_PREFIX = { '.mak': r'#\s*', 'Makefile': r'#\s*', 'Dockerfile': r'#\s*', - 'LICENSE': r'\s*', 'BUILD': r'#\s*', } @@ -124,7 +123,7 @@ def save(name, text): with open(name, 'w') as f: f.write(text) -assert(re.search(RE_LICENSE['LICENSE'], load('LICENSE'))) + assert(re.search(RE_LICENSE['Makefile'], load('Makefile'))) diff --git a/tools/distrib/pylint_code.sh b/tools/distrib/pylint_code.sh index f5c958473f1..3a1825535d5 100755 --- a/tools/distrib/pylint_code.sh +++ b/tools/distrib/pylint_code.sh @@ -19,15 +19,16 @@ set -ex cd "$(dirname "$0")/../.." DIRS=( - 'src/python/grpcio/grpc' - 'src/python/grpcio_reflection/grpc_reflection' - 'src/python/grpcio_health_checking/grpc_health' + 'src/python/grpcio/grpc' + 'src/python/grpcio_health_checking/grpc_health' + 'src/python/grpcio_reflection/grpc_reflection' ) VIRTUALENV=python_pylint_venv virtualenv $VIRTUALENV PYTHON=$(realpath $VIRTUALENV/bin/python) +$PYTHON -m pip install --upgrade pip $PYTHON -m pip install pylint==1.6.5 for dir in "${DIRS[@]}"; do diff --git a/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile new file mode 100644 index 00000000000..35998a3cb27 --- /dev/null +++ b/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile @@ -0,0 +1,76 @@ +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM debian:jessie + +# Install JDK 8 and Git +RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \ + echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list && \ + echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list && \ + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 +RUN apt-get update && apt-get -y install \ + git \ + libapr1 \ + oracle-java8-installer \ + && \ + apt-get clean && rm -r /var/cache/oracle-jdk8-installer/ +ENV JAVA_HOME /usr/lib/jvm/java-8-oracle +ENV PATH $PATH:$JAVA_HOME/bin + +# Install protobuf +RUN apt-get update && apt-get install -y \ + autoconf \ + build-essential \ + curl \ + gcc \ + libtool \ + unzip \ + && \ + apt-get clean +WORKDIR / +RUN git clone https://github.com/google/protobuf.git +WORKDIR /protobuf +RUN git checkout v3.3.1 && \ + ./autogen.sh && \ + ./configure && \ + make && \ + make check && \ + make install + +# Install gcloud command line tools +ENV CLOUD_SDK_REPO "cloud-sdk-jessie" +RUN echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \ + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ + apt-get update && apt-get install -y google-cloud-sdk && apt-get clean && \ + gcloud config set component_manager/disable_update_check true + +# Download and install grpc-java +WORKDIR / +RUN git clone https://github.com/grpc/grpc-java.git +WORKDIR /grpc-java +RUN ./gradlew install + +# Setup the Android SDK licenses +ENV ANDROID_HOME "/grpc-java/android-interop-testing/.android" +RUN mkdir -p "${ANDROID_HOME}/licenses" +RUN echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "${ANDROID_HOME}/licenses/android-sdk-license" +RUN echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "${ANDROID_HOME}/licenses/android-sdk-preview-license" + +# Build the Android interop apks +WORKDIR /grpc-java/android-interop-testing +RUN ../gradlew assembleDebug +RUN ../gradlew assembleDebugAndroidTest + +# Define the default command. +CMD ["bash"] diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 766c20f59b7..63067b3081f 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1304,8 +1304,6 @@ src/core/lib/support/mpscq.h \ src/core/lib/support/murmur_hash.c \ src/core/lib/support/murmur_hash.h \ src/core/lib/support/spinlock.h \ -src/core/lib/support/stack_lockfree.c \ -src/core/lib/support/stack_lockfree.h \ src/core/lib/support/string.c \ src/core/lib/support/string.h \ src/core/lib/support/string_posix.c \ diff --git a/tools/gcp/utils/big_query_utils.py b/tools/gcp/utils/big_query_utils.py index 76c86645b76..77a5f5691e9 100755 --- a/tools/gcp/utils/big_query_utils.py +++ b/tools/gcp/utils/big_query_utils.py @@ -116,6 +116,33 @@ def create_table2(big_query, project_id, dataset_id, table_id, fields_schema, return is_success +def patch_table(big_query, project_id, dataset_id, table_id, fields_schema): + is_success = True + + body = { + 'schema': { + 'fields': fields_schema + }, + 'tableReference': { + 'datasetId': dataset_id, + 'projectId': project_id, + 'tableId': table_id + } + } + + try: + table_req = big_query.tables().patch(projectId=project_id, + datasetId=dataset_id, + tableId=table_id, + body=body) + res = table_req.execute(num_retries=NUM_RETRIES) + print 'Successfully patched %s "%s"' % (res['kind'], res['id']) + except HttpError as http_error: + print 'Error in creating table: %s. Err: %s' % (table_id, http_error) + is_success = False + return is_success + + def insert_rows(big_query, project_id, dataset_id, table_id, rows_list): is_success = True body = {'rows': rows_list} diff --git a/tools/grift/Dockerfile b/tools/grift/Dockerfile deleted file mode 100644 index 4d2fc3146b4..00000000000 --- a/tools/grift/Dockerfile +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2016 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM ubuntu:14.04 - -RUN apt-get update && \ - apt-get install -y \ - git build-essential \ - pkg-config flex \ - bison \ - libkrb5-dev \ - libsasl2-dev \ - libnuma-dev \ - pkg-config \ - libssl-dev \ - autoconf libtool \ - cmake \ - libiberty-dev \ - g++ unzip \ - curl make automake libtool libboost-dev - -# Configure git -RUN git config --global user.name "Jenkins" && \ - git config --global user.email "jenkins@grpc" - -# Clone gRPC -RUN git clone https://github.com/grpc/grpc - -# Update Submodules -RUN cd grpc && git submodule update --init - -# Install protobuf -RUN cd grpc/third_party/protobuf && ./autogen.sh && ./configure && \ - make -j && make check -j && make install && ldconfig - -# Install gRPC -RUN cd grpc && make -j && make install - -# Install thrift -RUN cd grpc/third_party/thrift && git am --signoff < ../../tools/grift/grpc_plugins_generator.patch && \ - ./bootstrap.sh && ./configure && make -j && make install \ No newline at end of file diff --git a/tools/grift/README.md b/tools/grift/README.md deleted file mode 100644 index 2b5fa5ae14b..00000000000 --- a/tools/grift/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# Documentation - -grift is integration of [Apache Thrift](https://github.com/apache/thrift.git) Serializer with gRPC. - -This integration allows you to use grpc to send thrift messages in C++ and java. - -grift uses Compact Protocol to serialize thrift messages. - -## generating grpc plugins for thrift services - -### C++ -```sh - $ thrift --gen cpp -``` - -### Java -```sh - $ thrift --gen java -``` - -# Installation - -Before Installing thrift make sure to apply this [patch](grpc_plugins_generator.patch) to third_party/thrift. -Go to third_party/thrift and follow the [INSTALLATION](https://github.com/apache/thrift.git) instructions to install thrift with commit id bcad91771b7f0bff28a1cac1981d7ef2b9bcef3c. \ No newline at end of file diff --git a/tools/grift/grpc_plugins_generator.patch b/tools/grift/grpc_plugins_generator.patch deleted file mode 100644 index de82a01f625..00000000000 --- a/tools/grift/grpc_plugins_generator.patch +++ /dev/null @@ -1,2505 +0,0 @@ -From 0894590b5020c38106d4ebb2291994668c64f9dd Mon Sep 17 00:00:00 2001 -From: chedeti -Date: Sun, 31 Jul 2016 15:47:47 -0700 -Subject: [PATCH 1/3] don't build tests - ---- - Makefile.am | 7 ++----- - lib/cpp/Makefile.am | 7 ++----- - 2 files changed, 4 insertions(+), 10 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 10fe49a..d49caac 100755 ---- a/Makefile.am -+++ b/Makefile.am -@@ -21,10 +21,6 @@ ACLOCAL_AMFLAGS = -I ./aclocal - - SUBDIRS = compiler/cpp lib - --if WITH_TESTS --SUBDIRS += test --endif -- - if WITH_TUTORIAL - SUBDIRS += tutorial - endif -@@ -117,4 +113,5 @@ EXTRA_DIST = \ - CHANGES \ - NOTICE \ - README.md \ -- Thrift.podspec -+ Thrift.podspec \ -+ test -diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am -index 6fd15d2..7de1fad 100755 ---- a/lib/cpp/Makefile.am -+++ b/lib/cpp/Makefile.am -@@ -27,10 +27,6 @@ moc__%.cpp: %.h - - SUBDIRS = . - --if WITH_TESTS --SUBDIRS += test --endif -- - pkgconfigdir = $(libdir)/pkgconfig - - lib_LTLIBRARIES = libthrift.la -@@ -277,7 +273,8 @@ EXTRA_DIST = \ - thrift-qt.pc.in \ - thrift-qt5.pc.in \ - src/thrift/qt/CMakeLists.txt \ -- $(WINDOWS_DIST) -+ $(WINDOWS_DIST) \ -+ test - - style-local: - $(CPPSTYLE_CMD) --- -2.8.0.rc3.226.g39d4020 - - -From 387e4300bc9d98176a92a7c010621443a538e7f2 Mon Sep 17 00:00:00 2001 -From: chedeti -Date: Sun, 31 Jul 2016 16:16:40 -0700 -Subject: [PATCH 2/3] grpc cpp plugins generator with example - ---- - compiler/cpp/src/generate/t_cpp_generator.cc | 489 +++++++++++++++++++++++---- - tutorial/cpp/CMakeLists.txt | 53 --- - tutorial/cpp/CppClient.cpp | 80 ----- - tutorial/cpp/CppServer.cpp | 181 ---------- - tutorial/cpp/GriftClient.cpp | 93 +++++ - tutorial/cpp/GriftServer.cpp | 93 +++++ - tutorial/cpp/Makefile.am | 66 ++-- - tutorial/cpp/test.thrift | 13 + - 8 files changed, 652 insertions(+), 416 deletions(-) - delete mode 100644 tutorial/cpp/CMakeLists.txt - delete mode 100644 tutorial/cpp/CppClient.cpp - delete mode 100644 tutorial/cpp/CppServer.cpp - create mode 100644 tutorial/cpp/GriftClient.cpp - create mode 100644 tutorial/cpp/GriftServer.cpp - create mode 100644 tutorial/cpp/test.thrift - -diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc -index 6c04899..1557241 100644 ---- a/compiler/cpp/src/generate/t_cpp_generator.cc -+++ b/compiler/cpp/src/generate/t_cpp_generator.cc -@@ -162,6 +162,8 @@ public: - bool specialized = false); - void generate_function_helpers(t_service* tservice, t_function* tfunction); - void generate_service_async_skeleton(t_service* tservice); -+ void generate_service_stub_interface(t_service* tservice); -+ void generate_service_stub(t_service* tservice); - - /** - * Serialization constructs -@@ -883,10 +885,10 @@ void t_cpp_generator::generate_struct_declaration(ofstream& out, - bool is_user_struct) { - string extends = ""; - if (is_exception) { -- extends = " : public ::apache::thrift::TException"; -+ extends = " : public apache::thrift::TException"; - } else { -- if (is_user_struct && !gen_templates_) { -- extends = " : public virtual ::apache::thrift::TBase"; -+ if (!gen_templates_) { -+ extends = " : public virtual apache::thrift::TBase"; - } - } - -@@ -1130,9 +1132,15 @@ void t_cpp_generator::generate_struct_definition(ofstream& out, - vector::const_iterator m_iter; - const vector& members = tstruct->get_members(); - -+ string method_prefix = ""; -+ if (service_name_ != "") { -+ method_prefix = service_name_ + "::"; -+ } -+ - // Destructor - if (tstruct->annotations_.find("final") == tstruct->annotations_.end()) { -- force_cpp_out << endl << indent() << tstruct->get_name() << "::~" << tstruct->get_name() -+ force_cpp_out << endl << indent() << method_prefix << -+ tstruct->get_name() << "::~" << tstruct->get_name() - << "() throw() {" << endl; - indent_up(); - -@@ -1145,12 +1153,14 @@ void t_cpp_generator::generate_struct_definition(ofstream& out, - for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { - if (is_reference((*m_iter))) { - std::string type = type_name((*m_iter)->get_type()); -- out << endl << indent() << "void " << tstruct->get_name() << "::__set_" -+ out << endl << indent() << "void " << method_prefix -+ << tstruct->get_name() << "::__set_" - << (*m_iter)->get_name() << "(boost::shared_ptr<" - << type_name((*m_iter)->get_type(), false, false) << ">"; - out << " val) {" << endl; - } else { -- out << endl << indent() << "void " << tstruct->get_name() << "::__set_" -+ out << endl << indent() << "void " << method_prefix -+ << tstruct->get_name() << "::__set_" - << (*m_iter)->get_name() << "(" << type_name((*m_iter)->get_type(), false, true); - out << " val) {" << endl; - } -@@ -1177,11 +1187,16 @@ void t_cpp_generator::generate_struct_definition(ofstream& out, - * @param tstruct The struct - */ - void t_cpp_generator::generate_struct_reader(ofstream& out, t_struct* tstruct, bool pointers) { -+ string method_prefix = ""; -+ if (service_name_ != "") { -+ method_prefix = service_name_ + "::"; -+ } -+ - if (gen_templates_) { - out << indent() << "template " << endl << indent() << "uint32_t " -- << tstruct->get_name() << "::read(Protocol_* iprot) {" << endl; -+ << method_prefix << tstruct->get_name() << "::read(Protocol_* iprot) {" << endl; - } else { -- indent(out) << "uint32_t " << tstruct->get_name() -+ indent(out) << "uint32_t " << method_prefix << tstruct->get_name() - << "::read(::apache::thrift::protocol::TProtocol* iprot) {" << endl; - } - indent_up(); -@@ -1301,14 +1316,18 @@ void t_cpp_generator::generate_struct_reader(ofstream& out, t_struct* tstruct, b - */ - void t_cpp_generator::generate_struct_writer(ofstream& out, t_struct* tstruct, bool pointers) { - string name = tstruct->get_name(); -+ string method_prefix = ""; -+ if (service_name_ != "") { -+ method_prefix = service_name_ + "::"; -+ } - const vector& fields = tstruct->get_sorted_members(); - vector::const_iterator f_iter; - - if (gen_templates_) { - out << indent() << "template " << endl << indent() << "uint32_t " -- << tstruct->get_name() << "::write(Protocol_* oprot) const {" << endl; -+ << method_prefix << tstruct->get_name() << "::write(Protocol_* oprot) const {" << endl; - } else { -- indent(out) << "uint32_t " << tstruct->get_name() -+ indent(out) << "uint32_t " << method_prefix << tstruct->get_name() - << "::write(::apache::thrift::protocol::TProtocol* oprot) const {" << endl; - } - indent_up(); -@@ -1369,14 +1388,18 @@ void t_cpp_generator::generate_struct_result_writer(ofstream& out, - t_struct* tstruct, - bool pointers) { - string name = tstruct->get_name(); -+ string method_prefix = ""; -+ if (service_name_ != "") { -+ method_prefix = service_name_ + "::"; -+ } - const vector& fields = tstruct->get_sorted_members(); - vector::const_iterator f_iter; - - if (gen_templates_) { - out << indent() << "template " << endl << indent() << "uint32_t " -- << tstruct->get_name() << "::write(Protocol_* oprot) const {" << endl; -+ << method_prefix << tstruct->get_name() << "::write(Protocol_* oprot) const {" << endl; - } else { -- indent(out) << "uint32_t " << tstruct->get_name() -+ indent(out) << "uint32_t " << method_prefix << tstruct->get_name() - << "::write(::apache::thrift::protocol::TProtocol* oprot) const {" << endl; - } - indent_up(); -@@ -1385,18 +1408,7 @@ void t_cpp_generator::generate_struct_result_writer(ofstream& out, - - indent(out) << "xfer += oprot->writeStructBegin(\"" << name << "\");" << endl; - -- bool first = true; - for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { -- if (first) { -- first = false; -- out << endl << indent() << "if "; -- } else { -- out << " else if "; -- } -- -- out << "(this->__isset." << (*f_iter)->get_name() << ") {" << endl; -- -- indent_up(); - - // Write field header - out << indent() << "xfer += oprot->writeFieldBegin(" -@@ -1410,9 +1422,6 @@ void t_cpp_generator::generate_struct_result_writer(ofstream& out, - } - // Write field closer - indent(out) << "xfer += oprot->writeFieldEnd();" << endl; -- -- indent_down(); -- indent(out) << "}"; - } - - // Write the struct map -@@ -1478,9 +1487,13 @@ void t_cpp_generator::generate_struct_ostream_operator(std::ofstream& out, t_str - } - - void t_cpp_generator::generate_struct_print_method_decl(std::ofstream& out, t_struct* tstruct) { -+ string method_prefix = ""; -+ if (service_name_ != "") { -+ method_prefix = service_name_ + "::"; -+ } - out << "void "; - if (tstruct) { -- out << tstruct->get_name() << "::"; -+ out << method_prefix << tstruct->get_name() << "::"; - } - out << "printTo(std::ostream& out) const"; - } -@@ -1601,11 +1614,13 @@ void t_cpp_generator::generate_exception_what_method(std::ofstream& out, t_struc - */ - void t_cpp_generator::generate_service(t_service* tservice) { - string svcname = tservice->get_name(); -+ string ns = tservice->get_program()->get_namespace("cpp"); - - // Make output files -- string f_header_name = get_out_dir() + svcname + ".h"; -+ string f_header_name = get_out_dir() + svcname + ".grpc.thrift.h"; - f_header_.open(f_header_name.c_str()); - -+ - // Print header file includes - f_header_ << autogen_comment(); - f_header_ << "#ifndef " << svcname << "_H" << endl << "#define " << svcname << "_H" << endl -@@ -1621,15 +1636,38 @@ void t_cpp_generator::generate_service(t_service* tservice) { - f_header_ << "#include " << endl; - } - f_header_ << "#include " << endl; -+ - f_header_ << "#include \"" << get_include_prefix(*get_program()) << program_name_ << "_types.h\"" - << endl; - - t_service* extends_service = tservice->get_extends(); -- if (extends_service != NULL) { -+ if (extends_service) { - f_header_ << "#include \"" << get_include_prefix(*(extends_service->get_program())) -- << extends_service->get_name() << ".h\"" << endl; -+ << extends_service->get_name() << ".grpc.thrift.h\"" << endl; - } - -+ -+ f_header_ << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl; -+ -+ -+ f_header_ << -+ endl << -+ "namespace grpc {" << endl << -+ "class CompletionQueue;" << endl << -+ "class Channel;" << endl << -+ "class RpcService;" << endl << -+ "class ServerCompletionQueue;" << endl << -+ "class ServerContext;" << endl << -+ "}" << endl; -+ - f_header_ << endl << ns_open_ << endl << endl; - - f_header_ << "#ifdef _WIN32\n" -@@ -1638,10 +1676,13 @@ void t_cpp_generator::generate_service(t_service* tservice) { - "#endif\n\n"; - - // Service implementation file includes -- string f_service_name = get_out_dir() + svcname + ".cpp"; -+ string f_service_name = get_out_dir() + svcname + ".grpc.thrift.cpp"; - f_service_.open(f_service_name.c_str()); - f_service_ << autogen_comment(); -- f_service_ << "#include \"" << get_include_prefix(*get_program()) << svcname << ".h\"" << endl; -+ -+ f_service_ << "#include \"" << -+ get_include_prefix(*get_program()) << svcname << ".grpc.thrift.h\"" << endl; -+ - if (gen_cob_style_) { - f_service_ << "#include \"thrift/async/TAsyncChannel.h\"" << endl; - } -@@ -1652,7 +1693,7 @@ void t_cpp_generator::generate_service(t_service* tservice) { - string f_service_tcc_name = get_out_dir() + svcname + ".tcc"; - f_service_tcc_.open(f_service_tcc_name.c_str()); - f_service_tcc_ << autogen_comment(); -- f_service_tcc_ << "#include \"" << get_include_prefix(*get_program()) << svcname << ".h\"" -+ f_service_tcc_ << "#include \"" << get_include_prefix(*get_program()) << svcname << ".grpc.thrift.h\"" - << endl; - - f_service_tcc_ << "#ifndef " << svcname << "_TCC" << endl << "#define " << svcname << "_TCC" -@@ -1663,19 +1704,69 @@ void t_cpp_generator::generate_service(t_service* tservice) { - } - } - -+ f_service_ << -+ endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ "#include " << endl << -+ endl; -+ - f_service_ << endl << ns_open_ << endl << endl; - f_service_tcc_ << endl << ns_open_ << endl << endl; - -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ -+ f_service_ << -+ "static const char* " << service_name_ << "_method_names[] = {" << endl; -+ -+ -+ indent_up(); -+ -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "\"/" << ns << "." << service_name_ << "/" << (*f_iter)->get_name() << "\"," << endl; -+ } -+ -+ -+ t_service* service_iter = extends_service; -+ while (service_iter) { -+ vector functions = service_iter->get_functions(); -+ vector::iterator f_iter; -+ -+ for ( f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "\"/" << service_iter->get_program()->get_namespace("cpp") << -+ "." << service_iter->get_name() << "/" << (*f_iter)->get_name() << "\"," << endl; -+ } -+ service_iter = service_iter->get_extends(); -+ } -+ -+ indent_down(); -+ f_service_ << -+ "};" << endl; -+ -+ // Generate service class -+ if ( extends_service) { -+ f_header_ << "class " << service_name_ << " : public " << -+ type_name(extends_service) << " {" << endl << -+ "public:" << endl; -+ } -+ else { -+ f_header_ << "class " << service_name_ << "{" << endl << -+ "public:" << endl; -+ } -+ - // Generate all the components -- generate_service_interface(tservice, ""); -- generate_service_interface_factory(tservice, ""); -- generate_service_null(tservice, ""); - generate_service_helpers(tservice); -- generate_service_client(tservice, ""); -- generate_service_processor(tservice, ""); -- generate_service_multiface(tservice); -- generate_service_skeleton(tservice); -- generate_service_client(tservice, "Concurrent"); -+ generate_service_interface(tservice, ""); -+ generate_service_stub_interface(tservice); -+ generate_service_stub(tservice); - - // Generate all the cob components - if (gen_cob_style_) { -@@ -1688,10 +1779,14 @@ void t_cpp_generator::generate_service(t_service* tservice) { - generate_service_async_skeleton(tservice); - } - -+ // Close service class -+ f_header_ << "};" << endl; -+ - f_header_ << "#ifdef _WIN32\n" - " #pragma warning( pop )\n" - "#endif\n\n"; - -+ - // Close the namespace - f_service_ << ns_close_ << endl << endl; - f_service_tcc_ << ns_close_ << endl << endl; -@@ -1729,15 +1824,11 @@ void t_cpp_generator::generate_service_helpers(t_service* tservice) { - string name_orig = ts->get_name(); - - // TODO(dreiss): Why is this stuff not in generate_function_helpers? -- ts->set_name(tservice->get_name() + "_" + (*f_iter)->get_name() + "_args"); -+ ts->set_name((*f_iter)->get_name() + "Req"); - generate_struct_declaration(f_header_, ts, false); -- generate_struct_definition(out, f_service_, ts, false); -+ generate_struct_definition(out, f_service_, ts, true); - generate_struct_reader(out, ts); - generate_struct_writer(out, ts); -- ts->set_name(tservice->get_name() + "_" + (*f_iter)->get_name() + "_pargs"); -- generate_struct_declaration(f_header_, ts, false, true, false, true); -- generate_struct_definition(out, f_service_, ts, false); -- generate_struct_writer(out, ts, true); - ts->set_name(name_orig); - - generate_function_helpers(tservice, *f_iter); -@@ -1745,13 +1836,218 @@ void t_cpp_generator::generate_service_helpers(t_service* tservice) { - } - - /** -+ * Generates a service Stub Interface -+ * -+ * @param tservice The service to generate a stub for. -+ * -+ */ -+void t_cpp_generator::generate_service_stub_interface(t_service* tservice) { -+ -+ string extends = ""; -+ if (tservice->get_extends()) { -+ extends = " : virtual public " + type_name(tservice->get_extends()) + "::StubInterface"; -+ } -+ -+ f_header_ << -+ endl << -+ "class StubInterface " << extends << " {" << endl; -+ indent_up(); -+ f_header_ << -+ " public:" << endl << -+ indent() << "virtual ~StubInterface() {}" << endl; -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ string function_name = (*f_iter)->get_name(); -+ f_header_ << -+ indent() << "virtual ::grpc::Status " << function_name << -+ "(::grpc::ClientContext* context, const " << function_name << -+ "Req& request, " << function_name << "Resp* response) = 0;" << endl; -+ } -+ indent_down(); -+ f_header_ << -+ "};" << endl << endl; -+ -+} -+void t_cpp_generator::generate_service_stub(t_service* tservice) { -+ f_header_ << -+ endl << -+ "class Stub : public StubInterface {" << -+ endl; -+ -+ indent_up(); -+ f_header_ << -+ " public:" << endl << -+ indent() << "Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);" << -+ endl; -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ string function_name = (*f_iter)->get_name(); -+ f_header_ << -+ indent() << "::grpc::Status " << function_name << -+ "(::grpc::ClientContext* context, const " << function_name << -+ "Req& request, " << function_name << "Resp* response) override;" << endl; -+ } -+ -+ t_service* extends_service = tservice->get_extends(); -+ t_service* service_iter = extends_service; -+ while (service_iter) { -+ // generate inherited methods -+ vector functions = service_iter->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ string function_name = (*f_iter)->get_name(); -+ f_header_ << -+ indent() << "::grpc::Status " << function_name << -+ "(::grpc::ClientContext* context, const " << function_name << -+ "Req& request, " << function_name << "Resp* response) override;" << endl; -+ } -+ service_iter = service_iter->get_extends(); -+ } -+ -+ f_header_ << -+ endl << -+ " private:" << endl << -+ indent() << "std::shared_ptr< ::grpc::ChannelInterface> channel_;" << -+ endl; -+ -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_header_ << -+ indent() << "const ::grpc::RpcMethod rpcmethod_" << (*f_iter)->get_name() << "_;" << endl; -+ } -+ -+ service_iter = extends_service; -+ while (service_iter) { -+ // generate inherited methods -+ vector functions = service_iter->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_header_ << -+ indent() << "const ::grpc::RpcMethod rpcmethod_" << (*f_iter)->get_name() << "_;" << endl; -+ } -+ service_iter = service_iter->get_extends(); -+ } -+ -+ indent_down(); -+ f_header_ << -+ "};" << endl << endl; -+ -+ // generate the implementaion of Stub -+ f_service_ << -+ endl << -+ service_name_ << "::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)" << endl; -+ -+ indent_up(); -+ f_service_ << -+ indent() << ": channel_(channel)" << endl; -+ int i=0; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter , ++i) { -+ f_service_ << -+ indent() << -+ ", rpcmethod_" << (*f_iter)->get_name() << "_(" << -+ service_name_ << "_method_names[" << i << "], ::grpc::RpcMethod::NORMAL_RPC, channel)" << endl; -+ } -+ -+ service_iter = extends_service; -+ while (service_iter) { -+ // generate inherited methods -+ vector functions = service_iter->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter, ++i) { -+ f_service_ << -+ indent() << -+ ", rpcmethod_" << (*f_iter)->get_name() << "_(" << -+ service_name_ << "_method_names[" << i << "], ::grpc::RpcMethod::NORMAL_RPC, channel)" << endl; -+ } -+ service_iter = service_iter->get_extends(); -+ } -+ f_service_ << -+ indent() << "{}" << endl; -+ indent_down(); -+ -+ // generate NewStub -+ f_header_ << -+ endl << -+ "static std::unique_ptr NewStub(const std::shared_ptr\ -+ < ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());" << -+ endl; -+ -+ // generate NewStub Implementation -+ f_service_ << -+ endl << -+ "std::unique_ptr< " << service_name_ << "::Stub> " << service_name_ << "::NewStub(const std::shared_ptr\ -+ < ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {" << endl; -+ -+ indent_up(); -+ f_service_ << -+ indent() << "std::unique_ptr< " << service_name_ << "::Stub> stub(new " << service_name_ << -+ "::Stub(channel));" << endl << -+ indent() << "return stub;" << endl; -+ indent_down(); -+ f_service_ << -+ "}" << endl; -+ -+ // generate stub methods -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ string function_name = (*f_iter)->get_name(); -+ f_service_ << -+ endl << -+ "::grpc::Status " << service_name_ << "::Stub::" << function_name << -+ "(::grpc::ClientContext* context, const " << service_name_ << "::" << -+ function_name << "Req& request, " << service_name_ << "::" << -+ function_name << "Resp* response) {" << endl; -+ -+ indent_up(); -+ f_service_ << -+ indent() << "return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_" << -+ function_name << "_, context, request, response);" << endl; -+ indent_down(); -+ -+ f_service_ << -+ "}" << endl; -+ -+ } -+ -+ service_iter = extends_service; -+ while (service_iter) { -+ vector functions = service_iter->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ string function_name = (*f_iter)->get_name(); -+ f_service_ << -+ endl << -+ "::grpc::Status " << service_name_ << "::Stub::" << function_name << -+ "(::grpc::ClientContext* context, const " << service_name_ << "::" << -+ function_name << "Req& request, " << service_name_ << "::" << -+ function_name << "Resp* response) {" << endl; -+ -+ indent_up(); -+ f_service_ << -+ indent() << "return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_" << -+ function_name << "_, context, request, response);" << endl; -+ indent_down(); -+ -+ f_service_ << -+ "}" << endl; -+ -+ } -+ service_iter = service_iter->get_extends(); -+ } -+ -+} -+ -+ -+/** - * Generates a service interface definition. - * - * @param tservice The service to generate a header definition for - */ - void t_cpp_generator::generate_service_interface(t_service* tservice, string style) { - -- string service_if_name = service_name_ + style + "If"; -+ string service_if_name = "Service"; - if (style == "CobCl") { - // Forward declare the client. - string client_name = service_name_ + "CobClient"; -@@ -1764,13 +2060,15 @@ void t_cpp_generator::generate_service_interface(t_service* tservice, string sty - } - - string extends = ""; -- if (tservice->get_extends() != NULL) { -- extends = " : virtual public " + type_name(tservice->get_extends()) + style + "If"; -+ if (tservice->get_extends()) { -+ extends = " : virtual public " + type_name(tservice->get_extends()) + style + "::Service"; - if (style == "CobCl" && gen_templates_) { - // TODO(simpkins): If gen_templates_ is enabled, we currently assume all - // parent services were also generated with templates enabled. - extends += "T"; - } -+ } else { -+ extends = " : public ::grpc::Service"; - } - - if (style == "CobCl" && gen_templates_) { -@@ -1778,7 +2076,9 @@ void t_cpp_generator::generate_service_interface(t_service* tservice, string sty - } - f_header_ << "class " << service_if_name << extends << " {" << endl << " public:" << endl; - indent_up(); -- f_header_ << indent() << "virtual ~" << service_if_name << "() {}" << endl; -+ -+ f_header_ << indent() << "Service();" << endl; -+ f_header_ << indent() << "virtual ~Service();" << endl; - - vector functions = tservice->get_functions(); - vector::iterator f_iter; -@@ -1786,7 +2086,12 @@ void t_cpp_generator::generate_service_interface(t_service* tservice, string sty - if ((*f_iter)->has_doc()) - f_header_ << endl; - generate_java_doc(f_header_, *f_iter); -- f_header_ << indent() << "virtual " << function_signature(*f_iter, style) << " = 0;" << endl; -+ -+ string function_name = (*f_iter)->get_name(); -+ f_header_ << -+ indent() << "virtual ::grpc::Status " << function_name << -+ "(::grpc::ServerContext* context, const "<< function_name << -+ "Req* request, "<< function_name << "Resp* response);" << endl; - } - indent_down(); - f_header_ << "};" << endl << endl; -@@ -1797,6 +2102,66 @@ void t_cpp_generator::generate_service_interface(t_service* tservice, string sty - f_header_ << "typedef " << service_if_name << "< ::apache::thrift::protocol::TProtocol> " - << service_name_ << style << "If;" << endl << endl; - } -+ -+ // generate the service interface implementations -+ -+ f_service_ << -+ endl << -+ service_name_ << "::Service::Service() {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "(void)" << service_name_ << "_method_names;" << endl; -+ uint32_t i=0; -+ for(i=0;iget_name(); -+ f_service_ << -+ endl << -+ indent() << "AddMethod(new ::grpc::RpcServiceMethod(" << endl; -+ indent_up(); -+ -+ f_service_ << -+ indent() << service_name_ << "_method_names[" << i << "]," << endl << -+ indent() << "::grpc::RpcMethod::NORMAL_RPC," << endl << -+ indent() << "new ::grpc::RpcMethodHandler< " << service_name_ << "::Service, " << -+ service_name_ << "::" << function_name << "Req, " << service_name_ << "::" << -+ function_name << "Resp>(" << endl; -+ -+ indent_up(); -+ f_service_ << -+ indent() << "std::mem_fn(&" << service_name_ << "::Service::" << function_name << "), this)));" << endl; -+ -+ indent_down(); -+ indent_down(); -+ } -+ -+ indent_down(); -+ f_service_ << -+ "}" << endl; -+ -+ f_service_ << -+ endl << -+ service_name_ << "::Service::~Service() {" << endl << -+ "}" << endl; -+ -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ string function_name = (*f_iter)->get_name(); -+ f_service_ << -+ endl << -+ "::grpc::Status " << service_name_ << "::Service::" << function_name << -+ "(::grpc::ServerContext* context, const " << service_name_ << "::" << function_name << -+ "Req* request, " << service_name_ << "::" << function_name << "Resp* response) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "(void) context;" << endl << -+ indent() << "(void) request;" << endl << -+ indent() << "(void) response;" << endl << -+ indent() << "return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED,\"\");" << endl; -+ indent_down(); -+ -+ f_service_ << -+ "}" << endl; -+ } -+ - } - - /** -@@ -3095,7 +3460,7 @@ void t_cpp_generator::generate_function_helpers(t_service* tservice, t_function* - - std::ofstream& out = (gen_templates_ ? f_service_tcc_ : f_service_); - -- t_struct result(program_, tservice->get_name() + "_" + tfunction->get_name() + "_result"); -+ t_struct result(program_, tfunction->get_name() + "Resp"); - t_field success(tfunction->get_returntype(), "success", 0); - if (!tfunction->get_returntype()->is_void()) { - result.append(&success); -@@ -3109,17 +3474,9 @@ void t_cpp_generator::generate_function_helpers(t_service* tservice, t_function* - } - - generate_struct_declaration(f_header_, &result, false); -- generate_struct_definition(out, f_service_, &result, false); -+ generate_struct_definition(out, f_service_, &result, true); - generate_struct_reader(out, &result); - generate_struct_result_writer(out, &result); -- -- result.set_name(tservice->get_name() + "_" + tfunction->get_name() + "_presult"); -- generate_struct_declaration(f_header_, &result, false, true, true, gen_cob_style_); -- generate_struct_definition(out, f_service_, &result, false); -- generate_struct_reader(out, &result, true); -- if (gen_cob_style_) { -- generate_struct_writer(out, &result, true); -- } - } - - /** -@@ -3162,8 +3519,8 @@ void t_cpp_generator::generate_process_function(t_service* tservice, - << endl; - scope_up(out); - -- string argsname = tservice->get_name() + "_" + tfunction->get_name() + "_args"; -- string resultname = tservice->get_name() + "_" + tfunction->get_name() + "_result"; -+ string argsname = tfunction->get_name() + "Req"; -+ string resultname = tfunction->get_name() + "Resp"; - - if (tfunction->is_oneway() && !unnamed_oprot_seqid) { - out << indent() << "(void) seqid;" << endl << indent() << "(void) oprot;" << endl; -@@ -3320,7 +3677,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice, - out << indent() << "(void) seqid;" << endl << indent() << "(void) oprot;" << endl; - } - -- out << indent() << tservice->get_name() + "_" + tfunction->get_name() << "_args args;" << endl -+ out << indent() << tfunction->get_name() << "Req args;" << endl - << indent() << "void* ctx = NULL;" << endl << indent() - << "if (this->eventHandler_.get() != NULL) {" << endl << indent() - << " ctx = this->eventHandler_->getContext(" << service_func_name << ", NULL);" << endl -@@ -3487,7 +3844,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice, - << "this->eventHandler_.get(), ctx, " << service_func_name << ");" << endl << endl; - - // Throw the TDelayedException, and catch the result -- out << indent() << tservice->get_name() << "_" << tfunction->get_name() << "_result result;" -+ out << indent() << tfunction->get_name() << "Resp result;" - << endl << endl << indent() << "try {" << endl; - indent_up(); - out << indent() << "_throw->throw_it();" << endl << indent() << "return cob(false);" -diff --git a/tutorial/cpp/CMakeLists.txt b/tutorial/cpp/CMakeLists.txt -deleted file mode 100644 -index 8a3d085..0000000 ---- a/tutorial/cpp/CMakeLists.txt -+++ /dev/null -@@ -1,53 +0,0 @@ --# --# Licensed to the Apache Software Foundation (ASF) under one --# or more contributor license agreements. See the NOTICE file --# distributed with this work for additional information --# regarding copyright ownership. The ASF licenses this file --# to you under the Apache License, Version 2.0 (the --# "License"); you may not use this file except in compliance --# with the License. You may obtain a copy of the License at --# --# http://www.apache.org/licenses/LICENSE-2.0 --# --# Unless required by applicable law or agreed to in writing, --# software distributed under the License is distributed on an --# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY --# KIND, either express or implied. See the License for the --# specific language governing permissions and limitations --# under the License. --# -- --find_package(Boost 1.53.0 REQUIRED) --include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") -- --#Make sure gen-cpp files can be included --include_directories("${CMAKE_CURRENT_BINARY_DIR}") --include_directories("${CMAKE_CURRENT_BINARY_DIR}/gen-cpp") --include_directories("${PROJECT_SOURCE_DIR}/lib/cpp/src") -- --include(ThriftMacros) -- --set(tutorialgencpp_SOURCES -- gen-cpp/Calculator.cpp -- gen-cpp/SharedService.cpp -- gen-cpp/shared_constants.cpp -- gen-cpp/shared_types.cpp -- gen-cpp/tutorial_constants.cpp -- gen-cpp/tutorial_types.cpp --) --add_library(tutorialgencpp STATIC ${tutorialgencpp_SOURCES}) --LINK_AGAINST_THRIFT_LIBRARY(tutorialgencpp thrift) -- --add_custom_command(OUTPUT gen-cpp/Calculator.cpp gen-cpp/SharedService.cpp gen-cpp/shared_constants.cpp gen-cpp/shared_types.cpp gen-cpp/tutorial_constants.cpp gen-cpp/tutorial_types.cpp -- COMMAND ${THRIFT_COMPILER} --gen cpp -r ${PROJECT_SOURCE_DIR}/tutorial/tutorial.thrift --) -- --add_executable(TutorialServer CppServer.cpp) --target_link_libraries(TutorialServer tutorialgencpp) --LINK_AGAINST_THRIFT_LIBRARY(TutorialServer thrift) --target_link_libraries(TutorialServer ${ZLIB_LIBRARIES}) -- --add_executable(TutorialClient CppClient.cpp) --target_link_libraries(TutorialClient tutorialgencpp) --LINK_AGAINST_THRIFT_LIBRARY(TutorialClient thrift) --target_link_libraries(TutorialClient ${ZLIB_LIBRARIES}) -diff --git a/tutorial/cpp/CppClient.cpp b/tutorial/cpp/CppClient.cpp -deleted file mode 100644 -index 2763fee..0000000 ---- a/tutorial/cpp/CppClient.cpp -+++ /dev/null -@@ -1,80 +0,0 @@ --/* -- * Licensed to the Apache Software Foundation (ASF) under one -- * or more contributor license agreements. See the NOTICE file -- * distributed with this work for additional information -- * regarding copyright ownership. The ASF licenses this file -- * to you under the Apache License, Version 2.0 (the -- * "License"); you may not use this file except in compliance -- * with the License. You may obtain a copy of the License at -- * -- * http://www.apache.org/licenses/LICENSE-2.0 -- * -- * Unless required by applicable law or agreed to in writing, -- * software distributed under the License is distributed on an -- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -- * KIND, either express or implied. See the License for the -- * specific language governing permissions and limitations -- * under the License. -- */ -- --#include -- --#include --#include --#include -- --#include "../gen-cpp/Calculator.h" -- --using namespace std; --using namespace apache::thrift; --using namespace apache::thrift::protocol; --using namespace apache::thrift::transport; -- --using namespace tutorial; --using namespace shared; -- --int main() { -- boost::shared_ptr socket(new TSocket("localhost", 9090)); -- boost::shared_ptr transport(new TBufferedTransport(socket)); -- boost::shared_ptr protocol(new TBinaryProtocol(transport)); -- CalculatorClient client(protocol); -- -- try { -- transport->open(); -- -- client.ping(); -- cout << "ping()" << endl; -- -- cout << "1 + 1 = " << client.add(1, 1) << endl; -- -- Work work; -- work.op = Operation::DIVIDE; -- work.num1 = 1; -- work.num2 = 0; -- -- try { -- client.calculate(1, work); -- cout << "Whoa? We can divide by zero!" << endl; -- } catch (InvalidOperation& io) { -- cout << "InvalidOperation: " << io.why << endl; -- // or using generated operator<<: cout << io << endl; -- // or by using std::exception native method what(): cout << io.what() << endl; -- } -- -- work.op = Operation::SUBTRACT; -- work.num1 = 15; -- work.num2 = 10; -- int32_t diff = client.calculate(1, work); -- cout << "15 - 10 = " << diff << endl; -- -- // Note that C++ uses return by reference for complex types to avoid -- // costly copy construction -- SharedStruct ss; -- client.getStruct(ss, 1); -- cout << "Received log: " << ss << endl; -- -- transport->close(); -- } catch (TException& tx) { -- cout << "ERROR: " << tx.what() << endl; -- } --} -diff --git a/tutorial/cpp/CppServer.cpp b/tutorial/cpp/CppServer.cpp -deleted file mode 100644 -index eafffa9..0000000 ---- a/tutorial/cpp/CppServer.cpp -+++ /dev/null -@@ -1,181 +0,0 @@ --/* -- * Licensed to the Apache Software Foundation (ASF) under one -- * or more contributor license agreements. See the NOTICE file -- * distributed with this work for additional information -- * regarding copyright ownership. The ASF licenses this file -- * to you under the Apache License, Version 2.0 (the -- * "License"); you may not use this file except in compliance -- * with the License. You may obtain a copy of the License at -- * -- * http://www.apache.org/licenses/LICENSE-2.0 -- * -- * Unless required by applicable law or agreed to in writing, -- * software distributed under the License is distributed on an -- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -- * KIND, either express or implied. See the License for the -- * specific language governing permissions and limitations -- * under the License. -- */ -- --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include -- --#include -- --#include --#include --#include -- --#include "../gen-cpp/Calculator.h" -- --using namespace std; --using namespace apache::thrift; --using namespace apache::thrift::concurrency; --using namespace apache::thrift::protocol; --using namespace apache::thrift::transport; --using namespace apache::thrift::server; -- --using namespace tutorial; --using namespace shared; -- --class CalculatorHandler : public CalculatorIf { --public: -- CalculatorHandler() {} -- -- void ping() { cout << "ping()" << endl; } -- -- int32_t add(const int32_t n1, const int32_t n2) { -- cout << "add(" << n1 << ", " << n2 << ")" << endl; -- return n1 + n2; -- } -- -- int32_t calculate(const int32_t logid, const Work& work) { -- cout << "calculate(" << logid << ", " << work << ")" << endl; -- int32_t val; -- -- switch (work.op) { -- case Operation::ADD: -- val = work.num1 + work.num2; -- break; -- case Operation::SUBTRACT: -- val = work.num1 - work.num2; -- break; -- case Operation::MULTIPLY: -- val = work.num1 * work.num2; -- break; -- case Operation::DIVIDE: -- if (work.num2 == 0) { -- InvalidOperation io; -- io.whatOp = work.op; -- io.why = "Cannot divide by 0"; -- throw io; -- } -- val = work.num1 / work.num2; -- break; -- default: -- InvalidOperation io; -- io.whatOp = work.op; -- io.why = "Invalid Operation"; -- throw io; -- } -- -- SharedStruct ss; -- ss.key = logid; -- ss.value = to_string(val); -- -- log[logid] = ss; -- -- return val; -- } -- -- void getStruct(SharedStruct& ret, const int32_t logid) { -- cout << "getStruct(" << logid << ")" << endl; -- ret = log[logid]; -- } -- -- void zip() { cout << "zip()" << endl; } -- --protected: -- map log; --}; -- --/* -- CalculatorIfFactory is code generated. -- CalculatorCloneFactory is useful for getting access to the server side of the -- transport. It is also useful for making per-connection state. Without this -- CloneFactory, all connections will end up sharing the same handler instance. --*/ --class CalculatorCloneFactory : virtual public CalculatorIfFactory { -- public: -- virtual ~CalculatorCloneFactory() {} -- virtual CalculatorIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) -- { -- boost::shared_ptr sock = boost::dynamic_pointer_cast(connInfo.transport); -- cout << "Incoming connection\n"; -- cout << "\tSocketInfo: " << sock->getSocketInfo() << "\n"; -- cout << "\tPeerHost: " << sock->getPeerHost() << "\n"; -- cout << "\tPeerAddress: " << sock->getPeerAddress() << "\n"; -- cout << "\tPeerPort: " << sock->getPeerPort() << "\n"; -- return new CalculatorHandler; -- } -- virtual void releaseHandler( ::shared::SharedServiceIf* handler) { -- delete handler; -- } --}; -- --int main() { -- TThreadedServer server( -- boost::make_shared(boost::make_shared()), -- boost::make_shared(9090), //port -- boost::make_shared(), -- boost::make_shared()); -- -- /* -- // if you don't need per-connection state, do the following instead -- TThreadedServer server( -- boost::make_shared(boost::make_shared()), -- boost::make_shared(9090), //port -- boost::make_shared(), -- boost::make_shared()); -- */ -- -- /** -- * Here are some alternate server types... -- -- // This server only allows one connection at a time, but spawns no threads -- TSimpleServer server( -- boost::make_shared(boost::make_shared()), -- boost::make_shared(9090), -- boost::make_shared(), -- boost::make_shared()); -- -- const int workerCount = 4; -- -- boost::shared_ptr threadManager = -- ThreadManager::newSimpleThreadManager(workerCount); -- threadManager->threadFactory( -- boost::make_shared()); -- threadManager->start(); -- -- // This server allows "workerCount" connection at a time, and reuses threads -- TThreadPoolServer server( -- boost::make_shared(boost::make_shared()), -- boost::make_shared(9090), -- boost::make_shared(), -- boost::make_shared(), -- threadManager); -- */ -- -- cout << "Starting the server..." << endl; -- server.serve(); -- cout << "Done." << endl; -- return 0; --} -diff --git a/tutorial/cpp/GriftClient.cpp b/tutorial/cpp/GriftClient.cpp -new file mode 100644 -index 0000000..647a683 ---- /dev/null -+++ b/tutorial/cpp/GriftClient.cpp -@@ -0,0 +1,93 @@ -+/* -+ * -+ * Copyright 2016, Google Inc. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are -+ * met: -+ * -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * * Redistributions in binary form must reproduce the above -+ * copyright notice, this list of conditions and the following disclaimer -+ * in the documentation and/or other materials provided with the -+ * distribution. -+ * * Neither the name of Google Inc. nor the names of its -+ * contributors may be used to endorse or promote products derived from -+ * this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ */ -+ -+#include -+#include -+#include -+ -+#include -+ -+#include "gen-cpp/Greeter.grpc.thrift.h" -+ -+using grpc::Channel; -+using grpc::ClientContext; -+using grpc::Status; -+using test::Greeter; -+ -+class GreeterClient { -+ public: -+ GreeterClient(std::shared_ptr channel) -+ : stub_(Greeter::NewStub(channel)) {} -+ -+ // Assembles the client's payload, sends it and presents the response back -+ // from the server. -+ std::string SayHello(const std::string& user) { -+ // Data we are sending to the server. -+ Greeter::SayHelloReq req; -+ req.request.name = user; -+ -+ // Container for the data we expect from the server. -+ Greeter::SayHelloResp reply; -+ -+ // Context for the client. It could be used to convey extra information to -+ // the server and/or tweak certain RPC behaviors. -+ ClientContext context; -+ -+ // The actual RPC. -+ Status status = stub_->SayHello(&context, req, &reply); -+ -+ // Act upon its status. -+ if (status.ok()) { -+ return reply.success.message; -+ } else { -+ return "RPC failed"; -+ } -+ } -+ -+ private: -+ std::unique_ptr stub_; -+}; -+ -+int main() { -+ // Instantiate the client. It requires a channel, out of which the actual RPCs -+ // are created. This channel models a connection to an endpoint (in this case, -+ // localhost at port 50051). We indicate that the channel isn't authenticated -+ // (use of InsecureChannelCredentials()). -+ GreeterClient greeter(grpc::CreateChannel( -+ "localhost:50051", grpc::InsecureChannelCredentials())); -+ std::string user("world"); -+ std::string reply = greeter.SayHello(user); -+ std::cout << "Greeter received: " << reply << std::endl; -+ -+ return 0; -+} -diff --git a/tutorial/cpp/GriftServer.cpp b/tutorial/cpp/GriftServer.cpp -new file mode 100644 -index 0000000..7c01606 ---- /dev/null -+++ b/tutorial/cpp/GriftServer.cpp -@@ -0,0 +1,93 @@ -+/* -+ * -+ * Copyright 2016, Google Inc. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are -+ * met: -+ * -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * * Redistributions in binary form must reproduce the above -+ * copyright notice, this list of conditions and the following disclaimer -+ * in the documentation and/or other materials provided with the -+ * distribution. -+ * * Neither the name of Google Inc. nor the names of its -+ * contributors may be used to endorse or promote products derived from -+ * this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ */ -+ -+#include -+#include -+#include -+ -+#include -+ -+#include "gen-cpp/Greeter.grpc.thrift.h" -+#include -+ -+using grpc::Server; -+using grpc::ServerBuilder; -+using grpc::ServerContext; -+using grpc::Status; -+using test::Greeter; -+ -+// Logic and data behind the server's behavior. -+class GreeterServiceImpl final : public Greeter::Service { -+ public: -+ ~GreeterServiceImpl() { -+ // shutdown server -+ server->Shutdown(); -+ } -+ -+ Status SayHello(ServerContext* context,const Greeter::SayHelloReq* request, -+ Greeter::SayHelloResp* reply) override { -+ std::string prefix("Hello "); -+ -+ reply->success.message = prefix + request->request.name; -+ -+ return Status::OK; -+ } -+ -+ void RunServer() { -+ std::string server_address("0.0.0.0:50051"); -+ -+ ServerBuilder builder; -+ // Listen on the given address without any authentication mechanism. -+ builder.AddListeningPort(server_address, grpc::InsecureServerCredentials()); -+ // Register "service" as the instance through which we'll communicate with -+ // clients. In this case it corresponds to an *synchronous* service. -+ builder.RegisterService(this); -+ // Finally assemble the server. -+ server = builder.BuildAndStart(); -+ std::cout << "Server listening on " << server_address << std::endl; -+ -+ // Wait for the server to shutdown. Note that some other thread must be -+ // responsible for shutting down the server for this call to ever return. -+ server->Wait(); -+ } -+ -+ private: -+ std::unique_ptr server; -+}; -+ -+int main() { -+ GreeterServiceImpl service; -+ service.RunServer(); -+ -+ return 0; -+} -diff --git a/tutorial/cpp/Makefile.am b/tutorial/cpp/Makefile.am -index 184a69d..6f91e28 100755 ---- a/tutorial/cpp/Makefile.am -+++ b/tutorial/cpp/Makefile.am -@@ -18,44 +18,38 @@ - # - AUTOMAKE_OPTIONS = subdir-objects serial-tests - --BUILT_SOURCES = gen-cpp/shared_types.cpp \ -- gen-cpp/tutorial_types.cpp -+BUILT_SOURCES = gen-cpp/test_types.cpp - --noinst_LTLIBRARIES = libtutorialgencpp.la --nodist_libtutorialgencpp_la_SOURCES = \ -- gen-cpp/Calculator.cpp \ -- gen-cpp/Calculator.h \ -- gen-cpp/SharedService.cpp \ -- gen-cpp/SharedService.h \ -- gen-cpp/shared_constants.cpp \ -- gen-cpp/shared_constants.h \ -- gen-cpp/shared_types.cpp \ -- gen-cpp/shared_types.h \ -- gen-cpp/tutorial_constants.cpp \ -- gen-cpp/tutorial_constants.h \ -- gen-cpp/tutorial_types.cpp \ -- gen-cpp/tutorial_types.h -+#noinst_LTLIBRARIES = libtutorialgencpp.la -+noinst_LTLIBRARIES = libtestgencpp.la -+nodist_libtestgencpp_la_SOURCES = \ -+ gen-cpp/Greeter.grpc.thrift.cpp \ -+ gen-cpp/Greeter.grpc.thrift.h \ -+ gen-cpp/test_constants.cpp \ -+ gen-cpp/test_constants.h \ -+ gen-cpp/test_types.cpp \ -+ gen-cpp/test_types.h - - - --libtutorialgencpp_la_LIBADD = $(top_builddir)/lib/cpp/libthrift.la -+libtestgencpp_la_LIBADD = $(top_builddir)/lib/cpp/libthrift.la - - noinst_PROGRAMS = \ -- TutorialServer \ -- TutorialClient -+ TestServer \ -+ TestClient - --TutorialServer_SOURCES = \ -- CppServer.cpp -+TestServer_SOURCES = \ -+ GriftServer.cpp - --TutorialServer_LDADD = \ -- libtutorialgencpp.la \ -+TestServer_LDADD = \ -+ libtestgencpp.la \ - $(top_builddir)/lib/cpp/libthrift.la - --TutorialClient_SOURCES = \ -- CppClient.cpp -+TestClient_SOURCES = \ -+ GriftClient.cpp - --TutorialClient_LDADD = \ -- libtutorialgencpp.la \ -+TestClient_LDADD = \ -+ libtestgencpp.la \ - $(top_builddir)/lib/cpp/libthrift.la - - # -@@ -63,26 +57,26 @@ TutorialClient_LDADD = \ - # - THRIFT = $(top_builddir)/compiler/cpp/thrift - --gen-cpp/Calculator.cpp gen-cpp/SharedService.cpp gen-cpp/shared_constants.cpp gen-cpp/shared_types.cpp gen-cpp/tutorial_constants.cpp gen-cpp/tutorial_types.cpp: $(top_srcdir)/tutorial/tutorial.thrift -+gen-cpp/Greeter.grpc.thrift.cpp gen-cpp/test_constants.cpp gen-cpp/test_types.cpp: $(top_srcdir)/tutorial/cpp/test.thrift - $(THRIFT) --gen cpp -r $< - - AM_CPPFLAGS = $(BOOST_CPPFLAGS) $(LIBEVENT_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src -Igen-cpp - AM_CXXFLAGS = -Wall -Wextra -pedantic --AM_LDFLAGS = $(BOOST_LDFLAGS) $(LIBEVENT_LDFLAGS) -+AM_LDFLAGS = $(BOOST_LDFLAGS) $(LIBEVENT_LDFLAGS) `pkg-config --libs grpc++ grpc` -lpthread -ldl -lgrpc - - clean-local: -- $(RM) gen-cpp/* -+ $(RM) -r gen-cpp - --tutorialserver: all -- ./TutorialServer -+testserver: all -+ ./TestServer - --tutorialclient: all -- ./TutorialClient -+testclient: all -+ ./TestClient - - style-local: - $(CPPSTYLE_CMD) - - EXTRA_DIST = \ - CMakeLists.txt \ -- CppClient.cpp \ -- CppServer.cpp -+ GriftClient.cpp \ -+ GriftServer.cpp -diff --git a/tutorial/cpp/test.thrift b/tutorial/cpp/test.thrift -new file mode 100644 -index 0000000..de3c9a4 ---- /dev/null -+++ b/tutorial/cpp/test.thrift -@@ -0,0 +1,13 @@ -+namespace cpp test -+ -+struct HelloRequest { -+ 1:string name -+} -+ -+struct HelloResponse { -+ 1:string message -+} -+ -+service Greeter { -+ HelloResponse SayHello(1:HelloRequest request); -+} -\ No newline at end of file --- -2.8.0.rc3.226.g39d4020 - - -From 3e4d75a2e2c474ee7700e7c9acaf89fdb768bedc Mon Sep 17 00:00:00 2001 -From: chedeti -Date: Sun, 31 Jul 2016 16:23:53 -0700 -Subject: [PATCH 3/3] grpc java plugins generator - -for examples refer to https://github.com/grpc/grpc-java/tree/master/examples/thrift ---- - compiler/cpp/src/generate/t_java_generator.cc | 906 +++++++++++++++++++++++++- - tutorial/Makefile.am | 8 +- - 2 files changed, 887 insertions(+), 27 deletions(-) - -diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc -index 2db8cb8..8b28fe2 100644 ---- a/compiler/cpp/src/generate/t_java_generator.cc -+++ b/compiler/cpp/src/generate/t_java_generator.cc -@@ -97,10 +97,10 @@ public: - } else if(iter->second.compare("suppress") == 0) { - suppress_generated_annotations_ = true; - } else { -- throw "unknown option java:" + iter->first + "=" + iter->second; -+ throw "unknown option java:" + iter->first + "=" + iter->second; - } - } else { -- throw "unknown option java:" + iter->first; -+ throw "unknown option java:" + iter->first; - } - } - -@@ -195,6 +195,17 @@ public: - void generate_service_async_server(t_service* tservice); - void generate_process_function(t_service* tservice, t_function* tfunction); - void generate_process_async_function(t_service* tservice, t_function* tfunction); -+ void generate_service_impl_base(t_service* tservice); -+ void generate_method_descriptors(t_service* tservice); -+ void generate_stub(t_service* tservice); -+ void generate_blocking_stub(t_service* tservice); -+ void generate_future_stub(t_service* tservice); -+ void generate_method_ids(t_service* tservice); -+ void generate_method_handlers(t_service* tservice); -+ void generate_service_descriptors(t_service* tservice); -+ void generate_service_builder(t_service* tservice); -+ void generate_arg_ids(t_service* tservice); -+ void generate_message_factory(t_service* tservice); - - void generate_java_union(t_struct* tstruct); - void generate_union_constructor(ofstream& out, t_struct* tstruct); -@@ -307,6 +318,8 @@ public: - std::string java_package(); - std::string java_type_imports(); - std::string java_suppressions(); -+ std::string grpc_imports(); -+ std::string import_extended_service(t_service* tservice); - std::string type_name(t_type* ttype, - bool in_container = false, - bool in_init = false, -@@ -368,7 +381,7 @@ private: - bool use_option_type_; - bool undated_generated_annotations_; - bool suppress_generated_annotations_; -- -+ - }; - - /** -@@ -456,6 +469,35 @@ string t_java_generator::java_suppressions() { - return "@SuppressWarnings({\"cast\", \"rawtypes\", \"serial\", \"unchecked\", \"unused\"})\n"; - } - -+string t_java_generator::grpc_imports() { -+ return -+ string() + -+ "import static io.grpc.stub.ClientCalls.asyncUnaryCall;\n" + -+ "import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;\n" + -+ "import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;\n" + -+ "import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;\n" + -+ "import static io.grpc.stub.ClientCalls.blockingUnaryCall;\n" + -+ "import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;\n" + -+ "import static io.grpc.stub.ClientCalls.futureUnaryCall;\n" + -+ "import static io.grpc.MethodDescriptor.generateFullMethodName;\n" + -+ "import static io.grpc.stub.ServerCalls.asyncUnaryCall;\n" + -+ "import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;\n" + -+ "import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;\n" + -+ "import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;\n" + -+ "import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;\n" + -+ "import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;\n" + -+ "import io.grpc.thrift.ThriftUtils;\n\n"; -+} -+ -+string t_java_generator::import_extended_service(t_service* tservice) { -+ if (!tservice) { -+ return string() + "\n"; -+ } -+ string ns = tservice->get_program()->get_namespace("java"); -+ string extend_service_name = tservice->get_name() + "Grpc"; -+ return string() + "import " + ns + "." + extend_service_name + ";\n\n"; -+} -+ - /** - * Nothing in Java - */ -@@ -2772,25 +2814,51 @@ void t_java_generator::generate_field_value_meta_data(std::ofstream& out, t_type - */ - void t_java_generator::generate_service(t_service* tservice) { - // Make output file -- string f_service_name = package_dir_ + "/" + make_valid_java_filename(service_name_) + ".java"; -+ string f_service_name = package_dir_ + "/" + make_valid_java_filename(service_name_) + "Grpc.java"; - f_service_.open(f_service_name.c_str()); - -- f_service_ << autogen_comment() << java_package() << java_type_imports() << java_suppressions(); -+ f_service_ << -+ autogen_comment() << -+ java_package() << -+ java_type_imports() << -+ grpc_imports() << -+ import_extended_service(tservice->get_extends()); -+ java_suppressions(); -+ -+ f_service_ << -+ "public class " << service_name_ << "Grpc {" << endl << -+ endl; - -- if (!suppress_generated_annotations_) { -- generate_javax_generated_annotation(f_service_); -- } -- f_service_ << "public class " << service_name_ << " {" << endl << endl; - indent_up(); - -+ // generate constructor -+ f_service_ << -+ indent() << "private " << service_name_ << -+ "Grpc() {}" << endl << endl; -+ -+ f_service_ << -+ indent() << "public static final String SERVICE_NAME = " << -+ "\"" << package_name_ << "." << service_name_ << "\";" << endl << endl; -+ - // Generate the three main parts of the service - generate_service_interface(tservice); -- generate_service_async_interface(tservice); -- generate_service_client(tservice); -- generate_service_async_client(tservice); -- generate_service_server(tservice); -- generate_service_async_server(tservice); -+ generate_arg_ids(tservice); -+ generate_message_factory(tservice); -+ generate_service_impl_base(tservice); -+ //generate_service_async_interface(tservice); -+ //generate_service_client(tservice); -+ //generate_service_async_client(tservice); -+ //generate_service_server(tservice); -+ //generate_service_async_server(tservice); - generate_service_helpers(tservice); -+ generate_method_descriptors(tservice); -+ generate_stub(tservice); -+ generate_blocking_stub(tservice); -+ generate_future_stub(tservice); -+ generate_method_ids(tservice); -+ generate_method_handlers(tservice); -+ generate_service_descriptors(tservice); -+ generate_service_builder(tservice); - - indent_down(); - f_service_ << "}" << endl; -@@ -2805,24 +2873,820 @@ void t_java_generator::generate_service(t_service* tservice) { - void t_java_generator::generate_service_interface(t_service* tservice) { - string extends = ""; - string extends_iface = ""; -- if (tservice->get_extends() != NULL) { -- extends = type_name(tservice->get_extends()); -- extends_iface = " extends " + extends + ".Iface"; -- } - - generate_java_doc(f_service_, tservice); -- f_service_ << indent() << "public interface Iface" << extends_iface << " {" << endl << endl; -+ f_service_ << indent() << -+ "@java.lang.Deprecated public static interface " << service_name_; -+ -+ if (tservice->get_extends()) { -+ f_service_ << " extends " << tservice->get_extends()->get_name() + "Grpc." << -+ tservice->get_extends()->get_name() << endl; -+ } -+ f_service_ << " {" << endl; -+ -+ indent_up(); -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ //generate_java_doc(f_service_, *f_iter); -+ f_service_ << -+ indent() << "public void " << (*f_iter)->get_name() << "(" << (*f_iter)->get_name() << -+ "_args request," << endl << -+ indent() << " io.grpc.stub.StreamObserver<" << (*f_iter)->get_name() << -+ "_result> responseObserver);" << endl << endl; -+ } -+ indent_down(); -+ f_service_ << indent() << "}" << endl << endl; -+} -+ -+void t_java_generator::generate_arg_ids(t_service* tservice) { -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ int i=0; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << indent() << -+ "private static final int ARG_IN_METHOD_" << -+ (*f_iter)->get_name() << " = " << ++i << ";" << endl; -+ f_service_ << indent() << -+ "private static final int ARG_OUT_METHOD_" << -+ (*f_iter)->get_name() << " = " << ++i << ";" << endl; -+ } -+ f_service_ << endl; -+ -+ if (tservice->get_extends()) { -+ f_service_ << indent() << "// ARG IDs for extended service" << endl; -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << indent() << -+ "private static final int ARG_IN_METHOD_" << -+ (*f_iter)->get_name() << " = " << ++i << ";" << endl; -+ f_service_ << indent() << -+ "private static final int ARG_OUT_METHOD_" << -+ (*f_iter)->get_name() << " = " << ++i << ";" << endl; -+ } -+ f_service_ << endl; -+ } -+} -+ -+void t_java_generator::generate_message_factory(t_service* tservice) { -+ f_service_ << indent() << -+ "private static final class ThriftMessageFactory>" << endl << indent() << -+ " implements io.grpc.thrift.MessageFactory {" << endl; -+ indent_up(); -+ f_service_ << indent() << -+ "private final int id;" << endl << endl; -+ f_service_ << endl; -+ -+ f_service_ << indent() << -+ "ThriftMessageFactory(int id) {" << endl << -+ indent() << " this.id = id;" << endl << -+ indent() << "}" << endl; -+ -+ f_service_ << indent() << -+ "@java.lang.Override" << endl << -+ indent() << "public T newInstance() {" << endl; -+ indent_up(); -+ -+ f_service_ << indent() << -+ "Object o;" << endl << -+ indent() << "switch (id) {" << endl; -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << indent() << -+ "case ARG_IN_METHOD_" << (*f_iter)->get_name() << ":" << endl << -+ indent() << " o = new " << (*f_iter)->get_name() << "_args();" << -+ endl << indent() << " break;" << endl; -+ f_service_ << indent() << -+ "case ARG_OUT_METHOD_" << (*f_iter)->get_name() << ":" << endl << -+ indent() << " o = new " << (*f_iter)->get_name() << "_result();" << -+ endl << indent() << " break;" << endl; -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for (f_iter = functions.begin(); f_iter!= functions.end(); ++f_iter) { -+ f_service_ << indent() << -+ "case ARG_IN_METHOD_" << (*f_iter)->get_name() << ":" << endl << -+ indent() << " o = new " << extend_service_name << "." << (*f_iter)->get_name() << "_args();" << -+ endl << indent() << " break;" << endl; -+ f_service_ << indent() << -+ "case ARG_OUT_METHOD_" << (*f_iter)->get_name() << ":" << endl << -+ indent() << " o = new " << extend_service_name << "." << (*f_iter)->get_name() << "_result();" << -+ endl << indent() << " break;" << endl; -+ } -+ } -+ -+ f_service_ << indent() << -+ "default:" << endl << indent() << -+ " throw new AssertionError();" << endl << indent() << -+ "}" << endl; -+ -+ f_service_ << indent() << -+ "@java.lang.SuppressWarnings(\"unchecked\")" << endl << -+ indent() << "T t = (T) o;" << endl << indent() << -+ "return t;" << endl; -+ -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl; -+ -+ indent_down(); -+ f_service_ << indent() << "}" << endl; -+} -+ -+void t_java_generator::generate_service_impl_base(t_service* tservice) { -+ f_service_ << -+ indent() << "public static abstract class " << service_name_ << -+ "ImplBase implements " << service_name_ << ", io.grpc.BindableService {" << endl; -+ indent_up(); -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public void " << (*f_iter)->get_name() << "(" << (*f_iter)->get_name() << -+ "_args request, " << endl << -+ indent() << " io.grpc.stub.StreamObserver<" << (*f_iter)->get_name() << -+ "_result> responseObserver) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "asyncUnimplementedUnaryCall(METHOD_" << (*f_iter)->get_name() << -+ ", responseObserver);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc" ; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public void " << (*f_iter)->get_name() << "(" << -+ extend_service_name << "." << (*f_iter)->get_name() << -+ "_args request, " << endl << -+ indent() << " io.grpc.stub.StreamObserver<" << extend_service_name -+ << "." << (*f_iter)->get_name() << "_result> responseObserver) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "asyncUnimplementedUnaryCall(METHOD_" << (*f_iter)->get_name() << -+ ", responseObserver);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ } -+ -+ f_service_ << -+ indent() << "@java.lang.Override" << -+ " public io.grpc.ServerServiceDefinition bindService() {" << endl; - indent_up(); -+ f_service_ << -+ indent() << "return " << service_name_ << "Grpc.bindService(this);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // generate Abstract Service -+ f_service_ << -+ indent() << "@java.lang.Deprecated public static abstract class Abstract" << service_name_ << -+ " extends " << service_name_ << "ImplBase {}" << endl << endl; -+} -+ -+void t_java_generator::generate_method_descriptors(t_service* tservice) { -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for( f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "public static final io.grpc.MethodDescriptor<" << -+ (*f_iter)->get_name() << "_args," << endl << -+ indent() << " " << (*f_iter)->get_name() << "_result> METHOD_" << (*f_iter)->get_name() << -+ " = " << endl << indent() << " io.grpc.MethodDescriptor.create(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " io.grpc.MethodDescriptor.MethodType.UNARY," << endl << -+ indent() << " generateFullMethodName(" << "\"" << package_name_ << "." << -+ service_name_ << "\" , \"" << (*f_iter)->get_name() << "\")," << endl << -+ indent() << " io.grpc.thrift.ThriftUtils.marshaller(" << endl << -+ indent() << " new ThriftMessageFactory<" << (*f_iter)->get_name() << -+ "_args>( ARG_IN_METHOD_" << (*f_iter)->get_name() << "))," << endl << -+ indent() << " io.grpc.thrift.ThriftUtils.marshaller(" << endl << -+ indent() << " new ThriftMessageFactory<" << (*f_iter)->get_name() << -+ "_result>( ARG_OUT_METHOD_" << (*f_iter)->get_name() << ")));" << endl << endl; -+ indent_down(); -+ } -+ -+ if(tservice->get_extends()) { -+ t_service* extends_service = tservice->get_extends(); -+ functions = extends_service->get_functions(); -+ string extend_service_name = extends_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "public static final io.grpc.MethodDescriptor<" << extend_service_name << "." << -+ (*f_iter)->get_name() << "_args," << endl << -+ indent() << " " << extend_service_name << "." << (*f_iter)->get_name() << "_result> METHOD_" -+ << (*f_iter)->get_name() << " = " << endl << indent() << -+ " io.grpc.MethodDescriptor.create(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " io.grpc.MethodDescriptor.MethodType.UNARY," << endl << -+ indent() << " generateFullMethodName(" << "\"" << package_name_ << "." << -+ service_name_ << "\" , \"" << (*f_iter)->get_name() << "\")," << endl << -+ indent() << " io.grpc.thrift.ThriftUtils.marshaller(" << endl << -+ indent() << " new ThriftMessageFactory<" << extend_service_name << "." << -+ (*f_iter)->get_name() << "_args>( ARG_IN_METHOD_" << (*f_iter)->get_name() << "))," << endl << -+ indent() << " io.grpc.thrift.ThriftUtils.marshaller(" << endl << -+ indent() << " new ThriftMessageFactory<" << extend_service_name << "." << (*f_iter)->get_name() << -+ "_result>( ARG_OUT_METHOD_" << (*f_iter)->get_name() << ")));" << endl << endl; -+ indent_down(); -+ } -+ } -+} -+ -+void t_java_generator::generate_stub(t_service* tservice) { -+ f_service_ << -+ indent() << -+ "public static " << service_name_ << -+ "Stub newStub(io.grpc.Channel channel) {" << -+ endl; -+ -+ indent_up(); -+ f_service_ << -+ indent() << -+ "return new " << service_name_ << "Stub(channel);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // generate Stub impl -+ -+ f_service_ << -+ indent() << "public static class " << -+ service_name_ << "Stub extends io.grpc.stub.AbstractStub<" << -+ service_name_ << "Stub>" << endl << -+ indent() << " implements " << service_name_ << "{" << endl; -+ indent_up(); -+ -+ f_service_ << -+ indent() << "private " << service_name_ << "Stub(io.grpc.Channel channel) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "super(channel);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ f_service_ << -+ indent() << "private " << service_name_ << "Stub(io.grpc.Channel channel, " << endl << -+ indent() << " io.grpc.CallOptions callOptions) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "super(channel, callOptions);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "protected " << service_name_ << "Stub build(io.grpc.Channel channel, " << -+ endl << indent() << " io.grpc.CallOptions callOptions) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return new " << service_name_ << "Stub(channel, callOptions);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public void " << (*f_iter)->get_name() << "(" << -+ (*f_iter)->get_name() << "_args request," << endl << indent() << -+ " io.grpc.stub.StreamObserver<" << (*f_iter)->get_name() << -+ "_result> responseObserver) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "asyncUnaryCall(" << endl << -+ indent() << " getChannel().newCall(METHOD_" << (*f_iter)->get_name() << -+ ", getCallOptions()), request, responseObserver);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public void " << (*f_iter)->get_name() << "(" << -+ extend_service_name << "." << (*f_iter)->get_name() << "_args request," -+ << endl << indent() << " io.grpc.stub.StreamObserver<" << -+ extend_service_name << "." << (*f_iter)->get_name() << -+ "_result> responseObserver) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "asyncUnaryCall(" << endl << -+ indent() << " getChannel().newCall(METHOD_" << (*f_iter)->get_name() << -+ ", getCallOptions()), request, responseObserver);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ } -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+} -+ -+void t_java_generator::generate_blocking_stub(t_service* tservice) { -+ f_service_ << -+ indent() << "public static " << service_name_ << -+ "BlockingStub newBlockingStub(" << endl << -+ indent() << " io.grpc.Channel channel) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return new " << service_name_ << "BlockingStub(channel);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // generate Blocking Client -+ f_service_ << -+ indent() << "@java.lang.Deprecated public static interface " << service_name_ << -+ "BlockingClient " ; -+ -+ if (tservice->get_extends()) { -+ string extend_service_name = tservice->get_extends()->get_name(); -+ f_service_ << endl << indent() << " extends " << extend_service_name << "Grpc." << -+ extend_service_name << "BlockingClient " ; -+ } -+ -+ f_service_ << "{" << endl; -+ -+ indent_up(); -+ - vector functions = tservice->get_functions(); - vector::iterator f_iter; - for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -- generate_java_doc(f_service_, *f_iter); -- indent(f_service_) << "public " << function_signature(*f_iter) << ";" << endl << endl; -+ f_service_ << -+ indent() << "public " << (*f_iter)->get_name() << "_result " << -+ (*f_iter)->get_name() << "(" << (*f_iter)->get_name() << "_args request);" << endl << endl; -+ } -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // generate Blocking Stub impl -+ -+ f_service_ << -+ indent() << "public static class " << -+ service_name_ << "BlockingStub extends io.grpc.stub.AbstractStub<" << -+ service_name_ << "BlockingStub>" << endl << -+ indent() << " implements " << service_name_ << "BlockingClient {"; -+ -+ indent_up(); -+ -+ f_service_ << -+ indent() << "private " << service_name_ << "BlockingStub(io.grpc.Channel channel) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "super(channel);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ f_service_ << -+ indent() << "private " << service_name_ << "BlockingStub(io.grpc.Channel channel, " << endl << -+ indent() << " io.grpc.CallOptions callOptions) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "super(channel, callOptions);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "protected " << service_name_ << "BlockingStub build(io.grpc.Channel channel, " << -+ endl << indent() << " io.grpc.CallOptions callOptions) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return new " << service_name_ << "BlockingStub(channel, callOptions);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public " << (*f_iter)->get_name() << "_result " << (*f_iter)->get_name() << "(" << -+ (*f_iter)->get_name() << "_args request) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return blockingUnaryCall(" << endl << -+ indent() << " getChannel(), METHOD_" << (*f_iter)->get_name() << -+ ", getCallOptions(), request);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public " << extend_service_name << "." << (*f_iter)->get_name() << -+ "_result " << (*f_iter)->get_name() << "(" << extend_service_name << "." << -+ (*f_iter)->get_name() << "_args request) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return blockingUnaryCall(" << endl << -+ indent() << " getChannel(), METHOD_" << (*f_iter)->get_name() << -+ ", getCallOptions(), request);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ } -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+} -+ -+void t_java_generator::generate_future_stub(t_service* tservice) { -+ f_service_ << -+ indent() << "public static " << service_name_ << -+ "FutureStub newFutureStub(" << endl << -+ indent() << " io.grpc.Channel channel) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return new " << service_name_ << "FutureStub(channel);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // generate Future Client -+ f_service_ << -+ indent() << "@java.lang.Deprecated public static interface " << service_name_ << -+ "FutureClient " ; -+ -+ if (tservice->get_extends()) { -+ string extend_service_name = tservice->get_extends()->get_name(); -+ f_service_ << endl << indent() << " extends " << extend_service_name << "Grpc." << -+ extend_service_name << "FutureClient " ; -+ } -+ f_service_ << "{" << endl; -+ -+ indent_up(); -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "public com.google.common.util.concurrent.ListenableFuture<" << -+ (*f_iter)->get_name() << "_result> " << (*f_iter)->get_name() << "(" << endl << -+ indent() << " " << (*f_iter)->get_name() << "_args request);" << endl << endl; -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "public com.google.common.util.concurrent.ListenableFuture<" << -+ extend_service_name << "." << (*f_iter)->get_name() << "_result> " << -+ (*f_iter)->get_name() << "(" << endl << -+ indent() << " " << extend_service_name << "." << (*f_iter)->get_name() << -+ "_args request);" << endl << endl; -+ } -+ } -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // generate Stub impl -+ -+ f_service_ << -+ indent() << "public static class " << -+ service_name_ << "FutureStub extends io.grpc.stub.AbstractStub<" << -+ service_name_ << "FutureStub>" << endl << -+ indent() << " implements " << service_name_ << "FutureClient {" << endl; -+ indent_up(); -+ -+ f_service_ << -+ indent() << "private " << service_name_ << "FutureStub(io.grpc.Channel channel) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "super(channel);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ f_service_ << -+ indent() << "private " << service_name_ << "FutureStub(io.grpc.Channel channel, " << endl << -+ indent() << " io.grpc.CallOptions callOptions) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "super(channel, callOptions);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "protected " << service_name_ << "FutureStub build(io.grpc.Channel channel, " << -+ endl << indent() << " io.grpc.CallOptions callOptions) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return new " << service_name_ << "FutureStub(channel, callOptions);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ functions = tservice->get_functions(); -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public com.google.common.util.concurrent.ListenableFuture<" << -+ (*f_iter)->get_name() << "_result> " << (*f_iter)->get_name() << "(" << -+ endl << indent() << " " << (*f_iter)->get_name() << "_args request) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return futureUnaryCall(" << endl << -+ indent() << " getChannel().newCall(METHOD_" << (*f_iter)->get_name() << -+ ", getCallOptions()), request);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "public com.google.common.util.concurrent.ListenableFuture<" << -+ extend_service_name << "." << (*f_iter)->get_name() << "_result> " << -+ (*f_iter)->get_name() << "(" << endl << indent() << " " << -+ extend_service_name << "." << (*f_iter)->get_name() << "_args request) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return futureUnaryCall(" << endl << -+ indent() << " getChannel().newCall(METHOD_" << (*f_iter)->get_name() << -+ ", getCallOptions()), request);" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ } -+ } -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+} -+ -+void t_java_generator::generate_method_ids(t_service* tservice) { -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ int i=0; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter, ++i) { -+ f_service_ << -+ indent() << "private static final int METHODID_" << -+ (*f_iter)->get_name() << " = " << i << ";" << endl; -+ } -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter, ++i) { -+ f_service_ << -+ indent() << "private static final int METHODID_" << -+ (*f_iter)->get_name() << " = " << i << ";" << endl; -+ } -+ } -+ f_service_ << endl; -+} -+ -+void t_java_generator::generate_method_handlers(t_service* tservice) { -+ f_service_ << -+ indent() << "private static class MethodHandlers implements" << -+ endl << indent() << " io.grpc.stub.ServerCalls.UnaryMethod," << -+ endl << indent() << " io.grpc.stub.ServerCalls.ServerStreamingMethod," << -+ endl << indent() << " io.grpc.stub.ServerCalls.ClientStreamingMethod," << -+ endl << indent() << " io.grpc.stub.ServerCalls.BidiStreamingMethod {" << -+ endl; -+ indent_up(); -+ f_service_ << -+ indent() << "private final " << service_name_ << " serviceImpl;" << endl << -+ indent() << "private final int methodId;" << endl << endl; -+ -+ f_service_ << -+ indent() << "public MethodHandlers(" << service_name_ << " serviceImpl, int " << -+ "methodId) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "this.serviceImpl = serviceImpl;" << endl << -+ indent() << "this.methodId = methodId;" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // invoke -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "@java.lang.SuppressWarnings(\"unchecked\")" << endl << -+ indent() << "public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) {" << -+ endl; -+ indent_up(); -+ f_service_ << -+ indent() << "switch (methodId) {" << endl; -+ indent_up(); -+ -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "case METHODID_" << (*f_iter)->get_name() << ":" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "serviceImpl." << (*f_iter)->get_name() << "((" << (*f_iter)->get_name() << -+ "_args) request," << endl << -+ indent() << " (io.grpc.stub.StreamObserver<" << (*f_iter)->get_name() << "_result>)" << -+ " responseObserver);" << endl << -+ indent() << "break;" << endl << endl; -+ indent_down(); -+ } -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "case METHODID_" << (*f_iter)->get_name() << ":" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "serviceImpl." << (*f_iter)->get_name() << "((" << extend_service_name << -+ "." << (*f_iter)->get_name() << "_args) request," << endl << -+ indent() << " (io.grpc.stub.StreamObserver<" << extend_service_name << "." << -+ (*f_iter)->get_name() << "_result>)" << " responseObserver);" << endl << -+ indent() << "break;" << endl << endl; -+ indent_down(); -+ } - } -+ f_service_ << -+ indent() << "default:" << endl << -+ indent() << " throw new AssertionError();" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl; -+ indent_down(); -+ f_service_ << -+ indent() << "}" << endl << endl; -+ -+ // invoke -+ f_service_ << -+ indent() << "@java.lang.Override" << endl << -+ indent() << "@java.lang.SuppressWarnings(\"unchecked\")" << endl << -+ indent() << "public io.grpc.stub.StreamObserver invoke(" << endl << -+ indent() << " io.grpc.stub.StreamObserver responseObserver) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "switch (methodId) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "default:" << endl; -+ f_service_ << -+ indent() << " throw new AssertionError();" << endl; -+ indent_down(); -+ f_service_ << indent() << "}" << endl; - indent_down(); - f_service_ << indent() << "}" << endl << endl; -+ indent_down(); -+ f_service_ << indent() << "}" << endl << endl; -+ - } - -+void t_java_generator::generate_service_descriptors(t_service* tservice) { -+ // generate service descriptor -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ f_service_ << -+ indent() << "public static io.grpc.ServiceDescriptor getServiceDescriptor() {" << -+ endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return new io.grpc.ServiceDescriptor(SERVICE_NAME"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "," << endl << -+ indent() << " METHOD_" << (*f_iter)->get_name(); -+ } -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << "," << endl << -+ indent() << " METHOD_" << (*f_iter)->get_name(); -+ } -+ } -+ f_service_ << ");" << endl; -+ indent_down(); -+ f_service_ << indent() << "}" << endl << endl; -+} -+ -+void t_java_generator::generate_service_builder(t_service* tservice) { -+ // bind Service -+ vector functions = tservice->get_functions(); -+ vector::iterator f_iter; -+ f_service_ << -+ indent() << "@java.lang.Deprecated public static io.grpc.ServerServiceDefinition" << -+ " bindService(" << endl << -+ indent() << " final " << service_name_ << " serviceImpl) {" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << "return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())" << -+ endl; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << " .addMethod(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " METHOD_" << (*f_iter)->get_name() << "," << endl << -+ indent() << " asyncUnaryCall(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " new MethodHandlers<" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " " << (*f_iter)->get_name() << "_args," << endl << -+ indent() << " " << (*f_iter)->get_name() << "_result>(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " serviceImpl, METHODID_" << (*f_iter)->get_name() << ")))" << endl; -+ indent_down(); -+ indent_down(); -+ indent_down(); -+ indent_down(); -+ } -+ -+ if (tservice->get_extends()) { -+ t_service* extend_service = tservice->get_extends(); -+ functions = extend_service->get_functions(); -+ string extend_service_name = extend_service->get_name() + "Grpc"; -+ for(f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { -+ f_service_ << -+ indent() << " .addMethod(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " METHOD_" << (*f_iter)->get_name() << "," << endl << -+ indent() << " asyncUnaryCall(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " new MethodHandlers<" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " " << extend_service_name << "." << (*f_iter)->get_name() << "_args," << endl << -+ indent() << " " << extend_service_name << "." << (*f_iter)->get_name() << "_result>(" << endl; -+ indent_up(); -+ f_service_ << -+ indent() << " serviceImpl, METHODID_" << (*f_iter)->get_name() << ")))" << endl; -+ indent_down(); -+ indent_down(); -+ indent_down(); -+ indent_down(); -+ } -+ } -+ f_service_ << -+ indent() << " .build();" << endl; -+ indent_down(); -+ f_service_ << indent() << "}" << endl << endl; -+} -+ -+ - void t_java_generator::generate_service_async_interface(t_service* tservice) { - string extends = ""; - string extends_iface = ""; -diff --git a/tutorial/Makefile.am b/tutorial/Makefile.am -index 5865c54..1cffbe6 100755 ---- a/tutorial/Makefile.am -+++ b/tutorial/Makefile.am -@@ -35,11 +35,6 @@ if WITH_D - SUBDIRS += d - endif - --if WITH_JAVA --SUBDIRS += java --SUBDIRS += js --endif -- - if WITH_PYTHON - SUBDIRS += py - SUBDIRS += py.twisted -@@ -95,4 +90,5 @@ EXTRA_DIST = \ - php \ - shared.thrift \ - tutorial.thrift \ -- README.md -+ README.md \ -+ java --- -2.8.0.rc3.226.g39d4020 - diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index 3851e565a4d..22e80d2afa1 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -15,53 +15,37 @@ # Source this rc script to prepare the environment for macos builds -# TODO(jtattermusch): remove all deps once installed on MacOS workers +ulimit -n 1000 -# brew and C++ deps -yes | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -brew install autoconf automake libtool ccache cmake gflags gpg wget +# show current limits +ulimit -a -# TODO(jtattermusch): hkp://keys.gnupg.net fails with "No route to host" -gpg --keyserver hkp://193.164.133.100 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 -curl -sSL https://get.rvm.io | sudo bash -s stable -# add ourselves to rvm group to prevent later "access denied" errors. -sudo dseditgroup -o edit -a `whoami` -t user rvm - -set +ex -source /etc/profile.d/rvm.sh -rvm install ruby-2.3 -gem install bundler +# required to build protobuf +brew install gflags +set +ex # rvm script is very verbose and exits with errorcode +source $HOME/.rvm/scripts/rvm +set -e # rvm commands are very verbose +rvm install ruby-2.4 rvm osx-ssl-certs status all rvm osx-ssl-certs update all set -ex +gem install bundler + # cocoapods -gem install cocoapods --version 1.0.0 +export LANG=en_US.UTF-8 +gem install cocoapods +pod repo update # needed by python # python -wget -q https://bootstrap.pypa.io/get-pip.py -sudo python get-pip.py +brew install coreutils # we need grealpath sudo pip install virtualenv +sudo pip install -U six tox setuptools -# TODO(jtattermusch): install python3 - -# mono -wget -q https://download.mono-project.com/archive/5.0.1/macos-10-universal/MonoFramework-MDK-5.0.1.1.macos10.xamarin.universal.pkg -sudo installer -pkg MonoFramework-MDK-5.0.1.1.macos10.xamarin.universal.pkg -target / -ln -s /Library/Frameworks/Mono.framework/Versions/Current/bin/mono /usr/local/bin/mono - -# dotnet SDK -brew install openssl -wget -q https://go.microsoft.com/fwlink/?linkid=843444 -O dotnet-dev-osx-x64.1.0.1.pkg -sudo installer -pkg dotnet-dev-osx-x64.1.0.1.pkg -target / -ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/dotnet -dotnet --version # bootstrap dotnet SDK - -# nvm -wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash - -# TODO(jtattermusch): install node if needed +# python 3.4 +wget -q https://www.python.org/ftp/python/3.4.4/python-3.4.4-macosx10.6.pkg +sudo installer -pkg python-3.4.4-macosx10.6.pkg -target / git submodule update --init diff --git a/tools/internal_ci/macos/grpc_build_artifacts.sh b/tools/internal_ci/macos/grpc_build_artifacts.sh index aad99b068d7..603c15f210f 100755 --- a/tools/internal_ci/macos/grpc_build_artifacts.sh +++ b/tools/internal_ci/macos/grpc_build_artifacts.sh @@ -18,6 +18,31 @@ set -ex # change to grpc repo root cd $(dirname $0)/../../.. -git submodule update --init +source tools/internal_ci/helper_scripts/prepare_build_macos_rc + +# python 3.5 +wget -q https://www.python.org/ftp/python/3.5.2/python-3.5.2-macosx10.6.pkg +sudo installer -pkg python-3.5.2-macosx10.6.pkg -target / + +# install cython for all python versions +python2.7 -m pip install cython setuptools wheel +python3.4 -m pip install cython setuptools wheel +python3.5 -m pip install cython setuptools wheel +python3.6 -m pip install cython setuptools wheel + +# node-gyp (needed for node artifacts) +npm install -g node-gyp + +# php dependencies: pecl +curl -O http://pear.php.net/go-pear.phar +sudo php -d detect_unicode=0 go-pear.phar + +# needed to build ruby artifacts +gem install rake-compiler +wget https://raw.githubusercontent.com/grpc/grpc/master/tools/distrib/build_ruby_environment_macos.sh +bash build_ruby_environment_macos.sh + +gem install rubygems-update +update_rubygems tools/run_tests/task_runner.py -f artifact macos diff --git a/tools/internal_ci/macos/grpc_master.sh b/tools/internal_ci/macos/grpc_master.sh index 786859be3fe..c64666b2dec 100755 --- a/tools/internal_ci/macos/grpc_master.sh +++ b/tools/internal_ci/macos/grpc_master.sh @@ -20,7 +20,7 @@ cd $(dirname $0)/../../.. source tools/internal_ci/helper_scripts/prepare_build_macos_rc -tools/run_tests/run_tests_matrix.py -f basictests macos --internal_ci || FAILED="true" +tools/run_tests/run_tests_matrix.py -f basictests macos --internal_ci -j 2 --inner_jobs 4 || FAILED="true" # kill port_server.py to prevent the build from hanging ps aux | grep port_server\\.py | awk '{print $2}' | xargs kill -9 diff --git a/tools/jenkins/run_qps_diff.sh b/tools/jenkins/run_qps_diff.sh new file mode 100755 index 00000000000..9529b0126fc --- /dev/null +++ b/tools/jenkins/run_qps_diff.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Copyright 2015 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This script is invoked by Jenkins and runs a diff on the qps drivers +set -ex + +# Enter the gRPC repo root +cd $(dirname $0)/../.. + +tools/run_tests/start_port_server.py +tools/profiling/qps/qps_diff.py -d origin/$ghprbTargetBranch diff --git a/tools/jenkins/run_trickle_diff.sh b/tools/jenkins/run_trickle_diff.sh index da905d02490..47dd8b44d64 100755 --- a/tools/jenkins/run_trickle_diff.sh +++ b/tools/jenkins/run_trickle_diff.sh @@ -20,4 +20,4 @@ set -ex cd $(dirname $0)/../.. tools/run_tests/start_port_server.py -tools/profiling/microbenchmarks/bm_diff/bm_main.py -d origin/$ghprbTargetBranch -b bm_fullstack_trickle -l 4 -t cli_transport_stalls cli_stream_stalls svr_transport_stalls svr_stream_stalls --no-counters --pr_comment_name trickle +tools/profiling/microbenchmarks/bm_diff/bm_main.py -d origin/$ghprbTargetBranch -b bm_fullstack_trickle -l 4 -t cli_transport_stalls_per_iteration cli_stream_stalls_per_iteration svr_transport_stalls_per_iteration svr_stream_stalls_per_iteration --no-counters --pr_comment_name trickle diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_constants.py b/tools/profiling/microbenchmarks/bm_diff/bm_constants.py index 4cd65867c37..ad79a0a1972 100644 --- a/tools/profiling/microbenchmarks/bm_diff/bm_constants.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_constants.py @@ -26,5 +26,6 @@ _AVAILABLE_BENCHMARK_TESTS = [ _INTERESTING = ('cpu_time', 'real_time', 'locks_per_iteration', 'allocs_per_iteration', 'writes_per_iteration', 'atm_cas_per_iteration', 'atm_add_per_iteration', - 'nows_per_iteration', 'cli_transport_stalls', 'cli_stream_stalls', - 'svr_transport_stalls', 'svr_stream_stalls',) + 'nows_per_iteration', 'cli_transport_stalls_per_iteration', + 'cli_stream_stalls_per_iteration', 'svr_transport_stalls_per_iteration', + 'svr_stream_stalls_per_iteration',) diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff/bm_diff.py index 73abf90ff52..809817a1a8c 100755 --- a/tools/profiling/microbenchmarks/bm_diff/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_diff.py @@ -108,9 +108,10 @@ class Benchmark: mdn_diff = abs(_median(new) - _median(old)) _maybe_print('%s: %s=%r %s=%r mdn_diff=%r' % (f, new_name, new, old_name, old, mdn_diff)) - s = bm_speedup.speedup(new, old) - if abs(s) > 3 and mdn_diff > 0.5: - self.final[f] = '%+d%%' % s + s = bm_speedup.speedup(new, old, 1e-5) + if abs(s) > 3: + if mdn_diff > 0.5 or 'trickle' in f: + self.final[f] = '%+d%%' % s return self.final.keys() def skip(self): @@ -172,18 +173,16 @@ def diff(bms, loops, track, old, new, counters): js_new_ctr = None js_old_ctr = None - if js_new_ctr: - for row in bm_json.expand_json(js_new_ctr, js_new_opt): - name = row['cpp_name'] - if name.endswith('_mean') or name.endswith('_stddev'): - continue - benchmarks[name].add_sample(track, row, True) - if js_old_ctr: - for row in bm_json.expand_json(js_old_ctr, js_old_opt): - name = row['cpp_name'] - if name.endswith('_mean') or name.endswith('_stddev'): - continue - benchmarks[name].add_sample(track, row, False) + for row in bm_json.expand_json(js_new_ctr, js_new_opt): + name = row['cpp_name'] + if name.endswith('_mean') or name.endswith('_stddev'): + continue + benchmarks[name].add_sample(track, row, True) + for row in bm_json.expand_json(js_old_ctr, js_old_opt): + name = row['cpp_name'] + if name.endswith('_mean') or name.endswith('_stddev'): + continue + benchmarks[name].add_sample(track, row, False) really_interesting = set() for name, bm in benchmarks.items(): diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py b/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py index 3d126efa62b..63e691af02f 100755 --- a/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_speedup.py @@ -17,8 +17,7 @@ from scipy import stats import math -_THRESHOLD = 1e-10 - +_DEFAULT_THRESHOLD = 1e-10 def scale(a, mul): return [x * mul for x in a] @@ -28,32 +27,32 @@ def cmp(a, b): return stats.ttest_ind(a, b) -def speedup(new, old): +def speedup(new, old, threshold = _DEFAULT_THRESHOLD): if (len(set(new))) == 1 and new == old: return 0 s0, p0 = cmp(new, old) if math.isnan(p0): return 0 if s0 == 0: return 0 - if p0 > _THRESHOLD: return 0 + if p0 > threshold: return 0 if s0 < 0: pct = 1 - while pct < 101: + while pct < 100: sp, pp = cmp(new, scale(old, 1 - pct / 100.0)) if sp > 0: break - if pp > _THRESHOLD: break + if pp > threshold: break pct += 1 return -(pct - 1) else: pct = 1 - while pct < 100000: + while pct < 10000: sp, pp = cmp(new, scale(old, 1 + pct / 100.0)) if sp < 0: break - if pp > _THRESHOLD: break + if pp > threshold: break pct += 1 return pct - 1 if __name__ == "__main__": - new = [1.0, 1.0, 1.0, 1.0] - old = [2.0, 2.0, 2.0, 2.0] - print speedup(new, old) - print speedup(old, new) + new = [0.0, 0.0, 0.0, 0.0] + old = [2.96608e-06, 3.35076e-06, 3.45384e-06, 3.34407e-06] + print speedup(new, old, 1e-5) + print speedup(old, new, 1e-5) diff --git a/tools/profiling/microbenchmarks/bm_json.py b/tools/profiling/microbenchmarks/bm_json.py index 062611f1c76..f6082fe7b4a 100644 --- a/tools/profiling/microbenchmarks/bm_json.py +++ b/tools/profiling/microbenchmarks/bm_json.py @@ -167,6 +167,8 @@ def parse_name(name): return out def expand_json(js, js2 = None): + if not js and not js2: raise StopIteration() + if not js: js = js2 for bm in js['benchmarks']: if bm['name'].endswith('_stddev') or bm['name'].endswith('_mean'): continue context = js['context'] diff --git a/tools/profiling/qps/qps_diff.py b/tools/profiling/qps/qps_diff.py new file mode 100755 index 00000000000..0654f45666f --- /dev/null +++ b/tools/profiling/qps/qps_diff.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python2.7 +# +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" Computes the diff between two qps runs and outputs significant results """ + +import argparse +import json +import multiprocessing +import os +import qps_scenarios +import shutil +import subprocess +import sys +import tabulate + +sys.path.append( + os.path.join( + os.path.dirname(sys.argv[0]), '..', 'microbenchmarks', 'bm_diff')) +import bm_speedup + +sys.path.append( + os.path.join( + os.path.dirname(sys.argv[0]), '..', '..', 'run_tests', 'python_utils')) +import comment_on_pr + + +def _args(): + argp = argparse.ArgumentParser( + description='Perform diff on QPS Driver') + argp.add_argument( + '-d', + '--diff_base', + type=str, + help='Commit or branch to compare the current one to') + argp.add_argument( + '-l', + '--loops', + type=int, + default=4, + help='Number of loops for each benchmark. More loops cuts down on noise' + ) + argp.add_argument( + '-j', + '--jobs', + type=int, + default=multiprocessing.cpu_count(), + help='Number of CPUs to use') + args = argp.parse_args() + assert args.diff_base, "diff_base must be set" + return args + + +def _make_cmd(jobs): + return ['make', '-j', '%d' % jobs, 'qps_json_driver', 'qps_worker'] + + +def build(name, jobs): + shutil.rmtree('qps_diff_%s' % name, ignore_errors=True) + subprocess.check_call(['git', 'submodule', 'update']) + try: + subprocess.check_call(_make_cmd(jobs)) + except subprocess.CalledProcessError, e: + subprocess.check_call(['make', 'clean']) + subprocess.check_call(_make_cmd(jobs)) + os.rename('bins', 'qps_diff_%s' % name) + + +def _run_cmd(name, scenario, fname): + return ['qps_diff_%s/opt/qps_json_driver' % name, '--scenarios_json', scenario, '--json_file_out', fname] + + +def run(name, scenarios, loops): + for sn in scenarios: + for i in range(0, loops): + fname = "%s.%s.%d.json" % (sn, name, i) + subprocess.check_call(_run_cmd(name, scenarios[sn], fname)) + + +def _load_qps(fname): + try: + with open(fname) as f: + return json.loads(f.read())['qps'] + except IOError, e: + print("IOError occurred reading file: %s" % fname) + return None + except ValueError, e: + print("ValueError occurred reading file: %s" % fname) + return None + + +def _median(ary): + assert (len(ary)) + ary = sorted(ary) + n = len(ary) + if n % 2 == 0: + return (ary[(n - 1) / 2] + ary[(n - 1) / 2 + 1]) / 2.0 + else: + return ary[n / 2] + + +def diff(scenarios, loops, old, new): + old_data = {} + new_data = {} + + # collect data + for sn in scenarios: + old_data[sn] = [] + new_data[sn] = [] + for i in range(loops): + old_data[sn].append(_load_qps("%s.%s.%d.json" % (sn, old, i))) + new_data[sn].append(_load_qps("%s.%s.%d.json" % (sn, new, i))) + + # crunch data + headers = ['Benchmark', 'qps'] + rows = [] + for sn in scenarios: + mdn_diff = abs(_median(new_data[sn]) - _median(old_data[sn])) + print('%s: %s=%r %s=%r mdn_diff=%r' % (sn, new, new_data[sn], old, old_data[sn], mdn_diff)) + s = bm_speedup.speedup(new_data[sn], old_data[sn], 10e-5) + if abs(s) > 3 and mdn_diff > 0.5: + rows.append([sn, '%+d%%' % s]) + + if rows: + return tabulate.tabulate(rows, headers=headers, floatfmt='+.2f') + else: + return None + + +def main(args): + build('new', args.jobs) + + if args.diff_base: + where_am_i = subprocess.check_output( + ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() + subprocess.check_call(['git', 'checkout', args.diff_base]) + try: + build('old', args.jobs) + finally: + subprocess.check_call(['git', 'checkout', where_am_i]) + subprocess.check_call(['git', 'submodule', 'update']) + + run('new', qps_scenarios._SCENARIOS, args.loops) + run('old', qps_scenarios._SCENARIOS, args.loops) + + diff_output = diff(qps_scenarios._SCENARIOS, args.loops, 'old', 'new') + + if diff_output: + text = '[qps] Performance differences noted:\n%s' % diff_output + else: + text = '[qps] No significant performance differences' + print('%s' % text) + comment_on_pr.comment_on_pr('```\n%s\n```' % text) + + +if __name__ == '__main__': + args = _args() + main(args) diff --git a/tools/profiling/qps/qps_scenarios.py b/tools/profiling/qps/qps_scenarios.py new file mode 100644 index 00000000000..4fbbdefc4db --- /dev/null +++ b/tools/profiling/qps/qps_scenarios.py @@ -0,0 +1,19 @@ +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" QPS Scenarios to run """ + +_SCENARIOS = { + 'large-message-throughput': '{"scenarios":[{"name":"large-message-throughput", "spawn_local_worker_count": -2, "warmup_seconds": 30, "benchmark_seconds": 270, "num_servers": 1, "server_config": {"async_server_threads": 1, "security_params": null, "server_type": "ASYNC_SERVER"}, "num_clients": 1, "client_config": {"client_type": "ASYNC_CLIENT", "security_params": null, "payload_config": {"simple_params": {"resp_size": 1048576, "req_size": 1048576}}, "client_channels": 1, "async_client_threads": 1, "outstanding_rpcs_per_channel": 1, "rpc_type": "UNARY", "load_params": {"closed_loop": {}}, "histogram_params": {"max_possible": 60000000000.0, "resolution": 0.01}}}]}', + 'multi-channel-64-KiB': '{"scenarios":[{"name":"multi-channel-64-KiB", "spawn_local_worker_count": -3, "warmup_seconds": 30, "benchmark_seconds": 270, "num_servers": 1, "server_config": {"async_server_threads": 31, "security_params": null, "server_type": "ASYNC_SERVER"}, "num_clients": 2, "client_config": {"client_type": "ASYNC_CLIENT", "security_params": null, "payload_config": {"simple_params": {"resp_size": 65536, "req_size": 65536}}, "client_channels": 32, "async_client_threads": 31, "outstanding_rpcs_per_channel": 100, "rpc_type": "UNARY", "load_params": {"closed_loop": {}}, "histogram_params": {"max_possible": 60000000000.0, "resolution": 0.01}}}]}' +} diff --git a/tools/run_tests/artifacts/build_artifact_node.bat b/tools/run_tests/artifacts/build_artifact_node.bat index a71db79b2d8..cca6563ee3e 100644 --- a/tools/run_tests/artifacts/build_artifact_node.bat +++ b/tools/run_tests/artifacts/build_artifact_node.bat @@ -12,7 +12,7 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. -set node_versions=4.0.0 5.0.0 6.0.0 7.0.0 +set node_versions=4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 @@ -30,13 +30,13 @@ for %%v in (%node_versions%) do ( @rem Try again after removing openssl headers rmdir "%HOMEDRIVE%%HOMEPATH%\.node-gyp\%%v\include\node\openssl" /S /Q rmdir "%HOMEDRIVE%%HOMEPATH%\.node-gyp\iojs-%%v\include\node\openssl" /S /Q - call .\node_modules\.bin\node-pre-gyp.cmd build package testpackage --target=%%v --target_arch=%1 || goto :error + call .\node_modules\.bin\node-pre-gyp.cmd build package --target=%%v --target_arch=%1 || goto :error xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error ) for %%v in (%electron_versions%) do ( - cmd /V /C "set "HOME=%HOMEDRIVE%%HOMEPATH%\electron-gyp" && call .\node_modules\.bin\node-pre-gyp.cmd configure rebuild package testpackage --runtime=electron --target=%%v --target_arch=%1 --disturl=https://atom.io/download/electron" || goto :error + cmd /V /C "set "HOME=%HOMEDRIVE%%HOMEPATH%\electron-gyp" && call .\node_modules\.bin\node-pre-gyp.cmd configure rebuild package --runtime=electron --target=%%v --target_arch=%1 --disturl=https://atom.io/download/electron" || goto :error xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error ) diff --git a/tools/run_tests/artifacts/build_artifact_node.sh b/tools/run_tests/artifacts/build_artifact_node.sh index 5f7f7d28a46..9d390831b85 100755 --- a/tools/run_tests/artifacts/build_artifact_node.sh +++ b/tools/run_tests/artifacts/build_artifact_node.sh @@ -27,18 +27,18 @@ mkdir -p "${ARTIFACTS_OUT}" npm update -node_versions=( 4.0.0 5.0.0 6.0.0 7.0.0 ) +node_versions=( 4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 ) electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 ) for version in ${node_versions[@]} do - ./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --target=$version --target_arch=$NODE_TARGET_ARCH --grpc_alpine=true + ./node_modules/.bin/node-pre-gyp configure rebuild package --target=$version --target_arch=$NODE_TARGET_ARCH --grpc_alpine=true cp -r build/stage/* "${ARTIFACTS_OUT}"/ done for version in ${electron_versions[@]} do - HOME=~/.electron-gyp ./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --runtime=electron --target=$version --target_arch=$NODE_TARGET_ARCH --disturl=https://atom.io/download/electron + HOME=~/.electron-gyp ./node_modules/.bin/node-pre-gyp configure rebuild package --runtime=electron --target=$version --target_arch=$NODE_TARGET_ARCH --disturl=https://atom.io/download/electron cp -r build/stage/* "${ARTIFACTS_OUT}"/ done diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 956f45fc2d0..0c4e1fae1d8 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -827,21 +827,6 @@ "third_party": false, "type": "target" }, - { - "deps": [ - "gpr", - "gpr_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_stack_lockfree_test", - "src": [ - "test/core/support/stack_lockfree_test.c" - ], - "third_party": false, - "type": "target" - }, { "deps": [ "gpr", @@ -4187,20 +4172,6 @@ "third_party": true, "type": "target" }, - { - "deps": [ - "boringssl", - "boringssl_chacha_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_chacha_test", - "src": [], - "third_party": true, - "type": "target" - }, { "deps": [ "boringssl", @@ -4299,20 +4270,6 @@ "third_party": true, "type": "target" }, - { - "deps": [ - "boringssl", - "boringssl_dh_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_dh_test", - "src": [], - "third_party": true, - "type": "target" - }, { "deps": [ "boringssl", @@ -4330,27 +4287,13 @@ { "deps": [ "boringssl", - "boringssl_dsa_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_dsa_test", - "src": [], - "third_party": true, - "type": "target" - }, - { - "deps": [ - "boringssl", - "boringssl_ec_test_lib", + "boringssl_example_mul_lib", "boringssl_test_util" ], "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_ec_test", + "name": "boringssl_example_mul", "src": [], "third_party": true, "type": "target" @@ -4358,13 +4301,13 @@ { "deps": [ "boringssl", - "boringssl_example_mul_lib", + "boringssl_p256-x86_64_test_lib", "boringssl_test_util" ], "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_example_mul", + "name": "boringssl_p256-x86_64_test", "src": [], "third_party": true, "type": "target" @@ -4425,20 +4368,6 @@ "third_party": true, "type": "target" }, - { - "deps": [ - "boringssl", - "boringssl_err_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_err_test", - "src": [], - "third_party": true, - "type": "target" - }, { "deps": [ "boringssl", @@ -4537,48 +4466,6 @@ "third_party": true, "type": "target" }, - { - "deps": [ - "boringssl", - "boringssl_newhope_statistical_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_newhope_statistical_test", - "src": [], - "third_party": true, - "type": "target" - }, - { - "deps": [ - "boringssl", - "boringssl_newhope_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_newhope_test", - "src": [], - "third_party": true, - "type": "target" - }, - { - "deps": [ - "boringssl", - "boringssl_newhope_vectors_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_newhope_vectors_test", - "src": [], - "third_party": true, - "type": "target" - }, { "deps": [ "boringssl", @@ -4638,13 +4525,13 @@ { "deps": [ "boringssl", - "boringssl_refcount_test_lib", + "boringssl_pool_test_lib", "boringssl_test_util" ], "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_refcount_test", + "name": "boringssl_pool_test", "src": [], "third_party": true, "type": "target" @@ -4652,13 +4539,13 @@ { "deps": [ "boringssl", - "boringssl_rsa_test_lib", + "boringssl_refcount_test_lib", "boringssl_test_util" ], "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_rsa_test", + "name": "boringssl_refcount_test", "src": [], "third_party": true, "type": "target" @@ -4733,20 +4620,6 @@ "third_party": true, "type": "target" }, - { - "deps": [ - "boringssl", - "boringssl_ssl_test_lib", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_ssl_test", - "src": [], - "third_party": true, - "type": "target" - }, { "deps": [ "bad_client_test", @@ -6580,14 +6453,14 @@ "third_party/boringssl/crypto/digest/md32_common.h", "third_party/boringssl/crypto/ec/internal.h", "third_party/boringssl/crypto/ec/p256-x86_64-table.h", + "third_party/boringssl/crypto/ec/p256-x86_64.h", "third_party/boringssl/crypto/evp/internal.h", "third_party/boringssl/crypto/internal.h", "third_party/boringssl/crypto/modes/internal.h", - "third_party/boringssl/crypto/newhope/internal.h", "third_party/boringssl/crypto/obj/obj_dat.h", - "third_party/boringssl/crypto/obj/obj_xref.h", "third_party/boringssl/crypto/pkcs8/internal.h", "third_party/boringssl/crypto/poly1305/internal.h", + "third_party/boringssl/crypto/pool/internal.h", "third_party/boringssl/crypto/rand/internal.h", "third_party/boringssl/crypto/rsa/internal.h", "third_party/boringssl/crypto/x509/charmap.h", @@ -6637,7 +6510,6 @@ "third_party/boringssl/include/openssl/md4.h", "third_party/boringssl/include/openssl/md5.h", "third_party/boringssl/include/openssl/mem.h", - "third_party/boringssl/include/openssl/newhope.h", "third_party/boringssl/include/openssl/nid.h", "third_party/boringssl/include/openssl/obj.h", "third_party/boringssl/include/openssl/obj_mac.h", @@ -6650,6 +6522,7 @@ "third_party/boringssl/include/openssl/pkcs7.h", "third_party/boringssl/include/openssl/pkcs8.h", "third_party/boringssl/include/openssl/poly1305.h", + "third_party/boringssl/include/openssl/pool.h", "third_party/boringssl/include/openssl/rand.h", "third_party/boringssl/include/openssl/rc4.h", "third_party/boringssl/include/openssl/ripemd.h", @@ -6662,7 +6535,6 @@ "third_party/boringssl/include/openssl/stack.h", "third_party/boringssl/include/openssl/stack_macros.h", "third_party/boringssl/include/openssl/thread.h", - "third_party/boringssl/include/openssl/time_support.h", "third_party/boringssl/include/openssl/tls1.h", "third_party/boringssl/include/openssl/type_check.h", "third_party/boringssl/include/openssl/x509.h", @@ -6767,19 +6639,6 @@ "third_party": true, "type": "lib" }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_chacha_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, { "deps": [ "boringssl", @@ -6826,7 +6685,7 @@ ], "headers": [], "is_filegroup": false, - "language": "c", + "language": "c++", "name": "boringssl_constant_time_test_lib", "src": [], "third_party": true, @@ -6871,19 +6730,6 @@ "third_party": true, "type": "lib" }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_dh_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, { "deps": [ "boringssl", @@ -6905,7 +6751,7 @@ "headers": [], "is_filegroup": false, "language": "c", - "name": "boringssl_dsa_test_lib", + "name": "boringssl_example_mul_lib", "src": [], "third_party": true, "type": "lib" @@ -6918,20 +6764,7 @@ "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_ec_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "boringssl_example_mul_lib", + "name": "boringssl_p256-x86_64_test_lib", "src": [], "third_party": true, "type": "lib" @@ -6988,19 +6821,6 @@ "third_party": true, "type": "lib" }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_err_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, { "deps": [ "boringssl", @@ -7047,7 +6867,7 @@ ], "headers": [], "is_filegroup": false, - "language": "c", + "language": "c++", "name": "boringssl_hkdf_test_lib", "src": [], "third_party": true, @@ -7073,7 +6893,7 @@ ], "headers": [], "is_filegroup": false, - "language": "c", + "language": "c++", "name": "boringssl_lhash_test_lib", "src": [], "third_party": true, @@ -7092,45 +6912,6 @@ "third_party": true, "type": "lib" }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_newhope_statistical_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_newhope_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_newhope_vectors_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, { "deps": [ "boringssl", @@ -7190,8 +6971,8 @@ ], "headers": [], "is_filegroup": false, - "language": "c", - "name": "boringssl_refcount_test_lib", + "language": "c++", + "name": "boringssl_pool_test_lib", "src": [], "third_party": true, "type": "lib" @@ -7204,7 +6985,7 @@ "headers": [], "is_filegroup": false, "language": "c++", - "name": "boringssl_rsa_test_lib", + "name": "boringssl_refcount_test_lib", "src": [], "third_party": true, "type": "lib" @@ -7274,19 +7055,6 @@ "third_party": true, "type": "lib" }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_ssl_test_lib", - "src": [], - "third_party": true, - "type": "lib" - }, { "deps": [], "headers": [ @@ -7680,7 +7448,6 @@ "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", "src/core/lib/support/spinlock.h", - "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.h", "src/core/lib/support/string_windows.h", "src/core/lib/support/thd_internal.h", @@ -7753,8 +7520,6 @@ "src/core/lib/support/murmur_hash.c", "src/core/lib/support/murmur_hash.h", "src/core/lib/support/spinlock.h", - "src/core/lib/support/stack_lockfree.c", - "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.c", "src/core/lib/support/string.h", "src/core/lib/support/string_posix.c", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 12c08dc72a0..2c4cff90b6a 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -947,28 +947,6 @@ "windows" ] }, - { - "args": [], - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 7, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "gtest": false, - "language": "c", - "name": "gpr_stack_lockfree_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [], "ci_platforms": [ @@ -4253,7 +4231,9 @@ ] }, { - "args": [], + "args": [ + "third_party/boringssl/crypto/aes/aes_tests.txt" + ], "boringssl": true, "ci_platforms": [ "linux", @@ -4404,31 +4384,6 @@ "windows" ] }, - { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_chacha_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [ "aes-128-gcm", @@ -4457,34 +4412,6 @@ "windows" ] }, - { - "args": [ - "aes-128-key-wrap", - "third_party/boringssl/crypto/cipher/test/aes_128_key_wrap_tests.txt" - ], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_aead_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [ "aes-256-gcm", @@ -4515,8 +4442,8 @@ }, { "args": [ - "aes-256-key-wrap", - "third_party/boringssl/crypto/cipher/test/aes_256_key_wrap_tests.txt" + "aes-128-gcm-siv", + "third_party/boringssl/crypto/cipher/test/aes_128_gcm_siv_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -4543,8 +4470,8 @@ }, { "args": [ - "chacha20-poly1305", - "third_party/boringssl/crypto/cipher/test/chacha20_poly1305_tests.txt" + "aes-256-gcm-siv", + "third_party/boringssl/crypto/cipher/test/aes_256_gcm_siv_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -4571,8 +4498,8 @@ }, { "args": [ - "chacha20-poly1305-old", - "third_party/boringssl/crypto/cipher/test/chacha20_poly1305_old_tests.txt" + "chacha20-poly1305", + "third_party/boringssl/crypto/cipher/test/chacha20_poly1305_tests.txt" ], "boringssl": true, "ci_platforms": [ @@ -5143,31 +5070,6 @@ "windows" ] }, - { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_dh_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [], "boringssl": true, @@ -5210,7 +5112,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_dsa_test", + "name": "boringssl_example_mul", "platforms": [ "linux", "mac", @@ -5219,32 +5121,9 @@ ] }, { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" + "args": [ + "third_party/boringssl/crypto/ec/p256-x86_64_tests.txt" ], - "flaky": false, - "language": "c++", - "name": "boringssl_ec_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, - { - "args": [], "boringssl": true, "ci_platforms": [ "linux", @@ -5260,7 +5139,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_example_mul", + "name": "boringssl_p256-x86_64_test", "platforms": [ "linux", "mac", @@ -5374,31 +5253,6 @@ "windows" ] }, - { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_err_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [], "boringssl": true, @@ -5578,83 +5432,6 @@ "windows" ] }, - { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_newhope_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, - { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_newhope_statistical_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, - { - "args": [ - "third_party/boringssl/crypto/newhope/newhope_tests.txt" - ], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_newhope_vectors_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [], "boringssl": true, @@ -5774,7 +5551,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_refcount_test", + "name": "boringssl_pool_test", "platforms": [ "linux", "mac", @@ -5799,7 +5576,7 @@ ], "flaky": false, "language": "c++", - "name": "boringssl_rsa_test", + "name": "boringssl_refcount_test", "platforms": [ "linux", "mac", @@ -5932,31 +5709,6 @@ "windows" ] }, - { - "args": [], - "boringssl": true, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "defaults": "boringssl", - "exclude_configs": [ - "asan", - "ubsan" - ], - "flaky": false, - "language": "c++", - "name": "boringssl_ssl_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, { "args": [ "authority_not_supported" diff --git a/tools/run_tests/helper_scripts/pre_build_node.bat b/tools/run_tests/helper_scripts/pre_build_node.bat index ff4d98aaee1..ececc5755d5 100644 --- a/tools/run_tests/helper_scripts/pre_build_node.bat +++ b/tools/run_tests/helper_scripts/pre_build_node.bat @@ -14,5 +14,7 @@ set PATH=%PATH%;C:\Program Files\nodejs\;%APPDATA%\npm -@rem Expire cache after 1 day -call npm update --cache-min 86400 +@rem Update npm to at least version 5 +call npm update -g npm + +call npm update --prefer-online diff --git a/tools/run_tests/helper_scripts/pre_build_node.sh b/tools/run_tests/helper_scripts/pre_build_node.sh index 5d14a549da5..f41da71d221 100755 --- a/tools/run_tests/helper_scripts/pre_build_node.sh +++ b/tools/run_tests/helper_scripts/pre_build_node.sh @@ -20,10 +20,12 @@ source ~/.nvm/nvm.sh nvm install $NODE_VERSION set -ex +# Update npm to at least version 5 +npm update -g npm + export GRPC_CONFIG=${CONFIG:-opt} -# Expire cache after 1 day -npm update --cache-min 86400 +npm update --prefer-online npm install node-gyp-install ./node_modules/.bin/node-gyp-install diff --git a/tools/run_tests/interop/android/android_interop_helper.sh b/tools/run_tests/interop/android/android_interop_helper.sh new file mode 100755 index 00000000000..9c0d18fba37 --- /dev/null +++ b/tools/run_tests/interop/android/android_interop_helper.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Helper that runs inside the docker container and builds the APKs and +# invokes Firebase Test Lab via gcloud. + +SERVICE_KEY=$1 + +gcloud auth activate-service-account --key-file=$SERVICE_KEY || exit 1 +gcloud config set project grpc-testing || exit 1 + +rm -rf grpc-java +git clone https://github.com/grpc/grpc-java.git +cd grpc-java +./gradlew install || exit 1 +cd android-interop-testing +../gradlew assembleDebug +../gradlew assembleDebugAndroidTest + +gcloud firebase test android run \ + --type instrumentation \ + --app app/build/outputs/apk/app-debug.apk \ + --test app/build/outputs/apk/app-debug-androidTest.apk \ + --device model=Nexus6,version=21,locale=en,orientation=portrait diff --git a/tools/run_tests/interop/android/run_android_tests_on_firebase.sh b/tools/run_tests/interop/android/run_android_tests_on_firebase.sh new file mode 100755 index 00000000000..0b4811355c5 --- /dev/null +++ b/tools/run_tests/interop/android/run_android_tests_on_firebase.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Builds the gRPC Android instrumented interop tests inside a docker container +# and runs them on Firebase Test Lab + +DOCKERFILE=tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile +DOCKER_TAG=android_interop_test +SERVICE_KEY=~/android-interops-service-key.json +HELPER=$(pwd)/tools/run_tests/interop/android/android_interop_helper.sh + +docker build -t $DOCKER_TAG -f $DOCKERFILE . + +docker run --interactive --rm \ + --volume="$SERVICE_KEY":/service-key.json:ro \ + --volume="$HELPER":/android_interop_helper.sh:ro \ + $DOCKER_TAG \ + /bin/bash -c "/android_interop_helper.sh /service-key.json" diff --git a/tools/run_tests/performance/patch_scenario_results_schema.py b/tools/run_tests/performance/patch_scenario_results_schema.py new file mode 100755 index 00000000000..81ba5381b3e --- /dev/null +++ b/tools/run_tests/performance/patch_scenario_results_schema.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# Copyright 2016 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Use to patch schema of existing scenario results tables (after adding fields). + +from __future__ import print_function + +import argparse +import calendar +import json +import os +import sys +import time +import uuid + + +gcp_utils_dir = os.path.abspath(os.path.join( + os.path.dirname(__file__), '../../gcp/utils')) +sys.path.append(gcp_utils_dir) +import big_query_utils + + +_PROJECT_ID='grpc-testing' + +def _patch_results_table(dataset_id, table_id): + bq = big_query_utils.create_big_query() + with open(os.path.dirname(__file__) + '/scenario_result_schema.json', 'r') as f: + table_schema = json.loads(f.read()) + desc = 'Results of performance benchmarks.' + return big_query_utils.patch_table(bq, _PROJECT_ID, dataset_id, + table_id, table_schema) + + +argp = argparse.ArgumentParser(description='Patch schema of scenario results table.') +argp.add_argument('--bq_result_table', required=True, default=None, type=str, + help='Bigquery "dataset.table" to patch.') + +args = argp.parse_args() + +dataset_id, table_id = args.bq_result_table.split('.', 2) + +_patch_results_table(dataset_id, table_id) +print('Successfully patched schema of %s.\n' % args.bq_result_table) diff --git a/tools/run_tests/performance/scenario_result_schema.json b/tools/run_tests/performance/scenario_result_schema.json index 8ec41c377c5..245861f8c27 100644 --- a/tools/run_tests/performance/scenario_result_schema.json +++ b/tools/run_tests/performance/scenario_result_schema.json @@ -107,6 +107,11 @@ "name": "timeSystem", "type": "FLOAT", "mode": "NULLABLE" + }, + { + "name": "cqPollCount", + "type": "INTEGER", + "mode": "NULLABLE" } ] }, @@ -129,6 +134,11 @@ "name": "timeSystem", "type": "FLOAT", "mode": "NULLABLE" + }, + { + "name": "cqPollCount", + "type": "INTEGER", + "mode": "NULLABLE" } ] }, @@ -196,6 +206,16 @@ "name": "latency999", "type": "FLOAT", "mode": "NULLABLE" + }, + { + "name": "clientPollsPerRequest", + "type": "FLOAT", + "mode": "NULLABLE" + }, + { + "name": "serverPollsPerRequest", + "type": "FLOAT", + "mode": "NULLABLE" } ] }, diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index cf1fabf1b81..ddfc1d68f19 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -81,7 +81,7 @@ def get_flaky_tests(limit=None): FROM [grpc-testing:jenkins_test_results.aggregate_results] WHERE - timestamp >= DATE_ADD(DATE(CURRENT_TIMESTAMP()), -1, "WEEK") + timestamp >= DATE_ADD(CURRENT_DATE(), -1, "WEEK") AND NOT REGEXP_MATCH(job_name, '.*portability.*') GROUP BY test_name @@ -450,10 +450,11 @@ class NodeLanguage(object): # we should specify in the compiler argument _check_compiler(self.args.compiler, ['default', 'node0.12', 'node4', 'node5', 'node6', - 'node7', 'electron1.3', 'electron1.6']) + 'node7', 'node8', + 'electron1.3', 'electron1.6']) if self.args.compiler == 'default': self.runtime = 'node' - self.node_version = '7' + self.node_version = '8' else: if self.args.compiler.startswith('electron'): self.runtime = 'electron' @@ -1192,7 +1193,7 @@ argp.add_argument('--compiler', 'clang3.4', 'clang3.5', 'clang3.6', 'clang3.7', 'vs2013', 'vs2015', 'python2.7', 'python3.4', 'python3.5', 'python3.6', 'pypy', 'pypy3', 'python_alpine', - 'node0.12', 'node4', 'node5', 'node6', 'node7', + 'node0.12', 'node4', 'node5', 'node6', 'node7', 'node8', 'electron1.3', 'electron1.6', 'coreclr', 'cmake'], diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index 96e865b0c0e..635d87f4762 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -287,6 +287,15 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) extra_args=extra_args, inner_jobs=inner_jobs) + test_jobs += _generate_jobs(languages=['node'], + configs=['dbg'], + platforms=['linux'], + arch='default', + compiler='node7', + labels=['portability'], + extra_args=extra_args, + inner_jobs=inner_jobs) + return test_jobs diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index c95ef4fcd82..d856e221760 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -27,7 +27,7 @@ want_submodules=`mktemp /tmp/submXXXXXX` git submodule | awk '{ print $1 }' | sort > $submodules cat << EOF | awk '{ print $1 }' | sort > $want_submodules 44c25c892a6229b20db7cd9dc05584ea865896de third_party/benchmark (v0.1.0-343-g44c25c8) - 78684e5b222645828ca302e56b40b9daff2b2d27 third_party/boringssl (78684e5) + be2ee342d3781ddb954f91f8a7e660c6f59e87e5 third_party/boringssl (heads/chromium-stable) 886e7d75368e3f4fab3f4d0d3584e4abfc557755 third_party/boringssl-with-bazel (version_for_cocoapods_7.0-857-g886e7d7) 30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e third_party/gflags (v2.2.0) ec44c6c1675c25b9827aacd08c02433cccde7780 third_party/googletest (release-1.8.0) diff --git a/tools/ubsan_suppressions.txt b/tools/ubsan_suppressions.txt index 3384efcac9b..83dcfc3d058 100644 --- a/tools/ubsan_suppressions.txt +++ b/tools/ubsan_suppressions.txt @@ -4,5 +4,6 @@ nonnull-attribute:CBB_add_bytes nonnull-attribute:rsa_blinding_get nonnull-attribute:ssl_copy_key_material alignment:CRYPTO_cbc128_encrypt +alignment:CRYPTO_gcm128_encrypt nonnull-attribute:google::protobuf::* alignment:google::protobuf::* diff --git a/vsprojects/buildtests_c.sln b/vsprojects/buildtests_c.sln index b7696a99651..3c6e8d8f34f 100644 --- a/vsprojects/buildtests_c.sln +++ b/vsprojects/buildtests_c.sln @@ -484,15 +484,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_spinlock_test", "vcxpro {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_stack_lockfree_test", "vcxproj\test\gpr_stack_lockfree_test\gpr_stack_lockfree_test.vcxproj", "{AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}" - ProjectSection(myProperties) = preProject - lib = "False" - EndProjectSection - ProjectSection(ProjectDependencies) = postProject - {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037} - {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_string_test", "vcxproj\test\gpr_string_test\gpr_string_test.vcxproj", "{B453457D-8FBC-9C9F-A55E-C06FCE13B1F2}" ProjectSection(myProperties) = preProject lib = "False" @@ -2497,22 +2488,6 @@ Global {D8EDE51A-CBB2-0362-D59B-09AA92A94F45}.Release-DLL|Win32.Build.0 = Release|Win32 {D8EDE51A-CBB2-0362-D59B-09AA92A94F45}.Release-DLL|x64.ActiveCfg = Release|x64 {D8EDE51A-CBB2-0362-D59B-09AA92A94F45}.Release-DLL|x64.Build.0 = Release|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug|Win32.ActiveCfg = Debug|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug|x64.ActiveCfg = Debug|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release|Win32.ActiveCfg = Release|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release|x64.ActiveCfg = Release|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug|Win32.Build.0 = Debug|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug|x64.Build.0 = Debug|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release|Win32.Build.0 = Release|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release|x64.Build.0 = Release|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug-DLL|Win32.Build.0 = Debug|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug-DLL|x64.ActiveCfg = Debug|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug-DLL|x64.Build.0 = Debug|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release-DLL|Win32.ActiveCfg = Release|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release-DLL|Win32.Build.0 = Release|Win32 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release-DLL|x64.ActiveCfg = Release|x64 - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release-DLL|x64.Build.0 = Release|x64 {B453457D-8FBC-9C9F-A55E-C06FCE13B1F2}.Debug|Win32.ActiveCfg = Debug|Win32 {B453457D-8FBC-9C9F-A55E-C06FCE13B1F2}.Debug|x64.ActiveCfg = Debug|x64 {B453457D-8FBC-9C9F-A55E-C06FCE13B1F2}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/vsprojects/vcxproj/boringssl/boringssl.vcxproj b/vsprojects/vcxproj/boringssl/boringssl.vcxproj index a67b2c3a5d8..ed8a54da96f 100644 --- a/vsprojects/vcxproj/boringssl/boringssl.vcxproj +++ b/vsprojects/vcxproj/boringssl/boringssl.vcxproj @@ -162,14 +162,14 @@ + - - + @@ -219,7 +219,6 @@ - @@ -232,6 +231,7 @@ + @@ -244,7 +244,6 @@ - @@ -257,6 +256,8 @@ + + @@ -319,6 +320,8 @@ + + @@ -329,8 +332,6 @@ - - @@ -543,17 +544,7 @@ - - - - - - - - - - - + @@ -575,8 +566,6 @@ - - @@ -589,8 +578,12 @@ + + + + @@ -613,6 +606,8 @@ + + @@ -629,8 +624,6 @@ - - @@ -797,6 +790,8 @@ + + @@ -817,8 +812,6 @@ - - @@ -839,12 +832,18 @@ - + + + + + + + diff --git a/vsprojects/vcxproj/boringssl/boringssl.vcxproj.filters b/vsprojects/vcxproj/boringssl/boringssl.vcxproj.filters index 09aa067f785..ad6732984dd 100644 --- a/vsprojects/vcxproj/boringssl/boringssl.vcxproj.filters +++ b/vsprojects/vcxproj/boringssl/boringssl.vcxproj.filters @@ -7,6 +7,9 @@ third_party\boringssl\crypto\aes + + third_party\boringssl\crypto\aes + third_party\boringssl\crypto\aes @@ -100,6 +103,9 @@ third_party\boringssl\crypto\asn1 + + third_party\boringssl\crypto\asn1 + third_party\boringssl\crypto\asn1 @@ -115,9 +121,6 @@ third_party\boringssl\crypto\bio - - third_party\boringssl\crypto\bio - third_party\boringssl\crypto\bio @@ -436,23 +439,8 @@ third_party\boringssl\crypto\modes - - third_party\boringssl\crypto\newhope - - - third_party\boringssl\crypto\newhope - - - third_party\boringssl\crypto\newhope - - - third_party\boringssl\crypto\newhope - - - third_party\boringssl\crypto\newhope - - - third_party\boringssl\crypto\newhope + + third_party\boringssl\crypto\modes third_party\boringssl\crypto\obj @@ -484,9 +472,6 @@ third_party\boringssl\crypto\pem - - third_party\boringssl\crypto\pkcs8 - third_party\boringssl\crypto\pkcs8 @@ -505,9 +490,15 @@ third_party\boringssl\crypto\poly1305 + + third_party\boringssl\crypto\pool + third_party\boringssl\crypto\rand + + third_party\boringssl\crypto\rand + third_party\boringssl\crypto\rand @@ -541,6 +532,9 @@ third_party\boringssl\crypto\rsa + + third_party\boringssl\crypto\sha + third_party\boringssl\crypto\sha @@ -565,9 +559,6 @@ third_party\boringssl\crypto - - third_party\boringssl\crypto - third_party\boringssl\crypto\x509 @@ -817,6 +808,9 @@ third_party\boringssl\crypto\x509v3 + + third_party\boringssl\ssl + third_party\boringssl\ssl @@ -847,9 +841,6 @@ third_party\boringssl\ssl - - third_party\boringssl\ssl - third_party\boringssl\ssl @@ -880,7 +871,10 @@ third_party\boringssl\ssl - + + third_party\boringssl\ssl + + third_party\boringssl\ssl @@ -889,6 +883,12 @@ third_party\boringssl\ssl + + third_party\boringssl\ssl + + + third_party\boringssl\ssl + third_party\boringssl\ssl @@ -960,6 +960,9 @@ third_party\boringssl\crypto\ec + + third_party\boringssl\crypto\ec + third_party\boringssl\crypto\evp @@ -969,21 +972,18 @@ third_party\boringssl\crypto\modes - - third_party\boringssl\crypto\newhope - third_party\boringssl\crypto\obj - - third_party\boringssl\crypto\obj - third_party\boringssl\crypto\pkcs8 third_party\boringssl\crypto\poly1305 + + third_party\boringssl\crypto\pool + third_party\boringssl\crypto\rand @@ -1131,9 +1131,6 @@ third_party\boringssl\include\openssl - - third_party\boringssl\include\openssl - third_party\boringssl\include\openssl @@ -1170,6 +1167,9 @@ third_party\boringssl\include\openssl + + third_party\boringssl\include\openssl + third_party\boringssl\include\openssl @@ -1206,9 +1206,6 @@ third_party\boringssl\include\openssl - - third_party\boringssl\include\openssl - third_party\boringssl\include\openssl @@ -1332,9 +1329,6 @@ {63ca8fcd-7644-61d6-4357-5a0bcfdc395b} - - {2a39f7c3-62df-5021-0825-36f18f10ad12} - {59349deb-4276-df4c-f4cd-e2cf707c3b4c} @@ -1347,6 +1341,9 @@ {9fd1fe61-f5b5-11e0-48ad-a90302eacab0} + + {19132e87-6e82-85b5-4109-6d353978eb21} + {965f2392-a795-b06a-7b17-d123d8e84f8d} diff --git a/vsprojects/vcxproj/gpr/gpr.vcxproj b/vsprojects/vcxproj/gpr/gpr.vcxproj index 7fb81a7fbca..3f0dedd6758 100644 --- a/vsprojects/vcxproj/gpr/gpr.vcxproj +++ b/vsprojects/vcxproj/gpr/gpr.vcxproj @@ -198,7 +198,6 @@ - @@ -254,8 +253,6 @@ - - diff --git a/vsprojects/vcxproj/gpr/gpr.vcxproj.filters b/vsprojects/vcxproj/gpr/gpr.vcxproj.filters index 27d9d2f38f4..f8cccb5c082 100644 --- a/vsprojects/vcxproj/gpr/gpr.vcxproj.filters +++ b/vsprojects/vcxproj/gpr/gpr.vcxproj.filters @@ -73,9 +73,6 @@ src\core\lib\support - - src\core\lib\support - src\core\lib\support @@ -290,9 +287,6 @@ src\core\lib\support - - src\core\lib\support - src\core\lib\support diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj deleted file mode 100644 index 3c4c382c56d..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {D15F1CF5-EC88-FDD5-55A0-CBE5DC8A9F29} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_chacha_test_lib - - - boringssl_chacha_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj.filters deleted file mode 100644 index 5fb3e2fc495..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test_lib/boringssl_chacha_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\chacha - - - - - - {4b736811-6554-6004-024b-74e526459c17} - - - {256ad378-581e-bc4f-e018-f4a4e4098091} - - - {7e6857c0-cc2b-da3a-bdf7-cf9f82aba586} - - - {02432684-f62e-6b57-5847-af2e296fbbab} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj index cc31162733c..f75842ba581 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj @@ -147,7 +147,7 @@ - + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj.filters index 2a3689b0103..99e90085bd3 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj.filters +++ b/vsprojects/vcxproj/test/boringssl/boringssl_constant_time_test_lib/boringssl_constant_time_test_lib.vcxproj.filters @@ -1,7 +1,7 @@ - + third_party\boringssl\crypto diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test/boringssl_dh_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_dh_test/boringssl_dh_test.vcxproj deleted file mode 100644 index f8bc4f23c0d..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test/boringssl_dh_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {26AFD763-4456-9AAF-2458-4C616281C668} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_dh_test - static - Debug - static - Debug - - - boringssl_dh_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {56A4B15E-3DB1-118D-1ED2-4527CA24FE81} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj.filters deleted file mode 100644 index 6d5de842c7d..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\dh - - - - - - {65ed99ff-7fef-84bd-69ac-699784eaa2d5} - - - {20a54707-e604-4830-8245-e0332914fc02} - - - {059fef06-fd8b-f6dd-d545-1355d0d6f0fe} - - - {909105d9-54df-9980-9131-c9273ab8a135} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj deleted file mode 100644 index 52505e6cc76..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {D99910AE-2E0C-437C-D2AD-B69724AC5724} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_dsa_test - static - Debug - static - Debug - - - boringssl_dsa_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {4D7D265F-7184-79BB-CDCA-93ADFE0555CA} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d4..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test/boringssl_dsa_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj deleted file mode 100644 index dfa7d23aaf7..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {6B7C8FF0-E60D-551F-61D8-4F865ED8F48E} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_ec_test - static - Debug - static - Debug - - - boringssl_ec_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {0B3020E4-6C92-E46A-CDD2-29CDAB97020B} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d4..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test/boringssl_ec_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj deleted file mode 100644 index 644048ba527..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {0B3020E4-6C92-E46A-CDD2-29CDAB97020B} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_ec_test_lib - - - boringssl_ec_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d4..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj deleted file mode 100644 index 87def13857e..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {11E8A736-EEA4-84A8-BCC8-08269674DCBF} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_err_test_lib - - - boringssl_err_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj.filters deleted file mode 100644 index 2a9696d54bb..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_err_test_lib/boringssl_err_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\err - - - - - - {1c12770a-24ce-cd11-bb90-f3b2e9216e03} - - - {f790f27a-bb2c-6ed0-ef88-abeb2a27a513} - - - {be436245-b188-a1ee-4e2b-d27f6cee0d88} - - - {027082a4-6859-7319-0e4a-c7b47e736762} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj index 0160850330a..93493b0b4b3 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj @@ -147,7 +147,7 @@ - + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj.filters index f3c142afffe..c88d022b15a 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj.filters +++ b/vsprojects/vcxproj/test/boringssl/boringssl_hkdf_test_lib/boringssl_hkdf_test_lib.vcxproj.filters @@ -1,7 +1,7 @@ - + third_party\boringssl\crypto\hkdf diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj index b12007d90d8..fb297c99c5d 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj @@ -147,7 +147,7 @@ - + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj.filters index d8606eade9a..80314422566 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj.filters +++ b/vsprojects/vcxproj/test/boringssl/boringssl_lhash_test_lib/boringssl_lhash_test_lib.vcxproj.filters @@ -1,7 +1,7 @@ - + third_party\boringssl\crypto\lhash diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj deleted file mode 100644 index f3dde154ade..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {2DFF4B39-A402-0C88-ACE5-58BD7E5F7686} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_newhope_statistical_test - static - Debug - static - Debug - - - boringssl_newhope_statistical_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {95B2444A-04E1-7F0A-049C-30099AA62E84} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d4..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test/boringssl_newhope_statistical_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj deleted file mode 100644 index c9cb80a4306..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {95B2444A-04E1-7F0A-049C-30099AA62E84} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_newhope_statistical_test_lib - - - boringssl_newhope_statistical_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj.filters deleted file mode 100644 index 95945c24671..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_statistical_test_lib/boringssl_newhope_statistical_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\newhope - - - - - - {25a9ae19-5707-441e-6d97-13ff38322368} - - - {e6e1e1f9-31eb-463f-a882-01c72cbe7a6e} - - - {37a6d595-952d-a224-060b-ea246359d76a} - - - {e0473499-9b3e-c3c3-5463-4706bd005f6c} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj deleted file mode 100644 index 7a085b638f1..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {105DF9D7-2B9F-501B-9FC4-C98BF16FC9D3} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_newhope_test - static - Debug - static - Debug - - - boringssl_newhope_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {2E791A00-9907-8B9A-D201-4E0C357A6BB3} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d4..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test/boringssl_newhope_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj deleted file mode 100644 index 55046360614..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {2E791A00-9907-8B9A-D201-4E0C357A6BB3} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_newhope_test_lib - - - boringssl_newhope_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj.filters deleted file mode 100644 index f2dc0e6a5bb..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_test_lib/boringssl_newhope_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\newhope - - - - - - {f6eddde4-4559-9adb-797f-897631281a89} - - - {81b307de-7498-3465-2ad4-7b634bf4788a} - - - {af9d3e32-2f0f-f0f3-f63f-4a8bd7f07c46} - - - {ea48f773-5060-8693-62ef-f257ccd47b21} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj deleted file mode 100644 index 505f7cf33a8..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {E4C140A1-B7A3-0D00-A02F-CC90C9972F00} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_newhope_vectors_test - static - Debug - static - Debug - - - boringssl_newhope_vectors_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {0993166D-33B9-2E51-B0A9-5035A9086A2E} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d4..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test/boringssl_newhope_vectors_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj deleted file mode 100644 index 4f01ec4b706..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {0993166D-33B9-2E51-B0A9-5035A9086A2E} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_newhope_vectors_test_lib - - - boringssl_newhope_vectors_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj.filters deleted file mode 100644 index 27b208d3507..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_newhope_vectors_test_lib/boringssl_newhope_vectors_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\newhope - - - - - - {678cf897-2d02-4bb5-1872-b6d6d61c528f} - - - {3cc5b2df-8409-e2e8-9504-748004a314f3} - - - {2a4fb92f-e756-007b-f6fc-d8f55fee6096} - - - {09155346-c8e7-ffdb-7791-4f623ac5d521} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test/boringssl_p256-x86_64_test.vcxproj similarity index 97% rename from vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj rename to vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test/boringssl_p256-x86_64_test.vcxproj index f8932983672..b99cdb0a3c7 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test/boringssl_p256-x86_64_test.vcxproj @@ -20,7 +20,7 @@ - {0F12358C-9F7A-E3B5-23EC-250C29C9D3A2} + {AB14282B-1904-75A7-14E9-5D796BA48A6E} true $(SolutionDir)IntDir\$(MSBuildProjectName)\ @@ -62,14 +62,14 @@ - boringssl_chacha_test + boringssl_p256-x86_64_test static Debug static Debug - boringssl_chacha_test + boringssl_p256-x86_64_test static Release static @@ -164,8 +164,8 @@ - - {D15F1CF5-EC88-FDD5-55A0-CBE5DC8A9F29} + + {41EDDD5E-AC73-5406-4816-B884A969A851} {427037B1-B51B-D6F1-5025-AD12B200266A} diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test/boringssl_p256-x86_64_test.vcxproj.filters similarity index 100% rename from vsprojects/vcxproj/test/boringssl/boringssl_chacha_test/boringssl_chacha_test.vcxproj.filters rename to vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test/boringssl_p256-x86_64_test.vcxproj.filters diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj similarity index 97% rename from vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj rename to vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj index 0d35de10a70..ae27f918267 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj @@ -19,7 +19,7 @@ - {4D7D265F-7184-79BB-CDCA-93ADFE0555CA} + {41EDDD5E-AC73-5406-4816-B884A969A851} true $(SolutionDir)IntDir\$(MSBuildProjectName)\ @@ -57,10 +57,10 @@ - boringssl_dsa_test_lib + boringssl_p256-x86_64_test_lib - boringssl_dsa_test_lib + boringssl_p256-x86_64_test_lib @@ -147,7 +147,7 @@ - + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj.filters similarity index 69% rename from vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj.filters rename to vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj.filters index c6b6a253a31..2aedced8e6e 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ec_test_lib/boringssl_ec_test_lib.vcxproj.filters +++ b/vsprojects/vcxproj/test/boringssl/boringssl_p256-x86_64_test_lib/boringssl_p256-x86_64_test_lib.vcxproj.filters @@ -1,23 +1,23 @@ - + third_party\boringssl\crypto\ec - {0c909793-7738-837f-28b9-e775ca31f1e0} + {d58c12fd-d68b-d1cf-8064-02ad7f5bd174} - {845f42f3-1622-7f5a-d949-f6921e429143} + {c404cc15-5ff2-192a-553a-c76dfd4dec24} - {971129bb-6f10-5a13-6770-3334e05d027e} + {59196cf4-477e-4d60-c632-11657bc8eb64} - {0673821d-35d0-95dd-6e39-870eb33127fc} + {e1e4c8c7-c53c-3220-f39f-e10a3a0cf545} diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test/boringssl_pool_test.vcxproj similarity index 97% rename from vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj rename to vsprojects/vcxproj/test/boringssl/boringssl_pool_test/boringssl_pool_test.vcxproj index 085b8ce0e82..9c3525e9155 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_err_test/boringssl_err_test.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test/boringssl_pool_test.vcxproj @@ -20,7 +20,7 @@ - {E8595872-8ABC-0177-B646-0783F8C4ADEF} + {35526D60-E216-B228-DDBA-0629A2F62E94} true $(SolutionDir)IntDir\$(MSBuildProjectName)\ @@ -62,14 +62,14 @@ - boringssl_err_test + boringssl_pool_test static Debug static Debug - boringssl_err_test + boringssl_pool_test static Release static @@ -164,8 +164,8 @@ - - {11E8A736-EEA4-84A8-BCC8-08269674DCBF} + + {92D44604-E9C2-7E21-E2FD-E392F711DE69} {427037B1-B51B-D6F1-5025-AD12B200266A} diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test/boringssl_dh_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test/boringssl_pool_test.vcxproj.filters similarity index 100% rename from vsprojects/vcxproj/test/boringssl/boringssl_dh_test/boringssl_dh_test.vcxproj.filters rename to vsprojects/vcxproj/test/boringssl/boringssl_pool_test/boringssl_pool_test.vcxproj.filters diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj similarity index 97% rename from vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj rename to vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj index aec7e2f64dd..d4d4f319a80 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dh_test_lib/boringssl_dh_test_lib.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj @@ -19,7 +19,7 @@ - {56A4B15E-3DB1-118D-1ED2-4527CA24FE81} + {92D44604-E9C2-7E21-E2FD-E392F711DE69} true $(SolutionDir)IntDir\$(MSBuildProjectName)\ @@ -57,10 +57,10 @@ - boringssl_dh_test_lib + boringssl_pool_test_lib - boringssl_dh_test_lib + boringssl_pool_test_lib @@ -147,7 +147,7 @@ - + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj.filters similarity index 57% rename from vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj.filters rename to vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj.filters index d4bcb3d4126..2c79653ee7c 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_dsa_test_lib/boringssl_dsa_test_lib.vcxproj.filters +++ b/vsprojects/vcxproj/test/boringssl/boringssl_pool_test_lib/boringssl_pool_test_lib.vcxproj.filters @@ -1,23 +1,23 @@ - - third_party\boringssl\crypto\dsa + + third_party\boringssl\crypto\pool - {e872ec56-f98e-8bf1-cf9f-f63207551aab} + {33e3c83d-455d-40bd-1713-c6e23c795524} - {8d566f1f-48e0-4f2e-497d-1b2d3b3a94af} + {e5fa673d-d1f1-d059-ba9e-73f64e5c9d2d} - {e161d8ba-c211-0c32-47d2-524b635a0de1} + {171c153b-3e26-d38a-e68f-928ac1ea6abe} - - {83748c5a-3e97-be8e-9881-c1f2ba816eb8} + + {be0032f3-238e-9f9a-dbf8-3e3994743cd6} diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj index ab0bb50492e..65f0cf58989 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj +++ b/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj @@ -147,7 +147,7 @@ - + diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj.filters index 58d3068efe6..879bef7d841 100644 --- a/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj.filters +++ b/vsprojects/vcxproj/test/boringssl/boringssl_refcount_test_lib/boringssl_refcount_test_lib.vcxproj.filters @@ -1,7 +1,7 @@ - + third_party\boringssl\crypto diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj deleted file mode 100644 index 4916f3ff183..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {2354090D-8BFD-2905-D2B4-89A211F2932A} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_rsa_test - static - Debug - static - Debug - - - boringssl_rsa_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {96D48EA8-C1E0-ECA1-7504-1F7CB7761937} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d4..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test/boringssl_rsa_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj deleted file mode 100644 index 420f70a5ce8..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {96D48EA8-C1E0-ECA1-7504-1F7CB7761937} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_rsa_test_lib - - - boringssl_rsa_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj.filters deleted file mode 100644 index e3450798a9f..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_rsa_test_lib/boringssl_rsa_test_lib.vcxproj.filters +++ /dev/null @@ -1,24 +0,0 @@ - - - - - third_party\boringssl\crypto\rsa - - - - - - {68d305bc-5eb5-b25f-a31b-a1612d05ed35} - - - {b02ccca6-4460-f6a2-3e46-86c2f7bfc21d} - - - {6de000ba-ac5d-11d3-3932-f463ff3ed11e} - - - {25fda1e5-deda-f910-1f28-54b498b5e648} - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj deleted file mode 100644 index eab2cabfd2f..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {2D1CD121-38BD-1C90-FDEC-01DB235D4881} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - boringssl_ssl_test - static - Debug - static - Debug - - - boringssl_ssl_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Console - true - false - true - true - - - - - - - - - - {E5224E90-A17D-5EC6-DDDE-36204B2F2601} - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj.filters deleted file mode 100644 index 00e4276f1d4..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test/boringssl_ssl_test.vcxproj.filters +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj b/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj deleted file mode 100644 index 58122a219d6..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {E5224E90-A17D-5EC6-DDDE-36204B2F2601} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - boringssl_ssl_test_lib - - - boringssl_ssl_test_lib - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - None - false - - - Windows - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - false - None - false - - - Windows - true - false - true - true - - - - - - - - - - {427037B1-B51B-D6F1-5025-AD12B200266A} - - - {9FD9A3EF-C4A3-8390-D8F4-6F86C22A58CE} - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj.filters b/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj.filters deleted file mode 100644 index aed49a863e8..00000000000 --- a/vsprojects/vcxproj/test/boringssl/boringssl_ssl_test_lib/boringssl_ssl_test_lib.vcxproj.filters +++ /dev/null @@ -1,21 +0,0 @@ - - - - - third_party\boringssl\ssl - - - - - - {63e7e5c0-fc47-80d3-1eba-465814020d80} - - - {7052a2bd-7144-f593-6ce0-41c21596a6e1} - - - {969234a8-1735-8a0f-d4b5-a59b08a3e246} - - - - diff --git a/vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj b/vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj deleted file mode 100644 index 218cff8ba9d..00000000000 --- a/vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {AD06B5CD-8D5C-A365-C46B-3CF32237A4F7} - true - $(SolutionDir)IntDir\$(MSBuildProjectName)\ - - - - v100 - - - v110 - - - v120 - - - v140 - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - gpr_stack_lockfree_test - static - Debug - static - Debug - - - gpr_stack_lockfree_test - static - Release - static - Release - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - None - false - - - Console - true - false - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - true - None - false - - - Console - true - false - true - true - - - - - - NotUsing - Level3 - MaxSpeed - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - true - MultiThreaded - true - None - false - - - Console - true - false - true - true - - - - - - - - - - {EAB0A629-17A9-44DB-B5FF-E91A721FE037} - - - {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - diff --git a/vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj.filters b/vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj.filters deleted file mode 100644 index b222ab41283..00000000000 --- a/vsprojects/vcxproj/test/gpr_stack_lockfree_test/gpr_stack_lockfree_test.vcxproj.filters +++ /dev/null @@ -1,21 +0,0 @@ - - - - - test\core\support - - - - - - {de41d2bf-c9ce-7f55-6da3-8d3798fd8fe2} - - - {4867ad9b-2b88-de6a-a1df-7a733d389df9} - - - {fca98aa0-f0c0-9254-ab22-a2792b4b94f0} - - - -