Merge github.com:grpc/grpc into verify

pull/12891/head
Craig Tiller 7 years ago
commit 642bdbea81
  1. 71
      CMakeLists.txt
  2. 12
      INSTALL.md
  3. 82
      Makefile
  4. 16
      build.yaml
  5. 60
      doc/core/moving-to-c++.md
  6. 7
      doc/load-balancing.md
  7. 2
      include/grpc++/server_builder.h
  8. 2
      src/core/ext/census/base_resources.h
  9. 2
      src/core/ext/census/census_interface.h
  10. 2
      src/core/ext/census/census_log.h
  11. 2
      src/core/ext/census/hash_table.h
  12. 2
      src/core/ext/census/mlog.h
  13. 2
      src/core/ext/census/resource.h
  14. 2
      src/core/ext/census/trace_context.h
  15. 2
      src/core/ext/census/trace_propagation.h
  16. 2
      src/core/ext/census/tracing.h
  17. 2
      src/core/ext/census/window_stats.h
  18. 2
      src/core/ext/filters/client_channel/client_channel.h
  19. 2
      src/core/ext/filters/client_channel/client_channel_factory.h
  20. 2
      src/core/ext/filters/client_channel/connector.h
  21. 2
      src/core/ext/filters/client_channel/http_connect_handshaker.h
  22. 2
      src/core/ext/filters/client_channel/http_proxy.h
  23. 55
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  24. 2
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h
  25. 2
      src/core/ext/filters/client_channel/lb_policy_factory.h
  26. 2
      src/core/ext/filters/client_channel/lb_policy_registry.h
  27. 2
      src/core/ext/filters/client_channel/parse_address.h
  28. 2
      src/core/ext/filters/client_channel/proxy_mapper.h
  29. 2
      src/core/ext/filters/client_channel/proxy_mapper_registry.h
  30. 2
      src/core/ext/filters/client_channel/resolver_factory.h
  31. 2
      src/core/ext/filters/client_channel/resolver_registry.h
  32. 2
      src/core/ext/filters/client_channel/retry_throttle.h
  33. 2
      src/core/ext/filters/client_channel/subchannel_index.h
  34. 2
      src/core/ext/filters/client_channel/uri_parser.h
  35. 2
      src/core/ext/filters/deadline/deadline_filter.h
  36. 2
      src/core/ext/filters/workarounds/workaround_utils.h
  37. 2
      src/core/ext/transport/chttp2/alpn/alpn.h
  38. 2
      src/core/ext/transport/chttp2/server/chttp2_server.h
  39. 2
      src/core/ext/transport/chttp2/transport/bin_decoder.h
  40. 2
      src/core/ext/transport/chttp2/transport/bin_encoder.h
  41. 2
      src/core/ext/transport/chttp2/transport/frame_data.h
  42. 2
      src/core/ext/transport/chttp2/transport/frame_goaway.h
  43. 2
      src/core/ext/transport/chttp2/transport/frame_ping.h
  44. 2
      src/core/ext/transport/chttp2/transport/frame_rst_stream.h
  45. 2
      src/core/ext/transport/chttp2/transport/frame_settings.h
  46. 2
      src/core/ext/transport/chttp2/transport/frame_window_update.h
  47. 2
      src/core/ext/transport/chttp2/transport/hpack_encoder.h
  48. 2
      src/core/ext/transport/chttp2/transport/hpack_parser.h
  49. 2
      src/core/ext/transport/chttp2/transport/http2_settings.h
  50. 2
      src/core/ext/transport/chttp2/transport/incoming_metadata.h
  51. 4
      src/core/ext/transport/chttp2/transport/internal.h
  52. 2
      src/core/ext/transport/chttp2/transport/stream_map.h
  53. 686
      src/core/ext/transport/chttp2/transport/writing.cc
  54. 2
      src/core/lib/channel/channel_args.h
  55. 2
      src/core/lib/channel/connected_channel.h
  56. 2
      src/core/lib/channel/handshaker.h
  57. 2
      src/core/lib/channel/handshaker_factory.h
  58. 2
      src/core/lib/channel/handshaker_registry.h
  59. 2
      src/core/lib/compression/algorithm_metadata.h
  60. 2
      src/core/lib/compression/message_compress.h
  61. 2
      src/core/lib/http/format_request.h
  62. 2
      src/core/lib/http/httpcli.h
  63. 2
      src/core/lib/http/parser.h
  64. 2
      src/core/lib/iomgr/endpoint.h
  65. 2
      src/core/lib/iomgr/endpoint_pair.h
  66. 2
      src/core/lib/iomgr/error_internal.h
  67. 2
      src/core/lib/iomgr/ev_epoll1_linux.h
  68. 2
      src/core/lib/iomgr/ev_epollex_linux.h
  69. 2
      src/core/lib/iomgr/ev_epollsig_linux.cc
  70. 2
      src/core/lib/iomgr/ev_poll_posix.h
  71. 31
      src/core/lib/iomgr/ev_posix.cc
  72. 2
      src/core/lib/iomgr/ev_posix.h
  73. 2
      src/core/lib/iomgr/executor.h
  74. 9
      src/core/lib/iomgr/iocp_windows.cc
  75. 2
      src/core/lib/iomgr/iocp_windows.h
  76. 2
      src/core/lib/iomgr/iomgr.h
  77. 2
      src/core/lib/iomgr/iomgr_internal.h
  78. 2
      src/core/lib/iomgr/is_epollexclusive_available.h
  79. 2
      src/core/lib/iomgr/lockfree_event.h
  80. 2
      src/core/lib/iomgr/network_status_tracker.h
  81. 2
      src/core/lib/iomgr/polling_entity.h
  82. 2
      src/core/lib/iomgr/pollset_set.h
  83. 2
      src/core/lib/iomgr/pollset_uv.h
  84. 2
      src/core/lib/iomgr/pollset_windows.h
  85. 2
      src/core/lib/iomgr/resolve_address.h
  86. 2
      src/core/lib/iomgr/resource_quota.h
  87. 2
      src/core/lib/iomgr/sockaddr_utils.h
  88. 2
      src/core/lib/iomgr/socket_utils.h
  89. 2
      src/core/lib/iomgr/socket_utils_posix.h
  90. 2
      src/core/lib/iomgr/socket_windows.h
  91. 2
      src/core/lib/iomgr/tcp_client.h
  92. 2
      src/core/lib/iomgr/tcp_client_posix.h
  93. 2
      src/core/lib/iomgr/tcp_posix.h
  94. 2
      src/core/lib/iomgr/tcp_server.h
  95. 2
      src/core/lib/iomgr/tcp_server_utils_posix.h
  96. 2
      src/core/lib/iomgr/tcp_uv.h
  97. 2
      src/core/lib/iomgr/time_averaged_stats.h
  98. 2
      src/core/lib/iomgr/timer_heap.h
  99. 2
      src/core/lib/iomgr/timer_manager.h
  100. 2
      src/core/lib/iomgr/udp_server.h
  101. Some files were not shown because too many files have changed in this diff Show More

@ -592,7 +592,6 @@ add_dependencies(buildtests_c h2_sockpair_test)
add_dependencies(buildtests_c h2_sockpair+trace_test) add_dependencies(buildtests_c h2_sockpair+trace_test)
add_dependencies(buildtests_c h2_sockpair_1byte_test) add_dependencies(buildtests_c h2_sockpair_1byte_test)
add_dependencies(buildtests_c h2_ssl_test) add_dependencies(buildtests_c h2_ssl_test)
add_dependencies(buildtests_c h2_ssl_cert_test)
add_dependencies(buildtests_c h2_ssl_proxy_test) add_dependencies(buildtests_c h2_ssl_proxy_test)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_c h2_uds_test) add_dependencies(buildtests_c h2_uds_test)
@ -704,6 +703,7 @@ add_dependencies(buildtests_cxx grpc_tool_test)
add_dependencies(buildtests_cxx grpclb_api_test) add_dependencies(buildtests_cxx grpclb_api_test)
add_dependencies(buildtests_cxx grpclb_end2end_test) add_dependencies(buildtests_cxx grpclb_end2end_test)
add_dependencies(buildtests_cxx grpclb_test) add_dependencies(buildtests_cxx grpclb_test)
add_dependencies(buildtests_cxx h2_ssl_cert_test)
add_dependencies(buildtests_cxx health_service_end2end_test) add_dependencies(buildtests_cxx health_service_end2end_test)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_cxx http2_client) add_dependencies(buildtests_cxx http2_client)
@ -11163,6 +11163,45 @@ target_link_libraries(grpclb_test
endif (gRPC_BUILD_TESTS) endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS)
add_executable(h2_ssl_cert_test
test/core/end2end/h2_ssl_cert_test.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
)
target_include_directories(h2_ssl_cert_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_INCLUDE_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include
PRIVATE third_party/googletest/googletest/include
PRIVATE third_party/googletest/googletest
PRIVATE third_party/googletest/googlemock/include
PRIVATE third_party/googletest/googlemock
PRIVATE ${_gRPC_PROTO_GENS_DIR}
)
target_link_libraries(h2_ssl_cert_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util
grpc++
grpc
gpr_test_util
gpr
${_gRPC_GFLAGS_LIBRARIES}
)
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(health_service_end2end_test add_executable(health_service_end2end_test
test/cpp/end2end/health_service_end2end_test.cc test/cpp/end2end/health_service_end2end_test.cc
third_party/googletest/googletest/src/gtest-all.cc third_party/googletest/googletest/src/gtest-all.cc
@ -13585,36 +13624,6 @@ target_link_libraries(h2_ssl_test
endif (gRPC_BUILD_TESTS) endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS)
add_executable(h2_ssl_cert_test
test/core/end2end/fixtures/h2_ssl_cert.c
)
target_include_directories(h2_ssl_cert_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_INCLUDE_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include
)
target_link_libraries(h2_ssl_cert_test
${_gRPC_ALLTARGETS_LIBRARIES}
end2end_tests
grpc_test_util
grpc
gpr_test_util
gpr
)
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(h2_ssl_proxy_test add_executable(h2_ssl_proxy_test
test/core/end2end/fixtures/h2_ssl_proxy.c test/core/end2end/fixtures/h2_ssl_proxy.c
) )

@ -94,6 +94,7 @@ on experience with the tools involved.
### Building using CMake (RECOMMENDED) ### Building using CMake (RECOMMENDED)
Builds gRPC C and C++ with boringssl. Builds gRPC C and C++ with boringssl.
- Install Visual Studio 2015 or 2017 (Visual C++ compiler will be used).
- Install [CMake](https://cmake.org/download/). - Install [CMake](https://cmake.org/download/).
- Install [Active State Perl](https://www.activestate.com/activeperl/) (`choco install activeperl`) - Install [Active State Perl](https://www.activestate.com/activeperl/) (`choco install activeperl`)
- Install [Ninja](https://ninja-build.org/) (`choco install ninja`) - Install [Ninja](https://ninja-build.org/) (`choco install ninja`)
@ -101,7 +102,9 @@ Builds gRPC C and C++ with boringssl.
- Install [yasm](http://yasm.tortall.net/) and add it to `PATH` (`choco install yasm`) - Install [yasm](http://yasm.tortall.net/) and add it to `PATH` (`choco install yasm`)
- Run these commands in the repo root directory - Run these commands in the repo root directory
Using Ninja (faster build, supports boringssl's assembly optimizations) #### cmake: Using Ninja (faster build, supports boringssl's assembly optimizations).
Please note that when using Ninja, you'll still need Visual C++ (part of Visual Studio)
installed to be able to compile the C/C++ sources.
``` ```
> md .build > md .build
> cd .build > cd .build
@ -110,7 +113,12 @@ Using Ninja (faster build, supports boringssl's assembly optimizations)
> cmake --build . > cmake --build .
``` ```
Using Visual Studio 2015 (can only build with OPENSSL_NO_ASM) #### cmake: Using Visual Studio 2015 (can only build with OPENSSL_NO_ASM).
When using the "Visual Studio" generator,
cmake will generate a solution (`grpc.sln`) that contains a VS project for
every target defined in `CMakeLists.txt` (+ few extra convenience projects
added automatically by cmake). After opening the solution with Visual Studio
you will be able to browse and build the code as usual.
``` ```
> md .build > md .build
> cd .build > cd .build

@ -1145,6 +1145,7 @@ grpc_tool_test: $(BINDIR)/$(CONFIG)/grpc_tool_test
grpclb_api_test: $(BINDIR)/$(CONFIG)/grpclb_api_test grpclb_api_test: $(BINDIR)/$(CONFIG)/grpclb_api_test
grpclb_end2end_test: $(BINDIR)/$(CONFIG)/grpclb_end2end_test grpclb_end2end_test: $(BINDIR)/$(CONFIG)/grpclb_end2end_test
grpclb_test: $(BINDIR)/$(CONFIG)/grpclb_test grpclb_test: $(BINDIR)/$(CONFIG)/grpclb_test
h2_ssl_cert_test: $(BINDIR)/$(CONFIG)/h2_ssl_cert_test
health_service_end2end_test: $(BINDIR)/$(CONFIG)/health_service_end2end_test health_service_end2end_test: $(BINDIR)/$(CONFIG)/health_service_end2end_test
http2_client: $(BINDIR)/$(CONFIG)/http2_client http2_client: $(BINDIR)/$(CONFIG)/http2_client
hybrid_end2end_test: $(BINDIR)/$(CONFIG)/hybrid_end2end_test hybrid_end2end_test: $(BINDIR)/$(CONFIG)/hybrid_end2end_test
@ -1247,7 +1248,6 @@ h2_sockpair_test: $(BINDIR)/$(CONFIG)/h2_sockpair_test
h2_sockpair+trace_test: $(BINDIR)/$(CONFIG)/h2_sockpair+trace_test h2_sockpair+trace_test: $(BINDIR)/$(CONFIG)/h2_sockpair+trace_test
h2_sockpair_1byte_test: $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_test h2_sockpair_1byte_test: $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_test
h2_ssl_test: $(BINDIR)/$(CONFIG)/h2_ssl_test h2_ssl_test: $(BINDIR)/$(CONFIG)/h2_ssl_test
h2_ssl_cert_test: $(BINDIR)/$(CONFIG)/h2_ssl_cert_test
h2_ssl_proxy_test: $(BINDIR)/$(CONFIG)/h2_ssl_proxy_test h2_ssl_proxy_test: $(BINDIR)/$(CONFIG)/h2_ssl_proxy_test
h2_uds_test: $(BINDIR)/$(CONFIG)/h2_uds_test h2_uds_test: $(BINDIR)/$(CONFIG)/h2_uds_test
inproc_test: $(BINDIR)/$(CONFIG)/inproc_test inproc_test: $(BINDIR)/$(CONFIG)/inproc_test
@ -1507,7 +1507,6 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/h2_sockpair+trace_test \ $(BINDIR)/$(CONFIG)/h2_sockpair+trace_test \
$(BINDIR)/$(CONFIG)/h2_sockpair_1byte_test \ $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_test \
$(BINDIR)/$(CONFIG)/h2_ssl_test \ $(BINDIR)/$(CONFIG)/h2_ssl_test \
$(BINDIR)/$(CONFIG)/h2_ssl_cert_test \
$(BINDIR)/$(CONFIG)/h2_ssl_proxy_test \ $(BINDIR)/$(CONFIG)/h2_ssl_proxy_test \
$(BINDIR)/$(CONFIG)/h2_uds_test \ $(BINDIR)/$(CONFIG)/h2_uds_test \
$(BINDIR)/$(CONFIG)/inproc_test \ $(BINDIR)/$(CONFIG)/inproc_test \
@ -1583,6 +1582,7 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/grpclb_api_test \ $(BINDIR)/$(CONFIG)/grpclb_api_test \
$(BINDIR)/$(CONFIG)/grpclb_end2end_test \ $(BINDIR)/$(CONFIG)/grpclb_end2end_test \
$(BINDIR)/$(CONFIG)/grpclb_test \ $(BINDIR)/$(CONFIG)/grpclb_test \
$(BINDIR)/$(CONFIG)/h2_ssl_cert_test \
$(BINDIR)/$(CONFIG)/health_service_end2end_test \ $(BINDIR)/$(CONFIG)/health_service_end2end_test \
$(BINDIR)/$(CONFIG)/http2_client \ $(BINDIR)/$(CONFIG)/http2_client \
$(BINDIR)/$(CONFIG)/hybrid_end2end_test \ $(BINDIR)/$(CONFIG)/hybrid_end2end_test \
@ -1703,6 +1703,7 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/grpclb_api_test \ $(BINDIR)/$(CONFIG)/grpclb_api_test \
$(BINDIR)/$(CONFIG)/grpclb_end2end_test \ $(BINDIR)/$(CONFIG)/grpclb_end2end_test \
$(BINDIR)/$(CONFIG)/grpclb_test \ $(BINDIR)/$(CONFIG)/grpclb_test \
$(BINDIR)/$(CONFIG)/h2_ssl_cert_test \
$(BINDIR)/$(CONFIG)/health_service_end2end_test \ $(BINDIR)/$(CONFIG)/health_service_end2end_test \
$(BINDIR)/$(CONFIG)/http2_client \ $(BINDIR)/$(CONFIG)/http2_client \
$(BINDIR)/$(CONFIG)/hybrid_end2end_test \ $(BINDIR)/$(CONFIG)/hybrid_end2end_test \
@ -2109,6 +2110,8 @@ test_cxx: buildtests_cxx
$(Q) $(BINDIR)/$(CONFIG)/grpclb_end2end_test || ( echo test grpclb_end2end_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/grpclb_end2end_test || ( echo test grpclb_end2end_test failed ; exit 1 )
$(E) "[RUN] Testing grpclb_test" $(E) "[RUN] Testing grpclb_test"
$(Q) $(BINDIR)/$(CONFIG)/grpclb_test || ( echo test grpclb_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/grpclb_test || ( echo test grpclb_test failed ; exit 1 )
$(E) "[RUN] Testing h2_ssl_cert_test"
$(Q) $(BINDIR)/$(CONFIG)/h2_ssl_cert_test || ( echo test h2_ssl_cert_test failed ; exit 1 )
$(E) "[RUN] Testing health_service_end2end_test" $(E) "[RUN] Testing health_service_end2end_test"
$(Q) $(BINDIR)/$(CONFIG)/health_service_end2end_test || ( echo test health_service_end2end_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/health_service_end2end_test || ( echo test health_service_end2end_test failed ; exit 1 )
$(E) "[RUN] Testing interop_test" $(E) "[RUN] Testing interop_test"
@ -15653,6 +15656,49 @@ endif
$(OBJDIR)/$(CONFIG)/test/cpp/grpclb/grpclb_test.o: $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.pb.cc $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/grpclb/grpclb_test.o: $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.pb.cc $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc
H2_SSL_CERT_TEST_SRC = \
test/core/end2end/h2_ssl_cert_test.cc \
H2_SSL_CERT_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(H2_SSL_CERT_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/h2_ssl_cert_test: openssl_dep_error
else
ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
$(BINDIR)/$(CONFIG)/h2_ssl_cert_test: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/h2_ssl_cert_test: $(PROTOBUF_DEP) $(H2_SSL_CERT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(H2_SSL_CERT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/h2_ssl_cert_test
endif
endif
$(OBJDIR)/$(CONFIG)/test/core/end2end/h2_ssl_cert_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_h2_ssl_cert_test: $(H2_SSL_CERT_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(H2_SSL_CERT_TEST_OBJS:.o=.dep)
endif
endif
HEALTH_SERVICE_END2END_TEST_SRC = \ HEALTH_SERVICE_END2END_TEST_SRC = \
test/cpp/end2end/health_service_end2end_test.cc \ test/cpp/end2end/health_service_end2end_test.cc \
@ -19100,38 +19146,6 @@ endif
endif endif
H2_SSL_CERT_TEST_SRC = \
test/core/end2end/fixtures/h2_ssl_cert.c \
H2_SSL_CERT_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(H2_SSL_CERT_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/h2_ssl_cert_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/h2_ssl_cert_test: $(H2_SSL_CERT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(H2_SSL_CERT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_ssl_cert_test
endif
$(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_ssl_cert.o: $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_h2_ssl_cert_test: $(H2_SSL_CERT_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(H2_SSL_CERT_TEST_OBJS:.o=.dep)
endif
endif
H2_SSL_PROXY_TEST_SRC = \ H2_SSL_PROXY_TEST_SRC = \
test/core/end2end/fixtures/h2_ssl_proxy.c \ test/core/end2end/fixtures/h2_ssl_proxy.c \

@ -4159,6 +4159,22 @@ targets:
excluded_poll_engines: excluded_poll_engines:
- poll - poll
- poll-cv - poll-cv
- name: h2_ssl_cert_test
gtest: true
build: test
language: c++
headers:
- test/core/end2end/end2end_tests.h
src:
- test/core/end2end/h2_ssl_cert_test.cc
deps:
- grpc_test_util
- grpc++
- grpc
- gpr_test_util
- gpr
uses:
- grpc++_test
- name: health_service_end2end_test - name: health_service_end2end_test
gtest: true gtest: true
build: test build: test

@ -0,0 +1,60 @@
# Moving gRPC core to C++
October 2017
ctiller, markdroth, vjpai
## Background and Goal
gRPC core was originally written in C89 for several reasons
(possibility of kernel integration, ease of wrapping, compiler
support, etc). Over time, this was changed to C99 as all relevant
compilers in active use came to support C99 effectively.
[Now, gRPC core is C++](https://github.com/grpc/proposal/blob/master/L6-allow-c%2B%2B-in-grpc-core.md)
(although the code is still idiomatically C code) with C linkage for
public functions. Throughout all of these transitions, the public
header files are committed to remain in C89.
The goal now is to make the gRPC core implementation true idiomatic
C++ compatible with
[Google's C++ style guide](https://google.github.io/styleguide/cppguide.html).
## Constraints
- No use of standard library
- Standard library makes wrapping difficult/impossible and also reduces platform portability
- This takes precedence over using C++ style guide
- But lambdas are ok
- As are third-party libraries that meet our build requirements (such as many parts of abseil)
- There will be some C++ features that don't work
- `new` and `delete`
- pure virtual functions are not allowed because the message that prints out "Pure Virtual Function called" is part of the standard library
- Make a `#define GRPC_ABSTRACT {GPR_ASSERT(false);}` instead of `= 0;`
- The sanity for making sure that we don't depend on libstdc++ is that at least some tests should explicitly not include it
- Most tests can migrate to use gtest
- There are tremendous # of code paths that can now be exposed to unit tests because of the use of gtest and C++
- But at least some tests should not use gtest
## Roadmap
- What should be the phases of getting code converted to idiomatic C++
- Opportunistically do leaf code that other parts don't depend on
- Spend a little time deciding how to do non-leaf stuff that isn't central or polymorphic (e.g., timer, call combiner)
- For big central or polymorphic interfaces, actually do an API review (for things like transport, filter API, endpoint, closure, exec_ctx, ...) .
- Core internal changes don't need a gRFC, but core surface changes do
- But an API review should include at least a PR with the header change and tests to use it before it gets used more broadly
- iomgr polling for POSIX is a gray area whether it's a leaf or central
- What is the schedule?
- In Q4 2017, if some stuff happens opportunistically, great; otherwise ¯\\\_(ツ)\_/¯
- More updates as team time becomes available and committed to this project
## Implications for C++ API and wrapped languages
- For C++ structs, switch to `using` when possible (e.g., Slice,
ByteBuffer, ...)
- The C++ API implementation might directly start using
`grpc_transport_stream_op_batch` rather than the core surface `grpc_op`.
- Can we get wrapped languages to a point where we can statically link C++? This will take a year in probability but that would allow the use of `std::`
- Are there other environments that don't support std library, like maybe Android NDK?
- Probably, that might push things out to 18 months

@ -129,10 +129,9 @@ works:
by the resolver. It asks the balancer for the server addresses to by the resolver. It asks the balancer for the server addresses to
use for the server name originally requested by the client (i.e., use for the server name originally requested by the client (i.e.,
the same one originally passed to the name resolver). the same one originally passed to the name resolver).
- Note: The `grpclb` policy currently ignores any non-balancer - Note: In the `grpclb` policy, the non-balancer addresses returned
addresses returned by the resolver. However, in the future, it by the resolver are used as a fallback in case no balancers can be
may be changed to use these addresses as a fallback in case no contacted when the LB policy is started.
balancers can be contacted.
2. The gRPC servers to which the load balancer is directing the client 2. The gRPC servers to which the load balancer is directing the client
may report load to the load balancers, if that information is needed may report load to the load balancers, if that information is needed
by the load balancer's configuration. by the load balancer's configuration.

@ -140,7 +140,7 @@ class ServerBuilder {
/// please use IPv6 any, i.e., [::]:<port>, which also accepts IPv4 /// please use IPv6 any, i.e., [::]:<port>, which also accepts IPv4
/// connections. Valid values include dns:///localhost:1234, / /// connections. Valid values include dns:///localhost:1234, /
/// 192.168.1.1:31416, dns:///[::1]:27182, etc.). /// 192.168.1.1:31416, dns:///[::1]:27182, etc.).
/// \params creds The credentials associated with the server. /// \param creds The credentials associated with the server.
/// \param selected_port[out] If not `nullptr`, gets populated with the port /// \param selected_port[out] If not `nullptr`, gets populated with the port
/// number bound to the \a grpc::Server for the corresponding endpoint after /// number bound to the \a grpc::Server for the corresponding endpoint after
/// it is successfully bound, 0 otherwise. /// it is successfully bound, 0 otherwise.

@ -29,4 +29,4 @@ void define_base_resources();
} }
#endif #endif
#endif /* GRPC_CORE_EXT_CENSUS_BASE_RESOURCES_H */ #endif /* GRPC_CORE_EXT_CENSUS_BASE_RESOURCES_H */

@ -66,4 +66,4 @@ void census_tracing_end_op(census_op_id op_id);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_CENSUS_CENSUS_INTERFACE_H */ #endif /* GRPC_CORE_EXT_CENSUS_CENSUS_INTERFACE_H */

@ -81,4 +81,4 @@ int census_log_out_of_space_count(void);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_CENSUS_CENSUS_LOG_H */ #endif /* GRPC_CORE_EXT_CENSUS_CENSUS_LOG_H */

@ -121,4 +121,4 @@ uint64_t census_ht_for_all(const census_ht *ht, census_ht_itr_cb);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_CENSUS_HASH_TABLE_H */ #endif /* GRPC_CORE_EXT_CENSUS_HASH_TABLE_H */

@ -85,4 +85,4 @@ int64_t census_log_out_of_space_count(void);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_CENSUS_MLOG_H */ #endif /* GRPC_CORE_EXT_CENSUS_MLOG_H */

@ -53,4 +53,4 @@ int32_t define_resource(const resource *base);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_CENSUS_RESOURCE_H */ #endif /* GRPC_CORE_EXT_CENSUS_RESOURCE_H */

@ -61,4 +61,4 @@ bool decode_trace_context(google_trace_TraceContext *ctxt, uint8_t *buffer,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_CENSUS_TRACE_CONTEXT_H */ #endif /* GRPC_CORE_EXT_CENSUS_TRACE_CONTEXT_H */

@ -53,4 +53,4 @@ size_t http_format_to_trace_span_context(const char *buf, size_t buf_size,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_CENSUS_TRACE_PROPAGATION_H */ #endif /* GRPC_CORE_EXT_CENSUS_TRACE_PROPAGATION_H */

@ -114,4 +114,4 @@ void trace_end_span(const trace_status *status, trace_span_context *span_ctxt);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_CENSUS_TRACING_H */ #endif /* GRPC_CORE_EXT_CENSUS_TRACING_H */

@ -163,4 +163,4 @@ void census_window_stats_destroy(struct census_window_stats *wstats);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_CENSUS_WINDOW_STATS_H */ #endif /* GRPC_CORE_EXT_CENSUS_WINDOW_STATS_H */

@ -60,4 +60,4 @@ grpc_subchannel_call *grpc_client_channel_get_subchannel_call(
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_H */

@ -82,4 +82,4 @@ grpc_arg grpc_client_channel_factory_create_channel_arg(
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_FACTORY_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_FACTORY_H */

@ -78,4 +78,4 @@ void grpc_connector_shutdown(grpc_exec_ctx *exec_ctx, grpc_connector *connector,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CONNECTOR_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CONNECTOR_H */

@ -39,4 +39,4 @@ void grpc_http_connect_register_handshaker_factory();
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_CONNECT_HANDSHAKER_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_CONNECT_HANDSHAKER_H */

@ -29,4 +29,4 @@ void grpc_register_http_proxy_mapper();
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_PROXY_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_PROXY_H */

@ -345,9 +345,6 @@ typedef struct glb_lb_policy {
/** are we currently updating lb_call? */ /** are we currently updating lb_call? */
bool updating_lb_call; bool updating_lb_call;
/** are we currently updating lb_channel? */
bool updating_lb_channel;
/** are we already watching the LB channel's connectivity? */ /** are we already watching the LB channel's connectivity? */
bool watching_lb_channel; bool watching_lb_channel;
@ -360,9 +357,6 @@ typedef struct glb_lb_policy {
/** called upon changes to the LB channel's connectivity. */ /** called upon changes to the LB channel's connectivity. */
grpc_closure lb_channel_on_connectivity_changed; grpc_closure lb_channel_on_connectivity_changed;
/** args from the latest update received while already updating, or NULL */
grpc_lb_policy_args *pending_update_args;
/************************************************************/ /************************************************************/
/* client data associated with the LB server communication */ /* client data associated with the LB server communication */
/************************************************************/ /************************************************************/
@ -982,10 +976,6 @@ static void glb_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
} }
grpc_fake_resolver_response_generator_unref(glb_policy->response_generator); grpc_fake_resolver_response_generator_unref(glb_policy->response_generator);
grpc_subchannel_index_unref(); grpc_subchannel_index_unref();
if (glb_policy->pending_update_args != NULL) {
grpc_channel_args_destroy(exec_ctx, glb_policy->pending_update_args->args);
gpr_free(glb_policy->pending_update_args);
}
gpr_free(glb_policy); gpr_free(glb_policy);
} }
@ -1752,45 +1742,22 @@ static void glb_update_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
} }
const grpc_lb_addresses *addresses = const grpc_lb_addresses *addresses =
(const grpc_lb_addresses *)arg->value.pointer.p; (const grpc_lb_addresses *)arg->value.pointer.p;
// If a non-empty serverlist hasn't been received from the balancer,
// propagate the update to fallback_backend_addresses.
if (glb_policy->serverlist == NULL) { if (glb_policy->serverlist == NULL) {
// If a non-empty serverlist hasn't been received from the balancer,
// propagate the update to fallback_backend_addresses.
fallback_update_locked(exec_ctx, glb_policy, addresses); fallback_update_locked(exec_ctx, glb_policy, addresses);
} else if (glb_policy->updating_lb_channel) {
// If we have recieved serverlist from the balancer, we need to defer update
// when there is an in-progress one.
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
gpr_log(GPR_INFO,
"Update already in progress for grpclb %p. Deferring update.",
(void *)glb_policy);
}
if (glb_policy->pending_update_args != NULL) {
grpc_channel_args_destroy(exec_ctx,
glb_policy->pending_update_args->args);
gpr_free(glb_policy->pending_update_args);
}
glb_policy->pending_update_args = (grpc_lb_policy_args *)gpr_zalloc(
sizeof(*glb_policy->pending_update_args));
glb_policy->pending_update_args->client_channel_factory =
args->client_channel_factory;
glb_policy->pending_update_args->args = grpc_channel_args_copy(args->args);
glb_policy->pending_update_args->combiner = args->combiner;
return;
} }
glb_policy->updating_lb_channel = true;
GPR_ASSERT(glb_policy->lb_channel != NULL); GPR_ASSERT(glb_policy->lb_channel != NULL);
// Propagate updates to the LB channel (pick_first) through the fake
// resolver.
grpc_channel_args *lb_channel_args = build_lb_channel_args( grpc_channel_args *lb_channel_args = build_lb_channel_args(
exec_ctx, addresses, glb_policy->response_generator, args->args); exec_ctx, addresses, glb_policy->response_generator, args->args);
/* Propagate updates to the LB channel (pick first) through the fake resolver
*/
grpc_fake_resolver_response_generator_set_response( grpc_fake_resolver_response_generator_set_response(
exec_ctx, glb_policy->response_generator, lb_channel_args); exec_ctx, glb_policy->response_generator, lb_channel_args);
grpc_channel_args_destroy(exec_ctx, lb_channel_args); grpc_channel_args_destroy(exec_ctx, lb_channel_args);
// Start watching the LB channel connectivity for connection, if not
// already doing so.
if (!glb_policy->watching_lb_channel) { if (!glb_policy->watching_lb_channel) {
// Watch the LB channel connectivity for connection.
glb_policy->lb_channel_connectivity = grpc_channel_check_connectivity_state( glb_policy->lb_channel_connectivity = grpc_channel_check_connectivity_state(
glb_policy->lb_channel, true /* try to connect */); glb_policy->lb_channel, true /* try to connect */);
grpc_channel_element *client_channel_elem = grpc_channel_stack_last_element( grpc_channel_element *client_channel_elem = grpc_channel_stack_last_element(
@ -1842,18 +1809,10 @@ static void glb_lb_channel_on_connectivity_changed_cb(grpc_exec_ctx *exec_ctx,
/* fallthrough */ /* fallthrough */
case GRPC_CHANNEL_READY: case GRPC_CHANNEL_READY:
if (glb_policy->lb_call != NULL) { if (glb_policy->lb_call != NULL) {
glb_policy->updating_lb_channel = false;
glb_policy->updating_lb_call = true; glb_policy->updating_lb_call = true;
grpc_call_cancel(glb_policy->lb_call, NULL); grpc_call_cancel(glb_policy->lb_call, NULL);
// lb_on_server_status_received will pick up the cancel and reinit // lb_on_server_status_received() will pick up the cancel and reinit
// lb_call. // lb_call.
if (glb_policy->pending_update_args != NULL) {
grpc_lb_policy_args *args = glb_policy->pending_update_args;
glb_policy->pending_update_args = NULL;
glb_update_locked(exec_ctx, &glb_policy->base, args);
grpc_channel_args_destroy(exec_ctx, args->args);
gpr_free(args);
}
} else if (glb_policy->started_picking && !glb_policy->shutting_down) { } else if (glb_policy->started_picking && !glb_policy->shutting_down) {
if (glb_policy->retry_timer_active) { if (glb_policy->retry_timer_active) {
grpc_timer_cancel(exec_ctx, &glb_policy->lb_call_retry_timer); grpc_timer_cancel(exec_ctx, &glb_policy->lb_call_retry_timer);

@ -34,4 +34,4 @@ grpc_lb_policy_factory *grpc_glb_lb_factory_create();
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_H */

@ -138,4 +138,4 @@ grpc_lb_policy *grpc_lb_policy_factory_create_lb_policy(
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_FACTORY_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_FACTORY_H */

@ -45,4 +45,4 @@ grpc_lb_policy *grpc_lb_policy_create(grpc_exec_ctx *exec_ctx, const char *name,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_REGISTRY_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_REGISTRY_H */

@ -53,4 +53,4 @@ bool grpc_parse_ipv6_hostport(const char *hostport, grpc_resolved_address *addr,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H */

@ -79,4 +79,4 @@ void grpc_proxy_mapper_destroy(grpc_proxy_mapper* mapper);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PROXY_MAPPER_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PROXY_MAPPER_H */

@ -49,4 +49,4 @@ bool grpc_proxy_mappers_map_address(grpc_exec_ctx* exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PROXY_MAPPER_REGISTRY_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PROXY_MAPPER_REGISTRY_H */

@ -75,4 +75,4 @@ char *grpc_resolver_factory_get_default_authority(
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H */

@ -74,4 +74,4 @@ char *grpc_resolver_factory_add_default_prefix_if_needed(
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H */

@ -55,4 +55,4 @@ grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RETRY_THROTTLE_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RETRY_THROTTLE_H */

@ -86,4 +86,4 @@ void grpc_subchannel_index_test_only_set_force_creation(bool force_creation);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SUBCHANNEL_INDEX_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SUBCHANNEL_INDEX_H */

@ -55,4 +55,4 @@ void grpc_uri_destroy(grpc_uri *uri);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_URI_PARSER_H */ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_URI_PARSER_H */

@ -98,4 +98,4 @@ extern const grpc_channel_filter grpc_server_deadline_filter;
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H */ #endif /* GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H */

@ -42,4 +42,4 @@ void grpc_register_workaround(uint32_t id, user_agent_parser parser);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS_H */ #endif /* GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS_H */

@ -39,4 +39,4 @@ const char *grpc_chttp2_get_alpn_version_index(size_t i);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_ALPN_ALPN_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_ALPN_ALPN_H */

@ -37,4 +37,4 @@ grpc_error *grpc_chttp2_server_add_port(grpc_exec_ctx *exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H */

@ -57,4 +57,4 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx *exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */

@ -44,4 +44,4 @@ grpc_slice grpc_chttp2_base64_encode_and_huffman_compress(grpc_slice input);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H */

@ -88,4 +88,4 @@ grpc_error *grpc_deframe_unprocessed_incoming_frames(
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */

@ -68,4 +68,4 @@ void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H */

@ -49,4 +49,4 @@ void grpc_set_disable_ping_ack(bool disable_ping_ack);
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H */

@ -48,4 +48,4 @@ grpc_error *grpc_chttp2_rst_stream_parser_parse(grpc_exec_ctx *exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H */

@ -66,4 +66,4 @@ grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H */

@ -47,4 +47,4 @@ grpc_error *grpc_chttp2_window_update_parser_parse(
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H */

@ -99,4 +99,4 @@ void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H */

@ -119,4 +119,4 @@ grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H */

@ -64,4 +64,4 @@ extern const grpc_chttp2_setting_parameters
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H */

@ -53,4 +53,4 @@ void grpc_chttp2_incoming_metadata_buffer_set_deadline(
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INCOMING_METADATA_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INCOMING_METADATA_H */

@ -657,8 +657,8 @@ bool grpc_chttp2_list_add_writable_stream(grpc_chttp2_transport *t,
returns non-zero if there was a stream available */ returns non-zero if there was a stream available */
bool grpc_chttp2_list_pop_writable_stream(grpc_chttp2_transport *t, bool grpc_chttp2_list_pop_writable_stream(grpc_chttp2_transport *t,
grpc_chttp2_stream **s); grpc_chttp2_stream **s);
bool grpc_chttp2_list_remove_writable_stream( bool grpc_chttp2_list_remove_writable_stream(grpc_chttp2_transport *t,
grpc_chttp2_transport *t, grpc_chttp2_stream *s) GRPC_MUST_USE_RESULT; grpc_chttp2_stream *s);
bool grpc_chttp2_list_add_writing_stream(grpc_chttp2_transport *t, bool grpc_chttp2_list_add_writing_stream(grpc_chttp2_transport *t,
grpc_chttp2_stream *s); grpc_chttp2_stream *s);

@ -73,4 +73,4 @@ void grpc_chttp2_stream_map_for_each(grpc_chttp2_stream_map *map,
} }
#endif #endif
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_STREAM_MAP_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_STREAM_MAP_H */

@ -174,343 +174,451 @@ static bool is_default_initial_metadata(grpc_metadata_batch *initial_metadata) {
return initial_metadata->list.default_count == initial_metadata->list.count; return initial_metadata->list.default_count == initial_metadata->list.count;
} }
grpc_chttp2_begin_write_result grpc_chttp2_begin_write( namespace {
grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { class StreamWriteContext;
grpc_chttp2_stream *s;
class WriteContext {
/* stats histogram counters: we increment these throughout this function, public:
and at the end publish to the central stats histograms */ WriteContext(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) : t_(t) {
int flow_control_writes = 0; GRPC_STATS_INC_HTTP2_WRITES_BEGUN(exec_ctx);
int initial_metadata_writes = 0; GPR_TIMER_BEGIN("grpc_chttp2_begin_write", 0);
int trailing_metadata_writes = 0; }
int message_writes = 0;
GRPC_STATS_INC_HTTP2_WRITES_BEGUN(exec_ctx); // TODO(ctiller): make this the destructor
void FlushStats(grpc_exec_ctx *exec_ctx) {
GRPC_STATS_INC_HTTP2_SEND_INITIAL_METADATA_PER_WRITE(
exec_ctx, initial_metadata_writes_);
GRPC_STATS_INC_HTTP2_SEND_MESSAGE_PER_WRITE(exec_ctx, message_writes_);
GRPC_STATS_INC_HTTP2_SEND_TRAILING_METADATA_PER_WRITE(
exec_ctx, trailing_metadata_writes_);
GRPC_STATS_INC_HTTP2_SEND_FLOWCTL_PER_WRITE(exec_ctx, flow_control_writes_);
}
GPR_TIMER_BEGIN("grpc_chttp2_begin_write", 0); void FlushSettings(grpc_exec_ctx *exec_ctx) {
if (t_->dirtied_local_settings && !t_->sent_local_settings) {
grpc_slice_buffer_add(
&t_->outbuf, grpc_chttp2_settings_create(
t_->settings[GRPC_SENT_SETTINGS],
t_->settings[GRPC_LOCAL_SETTINGS],
t_->force_send_settings, GRPC_CHTTP2_NUM_SETTINGS));
t_->force_send_settings = false;
t_->dirtied_local_settings = false;
t_->sent_local_settings = true;
GRPC_STATS_INC_HTTP2_SETTINGS_WRITES(exec_ctx);
}
}
if (t->dirtied_local_settings && !t->sent_local_settings) { void FlushQueuedBuffers(grpc_exec_ctx *exec_ctx) {
grpc_slice_buffer_add( /* simple writes are queued to qbuf, and flushed here */
&t->outbuf, grpc_slice_buffer_move_into(&t_->qbuf, &t_->outbuf);
grpc_chttp2_settings_create( GPR_ASSERT(t_->qbuf.count == 0);
t->settings[GRPC_SENT_SETTINGS], t->settings[GRPC_LOCAL_SETTINGS],
t->force_send_settings, GRPC_CHTTP2_NUM_SETTINGS));
t->force_send_settings = 0;
t->dirtied_local_settings = 0;
t->sent_local_settings = 1;
GRPC_STATS_INC_HTTP2_SETTINGS_WRITES(exec_ctx);
} }
for (size_t i = 0; i < t->ping_ack_count; i++) { void FlushWindowUpdates(grpc_exec_ctx *exec_ctx) {
grpc_slice_buffer_add(&t->outbuf, uint32_t transport_announce =
grpc_chttp2_ping_create(1, t->ping_acks[i])); grpc_chttp2_flowctl_maybe_send_transport_update(&t_->flow_control,
t_->outbuf.count > 0);
if (transport_announce) {
grpc_transport_one_way_stats throwaway_stats;
grpc_slice_buffer_add(
&t_->outbuf, grpc_chttp2_window_update_create(0, transport_announce,
&throwaway_stats));
ResetPingRecvClock();
}
} }
t->ping_ack_count = 0;
/* simple writes are queued to qbuf, and flushed here */ void FlushPingAcks() {
grpc_slice_buffer_move_into(&t->qbuf, &t->outbuf); for (size_t i = 0; i < t_->ping_ack_count; i++) {
GPR_ASSERT(t->qbuf.count == 0); grpc_slice_buffer_add(&t_->outbuf,
grpc_chttp2_ping_create(true, t_->ping_acks[i]));
}
t_->ping_ack_count = 0;
}
grpc_chttp2_hpack_compressor_set_max_table_size( void EnactHpackSettings(grpc_exec_ctx *exec_ctx) {
&t->hpack_compressor, grpc_chttp2_hpack_compressor_set_max_table_size(
t->settings[GRPC_PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE]); &t_->hpack_compressor,
t_->settings[GRPC_PEER_SETTINGS]
[GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE]);
}
if (t->flow_control.remote_window > 0) { void UpdateStreamsNoLongerStalled() {
while (grpc_chttp2_list_pop_stalled_by_transport(t, &s)) { grpc_chttp2_stream *s;
if (!t->closed && grpc_chttp2_list_add_writable_stream(t, s)) { while (grpc_chttp2_list_pop_stalled_by_transport(t_, &s)) {
stream_ref_if_not_destroyed(&s->refcount->refs); if (!t_->closed && grpc_chttp2_list_add_writable_stream(t_, s)) {
if (!stream_ref_if_not_destroyed(&s->refcount->refs)) {
grpc_chttp2_list_remove_writable_stream(t_, s);
}
} }
} }
} }
grpc_chttp2_begin_write_result result = {false, false, false}; grpc_chttp2_stream *NextStream() {
if (t_->outbuf.length > target_write_size(t_)) {
result_.partial = true;
return nullptr;
}
/* for each grpc_chttp2_stream that's become writable, frame it's data grpc_chttp2_stream *s;
(according to available window sizes) and add to the output buffer */ if (!grpc_chttp2_list_pop_writable_stream(t_, &s)) {
while (true) { return nullptr;
if (t->outbuf.length > target_write_size(t)) { }
result.partial = true;
break; return s;
}
void ResetPingRecvClock() {
if (!t_->is_client) {
t_->ping_recv_state.last_ping_recv_time = GRPC_MILLIS_INF_PAST;
t_->ping_recv_state.ping_strikes = 0;
}
}
void IncInitialMetadataWrites() { ++initial_metadata_writes_; }
void IncWindowUpdateWrites() { ++flow_control_writes_; }
void IncMessageWrites() { ++message_writes_; }
void IncTrailingMetadataWrites() { ++trailing_metadata_writes_; }
void NoteScheduledResults() { result_.early_results_scheduled = true; }
grpc_chttp2_transport *transport() const { return t_; }
grpc_chttp2_begin_write_result Result() {
result_.writing = t_->outbuf.count > 0;
return result_;
}
private:
grpc_chttp2_transport *const t_;
/* stats histogram counters: we increment these throughout this function,
and at the end publish to the central stats histograms */
int flow_control_writes_ = 0;
int initial_metadata_writes_ = 0;
int trailing_metadata_writes_ = 0;
int message_writes_ = 0;
grpc_chttp2_begin_write_result result_ = {false, false, false};
};
class DataSendContext {
public:
DataSendContext(WriteContext *write_context, grpc_chttp2_transport *t,
grpc_chttp2_stream *s)
: write_context_(write_context),
t_(t),
s_(s),
sending_bytes_before_(s_->sending_bytes) {}
uint32_t stream_remote_window() const {
return (uint32_t)GPR_MAX(
0, s_->flow_control.remote_window_delta +
(int64_t)t_->settings[GRPC_PEER_SETTINGS]
[GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]);
}
uint32_t max_outgoing() const {
return (uint32_t)GPR_MIN(
t_->settings[GRPC_PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE],
GPR_MIN(stream_remote_window(), t_->flow_control.remote_window));
}
bool AnyOutgoing() const { return max_outgoing() != 0; }
void FlushCompressedBytes() {
uint32_t send_bytes =
(uint32_t)GPR_MIN(max_outgoing(), s_->compressed_data_buffer.length);
bool is_last_data_frame =
(send_bytes == s_->compressed_data_buffer.length &&
s_->flow_controlled_buffer.length == 0 &&
s_->fetching_send_message == NULL);
if (is_last_data_frame && s_->send_trailing_metadata != NULL &&
s_->stream_compression_ctx != NULL) {
if (!grpc_stream_compress(s_->stream_compression_ctx,
&s_->flow_controlled_buffer,
&s_->compressed_data_buffer, NULL, MAX_SIZE_T,
GRPC_STREAM_COMPRESSION_FLUSH_FINISH)) {
gpr_log(GPR_ERROR, "Stream compression failed.");
}
grpc_stream_compression_context_destroy(s_->stream_compression_ctx);
s_->stream_compression_ctx = NULL;
/* After finish, bytes in s->compressed_data_buffer may be
* more than max_outgoing. Start another round of the current
* while loop so that send_bytes and is_last_data_frame are
* recalculated. */
return;
}
is_last_frame_ = is_last_data_frame && s_->send_trailing_metadata != NULL &&
grpc_metadata_batch_is_empty(s_->send_trailing_metadata);
grpc_chttp2_encode_data(s_->id, &s_->compressed_data_buffer, send_bytes,
is_last_frame_, &s_->stats.outgoing, &t_->outbuf);
grpc_chttp2_flowctl_sent_data(&t_->flow_control, &s_->flow_control,
send_bytes);
if (s_->compressed_data_buffer.length == 0) {
s_->sending_bytes += s_->uncompressed_data_size;
} }
}
if (!grpc_chttp2_list_pop_writable_stream(t, &s)) { void CompressMoreBytes() {
break; if (s_->stream_compression_ctx == NULL) {
s_->stream_compression_ctx =
grpc_stream_compression_context_create(s_->stream_compression_method);
}
s_->uncompressed_data_size = s_->flow_controlled_buffer.length;
if (!grpc_stream_compress(s_->stream_compression_ctx,
&s_->flow_controlled_buffer,
&s_->compressed_data_buffer, NULL, MAX_SIZE_T,
GRPC_STREAM_COMPRESSION_FLUSH_SYNC)) {
gpr_log(GPR_ERROR, "Stream compression failed.");
} }
}
bool is_last_frame() const { return is_last_frame_; }
bool sent_initial_metadata = s->sent_initial_metadata; void CallCallbacks(grpc_exec_ctx *exec_ctx) {
bool now_writing = false; if (update_list(exec_ctx, t_, s_,
(int64_t)(s_->sending_bytes - sending_bytes_before_),
&s_->on_flow_controlled_cbs,
&s_->flow_controlled_bytes_flowed, GRPC_ERROR_NONE)) {
write_context_->NoteScheduledResults();
}
}
private:
WriteContext *write_context_;
grpc_chttp2_transport *t_;
grpc_chttp2_stream *s_;
const size_t sending_bytes_before_;
bool is_last_frame_ = false;
};
class StreamWriteContext {
public:
StreamWriteContext(WriteContext *write_context, grpc_chttp2_stream *s)
: write_context_(write_context), t_(write_context->transport()), s_(s) {
GRPC_CHTTP2_IF_TRACING( GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_DEBUG, "W:%p %s[%d] im-(sent,send)=(%d,%d) announce=%d", t, gpr_log(GPR_DEBUG, "W:%p %s[%d] im-(sent,send)=(%d,%d) announce=%d", t_,
t->is_client ? "CLIENT" : "SERVER", s->id, t_->is_client ? "CLIENT" : "SERVER", s->id,
sent_initial_metadata, s->send_initial_metadata != NULL, s->sent_initial_metadata, s->send_initial_metadata != NULL,
(int)(s->flow_control.local_window_delta - (int)(s->flow_control.local_window_delta -
s->flow_control.announced_window_delta))); s->flow_control.announced_window_delta)));
}
grpc_mdelem *extra_headers_for_trailing_metadata[2]; void FlushInitialMetadata(grpc_exec_ctx *exec_ctx) {
size_t num_extra_headers_for_trailing_metadata = 0;
/* send initial metadata if it's available */ /* send initial metadata if it's available */
if (!sent_initial_metadata && s->send_initial_metadata != NULL) { if (s_->sent_initial_metadata) return;
// We skip this on the server side if there is no custom initial if (s_->send_initial_metadata == nullptr) return;
// metadata, there are no messages to send, and we are also sending
// trailing metadata. This results in a Trailers-Only response, // We skip this on the server side if there is no custom initial
// which is required for retries, as per: // metadata, there are no messages to send, and we are also sending
// https://github.com/grpc/proposal/blob/master/A6-client-retries.md#when-retries-are-valid // trailing metadata. This results in a Trailers-Only response,
if (t->is_client || s->fetching_send_message != NULL || // which is required for retries, as per:
s->flow_controlled_buffer.length != 0 || // https://github.com/grpc/proposal/blob/master/A6-client-retries.md#when-retries-are-valid
s->send_trailing_metadata == NULL || if (!t_->is_client && s_->fetching_send_message == nullptr &&
!is_default_initial_metadata(s->send_initial_metadata)) { s_->flow_controlled_buffer.length == 0 &&
grpc_encode_header_options hopt = { s_->compressed_data_buffer.length == 0 &&
s->id, // stream_id s_->send_trailing_metadata != nullptr &&
false, // is_eof is_default_initial_metadata(s_->send_initial_metadata)) {
t->settings[GRPC_PEER_SETTINGS] ConvertInitialMetadataToTrailingMetadata();
[GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != } else {
0, // use_true_binary_metadata grpc_encode_header_options hopt = {
t->settings[GRPC_PEER_SETTINGS] s_->id, // stream_id
[GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], // max_frame_size false, // is_eof
&s->stats.outgoing // stats t_->settings[GRPC_PEER_SETTINGS]
}; [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] !=
grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, NULL, 0, 0, // use_true_binary_metadata
s->send_initial_metadata, &hopt, &t->outbuf); t_->settings[GRPC_PEER_SETTINGS]
now_writing = true; [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], // max_frame_size
if (!t->is_client) { &s_->stats.outgoing // stats
t->ping_recv_state.last_ping_recv_time = GRPC_MILLIS_INF_PAST; };
t->ping_recv_state.ping_strikes = 0; grpc_chttp2_encode_header(exec_ctx, &t_->hpack_compressor, NULL, 0,
} s_->send_initial_metadata, &hopt, &t_->outbuf);
initial_metadata_writes++; write_context_->ResetPingRecvClock();
} else { write_context_->IncInitialMetadataWrites();
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;
}
trailing_metadata_writes++;
}
s->send_initial_metadata = NULL;
s->sent_initial_metadata = true;
sent_initial_metadata = true;
result.early_results_scheduled = true;
grpc_chttp2_complete_closure_step(
exec_ctx, t, s, &s->send_initial_metadata_finished, GRPC_ERROR_NONE,
"send_initial_metadata_finished");
} }
s_->send_initial_metadata = NULL;
s_->sent_initial_metadata = true;
write_context_->NoteScheduledResults();
grpc_chttp2_complete_closure_step(
exec_ctx, t_, s_, &s_->send_initial_metadata_finished, GRPC_ERROR_NONE,
"send_initial_metadata_finished");
}
void FlushWindowUpdates(grpc_exec_ctx *exec_ctx) {
/* send any window updates */ /* send any window updates */
uint32_t stream_announce = grpc_chttp2_flowctl_maybe_send_stream_update( uint32_t stream_announce = grpc_chttp2_flowctl_maybe_send_stream_update(
&t->flow_control, &s->flow_control); &t_->flow_control, &s_->flow_control);
if (stream_announce > 0) { if (stream_announce == 0) return;
grpc_slice_buffer_add(
&t->outbuf, grpc_chttp2_window_update_create(s->id, stream_announce, grpc_slice_buffer_add(
&s->stats.outgoing)); &t_->outbuf, grpc_chttp2_window_update_create(s_->id, stream_announce,
if (!t->is_client) { &s_->stats.outgoing));
t->ping_recv_state.last_ping_recv_time = GRPC_MILLIS_INF_PAST; write_context_->ResetPingRecvClock();
t->ping_recv_state.ping_strikes = 0; write_context_->IncWindowUpdateWrites();
}
void FlushData(grpc_exec_ctx *exec_ctx) {
if (!s_->sent_initial_metadata) return;
if (s_->flow_controlled_buffer.length == 0 &&
s_->compressed_data_buffer.length == 0) {
return; // early out: nothing to do
}
DataSendContext data_send_context(write_context_, t_, s_);
if (!data_send_context.AnyOutgoing()) {
if (t_->flow_control.remote_window == 0) {
report_stall(t_, s_, "transport");
grpc_chttp2_list_add_stalled_by_transport(t_, s_);
} else if (data_send_context.stream_remote_window() == 0) {
report_stall(t_, s_, "stream");
grpc_chttp2_list_add_stalled_by_stream(t_, s_);
} }
flow_control_writes++; return; // early out: nothing to do
} }
if (sent_initial_metadata) {
/* send any body bytes, if allowed by flow control */ while ((s_->flow_controlled_buffer.length > 0 ||
if (s->flow_controlled_buffer.length > 0 || s_->compressed_data_buffer.length > 0) &&
s->compressed_data_buffer.length > 0) { data_send_context.max_outgoing() > 0) {
uint32_t stream_remote_window = (uint32_t)GPR_MAX( if (s_->compressed_data_buffer.length > 0) {
0, data_send_context.FlushCompressedBytes();
s->flow_control.remote_window_delta + } else {
(int64_t)t->settings[GRPC_PEER_SETTINGS] data_send_context.CompressMoreBytes();
[GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]);
uint32_t max_outgoing = (uint32_t)GPR_MIN(
t->settings[GRPC_PEER_SETTINGS]
[GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE],
GPR_MIN(stream_remote_window, t->flow_control.remote_window));
if (max_outgoing > 0) {
bool is_last_data_frame = false;
bool is_last_frame = false;
size_t sending_bytes_before = s->sending_bytes;
while ((s->flow_controlled_buffer.length > 0 ||
s->compressed_data_buffer.length > 0) &&
max_outgoing > 0) {
if (s->compressed_data_buffer.length > 0) {
uint32_t send_bytes = (uint32_t)GPR_MIN(
max_outgoing, s->compressed_data_buffer.length);
is_last_data_frame =
(send_bytes == s->compressed_data_buffer.length &&
s->flow_controlled_buffer.length == 0 &&
s->fetching_send_message == NULL);
if (is_last_data_frame && s->send_trailing_metadata != NULL &&
s->stream_compression_ctx != NULL) {
if (!grpc_stream_compress(
s->stream_compression_ctx, &s->flow_controlled_buffer,
&s->compressed_data_buffer, NULL, MAX_SIZE_T,
GRPC_STREAM_COMPRESSION_FLUSH_FINISH)) {
gpr_log(GPR_ERROR, "Stream compression failed.");
}
grpc_stream_compression_context_destroy(
s->stream_compression_ctx);
s->stream_compression_ctx = NULL;
/* After finish, bytes in s->compressed_data_buffer may be
* more than max_outgoing. Start another round of the current
* while loop so that send_bytes and is_last_data_frame are
* recalculated. */
continue;
}
is_last_frame =
is_last_data_frame && s->send_trailing_metadata != NULL &&
grpc_metadata_batch_is_empty(s->send_trailing_metadata);
grpc_chttp2_encode_data(s->id, &s->compressed_data_buffer,
send_bytes, is_last_frame,
&s->stats.outgoing, &t->outbuf);
grpc_chttp2_flowctl_sent_data(&t->flow_control, &s->flow_control,
send_bytes);
max_outgoing -= send_bytes;
if (s->compressed_data_buffer.length == 0) {
s->sending_bytes += s->uncompressed_data_size;
}
} else {
if (s->stream_compression_ctx == NULL) {
s->stream_compression_ctx =
grpc_stream_compression_context_create(
s->stream_compression_method);
}
s->uncompressed_data_size = s->flow_controlled_buffer.length;
if (!grpc_stream_compress(
s->stream_compression_ctx, &s->flow_controlled_buffer,
&s->compressed_data_buffer, NULL, MAX_SIZE_T,
GRPC_STREAM_COMPRESSION_FLUSH_SYNC)) {
gpr_log(GPR_ERROR, "Stream compression failed.");
}
}
}
if (!t->is_client) {
t->ping_recv_state.last_ping_recv_time = 0;
t->ping_recv_state.ping_strikes = 0;
}
if (is_last_frame) {
s->send_trailing_metadata = NULL;
s->sent_trailing_metadata = true;
if (!t->is_client && !s->read_closed) {
grpc_slice_buffer_add(&t->outbuf, grpc_chttp2_rst_stream_create(
s->id, GRPC_HTTP2_NO_ERROR,
&s->stats.outgoing));
}
grpc_chttp2_mark_stream_closed(exec_ctx, t, s, !t->is_client, 1,
GRPC_ERROR_NONE);
}
result.early_results_scheduled |=
update_list(exec_ctx, t, s,
(int64_t)(s->sending_bytes - sending_bytes_before),
&s->on_flow_controlled_cbs,
&s->flow_controlled_bytes_flowed, GRPC_ERROR_NONE);
now_writing = true;
if (s->flow_controlled_buffer.length > 0 ||
s->compressed_data_buffer.length > 0) {
GRPC_CHTTP2_STREAM_REF(s, "chttp2_writing:fork");
grpc_chttp2_list_add_writable_stream(t, s);
}
message_writes++;
} else if (t->flow_control.remote_window == 0) {
report_stall(t, s, "transport");
grpc_chttp2_list_add_stalled_by_transport(t, s);
now_writing = true;
} else if (stream_remote_window == 0) {
report_stall(t, s, "stream");
grpc_chttp2_list_add_stalled_by_stream(t, s);
now_writing = true;
}
} }
if (s->send_trailing_metadata != NULL && }
s->fetching_send_message == NULL && write_context_->ResetPingRecvClock();
s->flow_controlled_buffer.length == 0 && if (data_send_context.is_last_frame()) {
s->compressed_data_buffer.length == 0) { SentLastFrame(exec_ctx);
GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "sending trailing_metadata")); }
if (grpc_metadata_batch_is_empty(s->send_trailing_metadata)) { data_send_context.CallCallbacks(exec_ctx);
grpc_chttp2_encode_data(s->id, &s->flow_controlled_buffer, 0, true, stream_became_writable_ = true;
&s->stats.outgoing, &t->outbuf); if (s_->flow_controlled_buffer.length > 0 ||
} else { s_->compressed_data_buffer.length > 0) {
grpc_encode_header_options hopt = { GRPC_CHTTP2_STREAM_REF(s_, "chttp2_writing:fork");
s->id, true, grpc_chttp2_list_add_writable_stream(t_, s_);
}
t->settings write_context_->IncMessageWrites();
[GRPC_PEER_SETTINGS] }
void FlushTrailingMetadata(grpc_exec_ctx *exec_ctx) {
if (!s_->sent_initial_metadata) return;
if (s_->send_trailing_metadata == NULL) return;
if (s_->fetching_send_message != NULL) return;
if (s_->flow_controlled_buffer.length != 0) return;
if (s_->compressed_data_buffer.length != 0) return;
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);
} else {
grpc_encode_header_options hopt = {
s_->id, true,
t_->settings[GRPC_PEER_SETTINGS]
[GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] !=
0, 0,
t->settings[GRPC_PEER_SETTINGS] t_->settings[GRPC_PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE],
[GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], &s_->stats.outgoing};
&s->stats.outgoing}; grpc_chttp2_encode_header(exec_ctx, &t_->hpack_compressor,
grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, extra_headers_for_trailing_metadata_,
extra_headers_for_trailing_metadata, num_extra_headers_for_trailing_metadata_,
num_extra_headers_for_trailing_metadata, s_->send_trailing_metadata, &hopt, &t_->outbuf);
s->send_trailing_metadata, &hopt, }
&t->outbuf); write_context_->IncTrailingMetadataWrites();
trailing_metadata_writes++; write_context_->ResetPingRecvClock();
} SentLastFrame(exec_ctx);
s->send_trailing_metadata = NULL;
s->sent_trailing_metadata = true; write_context_->NoteScheduledResults();
if (!t->is_client) { grpc_chttp2_complete_closure_step(
t->ping_recv_state.last_ping_recv_time = GRPC_MILLIS_INF_PAST; exec_ctx, t_, s_, &s_->send_trailing_metadata_finished, GRPC_ERROR_NONE,
t->ping_recv_state.ping_strikes = 0; "send_trailing_metadata_finished");
} }
if (!t->is_client && !s->read_closed) {
grpc_slice_buffer_add( bool stream_became_writable() { return stream_became_writable_; }
&t->outbuf, grpc_chttp2_rst_stream_create(
s->id, GRPC_HTTP2_NO_ERROR, &s->stats.outgoing)); private:
} void ConvertInitialMetadataToTrailingMetadata() {
grpc_chttp2_mark_stream_closed(exec_ctx, t, s, !t->is_client, 1, GRPC_CHTTP2_IF_TRACING(
GRPC_ERROR_NONE); gpr_log(GPR_INFO, "not sending initial_metadata (Trailers-Only)"));
now_writing = true; // When sending Trailers-Only, we need to move the :status and
result.early_results_scheduled = true; // content-type headers to the trailers.
grpc_chttp2_complete_closure_step( if (s_->send_initial_metadata->idx.named.status != NULL) {
exec_ctx, t, s, &s->send_trailing_metadata_finished, extra_headers_for_trailing_metadata_
GRPC_ERROR_NONE, "send_trailing_metadata_finished"); [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;
}
}
void SentLastFrame(grpc_exec_ctx *exec_ctx) {
s_->send_trailing_metadata = NULL;
s_->sent_trailing_metadata = true;
if (!t_->is_client && !s_->read_closed) {
grpc_slice_buffer_add(
&t_->outbuf, grpc_chttp2_rst_stream_create(
s_->id, GRPC_HTTP2_NO_ERROR, &s_->stats.outgoing));
}
grpc_chttp2_mark_stream_closed(exec_ctx, t_, s_, !t_->is_client, true,
GRPC_ERROR_NONE);
}
if (now_writing) { WriteContext *const write_context_;
GRPC_STATS_INC_HTTP2_SEND_INITIAL_METADATA_PER_WRITE( grpc_chttp2_transport *const t_;
exec_ctx, initial_metadata_writes); grpc_chttp2_stream *const s_;
GRPC_STATS_INC_HTTP2_SEND_MESSAGE_PER_WRITE(exec_ctx, message_writes); bool stream_became_writable_ = false;
GRPC_STATS_INC_HTTP2_SEND_TRAILING_METADATA_PER_WRITE( grpc_mdelem *extra_headers_for_trailing_metadata_[2];
exec_ctx, trailing_metadata_writes); size_t num_extra_headers_for_trailing_metadata_ = 0;
GRPC_STATS_INC_HTTP2_SEND_FLOWCTL_PER_WRITE(exec_ctx, };
flow_control_writes); } // namespace
grpc_chttp2_begin_write_result grpc_chttp2_begin_write(
grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) {
WriteContext ctx(exec_ctx, t);
ctx.FlushSettings(exec_ctx);
ctx.FlushPingAcks();
ctx.FlushQueuedBuffers(exec_ctx);
ctx.EnactHpackSettings(exec_ctx);
if (t->flow_control.remote_window > 0) {
ctx.UpdateStreamsNoLongerStalled();
}
/* for each grpc_chttp2_stream that's become writable, frame it's data
(according to available window sizes) and add to the output buffer */
while (grpc_chttp2_stream *s = ctx.NextStream()) {
StreamWriteContext stream_ctx(&ctx, s);
stream_ctx.FlushInitialMetadata(exec_ctx);
stream_ctx.FlushWindowUpdates(exec_ctx);
stream_ctx.FlushData(exec_ctx);
stream_ctx.FlushTrailingMetadata(exec_ctx);
if (stream_ctx.stream_became_writable()) {
if (!grpc_chttp2_list_add_writing_stream(t, s)) { if (!grpc_chttp2_list_add_writing_stream(t, s)) {
/* already in writing list: drop ref */ /* already in writing list: drop ref */
GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:already_writing"); GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:already_writing");
} else {
/* ref will be dropped at end of write */
} }
} else { } else {
GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:no_write"); GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:no_write");
} }
} }
maybe_initiate_ping(exec_ctx, t); ctx.FlushWindowUpdates(exec_ctx);
uint32_t transport_announce = grpc_chttp2_flowctl_maybe_send_transport_update( maybe_initiate_ping(exec_ctx, t);
&t->flow_control, t->outbuf.count > 0);
if (transport_announce) {
grpc_transport_one_way_stats throwaway_stats;
grpc_slice_buffer_add(
&t->outbuf, grpc_chttp2_window_update_create(0, transport_announce,
&throwaway_stats));
if (!t->is_client) {
t->ping_recv_state.last_ping_recv_time = GRPC_MILLIS_INF_PAST;
t->ping_recv_state.ping_strikes = 0;
}
}
GPR_TIMER_END("grpc_chttp2_begin_write", 0); GPR_TIMER_END("grpc_chttp2_begin_write", 0);
result.writing = t->outbuf.count > 0; return ctx.Result();
return result;
} }
void grpc_chttp2_end_write(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, void grpc_chttp2_end_write(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,

@ -157,4 +157,4 @@ grpc_arg grpc_channel_arg_pointer_create(char *name, void *value,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H */ #endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H */

@ -38,4 +38,4 @@ grpc_stream *grpc_connected_channel_get_stream(grpc_call_element *elem);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H */ #endif /* GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H */

@ -172,4 +172,4 @@ void grpc_handshake_manager_pending_list_shutdown_all(
} }
#endif #endif
#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_H */ #endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_H */

@ -56,4 +56,4 @@ void grpc_handshaker_factory_destroy(
} }
#endif #endif
#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H */ #endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H */

@ -53,4 +53,4 @@ void grpc_handshakers_add(grpc_exec_ctx* exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H */ #endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H */

@ -57,4 +57,4 @@ grpc_stream_compression_algorithm grpc_stream_compression_algorithm_from_slice(
} }
#endif #endif
#endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */ #endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */

@ -44,4 +44,4 @@ int grpc_msg_decompress(grpc_exec_ctx* exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */ #endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */

@ -37,4 +37,4 @@ grpc_slice grpc_httpcli_format_connect_request(
} }
#endif #endif
#endif /* GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H */ #endif /* GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H */

@ -131,4 +131,4 @@ void grpc_httpcli_set_override(grpc_httpcli_get_override get,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_HTTP_HTTPCLI_H */ #endif /* GRPC_CORE_LIB_HTTP_HTTPCLI_H */

@ -117,4 +117,4 @@ extern grpc_tracer_flag grpc_http1_trace;
} }
#endif #endif
#endif /* GRPC_CORE_LIB_HTTP_PARSER_H */ #endif /* GRPC_CORE_LIB_HTTP_PARSER_H */

@ -103,4 +103,4 @@ struct grpc_endpoint {
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_H */ #endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_H */

@ -37,4 +37,4 @@ grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char *name,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H */ #endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H */

@ -65,4 +65,4 @@ bool grpc_error_is_special(grpc_error *err);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_ERROR_INTERNAL_H */ #endif /* GRPC_CORE_LIB_IOMGR_ERROR_INTERNAL_H */

@ -34,4 +34,4 @@ const grpc_event_engine_vtable *grpc_init_epoll1_linux(bool explicit_request);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLL1_LINUX_H */ #endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLL1_LINUX_H */

@ -33,4 +33,4 @@ const grpc_event_engine_vtable *grpc_init_epollex_linux(
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLLEX_LINUX_H */ #endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLLEX_LINUX_H */

@ -18,6 +18,8 @@
#include "src/core/lib/iomgr/port.h" #include "src/core/lib/iomgr/port.h"
#include <grpc/grpc_posix.h>
/* This polling engine is only relevant on linux kernels supporting epoll() */ /* This polling engine is only relevant on linux kernels supporting epoll() */
#ifdef GRPC_LINUX_EPOLL #ifdef GRPC_LINUX_EPOLL

@ -32,4 +32,4 @@ const grpc_event_engine_vtable *grpc_init_poll_cv_posix(bool explicit_request);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_EV_POLL_POSIX_H */ #endif /* GRPC_CORE_LIB_IOMGR_EV_POLL_POSIX_H */

@ -61,12 +61,43 @@ typedef struct {
event_engine_factory_fn factory; event_engine_factory_fn factory;
} event_engine_factory; } event_engine_factory;
namespace {
extern "C" {
grpc_poll_function_type real_poll_function;
int dummy_poll(struct pollfd fds[], nfds_t nfds, int timeout) {
if (timeout == 0) {
return real_poll_function(fds, nfds, 0);
} else {
gpr_log(GPR_ERROR, "Attempted a blocking poll when declared non-polling.");
GPR_ASSERT(false);
return -1;
}
}
} // extern "C"
const grpc_event_engine_vtable *init_non_polling(bool explicit_request) {
if (!explicit_request) {
return nullptr;
}
// return the simplest engine as a dummy but also override the poller
auto ret = grpc_init_poll_posix(explicit_request);
real_poll_function = grpc_poll_function;
grpc_poll_function = dummy_poll;
return ret;
}
} // namespace
static const event_engine_factory g_factories[] = { static const event_engine_factory g_factories[] = {
{"epoll1", grpc_init_epoll1_linux}, {"epoll1", grpc_init_epoll1_linux},
{"epollsig", grpc_init_epollsig_linux}, {"epollsig", grpc_init_epollsig_linux},
{"poll", grpc_init_poll_posix}, {"poll", grpc_init_poll_posix},
{"poll-cv", grpc_init_poll_cv_posix}, {"poll-cv", grpc_init_poll_cv_posix},
{"epollex", grpc_init_epollex_linux}, {"epollex", grpc_init_epollex_linux},
{"none", init_non_polling},
}; };
static void add(const char *beg, const char *end, char ***ss, size_t *ns) { static void add(const char *beg, const char *end, char ***ss, size_t *ns) {

@ -166,4 +166,4 @@ const grpc_event_engine_vtable *grpc_get_event_engine_test_only();
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_EV_POSIX_H */ #endif /* GRPC_CORE_LIB_IOMGR_EV_POSIX_H */

@ -53,4 +53,4 @@ void grpc_executor_set_threading(grpc_exec_ctx *exec_ctx, bool enable);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_H */ #endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_H */

@ -21,6 +21,7 @@
#ifdef GRPC_WINSOCK_SOCKET #ifdef GRPC_WINSOCK_SOCKET
#include <winsock2.h> #include <winsock2.h>
#include <limits>
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
@ -43,11 +44,14 @@ static HANDLE g_iocp;
static DWORD deadline_to_millis_timeout(grpc_exec_ctx *exec_ctx, static DWORD deadline_to_millis_timeout(grpc_exec_ctx *exec_ctx,
grpc_millis deadline) { grpc_millis deadline) {
gpr_timespec timeout;
if (deadline == GRPC_MILLIS_INF_FUTURE) { if (deadline == GRPC_MILLIS_INF_FUTURE) {
return INFINITE; return INFINITE;
} }
return (DWORD)GPR_MAX(0, deadline - grpc_exec_ctx_now(exec_ctx)); grpc_millis now = grpc_exec_ctx_now(exec_ctx);
if (deadline < now) return 0;
grpc_millis timeout = deadline - now;
if (timeout > std::numeric_limits<DWORD>::max()) return INFINITE;
return static_cast<DWORD>(deadline - now);
} }
grpc_iocp_work_status grpc_iocp_work(grpc_exec_ctx *exec_ctx, grpc_iocp_work_status grpc_iocp_work(grpc_exec_ctx *exec_ctx,
@ -63,6 +67,7 @@ grpc_iocp_work_status grpc_iocp_work(grpc_exec_ctx *exec_ctx,
success = success =
GetQueuedCompletionStatus(g_iocp, &bytes, &completion_key, &overlapped, GetQueuedCompletionStatus(g_iocp, &bytes, &completion_key, &overlapped,
deadline_to_millis_timeout(exec_ctx, deadline)); deadline_to_millis_timeout(exec_ctx, deadline));
grpc_exec_ctx_invalidate_now(exec_ctx);
if (success == 0 && overlapped == NULL) { if (success == 0 && overlapped == NULL) {
return GRPC_IOCP_WORK_TIMEOUT; return GRPC_IOCP_WORK_TIMEOUT;
} }

@ -45,4 +45,4 @@ void grpc_iocp_add_socket(grpc_winsocket *);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H */ #endif /* GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H */

@ -40,4 +40,4 @@ void grpc_iomgr_shutdown(grpc_exec_ctx *exec_ctx);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_H */ #endif /* GRPC_CORE_LIB_IOMGR_IOMGR_H */

@ -48,4 +48,4 @@ bool grpc_iomgr_abort_on_leaks(void);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H */ #endif /* GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H */

@ -31,4 +31,4 @@ bool grpc_is_epollexclusive_available(void);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_IS_EPOLLEXCLUSIVE_AVAILABLE_H */ #endif /* GRPC_CORE_LIB_IOMGR_IS_EPOLLEXCLUSIVE_AVAILABLE_H */

@ -45,4 +45,4 @@ void grpc_lfev_set_ready(grpc_exec_ctx *exec_ctx, gpr_atm *state,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_LOCKFREE_EVENT_H */ #endif /* GRPC_CORE_LIB_IOMGR_LOCKFREE_EVENT_H */

@ -35,4 +35,4 @@ void grpc_network_status_shutdown_all_endpoints();
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_NETWORK_STATUS_TRACKER_H */ #endif /* GRPC_CORE_LIB_IOMGR_NETWORK_STATUS_TRACKER_H */

@ -72,4 +72,4 @@ void grpc_polling_entity_del_from_pollset_set(grpc_exec_ctx *exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H */ #endif /* GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H */

@ -52,4 +52,4 @@ void grpc_pollset_set_del_pollset_set(grpc_exec_ctx *exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_SET_H */ #endif /* GRPC_CORE_LIB_IOMGR_POLLSET_SET_H */

@ -32,4 +32,4 @@ void grpc_pollset_global_shutdown(void);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_UV_H */ #endif /* GRPC_CORE_LIB_IOMGR_POLLSET_UV_H */

@ -68,4 +68,4 @@ void grpc_pollset_global_shutdown(void);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H */ #endif /* GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H */

@ -60,4 +60,4 @@ extern grpc_error *(*grpc_blocking_resolve_address)(
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H */ #endif /* GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H */

@ -158,4 +158,4 @@ grpc_slice grpc_resource_user_slice_malloc(grpc_exec_ctx *exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H */ #endif /* GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H */

@ -85,4 +85,4 @@ int grpc_sockaddr_get_family(const grpc_resolved_address *resolved_addr);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H */ #endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H */

@ -32,4 +32,4 @@ const char *grpc_inet_ntop(int af, const void *src, char *dst, size_t size);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H */ #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H */

@ -137,4 +137,4 @@ grpc_error *grpc_create_dualstack_socket_using_factory(
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H */ #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H */

@ -115,4 +115,4 @@ void grpc_socket_become_ready(grpc_exec_ctx *exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H */ #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H */

@ -45,4 +45,4 @@ void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *on_connect,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H */ #endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H */

@ -35,4 +35,4 @@ grpc_endpoint *grpc_tcp_client_create_from_fd(
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H */ #endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H */

@ -61,4 +61,4 @@ void grpc_tcp_destroy_and_release_fd(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_TCP_POSIX_H */ #endif /* GRPC_CORE_LIB_IOMGR_TCP_POSIX_H */

@ -106,4 +106,4 @@ void grpc_tcp_server_shutdown_listeners(grpc_exec_ctx *exec_ctx,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_H */ #endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_H */

@ -125,4 +125,4 @@ bool grpc_tcp_server_have_ifaddrs(void);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_UTILS_POSIX_H */ #endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_UTILS_POSIX_H */

@ -50,4 +50,4 @@ grpc_endpoint *grpc_tcp_create(uv_tcp_t *handle,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_TCP_UV_H */ #endif /* GRPC_CORE_LIB_IOMGR_TCP_UV_H */

@ -78,4 +78,4 @@ double grpc_time_averaged_stats_update_average(grpc_time_averaged_stats* stats);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H */ #endif /* GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H */

@ -47,4 +47,4 @@ int grpc_timer_heap_is_empty(grpc_timer_heap *heap);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H */ #endif /* GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H */

@ -42,4 +42,4 @@ void grpc_timer_manager_tick(void);
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_TIMER_MANAGER_H */ #endif /* GRPC_CORE_LIB_IOMGR_TIMER_MANAGER_H */

@ -81,4 +81,4 @@ void grpc_udp_server_destroy(grpc_exec_ctx *exec_ctx, grpc_udp_server *server,
} }
#endif #endif
#endif /* GRPC_CORE_LIB_IOMGR_UDP_SERVER_H */ #endif /* GRPC_CORE_LIB_IOMGR_UDP_SERVER_H */

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save