Merge remote-tracking branch 'upstream/master' into packet-coalescing-core

pull/9246/head
Muxi Yan 8 years ago
commit e42f0b2160
  1. 6
      BUILD
  2. 90
      CMakeLists.txt
  3. 372
      Makefile
  4. 2
      README.md
  5. 146
      binding.gyp
  6. 81
      build.yaml
  7. 8
      config.m4
  8. 29
      doc/cpp/perf_notes.md
  9. 4
      doc/interop-test-descriptions.md
  10. 7
      doc/negative-http2-interop-test-descriptions.md
  11. 9
      gRPC-Core.podspec
  12. 6
      grpc.gemspec
  13. 4
      include/grpc++/grpc++.h
  14. 6
      include/grpc++/impl/codegen/completion_queue.h
  15. 2
      include/grpc++/support/channel_arguments.h
  16. 41
      include/grpc/impl/codegen/exec_ctx_fwd.h
  17. 6
      include/grpc/impl/codegen/grpc_types.h
  18. 2
      include/grpc/impl/codegen/port_platform.h
  19. 4
      include/grpc/impl/codegen/slice.h
  20. 2
      include/grpc/support/log_windows.h
  21. 4
      package.json
  22. 6
      package.xml
  23. 5
      src/core/ext/README.md
  24. 3
      src/core/ext/census/grpc_plugin.c
  25. 16
      src/core/ext/census/tracing.c
  26. 5
      src/core/ext/client_channel/channel_connectivity.c
  27. 28
      src/core/ext/client_channel/client_channel.c
  28. 6
      src/core/ext/client_channel/client_channel_factory.c
  29. 13
      src/core/ext/client_channel/client_channel_plugin.c
  30. 71
      src/core/ext/client_channel/http_connect_handshaker.c
  31. 10
      src/core/ext/client_channel/http_connect_handshaker.h
  32. 10
      src/core/ext/client_channel/lb_policy_factory.c
  33. 5
      src/core/ext/client_channel/lb_policy_factory.h
  34. 17
      src/core/ext/client_channel/subchannel.c
  35. 2
      src/core/ext/client_channel/subchannel_index.c
  36. 44
      src/core/ext/client_channel/uri_parser.c
  37. 42
      src/core/ext/lb_policy/grpclb/grpclb.c
  38. 2
      src/core/ext/lb_policy/round_robin/round_robin.c
  39. 3
      src/core/ext/load_reporting/load_reporting.c
  40. 12
      src/core/ext/load_reporting/load_reporting_filter.c
  41. 4
      src/core/ext/resolver/README.md
  42. 16
      src/core/ext/resolver/dns/native/dns_resolver.c
  43. 16
      src/core/ext/resolver/sockaddr/sockaddr_resolver.c
  44. 1
      src/core/ext/transport/README.md
  45. 1
      src/core/ext/transport/chttp2/README.md
  46. 25
      src/core/ext/transport/chttp2/client/chttp2_connector.c
  47. 12
      src/core/ext/transport/chttp2/client/chttp2_connector.h
  48. 16
      src/core/ext/transport/chttp2/client/insecure/channel_create.c
  49. 2
      src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c
  50. 68
      src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
  51. 47
      src/core/ext/transport/chttp2/server/chttp2_server.c
  52. 39
      src/core/ext/transport/chttp2/server/chttp2_server.h
  53. 3
      src/core/ext/transport/chttp2/server/insecure/server_chttp2.c
  54. 2
      src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c
  55. 51
      src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c
  56. 15
      src/core/ext/transport/chttp2/transport/bin_decoder.c
  57. 5
      src/core/ext/transport/chttp2/transport/bin_decoder.h
  58. 2
      src/core/ext/transport/chttp2/transport/bin_encoder.h
  59. 52
      src/core/ext/transport/chttp2/transport/chttp2_transport.c
  60. 2
      src/core/ext/transport/chttp2/transport/frame_rst_stream.c
  61. 57
      src/core/ext/transport/chttp2/transport/hpack_encoder.c
  62. 6
      src/core/ext/transport/chttp2/transport/hpack_encoder.h
  63. 64
      src/core/ext/transport/chttp2/transport/hpack_parser.c
  64. 6
      src/core/ext/transport/chttp2/transport/hpack_parser.h
  65. 35
      src/core/ext/transport/chttp2/transport/hpack_table.c
  66. 13
      src/core/ext/transport/chttp2/transport/hpack_table.h
  67. 4
      src/core/ext/transport/chttp2/transport/incoming_metadata.c
  68. 2
      src/core/ext/transport/chttp2/transport/incoming_metadata.h
  69. 10
      src/core/ext/transport/chttp2/transport/parsing.c
  70. 11
      src/core/ext/transport/chttp2/transport/writing.c
  71. 9
      src/core/ext/transport/cronet/transport/cronet_transport.c
  72. 6
      src/core/lib/README.md
  73. 4
      src/core/lib/channel/README.md
  74. 10
      src/core/lib/channel/channel_args.c
  75. 5
      src/core/lib/channel/channel_args.h
  76. 4
      src/core/lib/channel/channel_stack.c
  77. 12
      src/core/lib/channel/channel_stack_builder.c
  78. 6
      src/core/lib/channel/channel_stack_builder.h
  79. 22
      src/core/lib/channel/compress_filter.c
  80. 3
      src/core/lib/channel/connected_channel.c
  81. 3
      src/core/lib/channel/connected_channel.h
  82. 10
      src/core/lib/channel/deadline_filter.c
  83. 1
      src/core/lib/channel/deadline_filter.h
  84. 5
      src/core/lib/channel/handshaker.c
  85. 54
      src/core/lib/channel/handshaker_factory.c
  86. 66
      src/core/lib/channel/handshaker_factory.h
  87. 113
      src/core/lib/channel/handshaker_registry.c
  88. 63
      src/core/lib/channel/handshaker_registry.h
  89. 49
      src/core/lib/channel/http_client_filter.c
  90. 39
      src/core/lib/channel/http_server_filter.c
  91. 14
      src/core/lib/channel/message_size_filter.c
  92. 46
      src/core/lib/compression/message_compress.c
  93. 6
      src/core/lib/compression/message_compress.h
  94. 13
      src/core/lib/http/httpcli.c
  95. 19
      src/core/lib/http/httpcli_security_connector.c
  96. 6
      src/core/lib/iomgr/README.md
  97. 6
      src/core/lib/iomgr/closure.h
  98. 1
      src/core/lib/iomgr/ev_epoll_linux.c
  99. 7
      src/core/lib/iomgr/executor.c
  100. 2
      src/core/lib/iomgr/executor.h
  101. Some files were not shown because too many files have changed in this diff Show More

@ -421,6 +421,8 @@ grpc_cc_library(
"src/core/lib/channel/connected_channel.c", "src/core/lib/channel/connected_channel.c",
"src/core/lib/channel/deadline_filter.c", "src/core/lib/channel/deadline_filter.c",
"src/core/lib/channel/handshaker.c", "src/core/lib/channel/handshaker.c",
"src/core/lib/channel/handshaker_factory.c",
"src/core/lib/channel/handshaker_registry.c",
"src/core/lib/channel/http_client_filter.c", "src/core/lib/channel/http_client_filter.c",
"src/core/lib/channel/http_server_filter.c", "src/core/lib/channel/http_server_filter.c",
"src/core/lib/channel/message_size_filter.c", "src/core/lib/channel/message_size_filter.c",
@ -536,6 +538,8 @@ grpc_cc_library(
"src/core/lib/channel/context.h", "src/core/lib/channel/context.h",
"src/core/lib/channel/deadline_filter.h", "src/core/lib/channel/deadline_filter.h",
"src/core/lib/channel/handshaker.h", "src/core/lib/channel/handshaker.h",
"src/core/lib/channel/handshaker_factory.h",
"src/core/lib/channel/handshaker_registry.h",
"src/core/lib/channel/http_client_filter.h", "src/core/lib/channel/http_client_filter.h",
"src/core/lib/channel/http_server_filter.h", "src/core/lib/channel/http_server_filter.h",
"src/core/lib/channel/message_size_filter.h", "src/core/lib/channel/message_size_filter.h",
@ -602,6 +606,7 @@ grpc_cc_library(
"src/core/lib/json/json_reader.h", "src/core/lib/json/json_reader.h",
"src/core/lib/json/json_writer.h", "src/core/lib/json/json_writer.h",
"src/core/lib/slice/percent_encoding.h", "src/core/lib/slice/percent_encoding.h",
"src/core/lib/slice/slice_internal.h",
"src/core/lib/slice/slice_string_helpers.h", "src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/surface/api_trace.h", "src/core/lib/surface/api_trace.h",
"src/core/lib/surface/call.h", "src/core/lib/surface/call.h",
@ -699,6 +704,7 @@ grpc_cc_library(
"include/grpc/impl/codegen/byte_buffer_reader.h", "include/grpc/impl/codegen/byte_buffer_reader.h",
"include/grpc/impl/codegen/compression_types.h", "include/grpc/impl/codegen/compression_types.h",
"include/grpc/impl/codegen/connectivity_state.h", "include/grpc/impl/codegen/connectivity_state.h",
"include/grpc/impl/codegen/exec_ctx_fwd.h",
"include/grpc/impl/codegen/grpc_types.h", "include/grpc/impl/codegen/grpc_types.h",
"include/grpc/impl/codegen/propagation_bits.h", "include/grpc/impl/codegen/propagation_bits.h",
"include/grpc/impl/codegen/status.h", "include/grpc/impl/codegen/status.h",

@ -66,7 +66,13 @@ set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package")
set(gRPC_USE_PROTO_LITE OFF CACHE BOOL "Use the protobuf-lite library") set(gRPC_USE_PROTO_LITE OFF CACHE BOOL "Use the protobuf-lite library")
if (MSVC) if (MSVC)
add_definitions( -D_WIN32_WINNT=0x600 ) add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS)
# needed to compile boringssl
add_definitions(/wd4464 /wd4623 /wd4668 /wd4701 /wd4702 /wd4777 /wd5027)
# needed to compile protobuf
add_definitions(/wd4065 /wd4506)
# TODO(jtattermusch): revisit C4267 occurrences throughout the code
add_definitions(/wd4267)
endif() endif()
if (gRPC_USE_PROTO_LITE) if (gRPC_USE_PROTO_LITE)
@ -292,6 +298,8 @@ add_library(grpc
src/core/lib/channel/connected_channel.c src/core/lib/channel/connected_channel.c
src/core/lib/channel/deadline_filter.c src/core/lib/channel/deadline_filter.c
src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker.c
src/core/lib/channel/handshaker_factory.c
src/core/lib/channel/handshaker_registry.c
src/core/lib/channel/http_client_filter.c src/core/lib/channel/http_client_filter.c
src/core/lib/channel/http_server_filter.c src/core/lib/channel/http_server_filter.c
src/core/lib/channel/message_size_filter.c src/core/lib/channel/message_size_filter.c
@ -530,6 +538,7 @@ foreach(_hdr
include/grpc/impl/codegen/byte_buffer_reader.h include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h include/grpc/impl/codegen/connectivity_state.h
include/grpc/impl/codegen/exec_ctx_fwd.h
include/grpc/impl/codegen/grpc_types.h include/grpc/impl/codegen/grpc_types.h
include/grpc/impl/codegen/propagation_bits.h include/grpc/impl/codegen/propagation_bits.h
include/grpc/impl/codegen/status.h include/grpc/impl/codegen/status.h
@ -573,6 +582,8 @@ add_library(grpc_cronet
src/core/lib/channel/connected_channel.c src/core/lib/channel/connected_channel.c
src/core/lib/channel/deadline_filter.c src/core/lib/channel/deadline_filter.c
src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker.c
src/core/lib/channel/handshaker_factory.c
src/core/lib/channel/handshaker_registry.c
src/core/lib/channel/http_client_filter.c src/core/lib/channel/http_client_filter.c
src/core/lib/channel/http_server_filter.c src/core/lib/channel/http_server_filter.c
src/core/lib/channel/message_size_filter.c src/core/lib/channel/message_size_filter.c
@ -781,6 +792,7 @@ foreach(_hdr
include/grpc/impl/codegen/byte_buffer_reader.h include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h include/grpc/impl/codegen/connectivity_state.h
include/grpc/impl/codegen/exec_ctx_fwd.h
include/grpc/impl/codegen/grpc_types.h include/grpc/impl/codegen/grpc_types.h
include/grpc/impl/codegen/propagation_bits.h include/grpc/impl/codegen/propagation_bits.h
include/grpc/impl/codegen/status.h include/grpc/impl/codegen/status.h
@ -825,6 +837,8 @@ add_library(grpc_unsecure
src/core/lib/channel/connected_channel.c src/core/lib/channel/connected_channel.c
src/core/lib/channel/deadline_filter.c src/core/lib/channel/deadline_filter.c
src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker.c
src/core/lib/channel/handshaker_factory.c
src/core/lib/channel/handshaker_registry.c
src/core/lib/channel/http_client_filter.c src/core/lib/channel/http_client_filter.c
src/core/lib/channel/http_server_filter.c src/core/lib/channel/http_server_filter.c
src/core/lib/channel/message_size_filter.c src/core/lib/channel/message_size_filter.c
@ -1032,6 +1046,7 @@ foreach(_hdr
include/grpc/impl/codegen/byte_buffer_reader.h include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h include/grpc/impl/codegen/connectivity_state.h
include/grpc/impl/codegen/exec_ctx_fwd.h
include/grpc/impl/codegen/grpc_types.h include/grpc/impl/codegen/grpc_types.h
include/grpc/impl/codegen/propagation_bits.h include/grpc/impl/codegen/propagation_bits.h
include/grpc/impl/codegen/status.h include/grpc/impl/codegen/status.h
@ -1195,6 +1210,7 @@ foreach(_hdr
include/grpc/impl/codegen/byte_buffer_reader.h include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h include/grpc/impl/codegen/connectivity_state.h
include/grpc/impl/codegen/exec_ctx_fwd.h
include/grpc/impl/codegen/grpc_types.h include/grpc/impl/codegen/grpc_types.h
include/grpc/impl/codegen/propagation_bits.h include/grpc/impl/codegen/propagation_bits.h
include/grpc/impl/codegen/status.h include/grpc/impl/codegen/status.h
@ -1292,6 +1308,8 @@ add_library(grpc++_cronet
src/core/lib/channel/connected_channel.c src/core/lib/channel/connected_channel.c
src/core/lib/channel/deadline_filter.c src/core/lib/channel/deadline_filter.c
src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker.c
src/core/lib/channel/handshaker_factory.c
src/core/lib/channel/handshaker_registry.c
src/core/lib/channel/http_client_filter.c src/core/lib/channel/http_client_filter.c
src/core/lib/channel/http_server_filter.c src/core/lib/channel/http_server_filter.c
src/core/lib/channel/message_size_filter.c src/core/lib/channel/message_size_filter.c
@ -1528,6 +1546,7 @@ foreach(_hdr
include/grpc/impl/codegen/byte_buffer_reader.h include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h include/grpc/impl/codegen/connectivity_state.h
include/grpc/impl/codegen/exec_ctx_fwd.h
include/grpc/impl/codegen/grpc_types.h include/grpc/impl/codegen/grpc_types.h
include/grpc/impl/codegen/propagation_bits.h include/grpc/impl/codegen/propagation_bits.h
include/grpc/impl/codegen/status.h include/grpc/impl/codegen/status.h
@ -1570,45 +1589,6 @@ if (gRPC_INSTALL)
endif() endif()
add_library(grpc++_reflection
src/cpp/ext/proto_server_reflection.cc
src/cpp/ext/proto_server_reflection_plugin.cc
src/proto/grpc/reflection/v1alpha/reflection.proto
)
target_include_directories(grpc++_reflection
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${BORINGSSL_ROOT_DIR}/include
PRIVATE ${PROTOBUF_ROOT_DIR}/src
PRIVATE ${ZLIB_INCLUDE_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib
)
target_link_libraries(grpc++_reflection
grpc++
)
foreach(_hdr
include/grpc++/ext/proto_server_reflection_plugin.h
)
string(REPLACE "include/" "" _path ${_hdr})
get_filename_component(_path ${_path} PATH)
install(FILES ${_hdr}
DESTINATION "${CMAKE_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}
)
endif()
add_library(grpc++_unsecure add_library(grpc++_unsecure
src/cpp/client/insecure_credentials.cc src/cpp/client/insecure_credentials.cc
src/cpp/common/insecure_create_auth_context.cc src/cpp/common/insecure_create_auth_context.cc
@ -1734,6 +1714,7 @@ foreach(_hdr
include/grpc/impl/codegen/byte_buffer_reader.h include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h include/grpc/impl/codegen/connectivity_state.h
include/grpc/impl/codegen/exec_ctx_fwd.h
include/grpc/impl/codegen/grpc_types.h include/grpc/impl/codegen/grpc_types.h
include/grpc/impl/codegen/propagation_bits.h include/grpc/impl/codegen/propagation_bits.h
include/grpc/impl/codegen/status.h include/grpc/impl/codegen/status.h
@ -1808,35 +1789,6 @@ if (gRPC_INSTALL)
) )
endif() endif()
add_library(grpc_csharp_ext
src/csharp/ext/grpc_csharp_ext.c
)
target_include_directories(grpc_csharp_ext
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${BORINGSSL_ROOT_DIR}/include
PRIVATE ${PROTOBUF_ROOT_DIR}/src
PRIVATE ${ZLIB_INCLUDE_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib
)
target_link_libraries(grpc_csharp_ext
grpc
gpr
)
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}
)
endif()
add_executable(gen_hpack_tables add_executable(gen_hpack_tables

@ -292,12 +292,19 @@ AR = libtool -no_warning_for_no_symbols -o
endif endif
STRIP ?= strip -x STRIP ?= strip -x
else else
ifeq ($(SYSTEM),MINGW32)
ifeq ($(origin AR), default)
AR = ar rcs
endif
STRIP ?= strip --strip-unneeded
else
ifeq ($(origin AR), default) ifeq ($(origin AR), default)
AR = ar rcs AR = ar rcs
endif endif
STRIP ?= strip STRIP ?= strip
endif endif
endif endif
endif
INSTALL ?= install INSTALL ?= install
RM ?= rm -f RM ?= rm -f
PKG_CONFIG ?= pkg-config PKG_CONFIG ?= pkg-config
@ -479,6 +486,7 @@ CPP_PC_TEMPLATE = prefix=$(prefix),exec_prefix=\$${prefix},includedir=\$${prefix
CSHARP_PC_TEMPLATE = prefix=$(prefix),exec_prefix=\$${prefix},includedir=\$${prefix}/include,libdir=\$${exec_prefix}/lib,,Name: $(PC_NAME),Description: $(PC_DESCRIPTION),Version: $(CSHARP_VERSION),Cflags: -I\$${includedir} $(PC_CFLAGS),Requires.private: $(PC_REQUIRES_PRIVATE),Libs: -L\$${libdir} $(PC_LIB),Libs.private: $(PC_LIBS_PRIVATE) CSHARP_PC_TEMPLATE = prefix=$(prefix),exec_prefix=\$${prefix},includedir=\$${prefix}/include,libdir=\$${exec_prefix}/lib,,Name: $(PC_NAME),Description: $(PC_DESCRIPTION),Version: $(CSHARP_VERSION),Cflags: -I\$${includedir} $(PC_CFLAGS),Requires.private: $(PC_REQUIRES_PRIVATE),Libs: -L\$${libdir} $(PC_LIB),Libs.private: $(PC_LIBS_PRIVATE)
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
EXECUTABLE_SUFFIX = .exe
SHARED_EXT_CORE = dll SHARED_EXT_CORE = dll
SHARED_EXT_CPP = dll SHARED_EXT_CPP = dll
SHARED_EXT_CSHARP = dll SHARED_EXT_CSHARP = dll
@ -487,6 +495,7 @@ SHARED_VERSION_CORE = -2
SHARED_VERSION_CPP = -1 SHARED_VERSION_CPP = -1
SHARED_VERSION_CSHARP = -1 SHARED_VERSION_CSHARP = -1
else ifeq ($(SYSTEM),Darwin) else ifeq ($(SYSTEM),Darwin)
EXECUTABLE_SUFFIX =
SHARED_EXT_CORE = dylib SHARED_EXT_CORE = dylib
SHARED_EXT_CPP = dylib SHARED_EXT_CPP = dylib
SHARED_EXT_CSHARP = dylib SHARED_EXT_CSHARP = dylib
@ -495,6 +504,7 @@ SHARED_VERSION_CORE =
SHARED_VERSION_CPP = SHARED_VERSION_CPP =
SHARED_VERSION_CSHARP = SHARED_VERSION_CSHARP =
else else
EXECUTABLE_SUFFIX =
SHARED_EXT_CORE = so.$(CORE_VERSION) SHARED_EXT_CORE = so.$(CORE_VERSION)
SHARED_EXT_CPP = so.$(CPP_VERSION) SHARED_EXT_CPP = so.$(CPP_VERSION)
SHARED_EXT_CSHARP = so.$(CSHARP_VERSION) SHARED_EXT_CSHARP = so.$(CSHARP_VERSION)
@ -1013,6 +1023,9 @@ lame_client_test: $(BINDIR)/$(CONFIG)/lame_client_test
lb_policies_test: $(BINDIR)/$(CONFIG)/lb_policies_test lb_policies_test: $(BINDIR)/$(CONFIG)/lb_policies_test
load_file_test: $(BINDIR)/$(CONFIG)/load_file_test load_file_test: $(BINDIR)/$(CONFIG)/load_file_test
low_level_ping_pong_benchmark: $(BINDIR)/$(CONFIG)/low_level_ping_pong_benchmark low_level_ping_pong_benchmark: $(BINDIR)/$(CONFIG)/low_level_ping_pong_benchmark
memory_profile_client: $(BINDIR)/$(CONFIG)/memory_profile_client
memory_profile_server: $(BINDIR)/$(CONFIG)/memory_profile_server
memory_profile_test: $(BINDIR)/$(CONFIG)/memory_profile_test
message_compress_test: $(BINDIR)/$(CONFIG)/message_compress_test message_compress_test: $(BINDIR)/$(CONFIG)/message_compress_test
mlog_test: $(BINDIR)/$(CONFIG)/mlog_test mlog_test: $(BINDIR)/$(CONFIG)/mlog_test
multiple_server_queues_test: $(BINDIR)/$(CONFIG)/multiple_server_queues_test multiple_server_queues_test: $(BINDIR)/$(CONFIG)/multiple_server_queues_test
@ -1085,6 +1098,7 @@ grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin
grpc_tool_test: $(BINDIR)/$(CONFIG)/grpc_tool_test 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_test: $(BINDIR)/$(CONFIG)/grpclb_test grpclb_test: $(BINDIR)/$(CONFIG)/grpclb_test
http2_client: $(BINDIR)/$(CONFIG)/http2_client
hybrid_end2end_test: $(BINDIR)/$(CONFIG)/hybrid_end2end_test hybrid_end2end_test: $(BINDIR)/$(CONFIG)/hybrid_end2end_test
interop_client: $(BINDIR)/$(CONFIG)/interop_client interop_client: $(BINDIR)/$(CONFIG)/interop_client
interop_server: $(BINDIR)/$(CONFIG)/interop_server interop_server: $(BINDIR)/$(CONFIG)/interop_server
@ -1260,9 +1274,9 @@ pc_cxx: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc
pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc
ifeq ($(EMBED_OPENSSL),true) ifeq ($(EMBED_OPENSSL),true)
privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_proto_reflection_desc_db.a $(LIBDIR)/$(CONFIG)/libgrpc++_test.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libinterop_client_helper.a $(LIBDIR)/$(CONFIG)/libinterop_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_server_helper.a $(LIBDIR)/$(CONFIG)/libinterop_server_lib.a $(LIBDIR)/$(CONFIG)/libinterop_server_main.a $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl_aes_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_asn1_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_base64_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bio_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bn_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bytestring_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_aead_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cipher_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ed25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_digest_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_extra_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pbkdf_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_hmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs12_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs8_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_poly1305_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x509_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a $(LIBDIR)/$(CONFIG)/libbenchmark.a privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_proto_reflection_desc_db.a $(LIBDIR)/$(CONFIG)/libgrpc++_test.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libhttp2_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_client_helper.a $(LIBDIR)/$(CONFIG)/libinterop_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_server_helper.a $(LIBDIR)/$(CONFIG)/libinterop_server_lib.a $(LIBDIR)/$(CONFIG)/libinterop_server_main.a $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl_aes_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_asn1_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_base64_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bio_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bn_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bytestring_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_aead_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cipher_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ed25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_digest_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_extra_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pbkdf_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_hmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs12_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs8_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_poly1305_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x509_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a $(LIBDIR)/$(CONFIG)/libbenchmark.a
else else
privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_proto_reflection_desc_db.a $(LIBDIR)/$(CONFIG)/libgrpc++_test.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libinterop_client_helper.a $(LIBDIR)/$(CONFIG)/libinterop_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_server_helper.a $(LIBDIR)/$(CONFIG)/libinterop_server_lib.a $(LIBDIR)/$(CONFIG)/libinterop_server_main.a $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libbenchmark.a privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_proto_reflection_desc_db.a $(LIBDIR)/$(CONFIG)/libgrpc++_test.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 endif
@ -1348,6 +1362,9 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/lame_client_test \ $(BINDIR)/$(CONFIG)/lame_client_test \
$(BINDIR)/$(CONFIG)/lb_policies_test \ $(BINDIR)/$(CONFIG)/lb_policies_test \
$(BINDIR)/$(CONFIG)/load_file_test \ $(BINDIR)/$(CONFIG)/load_file_test \
$(BINDIR)/$(CONFIG)/memory_profile_client \
$(BINDIR)/$(CONFIG)/memory_profile_server \
$(BINDIR)/$(CONFIG)/memory_profile_test \
$(BINDIR)/$(CONFIG)/message_compress_test \ $(BINDIR)/$(CONFIG)/message_compress_test \
$(BINDIR)/$(CONFIG)/mlog_test \ $(BINDIR)/$(CONFIG)/mlog_test \
$(BINDIR)/$(CONFIG)/multiple_server_queues_test \ $(BINDIR)/$(CONFIG)/multiple_server_queues_test \
@ -1467,6 +1484,7 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/grpc_tool_test \ $(BINDIR)/$(CONFIG)/grpc_tool_test \
$(BINDIR)/$(CONFIG)/grpclb_api_test \ $(BINDIR)/$(CONFIG)/grpclb_api_test \
$(BINDIR)/$(CONFIG)/grpclb_test \ $(BINDIR)/$(CONFIG)/grpclb_test \
$(BINDIR)/$(CONFIG)/http2_client \
$(BINDIR)/$(CONFIG)/hybrid_end2end_test \ $(BINDIR)/$(CONFIG)/hybrid_end2end_test \
$(BINDIR)/$(CONFIG)/interop_client \ $(BINDIR)/$(CONFIG)/interop_client \
$(BINDIR)/$(CONFIG)/interop_server \ $(BINDIR)/$(CONFIG)/interop_server \
@ -1560,6 +1578,7 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/grpc_tool_test \ $(BINDIR)/$(CONFIG)/grpc_tool_test \
$(BINDIR)/$(CONFIG)/grpclb_api_test \ $(BINDIR)/$(CONFIG)/grpclb_api_test \
$(BINDIR)/$(CONFIG)/grpclb_test \ $(BINDIR)/$(CONFIG)/grpclb_test \
$(BINDIR)/$(CONFIG)/http2_client \
$(BINDIR)/$(CONFIG)/hybrid_end2end_test \ $(BINDIR)/$(CONFIG)/hybrid_end2end_test \
$(BINDIR)/$(CONFIG)/interop_client \ $(BINDIR)/$(CONFIG)/interop_client \
$(BINDIR)/$(CONFIG)/interop_server \ $(BINDIR)/$(CONFIG)/interop_server \
@ -1739,6 +1758,8 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/lame_client_test || ( echo test lame_client_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/lame_client_test || ( echo test lame_client_test failed ; exit 1 )
$(E) "[RUN] Testing load_file_test" $(E) "[RUN] Testing load_file_test"
$(Q) $(BINDIR)/$(CONFIG)/load_file_test || ( echo test load_file_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/load_file_test || ( echo test load_file_test failed ; exit 1 )
$(E) "[RUN] Testing memory_profile_test"
$(Q) $(BINDIR)/$(CONFIG)/memory_profile_test || ( echo test memory_profile_test failed ; exit 1 )
$(E) "[RUN] Testing message_compress_test" $(E) "[RUN] Testing message_compress_test"
$(Q) $(BINDIR)/$(CONFIG)/message_compress_test || ( echo test message_compress_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/message_compress_test || ( echo test message_compress_test failed ; exit 1 )
$(E) "[RUN] Testing multiple_server_queues_test" $(E) "[RUN] Testing multiple_server_queues_test"
@ -2039,7 +2060,7 @@ $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.pb.cc: src/proto/grpc/lb/v1/load_ba
$(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc: src/proto/grpc/lb/v1/load_balancer.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc: src/proto/grpc/lb/v1/load_balancer.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
@ -2054,7 +2075,7 @@ $(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.pb.cc: src/proto/grpc/ref
$(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc: src/proto/grpc/reflection/v1alpha/reflection.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc: src/proto/grpc/reflection/v1alpha/reflection.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
@ -2069,7 +2090,7 @@ $(GENDIR)/src/proto/grpc/testing/compiler_test.pb.cc: src/proto/grpc/testing/com
$(GENDIR)/src/proto/grpc/testing/compiler_test.grpc.pb.cc: src/proto/grpc/testing/compiler_test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/compiler_test.grpc.pb.cc: src/proto/grpc/testing/compiler_test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
@ -2084,7 +2105,7 @@ $(GENDIR)/src/proto/grpc/testing/control.pb.cc: src/proto/grpc/testing/control.p
$(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc: src/proto/grpc/testing/control.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc: src/proto/grpc/testing/control.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
@ -2099,7 +2120,7 @@ $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc: src/proto/grpc/
$(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc: src/proto/grpc/testing/duplicate/echo_duplicate.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc: src/proto/grpc/testing/duplicate/echo_duplicate.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
@ -2114,7 +2135,7 @@ $(GENDIR)/src/proto/grpc/testing/echo.pb.cc: src/proto/grpc/testing/echo.proto $
$(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc: src/proto/grpc/testing/echo.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc: src/proto/grpc/testing/echo.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
@ -2129,7 +2150,7 @@ $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc: src/proto/grpc/testing/ech
$(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc: src/proto/grpc/testing/echo_messages.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc: src/proto/grpc/testing/echo_messages.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
@ -2144,7 +2165,7 @@ $(GENDIR)/src/proto/grpc/testing/empty.pb.cc: src/proto/grpc/testing/empty.proto
$(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc: src/proto/grpc/testing/empty.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc: src/proto/grpc/testing/empty.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
@ -2159,7 +2180,7 @@ $(GENDIR)/src/proto/grpc/testing/messages.pb.cc: src/proto/grpc/testing/messages
$(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc: src/proto/grpc/testing/messages.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc: src/proto/grpc/testing/messages.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
@ -2174,7 +2195,7 @@ $(GENDIR)/src/proto/grpc/testing/metrics.pb.cc: src/proto/grpc/testing/metrics.p
$(GENDIR)/src/proto/grpc/testing/metrics.grpc.pb.cc: src/proto/grpc/testing/metrics.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/metrics.grpc.pb.cc: src/proto/grpc/testing/metrics.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
@ -2189,7 +2210,7 @@ $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc: src/proto/grpc/testing/payloads
$(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc: src/proto/grpc/testing/payloads.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc: src/proto/grpc/testing/payloads.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
@ -2204,7 +2225,7 @@ $(GENDIR)/src/proto/grpc/testing/services.pb.cc: src/proto/grpc/testing/services
$(GENDIR)/src/proto/grpc/testing/services.grpc.pb.cc: src/proto/grpc/testing/services.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/services.grpc.pb.cc: src/proto/grpc/testing/services.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
@ -2219,7 +2240,7 @@ $(GENDIR)/src/proto/grpc/testing/stats.pb.cc: src/proto/grpc/testing/stats.proto
$(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc: src/proto/grpc/testing/stats.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc: src/proto/grpc/testing/stats.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
@ -2234,7 +2255,7 @@ $(GENDIR)/src/proto/grpc/testing/test.pb.cc: src/proto/grpc/testing/test.proto $
$(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc: src/proto/grpc/testing/test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc: src/proto/grpc/testing/test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
@ -2327,36 +2348,36 @@ install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx
install-shared_c: shared_c strip-shared_c install-pkg-config_c install-shared_c: shared_c strip-shared_c install-pkg-config_c
$(E) "[INSTALL] Installing $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" $(E) "[INSTALL] Installing $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)"
$(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) -d $(prefix)/lib
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)gpr$(SHARED_VERSION).$(SHARED_EXT_CORE) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgpr-imp.a $(prefix)/lib/libgpr-imp.a $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgpr.a
else ifneq ($(SYSTEM),Darwin) else ifneq ($(SYSTEM),Darwin)
$(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgpr.so.2 $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgpr.so.2
$(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgpr.so $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgpr.so
endif endif
$(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)"
$(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) -d $(prefix)/lib
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)grpc$(SHARED_VERSION).$(SHARED_EXT_CORE) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc-imp.a $(prefix)/lib/libgrpc-imp.a $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgrpc.a
else ifneq ($(SYSTEM),Darwin) else ifneq ($(SYSTEM),Darwin)
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc.so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc.so.2
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc.so $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc.so
endif endif
$(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)"
$(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) -d $(prefix)/lib
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION).$(SHARED_EXT_CORE) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_cronet-imp.a $(prefix)/lib/libgrpc_cronet-imp.a $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgrpc_cronet.a
else ifneq ($(SYSTEM),Darwin) else ifneq ($(SYSTEM),Darwin)
$(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_cronet.so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_cronet.so.2
$(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_cronet.so $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_cronet.so
endif endif
$(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)"
$(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) -d $(prefix)/lib
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION).$(SHARED_EXT_CORE) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure-imp.a $(prefix)/lib/libgrpc_unsecure-imp.a $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgrpc_unsecure.a
else ifneq ($(SYSTEM),Darwin) else ifneq ($(SYSTEM),Darwin)
$(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_unsecure.so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_unsecure.so.2
$(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_unsecure.so $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_unsecure.so
@ -2371,36 +2392,36 @@ endif
install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c install-pkg-config_cxx install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c install-pkg-config_cxx
$(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)"
$(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) -d $(prefix)/lib
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT_CPP) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++-imp.a $(prefix)/lib/libgrpc++-imp.a $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++.a
else ifneq ($(SYSTEM),Darwin) else ifneq ($(SYSTEM),Darwin)
$(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so.2
$(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so
endif endif
$(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)"
$(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) -d $(prefix)/lib
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION).$(SHARED_EXT_CPP) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet-imp.a $(prefix)/lib/libgrpc++_cronet-imp.a $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_cronet.a
else ifneq ($(SYSTEM),Darwin) else ifneq ($(SYSTEM),Darwin)
$(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so.2
$(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so
endif endif
$(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)"
$(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) -d $(prefix)/lib
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT_CPP) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection-imp.a $(prefix)/lib/libgrpc++_reflection-imp.a $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_reflection.a
else ifneq ($(SYSTEM),Darwin) else ifneq ($(SYSTEM),Darwin)
$(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_reflection.so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_reflection.so.2
$(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_reflection.so $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_reflection.so
endif endif
$(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)"
$(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) -d $(prefix)/lib
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT_CPP) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure-imp.a $(prefix)/lib/libgrpc++_unsecure-imp.a $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_unsecure.a
else ifneq ($(SYSTEM),Darwin) else ifneq ($(SYSTEM),Darwin)
$(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_unsecure.so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_unsecure.so.2
$(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_unsecure.so $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_unsecure.so
@ -2415,9 +2436,9 @@ endif
install-shared_csharp: shared_csharp strip-shared_csharp install-shared_csharp: shared_csharp strip-shared_csharp
$(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP)" $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP)"
$(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) -d $(prefix)/lib
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION).$(SHARED_EXT_CSHARP) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP)
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext-imp.a $(prefix)/lib/libgrpc_csharp_ext-imp.a $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP)-dll.a $(prefix)/lib/libgrpc_csharp_ext.a
else ifneq ($(SYSTEM),Darwin) else ifneq ($(SYSTEM),Darwin)
$(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so.2
$(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so
@ -2430,9 +2451,6 @@ endif
install-plugins: $(PROTOC_PLUGINS) install-plugins: $(PROTOC_PLUGINS)
ifeq ($(SYSTEM),MINGW32)
$(Q) false
else
$(E) "[INSTALL] Installing grpc protoc plugins" $(E) "[INSTALL] Installing grpc protoc plugins"
$(Q) $(INSTALL) -d $(prefix)/bin $(Q) $(INSTALL) -d $(prefix)/bin
$(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(prefix)/bin/grpc_cpp_plugin $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(prefix)/bin/grpc_cpp_plugin
@ -2448,7 +2466,6 @@ else
$(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_python_plugin $(prefix)/bin/grpc_python_plugin $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_python_plugin $(prefix)/bin/grpc_python_plugin
$(Q) $(INSTALL) -d $(prefix)/bin $(Q) $(INSTALL) -d $(prefix)/bin
$(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_ruby_plugin $(prefix)/bin/grpc_ruby_plugin $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_ruby_plugin $(prefix)/bin/grpc_ruby_plugin
endif
install-pkg-config_c: pc_c pc_c_unsecure install-pkg-config_c: pc_c pc_c_unsecure
$(E) "[INSTALL] Installing C pkg-config files" $(E) "[INSTALL] Installing C pkg-config files"
@ -2578,17 +2595,17 @@ ifeq ($(SYSTEM),MINGW32)
$(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGPR_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGPR_OBJS) $(ZLIB_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared gpr.def -Wl,--output-def=$(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS)
else else
$(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGPR_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGPR_OBJS) $(ZLIB_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)gpr$(SHARED_VERSION).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS)
else else
$(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgpr.so.2 -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgpr.so.2 -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS)
$(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so.2 $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so.2
$(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so
endif endif
endif endif
@ -2631,6 +2648,8 @@ LIBGRPC_SRC = \
src/core/lib/channel/connected_channel.c \ src/core/lib/channel/connected_channel.c \
src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/deadline_filter.c \
src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker.c \
src/core/lib/channel/handshaker_factory.c \
src/core/lib/channel/handshaker_registry.c \
src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_client_filter.c \
src/core/lib/channel/http_server_filter.c \ src/core/lib/channel/http_server_filter.c \
src/core/lib/channel/message_size_filter.c \ src/core/lib/channel/message_size_filter.c \
@ -2852,6 +2871,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/byte_buffer_reader.h \ include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/exec_ctx_fwd.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/propagation_bits.h \ include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/status.h \ include/grpc/impl/codegen/status.h \
@ -2898,17 +2918,17 @@ ifeq ($(SYSTEM),MINGW32)
$(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP) $(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared grpc.def -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS)
else else
$(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc$(SHARED_VERSION).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS)
else else
$(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS)
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.2
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so
endif endif
endif endif
@ -2930,6 +2950,8 @@ LIBGRPC_CRONET_SRC = \
src/core/lib/channel/connected_channel.c \ src/core/lib/channel/connected_channel.c \
src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/deadline_filter.c \
src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker.c \
src/core/lib/channel/handshaker_factory.c \
src/core/lib/channel/handshaker_registry.c \
src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_client_filter.c \
src/core/lib/channel/http_server_filter.c \ src/core/lib/channel/http_server_filter.c \
src/core/lib/channel/message_size_filter.c \ src/core/lib/channel/message_size_filter.c \
@ -3122,6 +3144,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/byte_buffer_reader.h \ include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/exec_ctx_fwd.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/propagation_bits.h \ include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/status.h \ include/grpc/impl/codegen/status.h \
@ -3168,17 +3191,17 @@ ifeq ($(SYSTEM),MINGW32)
$(LIBDIR)/$(CONFIG)/grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_CRONET_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP) $(LIBDIR)/$(CONFIG)/grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_CRONET_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared grpc_cronet.def -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_cronet$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_cronet$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS)
else else
$(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_CRONET_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_CRONET_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS)
else else
$(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_cronet.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_cronet.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS)
$(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).so.2
$(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).so $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).so
endif endif
endif endif
@ -3219,6 +3242,8 @@ LIBGRPC_TEST_UTIL_SRC = \
src/core/lib/channel/connected_channel.c \ src/core/lib/channel/connected_channel.c \
src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/deadline_filter.c \
src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker.c \
src/core/lib/channel/handshaker_factory.c \
src/core/lib/channel/handshaker_registry.c \
src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_client_filter.c \
src/core/lib/channel/http_server_filter.c \ src/core/lib/channel/http_server_filter.c \
src/core/lib/channel/message_size_filter.c \ src/core/lib/channel/message_size_filter.c \
@ -3338,6 +3363,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/byte_buffer_reader.h \ include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/exec_ctx_fwd.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/propagation_bits.h \ include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/status.h \ include/grpc/impl/codegen/status.h \
@ -3436,6 +3462,8 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/channel/connected_channel.c \ src/core/lib/channel/connected_channel.c \
src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/deadline_filter.c \
src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker.c \
src/core/lib/channel/handshaker_factory.c \
src/core/lib/channel/handshaker_registry.c \
src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_client_filter.c \
src/core/lib/channel/http_server_filter.c \ src/core/lib/channel/http_server_filter.c \
src/core/lib/channel/message_size_filter.c \ src/core/lib/channel/message_size_filter.c \
@ -3628,6 +3656,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/byte_buffer_reader.h \ include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/exec_ctx_fwd.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/propagation_bits.h \ include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/status.h \ include/grpc/impl/codegen/status.h \
@ -3662,17 +3691,17 @@ ifeq ($(SYSTEM),MINGW32)
$(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_UNSECURE_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_UNSECURE_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared grpc_unsecure.def -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS)
else else
$(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_UNSECURE_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_UNSECURE_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS)
else else
$(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_unsecure.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_unsecure.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS)
$(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so.2
$(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so
endif endif
endif endif
@ -3872,6 +3901,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc/impl/codegen/byte_buffer_reader.h \ include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/exec_ctx_fwd.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/propagation_bits.h \ include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/status.h \ include/grpc/impl/codegen/status.h \
@ -3922,20 +3952,20 @@ endif
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
$(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/grpc.$(SHARED_EXT_CORE) $(OPENSSL_DEP) $(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(OPENSSL_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared grpc++.def -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc-imp $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc$(SHARED_VERSION_CORE)-dll
else else
$(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT_CORE) $(OPENSSL_DEP) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT_CORE) $(OPENSSL_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc
else else
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc
$(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).so.1
$(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).so $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).so
endif endif
endif endif
@ -4015,6 +4045,8 @@ LIBGRPC++_CRONET_SRC = \
src/core/lib/channel/connected_channel.c \ src/core/lib/channel/connected_channel.c \
src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/deadline_filter.c \
src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker.c \
src/core/lib/channel/handshaker_factory.c \
src/core/lib/channel/handshaker_registry.c \
src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_client_filter.c \
src/core/lib/channel/http_server_filter.c \ src/core/lib/channel/http_server_filter.c \
src/core/lib/channel/message_size_filter.c \ src/core/lib/channel/message_size_filter.c \
@ -4234,6 +4266,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc/impl/codegen/byte_buffer_reader.h \ include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/exec_ctx_fwd.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/propagation_bits.h \ include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/status.h \ include/grpc/impl/codegen/status.h \
@ -4294,20 +4327,20 @@ endif
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
$(LIBDIR)/$(CONFIG)/grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_CRONET_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/gpr.$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/grpc_cronet.$(SHARED_EXT_CORE) $(OPENSSL_DEP) $(LIBDIR)/$(CONFIG)/grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_CRONET_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(OPENSSL_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared grpc++_cronet.def -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++_cronet$(SHARED_VERSION_CPP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(LDLIBS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr-imp -lgrpc_cronet-imp $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++_cronet$(SHARED_VERSION_CPP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(LDLIBS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr$(SHARED_VERSION_CORE)-dll -lgrpc_cronet$(SHARED_VERSION_CORE)-dll
else else
$(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_CRONET_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet.$(SHARED_EXT_CORE) $(OPENSSL_DEP) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_CRONET_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet.$(SHARED_EXT_CORE) $(OPENSSL_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(LDLIBS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc_cronet $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(LDLIBS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc_cronet
else else
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_cronet.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(LDLIBS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc_cronet $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_cronet.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(LDLIBS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc_cronet
$(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).so.1
$(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).so $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).so
endif endif
endif endif
@ -4417,20 +4450,20 @@ endif
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
$(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/grpc++.$(SHARED_EXT_CPP) $(OPENSSL_DEP) $(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(OPENSSL_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared grpc++_reflection.def -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION_CPP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc++-imp $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION_CPP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc++$(SHARED_VERSION_CPP)-dll
else else
$(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT_CPP) $(OPENSSL_DEP) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT_CPP) $(OPENSSL_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc++ $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc++
else else
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_reflection.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc++ $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_reflection.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc++
$(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).so.1
$(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).so $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).so
endif endif
endif endif
@ -4589,6 +4622,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc/impl/codegen/byte_buffer_reader.h \ include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/exec_ctx_fwd.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/propagation_bits.h \ include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/status.h \ include/grpc/impl/codegen/status.h \
@ -4767,6 +4801,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc/impl/codegen/byte_buffer_reader.h \ include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/exec_ctx_fwd.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/propagation_bits.h \ include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/status.h \ include/grpc/impl/codegen/status.h \
@ -4807,20 +4842,20 @@ endif
ifeq ($(SYSTEM),MINGW32) ifeq ($(SYSTEM),MINGW32)
$(LIBDIR)/$(CONFIG)/grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_UNSECURE_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/gpr.$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/grpc_unsecure.$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_UNSECURE_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared grpc++_unsecure.def -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++_unsecure$(SHARED_VERSION_CPP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_UNSECURE_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr-imp -lgrpc_unsecure-imp $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++_unsecure$(SHARED_VERSION_CPP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_UNSECURE_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr$(SHARED_VERSION_CORE)-dll -lgrpc_unsecure$(SHARED_VERSION_CORE)-dll
else else
$(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_UNSECURE_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_UNSECURE_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.$(SHARED_EXT_CORE)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_UNSECURE_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc_unsecure $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_UNSECURE_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc_unsecure
else else
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_unsecure.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_UNSECURE_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc_unsecure $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_unsecure.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_UNSECURE_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc_unsecure
$(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).so.1
$(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).so $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).so
endif endif
endif endif
@ -4934,6 +4969,59 @@ ifneq ($(NO_DEPS),true)
endif endif
LIBHTTP2_CLIENT_MAIN_SRC = \
$(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc \
$(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc \
$(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc \
test/cpp/interop/http2_client.cc \
PUBLIC_HEADERS_CXX += \
LIBHTTP2_CLIENT_MAIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBHTTP2_CLIENT_MAIN_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure libraries if you don't have OpenSSL.
$(LIBDIR)/$(CONFIG)/libhttp2_client_main.a: openssl_dep_error
else
ifeq ($(NO_PROTOBUF),true)
# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay.
$(LIBDIR)/$(CONFIG)/libhttp2_client_main.a: protobuf_dep_error
else
$(LIBDIR)/$(CONFIG)/libhttp2_client_main.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(PROTOBUF_DEP) $(LIBHTTP2_CLIENT_MAIN_OBJS)
$(E) "[AR] Creating $@"
$(Q) mkdir -p `dirname $@`
$(Q) rm -f $(LIBDIR)/$(CONFIG)/libhttp2_client_main.a
$(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libhttp2_client_main.a $(LIBHTTP2_CLIENT_MAIN_OBJS)
ifeq ($(SYSTEM),Darwin)
$(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libhttp2_client_main.a
endif
endif
endif
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(LIBHTTP2_CLIENT_MAIN_OBJS:.o=.dep)
endif
endif
$(OBJDIR)/$(CONFIG)/test/cpp/interop/http2_client.o: $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc
LIBINTEROP_CLIENT_HELPER_SRC = \ LIBINTEROP_CLIENT_HELPER_SRC = \
$(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc \ $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc \
test/cpp/interop/client_helper.cc \ test/cpp/interop/client_helper.cc \
@ -5300,17 +5388,17 @@ ifeq ($(SYSTEM),MINGW32)
$(LIBDIR)/$(CONFIG)/grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP): $(LIBGRPC_CSHARP_EXT_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP) $(LIBDIR)/$(CONFIG)/grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP): $(LIBGRPC_CSHARP_EXT_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared grpc_csharp_ext.def -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_csharp_ext$(SHARED_VERSION_CSHARP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_csharp_ext$(SHARED_VERSION_CSHARP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS)
else else
$(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP): $(LIBGRPC_CSHARP_EXT_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP): $(LIBGRPC_CSHARP_EXT_OBJS) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP)
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION).$(SHARED_EXT_CSHARP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS)
else else
$(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LDLIBS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS)
$(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so.1
$(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so
endif endif
endif endif
@ -10272,6 +10360,102 @@ endif
endif endif
MEMORY_PROFILE_CLIENT_SRC = \
test/core/memory_usage/client.c \
MEMORY_PROFILE_CLIENT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(MEMORY_PROFILE_CLIENT_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/memory_profile_client: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/memory_profile_client: $(MEMORY_PROFILE_CLIENT_OBJS) $(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) $(MEMORY_PROFILE_CLIENT_OBJS) $(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)/memory_profile_client
endif
$(OBJDIR)/$(CONFIG)/test/core/memory_usage/client.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_memory_profile_client: $(MEMORY_PROFILE_CLIENT_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(MEMORY_PROFILE_CLIENT_OBJS:.o=.dep)
endif
endif
MEMORY_PROFILE_SERVER_SRC = \
test/core/memory_usage/server.c \
MEMORY_PROFILE_SERVER_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(MEMORY_PROFILE_SERVER_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/memory_profile_server: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/memory_profile_server: $(MEMORY_PROFILE_SERVER_OBJS) $(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) $(MEMORY_PROFILE_SERVER_OBJS) $(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)/memory_profile_server
endif
$(OBJDIR)/$(CONFIG)/test/core/memory_usage/server.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_memory_profile_server: $(MEMORY_PROFILE_SERVER_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(MEMORY_PROFILE_SERVER_OBJS:.o=.dep)
endif
endif
MEMORY_PROFILE_TEST_SRC = \
test/core/memory_usage/memory_usage_test.c \
MEMORY_PROFILE_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(MEMORY_PROFILE_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/memory_profile_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/memory_profile_test: $(MEMORY_PROFILE_TEST_OBJS) $(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) $(MEMORY_PROFILE_TEST_OBJS) $(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)/memory_profile_test
endif
$(OBJDIR)/$(CONFIG)/test/core/memory_usage/memory_usage_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_memory_profile_test: $(MEMORY_PROFILE_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(MEMORY_PROFILE_TEST_OBJS:.o=.dep)
endif
endif
MESSAGE_COMPRESS_TEST_SRC = \ MESSAGE_COMPRESS_TEST_SRC = \
test/core/compression/message_compress_test.c \ test/core/compression/message_compress_test.c \
@ -12888,6 +13072,37 @@ 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
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/http2_client: 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)/http2_client: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/http2_client: $(LIBDIR)/$(CONFIG)/libhttp2_client_main.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libhttp2_client_main.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/http2_client
endif
endif
HYBRID_END2END_TEST_SRC = \ HYBRID_END2END_TEST_SRC = \
test/cpp/end2end/hybrid_end2end_test.cc \ test/cpp/end2end/hybrid_end2end_test.cc \
@ -16805,6 +17020,7 @@ test/core/util/test_tcp_server.c: $(OPENSSL_DEP)
test/cpp/end2end/test_service_impl.cc: $(OPENSSL_DEP) test/cpp/end2end/test_service_impl.cc: $(OPENSSL_DEP)
test/cpp/interop/client.cc: $(OPENSSL_DEP) test/cpp/interop/client.cc: $(OPENSSL_DEP)
test/cpp/interop/client_helper.cc: $(OPENSSL_DEP) test/cpp/interop/client_helper.cc: $(OPENSSL_DEP)
test/cpp/interop/http2_client.cc: $(OPENSSL_DEP)
test/cpp/interop/interop_client.cc: $(OPENSSL_DEP) test/cpp/interop/interop_client.cc: $(OPENSSL_DEP)
test/cpp/interop/interop_server.cc: $(OPENSSL_DEP) test/cpp/interop/interop_server.cc: $(OPENSSL_DEP)
test/cpp/interop/interop_server_bootstrap.cc: $(OPENSSL_DEP) test/cpp/interop/interop_server_bootstrap.cc: $(OPENSSL_DEP)

@ -17,6 +17,8 @@ See [INSTALL](INSTALL.md) for installation instructions for various platforms.
See [tools/run_tests](tools/run_tests) for more guidance on how to run various test suites (e.g. unit tests, interop tests, benchmarks) See [tools/run_tests](tools/run_tests) for more guidance on how to run various test suites (e.g. unit tests, interop tests, benchmarks)
See [Performance dashboard](http://performance-dot-grpc-testing.appspot.com/explore?dashboard=5712453606309888) for the performance numbers for v1.0.x.
#Repository Structure & Status #Repository Structure & Status
This repository contains source code for gRPC libraries for multiple languages written on top of shared C core library [src/core] (src/core). This repository contains source code for gRPC libraries for multiple languages written on top of shared C core library [src/core] (src/core).

@ -37,18 +37,68 @@
# Some of this file is built with the help of # Some of this file is built with the help of
# https://n8.io/converting-a-c-library-to-gyp/ # https://n8.io/converting-a-c-library-to-gyp/
{ {
'variables': {
'runtime%': 'node'
},
'target_defaults': { 'target_defaults': {
'include_dirs': [ 'include_dirs': [
'.', '.',
'include' 'include'
], ],
'defines': [ 'defines': [
'GRPC_UV' 'GPR_BACKWARDS_COMPATIBILITY_MODE'
], ],
'conditions': [ 'conditions': [
['runtime=="node"', {
'defines': [
'GRPC_UV'
]
}],
['OS!="win" and runtime=="electron"', {
"defines": [
'OPENSSL_NO_THREADS'
]
}],
# This is the condition for using boringssl
['OS=="win" or runtime=="electron"', {
"include_dirs": [
"third_party/boringssl/include"
],
"defines": [
'OPENSSL_NO_ASM'
]
}, {
# Based on logic above, we know that this must be a non-Windows system
'variables': {
# The output of "node --version" is "v[version]". We use cut to
# remove the first character.
'target%': '<!(node --version | cut -c2-)'
},
# Empirically, Node only exports ALPN symbols if its major version is >0.
# io.js always reports versions >0 and always exports ALPN symbols.
# Therefore, Node's major version will be truthy if and only if it
# supports ALPN. The target is "[major].[minor].[patch]". We split by
# periods and take the first field to get the major version.
'defines': [
'TSI_OPENSSL_ALPN_SUPPORT=<!(echo <(target) | cut -d. -f1)'
],
'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"', { ['OS == "win"', {
"include_dirs": [ "include_dirs": [
"third_party/boringssl/include",
"third_party/zlib" "third_party/zlib"
], ],
"defines": [ "defines": [
@ -58,8 +108,6 @@
'UNICODE', 'UNICODE',
'_UNICODE', '_UNICODE',
'NOMINMAX', 'NOMINMAX',
'OPENSSL_NO_ASM',
'GPR_BACKWARDS_COMPATIBILITY_MODE'
], ],
"msvs_settings": { "msvs_settings": {
'VCCLCompilerTool': { 'VCCLCompilerTool': {
@ -72,21 +120,8 @@
}, { # OS != "win" }, { # OS != "win"
'variables': { 'variables': {
'config': '<!(echo $CONFIG)', 'config': '<!(echo $CONFIG)',
# The output of "node --version" is "v[version]". We use cut to
# remove the first character.
'target%': '<!(node --version | cut -c2-)'
}, },
# Empirically, Node only exports ALPN symbols if its major version is >0.
# io.js always reports versions >0 and always exports ALPN symbols.
# Therefore, Node's major version will be truthy if and only if it
# supports ALPN. The target is "[major].[minor].[patch]". We split by
# periods and take the first field to get the major version.
'defines': [
'TSI_OPENSSL_ALPN_SUPPORT=<!(echo <(target) | cut -d. -f1)',
'GPR_BACKWARDS_COMPATIBILITY_MODE'
],
'include_dirs': [ 'include_dirs': [
'<(node_root_dir)/deps/openssl/openssl/include',
'<(node_root_dir)/deps/zlib' '<(node_root_dir)/deps/zlib'
], ],
'conditions': [ 'conditions': [
@ -101,47 +136,14 @@
'-fprofile-arcs' '-fprofile-arcs'
] ]
} }
], ]
["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" ]
}]
] ]
}] }]
] ]
}, },
'conditions': [ 'conditions': [
['OS == "win"', { ['OS=="win" or runtime=="electron"', {
'targets': [ 'targets': [
{
# IMPORTANT WINDOWS BUILD INFORMATION
# This library does not build on Windows without modifying the Node
# development packages that node-gyp downloads in order to build.
# Due to https://github.com/nodejs/node/issues/4932, the headers for
# BoringSSL conflict with the OpenSSL headers included by default
# when including the Node headers. The remedy for this is to remove
# the OpenSSL headers, from the downloaded Node development package,
# which is typically located in `.node-gyp` in your home directory.
'target_name': 'WINDOWS_BUILD_WARNING',
'actions': [
{
'action_name': 'WINDOWS_BUILD_WARNING',
'inputs': [
'package.json'
],
'outputs': [
'ignore_this_part'
],
'action': ['echo', 'IMPORTANT: Due to https://github.com/nodejs/node/issues/4932, to build this library on Windows, you must first remove <(node_root_dir)/include/node/openssl/']
}
]
},
# Only want to compile BoringSSL and zlib under Windows
{ {
'cflags': [ 'cflags': [
'-std=c99', '-std=c99',
@ -453,6 +455,34 @@
'third_party/boringssl/ssl/tls_record.c', 'third_party/boringssl/ssl/tls_record.c',
] ]
}, },
]
}],
['OS == "win"', {
'targets': [
{
# IMPORTANT WINDOWS BUILD INFORMATION
# This library does not build on Windows without modifying the Node
# development packages that node-gyp downloads in order to build.
# Due to https://github.com/nodejs/node/issues/4932, the headers for
# BoringSSL conflict with the OpenSSL headers included by default
# when including the Node headers. The remedy for this is to remove
# the OpenSSL headers, from the downloaded Node development package,
# which is typically located in `.node-gyp` in your home directory.
'target_name': 'WINDOWS_BUILD_WARNING',
'actions': [
{
'action_name': 'WINDOWS_BUILD_WARNING',
'inputs': [
'package.json'
],
'outputs': [
'ignore_this_part'
],
'action': ['echo', 'IMPORTANT: Due to https://github.com/nodejs/node/issues/4932, to build this library on Windows, you must first remove <(node_root_dir)/include/node/openssl/']
}
]
},
# Only want to compile zlib under Windows
{ {
'cflags': [ 'cflags': [
'-std=c99', '-std=c99',
@ -572,6 +602,8 @@
'src/core/lib/channel/connected_channel.c', 'src/core/lib/channel/connected_channel.c',
'src/core/lib/channel/deadline_filter.c', 'src/core/lib/channel/deadline_filter.c',
'src/core/lib/channel/handshaker.c', 'src/core/lib/channel/handshaker.c',
'src/core/lib/channel/handshaker_factory.c',
'src/core/lib/channel/handshaker_registry.c',
'src/core/lib/channel/http_client_filter.c', 'src/core/lib/channel/http_client_filter.c',
'src/core/lib/channel/http_server_filter.c', 'src/core/lib/channel/http_server_filter.c',
'src/core/lib/channel/message_size_filter.c', 'src/core/lib/channel/message_size_filter.c',
@ -805,6 +837,11 @@
'-g' '-g'
], ],
"conditions": [ "conditions": [
['OS=="win" or runtime=="electron"', {
'dependencies': [
"boringssl",
]
}],
['OS=="mac"', { ['OS=="mac"', {
'xcode_settings': { 'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.9', 'MACOSX_DEPLOYMENT_TARGET': '10.9',
@ -816,7 +853,6 @@
}], }],
['OS=="win"', { ['OS=="win"', {
'dependencies': [ 'dependencies': [
"boringssl",
"z", "z",
] ]
}], }],
@ -833,8 +869,8 @@
"src/node/ext/call_credentials.cc", "src/node/ext/call_credentials.cc",
"src/node/ext/channel.cc", "src/node/ext/channel.cc",
"src/node/ext/channel_credentials.cc", "src/node/ext/channel_credentials.cc",
"src/node/ext/completion_queue.cc", "src/node/ext/completion_queue_threadpool.cc",
"src/node/ext/completion_queue_async_worker.cc", "src/node/ext/completion_queue_uv.cc",
"src/node/ext/node_grpc.cc", "src/node/ext/node_grpc.cc",
"src/node/ext/server.cc", "src/node/ext/server.cc",
"src/node/ext/server_credentials.cc", "src/node/ext/server_credentials.cc",

@ -171,6 +171,8 @@ filegroups:
- src/core/lib/channel/context.h - src/core/lib/channel/context.h
- src/core/lib/channel/deadline_filter.h - src/core/lib/channel/deadline_filter.h
- src/core/lib/channel/handshaker.h - src/core/lib/channel/handshaker.h
- src/core/lib/channel/handshaker_factory.h
- src/core/lib/channel/handshaker_registry.h
- src/core/lib/channel/http_client_filter.h - src/core/lib/channel/http_client_filter.h
- src/core/lib/channel/http_server_filter.h - src/core/lib/channel/http_server_filter.h
- src/core/lib/channel/message_size_filter.h - src/core/lib/channel/message_size_filter.h
@ -237,6 +239,7 @@ filegroups:
- src/core/lib/json/json_reader.h - src/core/lib/json/json_reader.h
- src/core/lib/json/json_writer.h - src/core/lib/json/json_writer.h
- src/core/lib/slice/percent_encoding.h - src/core/lib/slice/percent_encoding.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_string_helpers.h - src/core/lib/slice/slice_string_helpers.h
- src/core/lib/surface/api_trace.h - src/core/lib/surface/api_trace.h
- src/core/lib/surface/call.h - src/core/lib/surface/call.h
@ -268,6 +271,8 @@ filegroups:
- src/core/lib/channel/connected_channel.c - src/core/lib/channel/connected_channel.c
- src/core/lib/channel/deadline_filter.c - src/core/lib/channel/deadline_filter.c
- src/core/lib/channel/handshaker.c - src/core/lib/channel/handshaker.c
- src/core/lib/channel/handshaker_factory.c
- src/core/lib/channel/handshaker_registry.c
- src/core/lib/channel/http_client_filter.c - src/core/lib/channel/http_client_filter.c
- src/core/lib/channel/http_server_filter.c - src/core/lib/channel/http_server_filter.c
- src/core/lib/channel/message_size_filter.c - src/core/lib/channel/message_size_filter.c
@ -421,6 +426,7 @@ filegroups:
- include/grpc/impl/codegen/byte_buffer_reader.h - include/grpc/impl/codegen/byte_buffer_reader.h
- include/grpc/impl/codegen/compression_types.h - include/grpc/impl/codegen/compression_types.h
- include/grpc/impl/codegen/connectivity_state.h - include/grpc/impl/codegen/connectivity_state.h
- include/grpc/impl/codegen/exec_ctx_fwd.h
- include/grpc/impl/codegen/grpc_types.h - include/grpc/impl/codegen/grpc_types.h
- include/grpc/impl/codegen/propagation_bits.h - include/grpc/impl/codegen/propagation_bits.h
- include/grpc/impl/codegen/status.h - include/grpc/impl/codegen/status.h
@ -1211,6 +1217,22 @@ libs:
vs_project_guid: '{B6E81D84-2ACB-41B8-8781-493A944C7817}' vs_project_guid: '{B6E81D84-2ACB-41B8-8781-493A944C7817}'
vs_props: vs_props:
- protoc - protoc
- name: http2_client_main
build: private
language: c++
headers:
- test/cpp/interop/http2_client.h
src:
- src/proto/grpc/testing/empty.proto
- src/proto/grpc/testing/messages.proto
- src/proto/grpc/testing/test.proto
- test/cpp/interop/http2_client.cc
deps:
- grpc++_test_util
- grpc_test_util
- grpc++
- grpc
- grpc++_test_config
- name: interop_client_helper - name: interop_client_helper
build: private build: private
language: c++ language: c++
@ -1253,6 +1275,7 @@ libs:
src: src:
- test/cpp/interop/server_helper.cc - test/cpp/interop/server_helper.cc
deps: deps:
- grpc++_test_util
- grpc_test_util - grpc_test_util
- grpc++ - grpc++
- grpc - grpc
@ -2316,6 +2339,43 @@ targets:
- mac - mac
- linux - linux
- posix - posix
- name: memory_profile_client
build: test
run: false
language: c
src:
- test/core/memory_usage/client.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: memory_profile_server
build: test
run: false
language: c
src:
- test/core/memory_usage/server.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: memory_profile_test
cpu_cost: 1.5
build: test
language: c
src:
- test/core/memory_usage/memory_usage_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
platforms:
- mac
- linux
- posix
- name: message_compress_test - name: message_compress_test
build: test build: test
language: c language: c
@ -3185,6 +3245,22 @@ targets:
- grpc++ - grpc++
- grpc++_test_util - grpc++_test_util
- grpc_test_util - grpc_test_util
- name: http2_client
build: test
run: false
language: c++
src: []
deps:
- http2_client_main
- grpc++_test_util
- grpc_test_util
- grpc++
- grpc
- grpc++_test_config
platforms:
- mac
- linux
- posix
- name: hybrid_end2end_test - name: hybrid_end2end_test
gtest: true gtest: true
build: test build: test
@ -3812,7 +3888,6 @@ node_modules:
- src/node/ext/channel.h - src/node/ext/channel.h
- src/node/ext/channel_credentials.h - src/node/ext/channel_credentials.h
- src/node/ext/completion_queue.h - src/node/ext/completion_queue.h
- src/node/ext/completion_queue_async_worker.h
- src/node/ext/server.h - src/node/ext/server.h
- src/node/ext/server_credentials.h - src/node/ext/server_credentials.h
- src/node/ext/timeval.h - src/node/ext/timeval.h
@ -3831,8 +3906,8 @@ node_modules:
- src/node/ext/call_credentials.cc - src/node/ext/call_credentials.cc
- src/node/ext/channel.cc - src/node/ext/channel.cc
- src/node/ext/channel_credentials.cc - src/node/ext/channel_credentials.cc
- src/node/ext/completion_queue.cc - src/node/ext/completion_queue_threadpool.cc
- src/node/ext/completion_queue_async_worker.cc - src/node/ext/completion_queue_uv.cc
- src/node/ext/node_grpc.cc - src/node/ext/node_grpc.cc
- src/node/ext/server.cc - src/node/ext/server.cc
- src/node/ext/server_credentials.cc - src/node/ext/server_credentials.cc

@ -5,9 +5,9 @@ if test "$PHP_GRPC" != "no"; then
dnl Write more examples of tests here... dnl Write more examples of tests here...
dnl # --with-grpc -> add include path dnl # --with-grpc -> add include path
PHP_ADD_INCLUDE(../../grpc/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/include)
PHP_ADD_INCLUDE(../../grpc/src/php/ext/grpc) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc)
PHP_ADD_INCLUDE(../../grpc/third_party/boringssl/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include)
LIBS="-lpthread $LIBS" LIBS="-lpthread $LIBS"
@ -88,6 +88,8 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/channel/connected_channel.c \ src/core/lib/channel/connected_channel.c \
src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/deadline_filter.c \
src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker.c \
src/core/lib/channel/handshaker_factory.c \
src/core/lib/channel/handshaker_registry.c \
src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_client_filter.c \
src/core/lib/channel/http_server_filter.c \ src/core/lib/channel/http_server_filter.c \
src/core/lib/channel/message_size_filter.c \ src/core/lib/channel/message_size_filter.c \

@ -0,0 +1,29 @@
# C++ Performance Notes
## Streaming write buffering
Generally, each write operation (Write(), WritesDone()) implies a syscall.
gRPC will try to batch together separate write operations from different
threads, but currently cannot automatically infer batching in a single stream.
If message k+1 in a stream does not rely on responses from message k, it's
possible to enable write batching by passing a WriteOptions argument to Write
with the buffer_hint set:
~~~{.cpp}
stream_writer->Write(message, WriteOptions().set_buffer_hint());
~~~
The write will be buffered until one of the following is true:
- the per-stream buffer is filled (controllable with the channel argument
GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE) - this prevents infinite buffering leading
to OOM
- a subsequent Write without buffer_hint set is posted
- the call is finished for writing (WritesDone() called on the client,
or Finish() called on an async server stream, or the service handler returns
for a sync server stream)
## Completion Queues and Threading in the Async API
Right now, the best performance trade-off is having numcpu's threads and one
completion queue per thread.

@ -716,7 +716,9 @@ Procedure:
``` ```
{ {
response_size: 314159 response_parameters:{
size: 314159
}
payload:{ payload:{
body: 271828 bytes of zeros body: 271828 bytes of zeros
} }

@ -49,7 +49,8 @@ server. The client should handle the goaway by switching to a new stream without
the user application having to do a thing. the user application having to do a thing.
Client Procedure: Client Procedure:
1. Client sends two UnaryCall requests with: 1. Client sends two UnaryCall requests (and sleeps for 1 second in-between).
TODO: resolve [9300](https://github.com/grpc/grpc/issues/9300) and remove the 1 second sleep
``` ```
{ {
@ -61,14 +62,14 @@ Client Procedure:
``` ```
Client asserts: Client asserts:
* Call was successful. * Both calls are successful.
* Response payload body is 314159 bytes in size. * Response payload body is 314159 bytes in size.
Server Procedure: Server Procedure:
1. Server sends a GOAWAY after receiving the first UnaryCall. 1. Server sends a GOAWAY after receiving the first UnaryCall.
Server asserts: Server asserts:
* The second UnaryCall has a different stream_id than the first one. * Two different connections were used from the client.
### rst_after_header ### rst_after_header

@ -167,6 +167,7 @@ Pod::Spec.new do |s|
'include/grpc/impl/codegen/byte_buffer_reader.h', 'include/grpc/impl/codegen/byte_buffer_reader.h',
'include/grpc/impl/codegen/compression_types.h', 'include/grpc/impl/codegen/compression_types.h',
'include/grpc/impl/codegen/connectivity_state.h', 'include/grpc/impl/codegen/connectivity_state.h',
'include/grpc/impl/codegen/exec_ctx_fwd.h',
'include/grpc/impl/codegen/grpc_types.h', 'include/grpc/impl/codegen/grpc_types.h',
'include/grpc/impl/codegen/propagation_bits.h', 'include/grpc/impl/codegen/propagation_bits.h',
'include/grpc/impl/codegen/status.h', 'include/grpc/impl/codegen/status.h',
@ -255,6 +256,8 @@ Pod::Spec.new do |s|
'src/core/lib/channel/context.h', 'src/core/lib/channel/context.h',
'src/core/lib/channel/deadline_filter.h', 'src/core/lib/channel/deadline_filter.h',
'src/core/lib/channel/handshaker.h', 'src/core/lib/channel/handshaker.h',
'src/core/lib/channel/handshaker_factory.h',
'src/core/lib/channel/handshaker_registry.h',
'src/core/lib/channel/http_client_filter.h', 'src/core/lib/channel/http_client_filter.h',
'src/core/lib/channel/http_server_filter.h', 'src/core/lib/channel/http_server_filter.h',
'src/core/lib/channel/message_size_filter.h', 'src/core/lib/channel/message_size_filter.h',
@ -321,6 +324,7 @@ Pod::Spec.new do |s|
'src/core/lib/json/json_reader.h', 'src/core/lib/json/json_reader.h',
'src/core/lib/json/json_writer.h', 'src/core/lib/json/json_writer.h',
'src/core/lib/slice/percent_encoding.h', 'src/core/lib/slice/percent_encoding.h',
'src/core/lib/slice/slice_internal.h',
'src/core/lib/slice/slice_string_helpers.h', 'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/surface/api_trace.h', 'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/call.h', 'src/core/lib/surface/call.h',
@ -434,6 +438,8 @@ Pod::Spec.new do |s|
'src/core/lib/channel/connected_channel.c', 'src/core/lib/channel/connected_channel.c',
'src/core/lib/channel/deadline_filter.c', 'src/core/lib/channel/deadline_filter.c',
'src/core/lib/channel/handshaker.c', 'src/core/lib/channel/handshaker.c',
'src/core/lib/channel/handshaker_factory.c',
'src/core/lib/channel/handshaker_registry.c',
'src/core/lib/channel/http_client_filter.c', 'src/core/lib/channel/http_client_filter.c',
'src/core/lib/channel/http_server_filter.c', 'src/core/lib/channel/http_server_filter.c',
'src/core/lib/channel/message_size_filter.c', 'src/core/lib/channel/message_size_filter.c',
@ -662,6 +668,8 @@ Pod::Spec.new do |s|
'src/core/lib/channel/context.h', 'src/core/lib/channel/context.h',
'src/core/lib/channel/deadline_filter.h', 'src/core/lib/channel/deadline_filter.h',
'src/core/lib/channel/handshaker.h', 'src/core/lib/channel/handshaker.h',
'src/core/lib/channel/handshaker_factory.h',
'src/core/lib/channel/handshaker_registry.h',
'src/core/lib/channel/http_client_filter.h', 'src/core/lib/channel/http_client_filter.h',
'src/core/lib/channel/http_server_filter.h', 'src/core/lib/channel/http_server_filter.h',
'src/core/lib/channel/message_size_filter.h', 'src/core/lib/channel/message_size_filter.h',
@ -728,6 +736,7 @@ Pod::Spec.new do |s|
'src/core/lib/json/json_reader.h', 'src/core/lib/json/json_reader.h',
'src/core/lib/json/json_writer.h', 'src/core/lib/json/json_writer.h',
'src/core/lib/slice/percent_encoding.h', 'src/core/lib/slice/percent_encoding.h',
'src/core/lib/slice/slice_internal.h',
'src/core/lib/slice/slice_string_helpers.h', 'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/surface/api_trace.h', 'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/call.h', 'src/core/lib/surface/call.h',

@ -148,6 +148,7 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/impl/codegen/byte_buffer_reader.h ) s.files += %w( include/grpc/impl/codegen/byte_buffer_reader.h )
s.files += %w( include/grpc/impl/codegen/compression_types.h ) s.files += %w( include/grpc/impl/codegen/compression_types.h )
s.files += %w( include/grpc/impl/codegen/connectivity_state.h ) s.files += %w( include/grpc/impl/codegen/connectivity_state.h )
s.files += %w( include/grpc/impl/codegen/exec_ctx_fwd.h )
s.files += %w( include/grpc/impl/codegen/grpc_types.h ) s.files += %w( include/grpc/impl/codegen/grpc_types.h )
s.files += %w( include/grpc/impl/codegen/propagation_bits.h ) s.files += %w( include/grpc/impl/codegen/propagation_bits.h )
s.files += %w( include/grpc/impl/codegen/status.h ) s.files += %w( include/grpc/impl/codegen/status.h )
@ -172,6 +173,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/channel/context.h ) s.files += %w( src/core/lib/channel/context.h )
s.files += %w( src/core/lib/channel/deadline_filter.h ) s.files += %w( src/core/lib/channel/deadline_filter.h )
s.files += %w( src/core/lib/channel/handshaker.h ) s.files += %w( src/core/lib/channel/handshaker.h )
s.files += %w( src/core/lib/channel/handshaker_factory.h )
s.files += %w( src/core/lib/channel/handshaker_registry.h )
s.files += %w( src/core/lib/channel/http_client_filter.h ) s.files += %w( src/core/lib/channel/http_client_filter.h )
s.files += %w( src/core/lib/channel/http_server_filter.h ) s.files += %w( src/core/lib/channel/http_server_filter.h )
s.files += %w( src/core/lib/channel/message_size_filter.h ) s.files += %w( src/core/lib/channel/message_size_filter.h )
@ -238,6 +241,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/json/json_reader.h ) s.files += %w( src/core/lib/json/json_reader.h )
s.files += %w( src/core/lib/json/json_writer.h ) s.files += %w( src/core/lib/json/json_writer.h )
s.files += %w( src/core/lib/slice/percent_encoding.h ) s.files += %w( src/core/lib/slice/percent_encoding.h )
s.files += %w( src/core/lib/slice/slice_internal.h )
s.files += %w( src/core/lib/slice/slice_string_helpers.h ) s.files += %w( src/core/lib/slice/slice_string_helpers.h )
s.files += %w( src/core/lib/surface/api_trace.h ) s.files += %w( src/core/lib/surface/api_trace.h )
s.files += %w( src/core/lib/surface/call.h ) s.files += %w( src/core/lib/surface/call.h )
@ -351,6 +355,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/channel/connected_channel.c ) s.files += %w( src/core/lib/channel/connected_channel.c )
s.files += %w( src/core/lib/channel/deadline_filter.c ) s.files += %w( src/core/lib/channel/deadline_filter.c )
s.files += %w( src/core/lib/channel/handshaker.c ) s.files += %w( src/core/lib/channel/handshaker.c )
s.files += %w( src/core/lib/channel/handshaker_factory.c )
s.files += %w( src/core/lib/channel/handshaker_registry.c )
s.files += %w( src/core/lib/channel/http_client_filter.c ) s.files += %w( src/core/lib/channel/http_client_filter.c )
s.files += %w( src/core/lib/channel/http_server_filter.c ) s.files += %w( src/core/lib/channel/http_server_filter.c )
s.files += %w( src/core/lib/channel/message_size_filter.c ) s.files += %w( src/core/lib/channel/message_size_filter.c )

@ -44,6 +44,10 @@
/// peer, compression settings, authentication, etc. /// peer, compression settings, authentication, etc.
/// - grpc::Server, representing a gRPC server, created by grpc::ServerBuilder. /// - grpc::Server, representing a gRPC server, created by grpc::ServerBuilder.
/// ///
/// Streaming calls are handled with the streaming classes in
/// \ref sync_stream.h and
/// \ref async_stream.h.
///
/// Refer to the /// Refer to the
/// [examples](https://github.com/grpc/grpc/blob/master/examples/cpp) /// [examples](https://github.com/grpc/grpc/blob/master/examples/cpp)
/// for code putting these pieces into play. /// for code putting these pieces into play.

@ -94,8 +94,10 @@ class ServerContext;
extern CoreCodegenInterface* g_core_codegen_interface; extern CoreCodegenInterface* g_core_codegen_interface;
/// A thin wrapper around \a grpc_completion_queue (see / \a /// A thin wrapper around \ref grpc_completion_queue (see \ref
/// src/core/surface/completion_queue.h). /// src/core/lib/surface/completion_queue.h).
/// See \ref doc/cpp/perf_notes.md for notes on best practices for high
/// performance servers.
class CompletionQueue : private GrpcLibraryCodegen { class CompletionQueue : private GrpcLibraryCodegen {
public: public:
/// Default constructor. Implicitly creates a \a grpc_completion_queue /// Default constructor. Implicitly creates a \a grpc_completion_queue

@ -127,7 +127,7 @@ class ChannelArguments {
/// Default pointer argument operations. /// Default pointer argument operations.
struct PointerVtableMembers { struct PointerVtableMembers {
static void* Copy(void* in) { return in; } static void* Copy(void* in) { return in; }
static void Destroy(void* in) {} static void Destroy(grpc_exec_ctx* exec_ctx, void* in) {}
static int Compare(void* a, void* b) { static int Compare(void* a, void* b) {
if (a < b) return -1; if (a < b) return -1;
if (a > b) return 1; if (a > b) return 1;

@ -0,0 +1,41 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_IMPL_CODEGEN_EXEC_CTX_FWD_H
#define GRPC_IMPL_CODEGEN_EXEC_CTX_FWD_H
/* forward declaration for exec_ctx.h */
struct grpc_exec_ctx;
typedef struct grpc_exec_ctx grpc_exec_ctx;
#endif /* GRPC_IMPL_CODEGEN_EXEC_CTX_FWD_H */

@ -34,10 +34,10 @@
#ifndef GRPC_IMPL_CODEGEN_GRPC_TYPES_H #ifndef GRPC_IMPL_CODEGEN_GRPC_TYPES_H
#define GRPC_IMPL_CODEGEN_GRPC_TYPES_H #define GRPC_IMPL_CODEGEN_GRPC_TYPES_H
#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/codegen/exec_ctx_fwd.h>
#include <grpc/impl/codegen/gpr_types.h> #include <grpc/impl/codegen/gpr_types.h>
#include <grpc/impl/codegen/slice.h> #include <grpc/impl/codegen/slice.h>
#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/codegen/status.h> #include <grpc/impl/codegen/status.h>
#include <stddef.h> #include <stddef.h>
@ -96,7 +96,7 @@ typedef enum {
typedef struct grpc_arg_pointer_vtable { typedef struct grpc_arg_pointer_vtable {
void *(*copy)(void *p); void *(*copy)(void *p);
void (*destroy)(void *p); void (*destroy)(grpc_exec_ctx *exec_ctx, void *p);
int (*cmp)(void *p, void *q); int (*cmp)(void *p, void *q);
} grpc_arg_pointer_vtable; } grpc_arg_pointer_vtable;

@ -361,7 +361,7 @@ typedef unsigned __int64 uint64_t;
#define GPR_MAX_ALIGNMENT 16 #define GPR_MAX_ALIGNMENT 16
#ifndef GRPC_MUST_USE_RESULT #ifndef GRPC_MUST_USE_RESULT
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__MINGW32__)
#define GRPC_MUST_USE_RESULT __attribute__((warn_unused_result)) #define GRPC_MUST_USE_RESULT __attribute__((warn_unused_result))
#else #else
#define GRPC_MUST_USE_RESULT #define GRPC_MUST_USE_RESULT

@ -37,6 +37,8 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <grpc/impl/codegen/exec_ctx_fwd.h>
/* Slice API /* Slice API
A slice represents a contiguous reference counted array of bytes. A slice represents a contiguous reference counted array of bytes.
@ -57,7 +59,7 @@
grpc_slice_new, or grpc_slice_new_with_len instead. */ grpc_slice_new, or grpc_slice_new_with_len instead. */
typedef struct grpc_slice_refcount { typedef struct grpc_slice_refcount {
void (*ref)(void *); void (*ref)(void *);
void (*unref)(void *); void (*unref)(grpc_exec_ctx *exec_ctx, void *);
} grpc_slice_refcount; } grpc_slice_refcount;
#define GRPC_SLICE_INLINED_SIZE (sizeof(size_t) + sizeof(uint8_t *) - 1) #define GRPC_SLICE_INLINED_SIZE (sizeof(size_t) + sizeof(uint8_t *) - 1)

@ -34,6 +34,8 @@
#ifndef GRPC_SUPPORT_LOG_WINDOWS_H #ifndef GRPC_SUPPORT_LOG_WINDOWS_H
#define GRPC_SUPPORT_LOG_WINDOWS_H #define GRPC_SUPPORT_LOG_WINDOWS_H
#include <grpc/impl/codegen/port_platform.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

@ -21,6 +21,7 @@
"scripts": { "scripts": {
"lint": "node ./node_modules/jshint/bin/jshint src/node/src src/node/test src/node/interop src/node/index.js --exclude-path=src/node/.jshintignore", "lint": "node ./node_modules/jshint/bin/jshint src/node/src src/node/test src/node/interop src/node/index.js --exclude-path=src/node/.jshintignore",
"test": "./node_modules/.bin/mocha src/node/test && npm run-script lint", "test": "./node_modules/.bin/mocha src/node/test && npm run-script lint",
"electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell",
"gen_docs": "./node_modules/.bin/jsdoc -c src/node/jsdoc_conf.json", "gen_docs": "./node_modules/.bin/jsdoc -c src/node/jsdoc_conf.json",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test",
"install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build" "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build"
@ -38,6 +39,7 @@
"devDependencies": { "devDependencies": {
"async": "^2.0.1", "async": "^2.0.1",
"body-parser": "^1.15.2", "body-parser": "^1.15.2",
"electron-mocha": "^3.1.1",
"express": "^4.14.0", "express": "^4.14.0",
"google-auth-library": "^0.9.2", "google-auth-library": "^0.9.2",
"google-protobuf": "^3.0.0", "google-protobuf": "^3.0.0",
@ -50,7 +52,7 @@
"poisson-process": "^0.2.1" "poisson-process": "^0.2.1"
}, },
"engines": { "engines": {
"node": ">=0.12.0" "node": ">=1.1.0"
}, },
"binary": { "binary": {
"module_name": "grpc_node", "module_name": "grpc_node",

@ -156,6 +156,7 @@
<file baseinstalldir="/" name="include/grpc/impl/codegen/byte_buffer_reader.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/byte_buffer_reader.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/compression_types.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/compression_types.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/connectivity_state.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/connectivity_state.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/exec_ctx_fwd.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/grpc_types.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/grpc_types.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/propagation_bits.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/propagation_bits.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/status.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/status.h" role="src" />
@ -180,6 +181,8 @@
<file baseinstalldir="/" name="src/core/lib/channel/context.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/context.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/deadline_filter.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/deadline_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/handshaker.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/handshaker.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/handshaker_factory.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/handshaker_registry.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/http_client_filter.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/http_client_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/http_server_filter.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/http_server_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/message_size_filter.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/message_size_filter.h" role="src" />
@ -246,6 +249,7 @@
<file baseinstalldir="/" name="src/core/lib/json/json_reader.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/json/json_reader.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/json/json_writer.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/json/json_writer.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/percent_encoding.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/slice/percent_encoding.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_internal.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_string_helpers.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/slice/slice_string_helpers.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/api_trace.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/api_trace.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/call.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/call.h" role="src" />
@ -359,6 +363,8 @@
<file baseinstalldir="/" name="src/core/lib/channel/connected_channel.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/connected_channel.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/deadline_filter.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/deadline_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/handshaker.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/handshaker.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/handshaker_factory.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/handshaker_registry.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/http_client_filter.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/http_client_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/http_server_filter.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/http_server_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/message_size_filter.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/message_size_filter.c" role="src" />

@ -0,0 +1,5 @@
Optional plugins for gRPC Core: Modules in this directory extend gRPC Core in
useful ways. All optional code belongs here.
NOTE: The movement of code between lib and ext is an ongoing effort, so this
directory currently contains too much of the core library.

@ -51,7 +51,8 @@ static bool is_census_enabled(const grpc_channel_args *a) {
return census_enabled(); return census_enabled();
} }
static bool maybe_add_census_filter(grpc_channel_stack_builder *builder, static bool maybe_add_census_filter(grpc_exec_ctx *exec_ctx,
grpc_channel_stack_builder *builder,
void *arg) { void *arg) {
const grpc_channel_args *args = const grpc_channel_args *args =
grpc_channel_stack_builder_get_channel_arguments(builder); grpc_channel_stack_builder_get_channel_arguments(builder);

@ -31,19 +31,15 @@
* *
*/ */
//#include "src/core/ext/census/tracing.h"
#include <grpc/census.h> #include <grpc/census.h>
/* TODO(aveitch): These are all placeholder implementations. */ /* TODO(aveitch): These are all placeholder implementations. */
// int census_trace_mask(const census_context *context) { int census_trace_mask(const census_context *context) {
// return CENSUS_TRACE_MASK_NONE; return CENSUS_TRACE_MASK_NONE;
// } }
// void census_set_trace_mask(int trace_mask) {}
// void census_trace_print(census_context *context, uint32_t type, void census_set_trace_mask(int trace_mask) {}
// const char *buffer, size_t n) {}
// void SetTracerParams(const Params& params); void census_trace_print(census_context *context, uint32_t type,
const char *buffer, size_t n) {}

@ -76,6 +76,7 @@ typedef struct {
gpr_mu mu; gpr_mu mu;
callback_phase phase; callback_phase phase;
grpc_closure on_complete; grpc_closure on_complete;
grpc_closure on_timeout;
grpc_timer alarm; grpc_timer alarm;
grpc_connectivity_state state; grpc_connectivity_state state;
grpc_completion_queue *cq; grpc_completion_queue *cq;
@ -200,6 +201,8 @@ void grpc_channel_watch_connectivity_state(
gpr_mu_init(&w->mu); gpr_mu_init(&w->mu);
grpc_closure_init(&w->on_complete, watch_complete, w, grpc_closure_init(&w->on_complete, watch_complete, w,
grpc_schedule_on_exec_ctx); grpc_schedule_on_exec_ctx);
grpc_closure_init(&w->on_timeout, timeout_complete, w,
grpc_schedule_on_exec_ctx);
w->phase = WAITING; w->phase = WAITING;
w->state = last_observed_state; w->state = last_observed_state;
w->cq = cq; w->cq = cq;
@ -208,7 +211,7 @@ void grpc_channel_watch_connectivity_state(
grpc_timer_init(&exec_ctx, &w->alarm, grpc_timer_init(&exec_ctx, &w->alarm,
gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC), gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC),
timeout_complete, w, gpr_now(GPR_CLOCK_MONOTONIC)); &w->on_timeout, gpr_now(GPR_CLOCK_MONOTONIC));
if (client_channel_elem->filter == &grpc_client_channel_filter) { if (client_channel_elem->filter == &grpc_client_channel_filter) {
GRPC_CHANNEL_INTERNAL_REF(channel, "watch_channel_connectivity"); GRPC_CHANNEL_INTERNAL_REF(channel, "watch_channel_connectivity");

@ -83,8 +83,12 @@ static void *method_parameters_copy(void *value) {
return new_value; return new_value;
} }
static void method_parameters_free(grpc_exec_ctx *exec_ctx, void *p) {
gpr_free(p);
}
static const grpc_mdstr_hash_table_vtable method_parameters_vtable = { static const grpc_mdstr_hash_table_vtable method_parameters_vtable = {
gpr_free, method_parameters_copy}; method_parameters_free, method_parameters_copy};
static void *method_parameters_create_from_json(const grpc_json *json) { static void *method_parameters_create_from_json(const grpc_json *json) {
wait_for_ready_value wait_for_ready = WAIT_FOR_READY_UNSET; wait_for_ready_value wait_for_ready = WAIT_FOR_READY_UNSET;
@ -328,7 +332,7 @@ static void on_resolver_result_changed(grpc_exec_ctx *exec_ctx, void *arg,
grpc_service_config_create(service_config_json); grpc_service_config_create(service_config_json);
if (service_config != NULL) { if (service_config != NULL) {
method_params_table = grpc_service_config_create_method_config_table( method_params_table = grpc_service_config_create_method_config_table(
service_config, method_parameters_create_from_json, exec_ctx, service_config, method_parameters_create_from_json,
&method_parameters_vtable); &method_parameters_vtable);
grpc_service_config_destroy(service_config); grpc_service_config_destroy(service_config);
} }
@ -337,7 +341,7 @@ static void on_resolver_result_changed(grpc_exec_ctx *exec_ctx, void *arg,
// be pointing to data inside chand->resolver_result. // be pointing to data inside chand->resolver_result.
// The copy will be saved in chand->lb_policy_name below. // The copy will be saved in chand->lb_policy_name below.
lb_policy_name = gpr_strdup(lb_policy_name); lb_policy_name = gpr_strdup(lb_policy_name);
grpc_channel_args_destroy(chand->resolver_result); grpc_channel_args_destroy(exec_ctx, chand->resolver_result);
chand->resolver_result = NULL; chand->resolver_result = NULL;
} }
@ -358,7 +362,7 @@ static void on_resolver_result_changed(grpc_exec_ctx *exec_ctx, void *arg,
chand->service_config_json = service_config_json; chand->service_config_json = service_config_json;
} }
if (chand->method_params_table != NULL) { if (chand->method_params_table != NULL) {
grpc_mdstr_hash_table_unref(chand->method_params_table); grpc_mdstr_hash_table_unref(exec_ctx, chand->method_params_table);
} }
chand->method_params_table = method_params_table; chand->method_params_table = method_params_table;
if (lb_policy != NULL) { if (lb_policy != NULL) {
@ -554,7 +558,7 @@ static void cc_destroy_channel_elem(grpc_exec_ctx *exec_ctx,
gpr_free(chand->lb_policy_name); gpr_free(chand->lb_policy_name);
gpr_free(chand->service_config_json); gpr_free(chand->service_config_json);
if (chand->method_params_table != NULL) { if (chand->method_params_table != NULL) {
grpc_mdstr_hash_table_unref(chand->method_params_table); grpc_mdstr_hash_table_unref(exec_ctx, chand->method_params_table);
} }
grpc_connectivity_state_destroy(exec_ctx, &chand->state_tracker); grpc_connectivity_state_destroy(exec_ctx, &chand->state_tracker);
grpc_pollset_set_destroy(chand->interested_parties); grpc_pollset_set_destroy(chand->interested_parties);
@ -1001,8 +1005,8 @@ static void read_service_config(grpc_exec_ctx *exec_ctx, void *arg,
gpr_mu_unlock(&chand->mu); gpr_mu_unlock(&chand->mu);
// If the method config table was present, use it. // If the method config table was present, use it.
if (method_params_table != NULL) { if (method_params_table != NULL) {
const method_parameters *method_params = const method_parameters *method_params = grpc_method_config_table_get(
grpc_method_config_table_get(method_params_table, calld->path); exec_ctx, method_params_table, calld->path);
if (method_params != NULL) { if (method_params != NULL) {
const bool have_method_timeout = const bool have_method_timeout =
gpr_time_cmp(method_params->timeout, gpr_time_0(GPR_TIMESPAN)) != 0; gpr_time_cmp(method_params->timeout, gpr_time_0(GPR_TIMESPAN)) != 0;
@ -1025,7 +1029,7 @@ static void read_service_config(grpc_exec_ctx *exec_ctx, void *arg,
gpr_mu_unlock(&calld->mu); gpr_mu_unlock(&calld->mu);
} }
} }
grpc_mdstr_hash_table_unref(method_params_table); grpc_mdstr_hash_table_unref(exec_ctx, method_params_table);
} }
} }
GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "read_service_config"); GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "read_service_config");
@ -1066,8 +1070,8 @@ static grpc_error *cc_init_call_elem(grpc_exec_ctx *exec_ctx,
grpc_mdstr_hash_table *method_params_table = grpc_mdstr_hash_table *method_params_table =
grpc_mdstr_hash_table_ref(chand->method_params_table); grpc_mdstr_hash_table_ref(chand->method_params_table);
gpr_mu_unlock(&chand->mu); gpr_mu_unlock(&chand->mu);
method_parameters *method_params = method_parameters *method_params = grpc_method_config_table_get(
grpc_method_config_table_get(method_params_table, args->path); exec_ctx, method_params_table, args->path);
if (method_params != NULL) { if (method_params != NULL) {
if (gpr_time_cmp(method_params->timeout, if (gpr_time_cmp(method_params->timeout,
gpr_time_0(GPR_CLOCK_MONOTONIC)) != 0) { gpr_time_0(GPR_CLOCK_MONOTONIC)) != 0) {
@ -1080,7 +1084,7 @@ static grpc_error *cc_init_call_elem(grpc_exec_ctx *exec_ctx,
method_params->wait_for_ready; method_params->wait_for_ready;
} }
} }
grpc_mdstr_hash_table_unref(method_params_table); grpc_mdstr_hash_table_unref(exec_ctx, method_params_table);
} else { } else {
gpr_mu_unlock(&chand->mu); gpr_mu_unlock(&chand->mu);
} }
@ -1109,7 +1113,7 @@ static void cc_destroy_call_elem(grpc_exec_ctx *exec_ctx,
void *and_free_memory) { void *and_free_memory) {
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
grpc_deadline_state_destroy(exec_ctx, elem); grpc_deadline_state_destroy(exec_ctx, elem);
GRPC_MDSTR_UNREF(calld->path); GRPC_MDSTR_UNREF(exec_ctx, calld->path);
GRPC_ERROR_UNREF(calld->cancel_error); GRPC_ERROR_UNREF(calld->cancel_error);
grpc_subchannel_call *call = GET_CALL(calld); grpc_subchannel_call *call = GET_CALL(calld);
if (call != NULL && call != CANCELLED_CALL) { if (call != NULL && call != CANCELLED_CALL) {

@ -61,12 +61,10 @@ static void* factory_arg_copy(void* factory) {
return factory; return factory;
} }
static void factory_arg_destroy(void* factory) { static void factory_arg_destroy(grpc_exec_ctx* exec_ctx, void* factory) {
// TODO(roth): Remove local exec_ctx when // TODO(roth): Remove local exec_ctx when
// https://github.com/grpc/grpc/pull/8705 is merged. // https://github.com/grpc/grpc/pull/8705 is merged.
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_client_channel_factory_unref(exec_ctx, factory);
grpc_client_channel_factory_unref(&exec_ctx, factory);
grpc_exec_ctx_finish(&exec_ctx);
} }
static int factory_arg_cmp(void* factory1, void* factory2) { static int factory_arg_cmp(void* factory1, void* factory2) {

@ -38,17 +38,20 @@
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
#include "src/core/ext/client_channel/client_channel.h" #include "src/core/ext/client_channel/client_channel.h"
#include "src/core/ext/client_channel/http_connect_handshaker.h"
#include "src/core/ext/client_channel/lb_policy_registry.h" #include "src/core/ext/client_channel/lb_policy_registry.h"
#include "src/core/ext/client_channel/resolver_registry.h" #include "src/core/ext/client_channel/resolver_registry.h"
#include "src/core/ext/client_channel/subchannel_index.h" #include "src/core/ext/client_channel/subchannel_index.h"
#include "src/core/lib/surface/channel_init.h" #include "src/core/lib/surface/channel_init.h"
static bool append_filter(grpc_channel_stack_builder *builder, void *arg) { static bool append_filter(grpc_exec_ctx *exec_ctx,
grpc_channel_stack_builder *builder, void *arg) {
return grpc_channel_stack_builder_append_filter( return grpc_channel_stack_builder_append_filter(
builder, (const grpc_channel_filter *)arg, NULL, NULL); builder, (const grpc_channel_filter *)arg, NULL, NULL);
} }
static bool set_default_host_if_unset(grpc_channel_stack_builder *builder, static bool set_default_host_if_unset(grpc_exec_ctx *exec_ctx,
grpc_channel_stack_builder *builder,
void *unused) { void *unused) {
const grpc_channel_args *args = const grpc_channel_args *args =
grpc_channel_stack_builder_get_channel_arguments(builder); grpc_channel_stack_builder_get_channel_arguments(builder);
@ -66,9 +69,10 @@ static bool set_default_host_if_unset(grpc_channel_stack_builder *builder,
arg.key = GRPC_ARG_DEFAULT_AUTHORITY; arg.key = GRPC_ARG_DEFAULT_AUTHORITY;
arg.value.string = default_authority; arg.value.string = default_authority;
grpc_channel_args *new_args = grpc_channel_args_copy_and_add(args, &arg, 1); grpc_channel_args *new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
grpc_channel_stack_builder_set_channel_arguments(builder, new_args); grpc_channel_stack_builder_set_channel_arguments(exec_ctx, builder,
new_args);
gpr_free(default_authority); gpr_free(default_authority);
grpc_channel_args_destroy(new_args); grpc_channel_args_destroy(exec_ctx, new_args);
} }
return true; return true;
} }
@ -81,6 +85,7 @@ void grpc_client_channel_init(void) {
set_default_host_if_unset, NULL); set_default_host_if_unset, NULL);
grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX, append_filter, grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX, append_filter,
(void *)&grpc_client_channel_filter); (void *)&grpc_client_channel_filter);
grpc_http_connect_register_handshaker_factory();
} }
void grpc_client_channel_shutdown(void) { void grpc_client_channel_shutdown(void) {

@ -44,8 +44,10 @@
#include "src/core/ext/client_channel/resolver_registry.h" #include "src/core/ext/client_channel/resolver_registry.h"
#include "src/core/ext/client_channel/uri_parser.h" #include "src/core/ext/client_channel/uri_parser.h"
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/handshaker_registry.h"
#include "src/core/lib/http/format_request.h" #include "src/core/lib/http/format_request.h"
#include "src/core/lib/http/parser.h" #include "src/core/lib/http/parser.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/support/env.h" #include "src/core/lib/support/env.h"
typedef struct http_connect_handshaker { typedef struct http_connect_handshaker {
@ -53,6 +55,8 @@ typedef struct http_connect_handshaker {
grpc_handshaker base; grpc_handshaker base;
char* proxy_server; char* proxy_server;
grpc_http_header* headers;
size_t num_headers;
gpr_refcount refcount; gpr_refcount refcount;
gpr_mu mu; gpr_mu mu;
@ -83,11 +87,17 @@ static void http_connect_handshaker_unref(grpc_exec_ctx* exec_ctx,
grpc_endpoint_destroy(exec_ctx, handshaker->endpoint_to_destroy); grpc_endpoint_destroy(exec_ctx, handshaker->endpoint_to_destroy);
} }
if (handshaker->read_buffer_to_destroy != NULL) { if (handshaker->read_buffer_to_destroy != NULL) {
grpc_slice_buffer_destroy(handshaker->read_buffer_to_destroy); grpc_slice_buffer_destroy_internal(exec_ctx,
handshaker->read_buffer_to_destroy);
gpr_free(handshaker->read_buffer_to_destroy); gpr_free(handshaker->read_buffer_to_destroy);
} }
gpr_free(handshaker->proxy_server); gpr_free(handshaker->proxy_server);
grpc_slice_buffer_destroy(&handshaker->write_buffer); for (size_t i = 0; i < handshaker->num_headers; ++i) {
gpr_free(handshaker->headers[i].key);
gpr_free(handshaker->headers[i].value);
}
gpr_free(handshaker->headers);
grpc_slice_buffer_destroy_internal(exec_ctx, &handshaker->write_buffer);
grpc_http_parser_destroy(&handshaker->http_parser); grpc_http_parser_destroy(&handshaker->http_parser);
grpc_http_response_destroy(&handshaker->http_response); grpc_http_response_destroy(&handshaker->http_response);
gpr_free(handshaker); gpr_free(handshaker);
@ -97,12 +107,12 @@ static void http_connect_handshaker_unref(grpc_exec_ctx* exec_ctx,
// Set args fields to NULL, saving the endpoint and read buffer for // Set args fields to NULL, saving the endpoint and read buffer for
// later destruction. // later destruction.
static void cleanup_args_for_failure_locked( static void cleanup_args_for_failure_locked(
http_connect_handshaker* handshaker) { grpc_exec_ctx* exec_ctx, http_connect_handshaker* handshaker) {
handshaker->endpoint_to_destroy = handshaker->args->endpoint; handshaker->endpoint_to_destroy = handshaker->args->endpoint;
handshaker->args->endpoint = NULL; handshaker->args->endpoint = NULL;
handshaker->read_buffer_to_destroy = handshaker->args->read_buffer; handshaker->read_buffer_to_destroy = handshaker->args->read_buffer;
handshaker->args->read_buffer = NULL; handshaker->args->read_buffer = NULL;
grpc_channel_args_destroy(handshaker->args->args); grpc_channel_args_destroy(exec_ctx, handshaker->args->args);
handshaker->args->args = NULL; handshaker->args->args = NULL;
} }
@ -125,7 +135,7 @@ static void handshake_failed_locked(grpc_exec_ctx* exec_ctx,
grpc_endpoint_shutdown(exec_ctx, handshaker->args->endpoint); grpc_endpoint_shutdown(exec_ctx, handshaker->args->endpoint);
// Not shutting down, so the handshake failed. Clean up before // Not shutting down, so the handshake failed. Clean up before
// invoking the callback. // invoking the callback.
cleanup_args_for_failure_locked(handshaker); cleanup_args_for_failure_locked(exec_ctx, handshaker);
// Set shutdown to true so that subsequent calls to // Set shutdown to true so that subsequent calls to
// http_connect_handshaker_shutdown() do nothing. // http_connect_handshaker_shutdown() do nothing.
handshaker->shutdown = true; handshaker->shutdown = true;
@ -193,7 +203,7 @@ static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg,
&handshaker->args->read_buffer->slices[i + 1], &handshaker->args->read_buffer->slices[i + 1],
handshaker->args->read_buffer->count - i - 1); handshaker->args->read_buffer->count - i - 1);
grpc_slice_buffer_swap(handshaker->args->read_buffer, &tmp_buffer); grpc_slice_buffer_swap(handshaker->args->read_buffer, &tmp_buffer);
grpc_slice_buffer_destroy(&tmp_buffer); grpc_slice_buffer_destroy_internal(exec_ctx, &tmp_buffer);
break; break;
} }
} }
@ -210,7 +220,8 @@ static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg,
// complete (e.g., handling chunked transfer encoding or looking // complete (e.g., handling chunked transfer encoding or looking
// at the Content-Length: header). // at the Content-Length: header).
if (handshaker->http_parser.state != GRPC_HTTP_BODY) { if (handshaker->http_parser.state != GRPC_HTTP_BODY) {
grpc_slice_buffer_reset_and_unref(handshaker->args->read_buffer); grpc_slice_buffer_reset_and_unref_internal(exec_ctx,
handshaker->args->read_buffer);
grpc_endpoint_read(exec_ctx, handshaker->args->endpoint, grpc_endpoint_read(exec_ctx, handshaker->args->endpoint,
handshaker->args->read_buffer, handshaker->args->read_buffer,
&handshaker->response_read_closure); &handshaker->response_read_closure);
@ -255,7 +266,7 @@ static void http_connect_handshaker_shutdown(grpc_exec_ctx* exec_ctx,
if (!handshaker->shutdown) { if (!handshaker->shutdown) {
handshaker->shutdown = true; handshaker->shutdown = true;
grpc_endpoint_shutdown(exec_ctx, handshaker->args->endpoint); grpc_endpoint_shutdown(exec_ctx, handshaker->args->endpoint);
cleanup_args_for_failure_locked(handshaker); cleanup_args_for_failure_locked(exec_ctx, handshaker);
} }
gpr_mu_unlock(&handshaker->mu); gpr_mu_unlock(&handshaker->mu);
} }
@ -286,6 +297,8 @@ static void http_connect_handshaker_do_handshake(
request.host = server_name; request.host = server_name;
request.http.method = "CONNECT"; request.http.method = "CONNECT";
request.http.path = server_name; request.http.path = server_name;
request.http.hdrs = handshaker->headers;
request.http.hdr_count = handshaker->num_headers;
request.handshaker = &grpc_httpcli_plaintext; request.handshaker = &grpc_httpcli_plaintext;
grpc_slice request_slice = grpc_httpcli_format_connect_request(&request); grpc_slice request_slice = grpc_httpcli_format_connect_request(&request);
grpc_slice_buffer_add(&handshaker->write_buffer, request_slice); grpc_slice_buffer_add(&handshaker->write_buffer, request_slice);
@ -303,7 +316,9 @@ static const grpc_handshaker_vtable http_connect_handshaker_vtable = {
http_connect_handshaker_destroy, http_connect_handshaker_shutdown, http_connect_handshaker_destroy, http_connect_handshaker_shutdown,
http_connect_handshaker_do_handshake}; http_connect_handshaker_do_handshake};
grpc_handshaker* grpc_http_connect_handshaker_create(const char* proxy_server) { grpc_handshaker* grpc_http_connect_handshaker_create(const char* proxy_server,
grpc_http_header* headers,
size_t num_headers) {
GPR_ASSERT(proxy_server != NULL); GPR_ASSERT(proxy_server != NULL);
http_connect_handshaker* handshaker = gpr_malloc(sizeof(*handshaker)); http_connect_handshaker* handshaker = gpr_malloc(sizeof(*handshaker));
memset(handshaker, 0, sizeof(*handshaker)); memset(handshaker, 0, sizeof(*handshaker));
@ -311,6 +326,14 @@ grpc_handshaker* grpc_http_connect_handshaker_create(const char* proxy_server) {
gpr_mu_init(&handshaker->mu); gpr_mu_init(&handshaker->mu);
gpr_ref_init(&handshaker->refcount, 1); gpr_ref_init(&handshaker->refcount, 1);
handshaker->proxy_server = gpr_strdup(proxy_server); handshaker->proxy_server = gpr_strdup(proxy_server);
if (num_headers > 0) {
handshaker->headers = gpr_malloc(sizeof(grpc_http_header) * num_headers);
for (size_t i = 0; i < num_headers; ++i) {
handshaker->headers[i].key = gpr_strdup(headers[i].key);
handshaker->headers[i].value = gpr_strdup(headers[i].value);
}
handshaker->num_headers = num_headers;
}
grpc_slice_buffer_init(&handshaker->write_buffer); grpc_slice_buffer_init(&handshaker->write_buffer);
grpc_closure_init(&handshaker->request_done_closure, on_write_done, grpc_closure_init(&handshaker->request_done_closure, on_write_done,
handshaker, grpc_schedule_on_exec_ctx); handshaker, grpc_schedule_on_exec_ctx);
@ -344,3 +367,33 @@ done:
grpc_uri_destroy(uri); grpc_uri_destroy(uri);
return proxy_name; return proxy_name;
} }
//
// handshaker factory
//
static void handshaker_factory_add_handshakers(
grpc_exec_ctx* exec_ctx, grpc_handshaker_factory* factory,
const grpc_channel_args* args, grpc_handshake_manager* handshake_mgr) {
char* proxy_name = grpc_get_http_proxy_server();
if (proxy_name != NULL) {
grpc_handshake_manager_add(
handshake_mgr,
grpc_http_connect_handshaker_create(proxy_name, NULL, 0));
gpr_free(proxy_name);
}
}
static void handshaker_factory_destroy(grpc_exec_ctx* exec_ctx,
grpc_handshaker_factory* factory) {}
static const grpc_handshaker_factory_vtable handshaker_factory_vtable = {
handshaker_factory_add_handshakers, handshaker_factory_destroy};
static grpc_handshaker_factory handshaker_factory = {
&handshaker_factory_vtable};
void grpc_http_connect_register_handshaker_factory() {
grpc_handshaker_factory_register(true /* at_start */, HANDSHAKER_CLIENT,
&handshaker_factory);
}

@ -35,12 +35,18 @@
#define GRPC_CORE_EXT_CLIENT_CHANNEL_HTTP_CONNECT_HANDSHAKER_H #define GRPC_CORE_EXT_CLIENT_CHANNEL_HTTP_CONNECT_HANDSHAKER_H
#include "src/core/lib/channel/handshaker.h" #include "src/core/lib/channel/handshaker.h"
#include "src/core/lib/http/parser.h"
/// Does NOT take ownership of \a proxy_server. /// Creates a new HTTP CONNECT handshaker.
grpc_handshaker* grpc_http_connect_handshaker_create(const char* proxy_server); grpc_handshaker* grpc_http_connect_handshaker_create(const char* proxy_server,
grpc_http_header* headers,
size_t num_headers);
/// Returns the name of the proxy to use, or NULL if no proxy is configured. /// Returns the name of the proxy to use, or NULL if no proxy is configured.
/// Caller takes ownership of result. /// Caller takes ownership of result.
char* grpc_get_http_proxy_server(); char* grpc_get_http_proxy_server();
/// Registers handshaker factory.
void grpc_http_connect_register_handshaker_factory();
#endif /* GRPC_CORE_EXT_CLIENT_CHANNEL_HTTP_CONNECT_HANDSHAKER_H */ #endif /* GRPC_CORE_EXT_CLIENT_CHANNEL_HTTP_CONNECT_HANDSHAKER_H */

@ -112,11 +112,13 @@ int grpc_lb_addresses_cmp(const grpc_lb_addresses* addresses1,
return 0; return 0;
} }
void grpc_lb_addresses_destroy(grpc_lb_addresses* addresses) { void grpc_lb_addresses_destroy(grpc_exec_ctx* exec_ctx,
grpc_lb_addresses* addresses) {
for (size_t i = 0; i < addresses->num_addresses; ++i) { for (size_t i = 0; i < addresses->num_addresses; ++i) {
gpr_free(addresses->addresses[i].balancer_name); gpr_free(addresses->addresses[i].balancer_name);
if (addresses->addresses[i].user_data != NULL) { if (addresses->addresses[i].user_data != NULL) {
addresses->user_data_vtable->destroy(addresses->addresses[i].user_data); addresses->user_data_vtable->destroy(exec_ctx,
addresses->addresses[i].user_data);
} }
} }
gpr_free(addresses->addresses); gpr_free(addresses->addresses);
@ -126,8 +128,8 @@ void grpc_lb_addresses_destroy(grpc_lb_addresses* addresses) {
static void* lb_addresses_copy(void* addresses) { static void* lb_addresses_copy(void* addresses) {
return grpc_lb_addresses_copy(addresses); return grpc_lb_addresses_copy(addresses);
} }
static void lb_addresses_destroy(void* addresses) { static void lb_addresses_destroy(grpc_exec_ctx* exec_ctx, void* addresses) {
grpc_lb_addresses_destroy(addresses); grpc_lb_addresses_destroy(exec_ctx, addresses);
} }
static int lb_addresses_cmp(void* addresses1, void* addresses2) { static int lb_addresses_cmp(void* addresses1, void* addresses2) {
return grpc_lb_addresses_cmp(addresses1, addresses2); return grpc_lb_addresses_cmp(addresses1, addresses2);

@ -64,7 +64,7 @@ typedef struct grpc_lb_address {
typedef struct grpc_lb_user_data_vtable { typedef struct grpc_lb_user_data_vtable {
void *(*copy)(void *); void *(*copy)(void *);
void (*destroy)(void *); void (*destroy)(grpc_exec_ctx *exec_ctx, void *);
int (*cmp)(void *, void *); int (*cmp)(void *, void *);
} grpc_lb_user_data_vtable; } grpc_lb_user_data_vtable;
@ -96,7 +96,8 @@ int grpc_lb_addresses_cmp(const grpc_lb_addresses *addresses1,
const grpc_lb_addresses *addresses2); const grpc_lb_addresses *addresses2);
/** Destroys \a addresses. */ /** Destroys \a addresses. */
void grpc_lb_addresses_destroy(grpc_lb_addresses *addresses); void grpc_lb_addresses_destroy(grpc_exec_ctx *exec_ctx,
grpc_lb_addresses *addresses);
/** Returns a channel arg containing \a addresses. */ /** Returns a channel arg containing \a addresses. */
grpc_arg grpc_lb_addresses_create_channel_arg( grpc_arg grpc_lb_addresses_create_channel_arg(

@ -46,6 +46,7 @@
#include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/iomgr/timer.h" #include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/profiling/timers.h" #include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/support/backoff.h" #include "src/core/lib/support/backoff.h"
#include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/channel_init.h" #include "src/core/lib/surface/channel_init.h"
@ -108,6 +109,9 @@ struct grpc_subchannel {
/** callback for connection finishing */ /** callback for connection finishing */
grpc_closure connected; grpc_closure connected;
/** callback for our alarm */
grpc_closure on_alarm;
/** pollset_set tracking who's interested in a connection /** pollset_set tracking who's interested in a connection
being setup */ being setup */
grpc_pollset_set *pollset_set; grpc_pollset_set *pollset_set;
@ -206,9 +210,9 @@ static void subchannel_destroy(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) { grpc_error *error) {
grpc_subchannel *c = arg; grpc_subchannel *c = arg;
gpr_free((void *)c->filters); gpr_free((void *)c->filters);
grpc_channel_args_destroy(c->args); grpc_channel_args_destroy(exec_ctx, c->args);
gpr_free(c->addr); gpr_free(c->addr);
grpc_slice_unref(c->initial_connect_string); grpc_slice_unref_internal(exec_ctx, c->initial_connect_string);
grpc_connectivity_state_destroy(exec_ctx, &c->state_tracker); grpc_connectivity_state_destroy(exec_ctx, &c->state_tracker);
grpc_connector_unref(exec_ctx, c->connector); grpc_connector_unref(exec_ctx, c->connector);
grpc_pollset_set_destroy(c->pollset_set); grpc_pollset_set_destroy(c->pollset_set);
@ -482,7 +486,8 @@ static void maybe_start_connecting_locked(grpc_exec_ctx *exec_ctx,
gpr_log(GPR_INFO, "Retry in %" PRId64 ".%09d seconds", gpr_log(GPR_INFO, "Retry in %" PRId64 ".%09d seconds",
time_til_next.tv_sec, time_til_next.tv_nsec); time_til_next.tv_sec, time_til_next.tv_nsec);
} }
grpc_timer_init(exec_ctx, &c->alarm, c->next_attempt, on_alarm, c, now); grpc_closure_init(&c->on_alarm, on_alarm, c, grpc_schedule_on_exec_ctx);
grpc_timer_init(exec_ctx, &c->alarm, c->next_attempt, &c->on_alarm, now);
} }
} }
@ -603,13 +608,13 @@ static void publish_transport_locked(grpc_exec_ctx *exec_ctx,
/* construct channel stack */ /* construct channel stack */
grpc_channel_stack_builder *builder = grpc_channel_stack_builder_create(); grpc_channel_stack_builder *builder = grpc_channel_stack_builder_create();
grpc_channel_stack_builder_set_channel_arguments( grpc_channel_stack_builder_set_channel_arguments(
builder, c->connecting_result.channel_args); exec_ctx, builder, c->connecting_result.channel_args);
grpc_channel_stack_builder_set_transport(builder, grpc_channel_stack_builder_set_transport(builder,
c->connecting_result.transport); c->connecting_result.transport);
if (!grpc_channel_init_create_stack(exec_ctx, builder, if (!grpc_channel_init_create_stack(exec_ctx, builder,
GRPC_CLIENT_SUBCHANNEL)) { GRPC_CLIENT_SUBCHANNEL)) {
grpc_channel_stack_builder_destroy(builder); grpc_channel_stack_builder_destroy(exec_ctx, builder);
abort(); /* TODO(ctiller): what to do here (previously we just crashed) */ abort(); /* TODO(ctiller): what to do here (previously we just crashed) */
} }
grpc_error *error = grpc_channel_stack_builder_finish( grpc_error *error = grpc_channel_stack_builder_finish(
@ -689,7 +694,7 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
} }
gpr_mu_unlock(&c->mu); gpr_mu_unlock(&c->mu);
GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connected"); GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connected");
grpc_channel_args_destroy(delete_channel_args); grpc_channel_args_destroy(exec_ctx, delete_channel_args);
} }
/* /*

@ -128,7 +128,7 @@ void grpc_subchannel_key_destroy(grpc_exec_ctx *exec_ctx,
grpc_subchannel_key *k) { grpc_subchannel_key *k) {
grpc_connector_unref(exec_ctx, k->connector); grpc_connector_unref(exec_ctx, k->connector);
gpr_free((grpc_channel_args *)k->args.filters); gpr_free((grpc_channel_args *)k->args.filters);
grpc_channel_args_destroy((grpc_channel_args *)k->args.args); grpc_channel_args_destroy(exec_ctx, (grpc_channel_args *)k->args.args);
gpr_free(k->args.addr); gpr_free(k->args.addr);
gpr_free(k); gpr_free(k);
} }

@ -42,7 +42,6 @@
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
#include <grpc/support/string_util.h> #include <grpc/support/string_util.h>
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h" #include "src/core/lib/support/string.h"
/** a size_t default value... maps to all 1's */ /** a size_t default value... maps to all 1's */
@ -138,7 +137,6 @@ static int parse_fragment_or_query(const char *uri_text, size_t *i) {
return 1; return 1;
} }
static void do_nothing(void *ignored) {}
static void parse_query_parts(grpc_uri *uri) { static void parse_query_parts(grpc_uri *uri) {
static const char *QUERY_PARTS_SEPARATOR = "&"; static const char *QUERY_PARTS_SEPARATOR = "&";
static const char *QUERY_PARTS_VALUE_SEPARATOR = "="; static const char *QUERY_PARTS_VALUE_SEPARATOR = "=";
@ -149,38 +147,32 @@ static void parse_query_parts(grpc_uri *uri) {
uri->num_query_parts = 0; uri->num_query_parts = 0;
return; return;
} }
grpc_slice query_slice =
grpc_slice_new(uri->query, strlen(uri->query), do_nothing);
grpc_slice_buffer query_parts; /* the &-separated elements of the query */
grpc_slice_buffer query_param_parts; /* the =-separated subelements */
grpc_slice_buffer_init(&query_parts); gpr_string_split(uri->query, QUERY_PARTS_SEPARATOR, &uri->query_parts,
grpc_slice_buffer_init(&query_param_parts); &uri->num_query_parts);
uri->query_parts_values = gpr_malloc(uri->num_query_parts * sizeof(char **));
grpc_slice_split(query_slice, QUERY_PARTS_SEPARATOR, &query_parts); for (size_t i = 0; i < uri->num_query_parts; i++) {
uri->query_parts = gpr_malloc(query_parts.count * sizeof(char *)); char **query_param_parts;
uri->query_parts_values = gpr_malloc(query_parts.count * sizeof(char *)); size_t num_query_param_parts;
uri->num_query_parts = query_parts.count; char *full = uri->query_parts[i];
for (size_t i = 0; i < query_parts.count; i++) { gpr_string_split(full, QUERY_PARTS_VALUE_SEPARATOR, &query_param_parts,
grpc_slice_split(query_parts.slices[i], QUERY_PARTS_VALUE_SEPARATOR, &num_query_param_parts);
&query_param_parts); GPR_ASSERT(num_query_param_parts > 0);
GPR_ASSERT(query_param_parts.count > 0); uri->query_parts[i] = query_param_parts[0];
uri->query_parts[i] = if (num_query_param_parts > 1) {
grpc_dump_slice(query_param_parts.slices[0], GPR_DUMP_ASCII);
if (query_param_parts.count > 1) {
/* TODO(dgq): only the first value after the separator is considered. /* TODO(dgq): only the first value after the separator is considered.
* Perhaps all chars after the first separator for the query part should * Perhaps all chars after the first separator for the query part should
* be included, even if they include the separator. */ * be included, even if they include the separator. */
uri->query_parts_values[i] = uri->query_parts_values[i] = query_param_parts[1];
grpc_dump_slice(query_param_parts.slices[1], GPR_DUMP_ASCII);
} else { } else {
uri->query_parts_values[i] = NULL; uri->query_parts_values[i] = NULL;
} }
grpc_slice_buffer_reset_and_unref(&query_param_parts); for (size_t j = 2; j < num_query_param_parts; j++) {
gpr_free(query_param_parts[j]);
}
gpr_free(query_param_parts);
gpr_free(full);
} }
grpc_slice_buffer_destroy(&query_parts);
grpc_slice_buffer_destroy(&query_param_parts);
grpc_slice_unref(query_slice);
} }
grpc_uri *grpc_uri_parse(const char *uri_text, int suppress_errors) { grpc_uri *grpc_uri_parse(const char *uri_text, int suppress_errors) {

@ -117,6 +117,7 @@
#include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h" #include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/timer.h" #include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/backoff.h" #include "src/core/lib/support/backoff.h"
#include "src/core/lib/support/string.h" #include "src/core/lib/support/string.h"
@ -326,6 +327,9 @@ typedef struct glb_lb_policy {
/* A response from the LB server has been received. Process it */ /* A response from the LB server has been received. Process it */
grpc_closure lb_on_response_received; grpc_closure lb_on_response_received;
/* LB call retry timer callback. */
grpc_closure lb_on_call_retry;
grpc_call *lb_call; /* streaming call to the LB server, */ grpc_call *lb_call; /* streaming call to the LB server, */
grpc_metadata_array lb_initial_metadata_recv; /* initial MD from LB server */ grpc_metadata_array lb_initial_metadata_recv; /* initial MD from LB server */
@ -386,8 +390,8 @@ static bool is_server_valid(const grpc_grpclb_server *server, size_t idx,
static void *lb_token_copy(void *token) { static void *lb_token_copy(void *token) {
return token == NULL ? NULL : GRPC_MDELEM_REF(token); return token == NULL ? NULL : GRPC_MDELEM_REF(token);
} }
static void lb_token_destroy(void *token) { static void lb_token_destroy(grpc_exec_ctx *exec_ctx, void *token) {
if (token != NULL) GRPC_MDELEM_UNREF(token); if (token != NULL) GRPC_MDELEM_UNREF(exec_ctx, token);
} }
static int lb_token_cmp(void *token1, void *token2) { static int lb_token_cmp(void *token1, void *token2) {
if (token1 > token2) return 1; if (token1 > token2) return 1;
@ -421,7 +425,7 @@ static void parse_server(const grpc_grpclb_server *server,
/* Returns addresses extracted from \a serverlist. */ /* Returns addresses extracted from \a serverlist. */
static grpc_lb_addresses *process_serverlist_locked( static grpc_lb_addresses *process_serverlist_locked(
const grpc_grpclb_serverlist *serverlist) { grpc_exec_ctx *exec_ctx, const grpc_grpclb_serverlist *serverlist) {
size_t num_valid = 0; size_t num_valid = 0;
/* first pass: count how many are valid in order to allocate the necessary /* first pass: count how many are valid in order to allocate the necessary
* memory in a single block */ * memory in a single block */
@ -457,8 +461,8 @@ static grpc_lb_addresses *process_serverlist_locked(
strnlen(server->load_balance_token, lb_token_max_length); strnlen(server->load_balance_token, lb_token_max_length);
grpc_mdstr *lb_token_mdstr = grpc_mdstr_from_buffer( grpc_mdstr *lb_token_mdstr = grpc_mdstr_from_buffer(
(uint8_t *)server->load_balance_token, lb_token_length); (uint8_t *)server->load_balance_token, lb_token_length);
user_data = grpc_mdelem_from_metadata_strings(GRPC_MDSTR_LB_TOKEN, user_data = grpc_mdelem_from_metadata_strings(
lb_token_mdstr); exec_ctx, GRPC_MDSTR_LB_TOKEN, lb_token_mdstr);
} else { } else {
char *uri = grpc_sockaddr_to_uri(&addr); char *uri = grpc_sockaddr_to_uri(&addr);
gpr_log(GPR_INFO, gpr_log(GPR_INFO,
@ -581,7 +585,8 @@ static grpc_lb_policy *create_rr_locked(
grpc_lb_policy_args args; grpc_lb_policy_args args;
memset(&args, 0, sizeof(args)); memset(&args, 0, sizeof(args));
args.client_channel_factory = glb_policy->cc_factory; args.client_channel_factory = glb_policy->cc_factory;
grpc_lb_addresses *addresses = process_serverlist_locked(serverlist); grpc_lb_addresses *addresses =
process_serverlist_locked(exec_ctx, serverlist);
// Replace the LB addresses in the channel args that we pass down to // Replace the LB addresses in the channel args that we pass down to
// the subchannel. // the subchannel.
@ -593,8 +598,8 @@ static grpc_lb_policy *create_rr_locked(
grpc_lb_policy *rr = grpc_lb_policy_create(exec_ctx, "round_robin", &args); grpc_lb_policy *rr = grpc_lb_policy_create(exec_ctx, "round_robin", &args);
GPR_ASSERT(rr != NULL); GPR_ASSERT(rr != NULL);
grpc_lb_addresses_destroy(addresses); grpc_lb_addresses_destroy(exec_ctx, addresses);
grpc_channel_args_destroy(args.args); grpc_channel_args_destroy(exec_ctx, args.args);
return rr; return rr;
} }
@ -840,7 +845,7 @@ static grpc_lb_policy *glb_create(grpc_exec_ctx *exec_ctx,
glb_policy->lb_channel = grpc_client_channel_factory_create_channel( glb_policy->lb_channel = grpc_client_channel_factory_create_channel(
exec_ctx, glb_policy->cc_factory, target_uri_str, exec_ctx, glb_policy->cc_factory, target_uri_str,
GRPC_CLIENT_CHANNEL_TYPE_LOAD_BALANCING, new_args); GRPC_CLIENT_CHANNEL_TYPE_LOAD_BALANCING, new_args);
grpc_channel_args_destroy(new_args); grpc_channel_args_destroy(exec_ctx, new_args);
gpr_free(target_uri_str); gpr_free(target_uri_str);
for (size_t i = 0; i < num_grpclb_addrs; i++) { for (size_t i = 0; i < num_grpclb_addrs; i++) {
@ -866,7 +871,7 @@ static void glb_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
GPR_ASSERT(glb_policy->pending_picks == NULL); GPR_ASSERT(glb_policy->pending_picks == NULL);
GPR_ASSERT(glb_policy->pending_pings == NULL); GPR_ASSERT(glb_policy->pending_pings == NULL);
gpr_free((void *)glb_policy->server_name); gpr_free((void *)glb_policy->server_name);
grpc_channel_args_destroy(glb_policy->args); grpc_channel_args_destroy(exec_ctx, glb_policy->args);
grpc_channel_destroy(glb_policy->lb_channel); grpc_channel_destroy(glb_policy->lb_channel);
glb_policy->lb_channel = NULL; glb_policy->lb_channel = NULL;
grpc_connectivity_state_destroy(exec_ctx, &glb_policy->state_tracker); grpc_connectivity_state_destroy(exec_ctx, &glb_policy->state_tracker);
@ -1089,7 +1094,8 @@ static void lb_on_server_status_received(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error); grpc_error *error);
static void lb_on_response_received(grpc_exec_ctx *exec_ctx, void *arg, static void lb_on_response_received(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error); grpc_error *error);
static void lb_call_init_locked(glb_lb_policy *glb_policy) { static void lb_call_init_locked(grpc_exec_ctx *exec_ctx,
glb_lb_policy *glb_policy) {
GPR_ASSERT(glb_policy->server_name != NULL); GPR_ASSERT(glb_policy->server_name != NULL);
GPR_ASSERT(glb_policy->server_name[0] != '\0'); GPR_ASSERT(glb_policy->server_name[0] != '\0');
GPR_ASSERT(!glb_policy->shutting_down); GPR_ASSERT(!glb_policy->shutting_down);
@ -1098,7 +1104,7 @@ static void lb_call_init_locked(glb_lb_policy *glb_policy) {
* glb_policy->base.interested_parties, which is comprised of the polling * glb_policy->base.interested_parties, which is comprised of the polling
* entities from \a client_channel. */ * entities from \a client_channel. */
glb_policy->lb_call = grpc_channel_create_pollset_set_call( glb_policy->lb_call = grpc_channel_create_pollset_set_call(
glb_policy->lb_channel, NULL, GRPC_PROPAGATE_DEFAULTS, exec_ctx, glb_policy->lb_channel, NULL, GRPC_PROPAGATE_DEFAULTS,
glb_policy->base.interested_parties, glb_policy->base.interested_parties,
"/grpc.lb.v1.LoadBalancer/BalanceLoad", glb_policy->server_name, "/grpc.lb.v1.LoadBalancer/BalanceLoad", glb_policy->server_name,
glb_policy->deadline, NULL); glb_policy->deadline, NULL);
@ -1111,7 +1117,7 @@ static void lb_call_init_locked(glb_lb_policy *glb_policy) {
grpc_slice request_payload_slice = grpc_grpclb_request_encode(request); grpc_slice request_payload_slice = grpc_grpclb_request_encode(request);
glb_policy->lb_request_payload = glb_policy->lb_request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_slice_unref(request_payload_slice); grpc_slice_unref_internal(exec_ctx, request_payload_slice);
grpc_grpclb_request_destroy(request); grpc_grpclb_request_destroy(request);
glb_policy->lb_call_status_details = NULL; glb_policy->lb_call_status_details = NULL;
@ -1152,7 +1158,7 @@ static void query_for_backends_locked(grpc_exec_ctx *exec_ctx,
GPR_ASSERT(glb_policy->lb_channel != NULL); GPR_ASSERT(glb_policy->lb_channel != NULL);
if (glb_policy->shutting_down) return; if (glb_policy->shutting_down) return;
lb_call_init_locked(glb_policy); lb_call_init_locked(exec_ctx, glb_policy);
if (grpc_lb_glb_trace) { if (grpc_lb_glb_trace) {
gpr_log(GPR_INFO, "Query for backends (grpclb: %p, lb_call: %p)", gpr_log(GPR_INFO, "Query for backends (grpclb: %p, lb_call: %p)",
@ -1237,7 +1243,7 @@ static void lb_on_response_received(grpc_exec_ctx *exec_ctx, void *arg,
grpc_grpclb_response_parse_serverlist(response_slice); grpc_grpclb_response_parse_serverlist(response_slice);
if (serverlist != NULL) { if (serverlist != NULL) {
GPR_ASSERT(glb_policy->lb_call != NULL); GPR_ASSERT(glb_policy->lb_call != NULL);
grpc_slice_unref(response_slice); grpc_slice_unref_internal(exec_ctx, response_slice);
if (grpc_lb_glb_trace) { if (grpc_lb_glb_trace) {
gpr_log(GPR_INFO, "Serverlist with %lu servers received", gpr_log(GPR_INFO, "Serverlist with %lu servers received",
(unsigned long)serverlist->num_servers); (unsigned long)serverlist->num_servers);
@ -1281,7 +1287,7 @@ static void lb_on_response_received(grpc_exec_ctx *exec_ctx, void *arg,
} else { /* serverlist == NULL */ } else { /* serverlist == NULL */
gpr_log(GPR_ERROR, "Invalid LB response received: '%s'. Ignoring.", gpr_log(GPR_ERROR, "Invalid LB response received: '%s'. Ignoring.",
grpc_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX)); grpc_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX));
grpc_slice_unref(response_slice); grpc_slice_unref_internal(exec_ctx, response_slice);
} }
if (!glb_policy->shutting_down) { if (!glb_policy->shutting_down) {
@ -1361,8 +1367,10 @@ static void lb_on_server_status_received(grpc_exec_ctx *exec_ctx, void *arg,
} }
} }
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "grpclb_retry_timer"); GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "grpclb_retry_timer");
grpc_closure_init(&glb_policy->lb_on_call_retry, lb_call_on_retry_timer,
glb_policy, grpc_schedule_on_exec_ctx);
grpc_timer_init(exec_ctx, &glb_policy->lb_call_retry_timer, next_try, grpc_timer_init(exec_ctx, &glb_policy->lb_call_retry_timer, next_try,
lb_call_on_retry_timer, glb_policy, now); &glb_policy->lb_on_call_retry, now);
} }
gpr_mu_unlock(&glb_policy->mu); gpr_mu_unlock(&glb_policy->mu);
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base, GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,

@ -284,7 +284,7 @@ static void rr_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
GRPC_SUBCHANNEL_UNREF(exec_ctx, sd->subchannel, "rr_destroy"); GRPC_SUBCHANNEL_UNREF(exec_ctx, sd->subchannel, "rr_destroy");
if (sd->user_data != NULL) { if (sd->user_data != NULL) {
GPR_ASSERT(sd->user_data_vtable != NULL); GPR_ASSERT(sd->user_data_vtable != NULL);
sd->user_data_vtable->destroy(sd->user_data); sd->user_data_vtable->destroy(exec_ctx, sd->user_data);
} }
gpr_free(sd); gpr_free(sd);
} }

@ -53,7 +53,8 @@ static bool is_load_reporting_enabled(const grpc_channel_args *a) {
return false; return false;
} }
static bool maybe_add_load_reporting_filter(grpc_channel_stack_builder *builder, static bool maybe_add_load_reporting_filter(grpc_exec_ctx *exec_ctx,
grpc_channel_stack_builder *builder,
void *arg) { void *arg) {
const grpc_channel_args *args = const grpc_channel_args *args =
grpc_channel_stack_builder_get_channel_arguments(builder); grpc_channel_stack_builder_get_channel_arguments(builder);

@ -68,7 +68,8 @@ typedef struct {
grpc_exec_ctx *exec_ctx; grpc_exec_ctx *exec_ctx;
} recv_md_filter_args; } recv_md_filter_args;
static grpc_mdelem *recv_md_filter(void *user_data, grpc_mdelem *md) { static grpc_mdelem *recv_md_filter(grpc_exec_ctx *exec_ctx, void *user_data,
grpc_mdelem *md) {
recv_md_filter_args *a = user_data; recv_md_filter_args *a = user_data;
grpc_call_element *elem = a->elem; grpc_call_element *elem = a->elem;
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
@ -92,8 +93,8 @@ static void on_initial_md_ready(grpc_exec_ctx *exec_ctx, void *user_data,
recv_md_filter_args a; recv_md_filter_args a;
a.elem = elem; a.elem = elem;
a.exec_ctx = exec_ctx; a.exec_ctx = exec_ctx;
grpc_metadata_batch_filter(calld->recv_initial_metadata, recv_md_filter, grpc_metadata_batch_filter(exec_ctx, calld->recv_initial_metadata,
&a); recv_md_filter, &a);
if (calld->service_method == NULL) { if (calld->service_method == NULL) {
err = err =
grpc_error_add_child(err, GRPC_ERROR_CREATE("Missing :path header")); grpc_error_add_child(err, GRPC_ERROR_CREATE("Missing :path header"));
@ -192,7 +193,8 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
*/ */
} }
static grpc_mdelem *lr_trailing_md_filter(void *user_data, grpc_mdelem *md) { static grpc_mdelem *lr_trailing_md_filter(grpc_exec_ctx *exec_ctx,
void *user_data, grpc_mdelem *md) {
grpc_call_element *elem = user_data; grpc_call_element *elem = user_data;
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
@ -216,7 +218,7 @@ static void lr_start_transport_stream_op(grpc_exec_ctx *exec_ctx,
calld->ops_recv_initial_metadata_ready = op->recv_initial_metadata_ready; calld->ops_recv_initial_metadata_ready = op->recv_initial_metadata_ready;
op->recv_initial_metadata_ready = &calld->on_initial_md_ready; op->recv_initial_metadata_ready = &calld->on_initial_md_ready;
} else if (op->send_trailing_metadata) { } else if (op->send_trailing_metadata) {
grpc_metadata_batch_filter(op->send_trailing_metadata, grpc_metadata_batch_filter(exec_ctx, op->send_trailing_metadata,
lr_trailing_md_filter, elem); lr_trailing_md_filter, elem);
} }
grpc_call_next_op(exec_ctx, elem, op); grpc_call_next_op(exec_ctx, elem, op);

@ -0,0 +1,4 @@
# Resolver
Implementations of various name resolution schemes.
See the [naming spec](/doc/naming.md).

@ -81,6 +81,7 @@ typedef struct {
/** retry timer */ /** retry timer */
bool have_retry_timer; bool have_retry_timer;
grpc_timer retry_timer; grpc_timer retry_timer;
grpc_closure on_retry;
/** retry backoff state */ /** retry backoff state */
gpr_backoff backoff_state; gpr_backoff backoff_state;
@ -182,13 +183,13 @@ static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
grpc_arg new_arg = grpc_lb_addresses_create_channel_arg(addresses); grpc_arg new_arg = grpc_lb_addresses_create_channel_arg(addresses);
result = grpc_channel_args_copy_and_add(r->channel_args, &new_arg, 1); result = grpc_channel_args_copy_and_add(r->channel_args, &new_arg, 1);
grpc_resolved_addresses_destroy(r->addresses); grpc_resolved_addresses_destroy(r->addresses);
grpc_lb_addresses_destroy(addresses); grpc_lb_addresses_destroy(exec_ctx, addresses);
} else { } else {
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC); gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
gpr_timespec next_try = gpr_backoff_step(&r->backoff_state, now); gpr_timespec next_try = gpr_backoff_step(&r->backoff_state, now);
gpr_timespec timeout = gpr_time_sub(next_try, now); gpr_timespec timeout = gpr_time_sub(next_try, now);
const char *msg = grpc_error_string(error); const char *msg = grpc_error_string(error);
gpr_log(GPR_DEBUG, "dns resolution failed: %s", msg); gpr_log(GPR_INFO, "dns resolution failed (will retry): %s", msg);
grpc_error_free_string(msg); grpc_error_free_string(msg);
GPR_ASSERT(!r->have_retry_timer); GPR_ASSERT(!r->have_retry_timer);
r->have_retry_timer = true; r->have_retry_timer = true;
@ -199,11 +200,12 @@ static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
} else { } else {
gpr_log(GPR_DEBUG, "retrying immediately"); gpr_log(GPR_DEBUG, "retrying immediately");
} }
grpc_timer_init(exec_ctx, &r->retry_timer, next_try, dns_on_retry_timer, r, grpc_closure_init(&r->on_retry, dns_on_retry_timer, r,
now); grpc_schedule_on_exec_ctx);
grpc_timer_init(exec_ctx, &r->retry_timer, next_try, &r->on_retry, now);
} }
if (r->resolved_result != NULL) { if (r->resolved_result != NULL) {
grpc_channel_args_destroy(r->resolved_result); grpc_channel_args_destroy(exec_ctx, r->resolved_result);
} }
r->resolved_result = result; r->resolved_result = result;
r->resolved_version++; r->resolved_version++;
@ -242,12 +244,12 @@ static void dns_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *gr) {
dns_resolver *r = (dns_resolver *)gr; dns_resolver *r = (dns_resolver *)gr;
gpr_mu_destroy(&r->mu); gpr_mu_destroy(&r->mu);
if (r->resolved_result != NULL) { if (r->resolved_result != NULL) {
grpc_channel_args_destroy(r->resolved_result); grpc_channel_args_destroy(exec_ctx, r->resolved_result);
} }
grpc_pollset_set_destroy(r->interested_parties); grpc_pollset_set_destroy(r->interested_parties);
gpr_free(r->name_to_resolve); gpr_free(r->name_to_resolve);
gpr_free(r->default_port); gpr_free(r->default_port);
grpc_channel_args_destroy(r->channel_args); grpc_channel_args_destroy(exec_ctx, r->channel_args);
gpr_free(r); gpr_free(r);
} }

@ -47,6 +47,7 @@
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h" #include "src/core/lib/iomgr/unix_sockets_posix.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h" #include "src/core/lib/support/string.h"
@ -131,8 +132,8 @@ static void sockaddr_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
static void sockaddr_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *gr) { static void sockaddr_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *gr) {
sockaddr_resolver *r = (sockaddr_resolver *)gr; sockaddr_resolver *r = (sockaddr_resolver *)gr;
gpr_mu_destroy(&r->mu); gpr_mu_destroy(&r->mu);
grpc_lb_addresses_destroy(r->addresses); grpc_lb_addresses_destroy(exec_ctx, r->addresses);
grpc_channel_args_destroy(r->channel_args); grpc_channel_args_destroy(exec_ctx, r->channel_args);
gpr_free(r); gpr_free(r);
} }
@ -161,7 +162,8 @@ char *unix_get_default_authority(grpc_resolver_factory *factory,
static void do_nothing(void *ignored) {} static void do_nothing(void *ignored) {}
static grpc_resolver *sockaddr_create(grpc_resolver_args *args, static grpc_resolver *sockaddr_create(grpc_exec_ctx *exec_ctx,
grpc_resolver_args *args,
int parse(grpc_uri *uri, int parse(grpc_uri *uri,
grpc_resolved_address *dst)) { grpc_resolved_address *dst)) {
if (0 != strcmp(args->uri->authority, "")) { if (0 != strcmp(args->uri->authority, "")) {
@ -188,10 +190,10 @@ static grpc_resolver *sockaddr_create(grpc_resolver_args *args,
gpr_free(part_str); gpr_free(part_str);
if (errors_found) break; if (errors_found) break;
} }
grpc_slice_buffer_destroy(&path_parts); grpc_slice_buffer_destroy_internal(exec_ctx, &path_parts);
grpc_slice_unref(path_slice); grpc_slice_unref_internal(exec_ctx, path_slice);
if (errors_found) { if (errors_found) {
grpc_lb_addresses_destroy(addresses); grpc_lb_addresses_destroy(exec_ctx, addresses);
return NULL; return NULL;
} }
/* Instantiate resolver. */ /* Instantiate resolver. */
@ -216,7 +218,7 @@ static void sockaddr_factory_unref(grpc_resolver_factory *factory) {}
static grpc_resolver *name##_factory_create_resolver( \ static grpc_resolver *name##_factory_create_resolver( \
grpc_exec_ctx *exec_ctx, grpc_resolver_factory *factory, \ grpc_exec_ctx *exec_ctx, grpc_resolver_factory *factory, \
grpc_resolver_args *args) { \ grpc_resolver_args *args) { \
return sockaddr_create(args, parse_##name); \ return sockaddr_create(exec_ctx, args, parse_##name); \
} \ } \
static const grpc_resolver_factory_vtable name##_factory_vtable = { \ static const grpc_resolver_factory_vtable name##_factory_vtable = { \
sockaddr_factory_ref, sockaddr_factory_unref, \ sockaddr_factory_ref, sockaddr_factory_unref, \

@ -0,0 +1 @@
Transports for gRPC

@ -0,0 +1 @@
CHTTP2 - gRPC's implementation of a HTTP2 based transport

@ -46,7 +46,9 @@
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/handshaker.h" #include "src/core/lib/channel/handshaker.h"
#include "src/core/lib/channel/handshaker_registry.h"
#include "src/core/lib/iomgr/tcp_client.h" #include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/slice/slice_internal.h"
typedef struct { typedef struct {
grpc_connector base; grpc_connector base;
@ -57,9 +59,6 @@ typedef struct {
bool shutdown; bool shutdown;
bool connecting; bool connecting;
grpc_chttp2_add_handshakers_func add_handshakers;
void *add_handshakers_user_data;
grpc_closure *notify; grpc_closure *notify;
grpc_connect_in_args args; grpc_connect_in_args args;
grpc_connect_out_args *result; grpc_connect_out_args *result;
@ -123,8 +122,8 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
// point this can be removed. // point this can be removed.
grpc_endpoint_shutdown(exec_ctx, args->endpoint); grpc_endpoint_shutdown(exec_ctx, args->endpoint);
grpc_endpoint_destroy(exec_ctx, args->endpoint); grpc_endpoint_destroy(exec_ctx, args->endpoint);
grpc_channel_args_destroy(args->args); grpc_channel_args_destroy(exec_ctx, args->args);
grpc_slice_buffer_destroy(args->read_buffer); grpc_slice_buffer_destroy_internal(exec_ctx, args->read_buffer);
gpr_free(args->read_buffer); gpr_free(args->read_buffer);
} else { } else {
error = GRPC_ERROR_REF(error); error = GRPC_ERROR_REF(error);
@ -150,16 +149,8 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
static void start_handshake_locked(grpc_exec_ctx *exec_ctx, static void start_handshake_locked(grpc_exec_ctx *exec_ctx,
chttp2_connector *c) { chttp2_connector *c) {
c->handshake_mgr = grpc_handshake_manager_create(); c->handshake_mgr = grpc_handshake_manager_create();
char *proxy_name = grpc_get_http_proxy_server(); grpc_handshakers_add(exec_ctx, HANDSHAKER_CLIENT, c->args.channel_args,
if (proxy_name != NULL) {
grpc_handshake_manager_add(c->handshake_mgr,
grpc_http_connect_handshaker_create(proxy_name));
gpr_free(proxy_name);
}
if (c->add_handshakers != NULL) {
c->add_handshakers(exec_ctx, c->add_handshakers_user_data,
c->handshake_mgr); c->handshake_mgr);
}
grpc_handshake_manager_do_handshake( grpc_handshake_manager_do_handshake(
exec_ctx, c->handshake_mgr, c->endpoint, c->args.channel_args, exec_ctx, c->handshake_mgr, c->endpoint, c->args.channel_args,
c->args.deadline, NULL /* acceptor */, on_handshake_done, c); c->args.deadline, NULL /* acceptor */, on_handshake_done, c);
@ -249,15 +240,11 @@ static const grpc_connector_vtable chttp2_connector_vtable = {
chttp2_connector_ref, chttp2_connector_unref, chttp2_connector_shutdown, chttp2_connector_ref, chttp2_connector_unref, chttp2_connector_shutdown,
chttp2_connector_connect}; chttp2_connector_connect};
grpc_connector *grpc_chttp2_connector_create( grpc_connector *grpc_chttp2_connector_create() {
grpc_exec_ctx *exec_ctx, grpc_chttp2_add_handshakers_func add_handshakers,
void *add_handshakers_user_data) {
chttp2_connector *c = gpr_malloc(sizeof(*c)); chttp2_connector *c = gpr_malloc(sizeof(*c));
memset(c, 0, sizeof(*c)); memset(c, 0, sizeof(*c));
c->base.vtable = &chttp2_connector_vtable; c->base.vtable = &chttp2_connector_vtable;
gpr_mu_init(&c->mu); gpr_mu_init(&c->mu);
gpr_ref_init(&c->refs, 1); gpr_ref_init(&c->refs, 1);
c->add_handshakers = add_handshakers;
c->add_handshakers_user_data = add_handshakers_user_data;
return &c->base; return &c->base;
} }

@ -35,17 +35,7 @@
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H #define GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H
#include "src/core/ext/client_channel/connector.h" #include "src/core/ext/client_channel/connector.h"
#include "src/core/lib/channel/handshaker.h"
#include "src/core/lib/iomgr/exec_ctx.h"
typedef void (*grpc_chttp2_add_handshakers_func)( grpc_connector* grpc_chttp2_connector_create();
grpc_exec_ctx* exec_ctx, void* user_data,
grpc_handshake_manager* handshake_mgr);
/// If \a add_handshakers is non-NULL, it will be called with
/// \a add_handshakers_user_data to add handshakers.
grpc_connector* grpc_chttp2_connector_create(
grpc_exec_ctx* exec_ctx, grpc_chttp2_add_handshakers_func add_handshakers,
void* add_handshakers_user_data);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H */

@ -53,8 +53,7 @@ static void client_channel_factory_unref(
static grpc_subchannel *client_channel_factory_create_subchannel( static grpc_subchannel *client_channel_factory_create_subchannel(
grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory, grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory,
const grpc_subchannel_args *args) { const grpc_subchannel_args *args) {
grpc_connector *connector = grpc_chttp2_connector_create( grpc_connector *connector = grpc_chttp2_connector_create();
exec_ctx, NULL /* add_handshakers */, NULL /* user_data */);
grpc_subchannel *s = grpc_subchannel_create(exec_ctx, connector, args); grpc_subchannel *s = grpc_subchannel_create(exec_ctx, connector, args);
grpc_connector_unref(exec_ctx, connector); grpc_connector_unref(exec_ctx, connector);
return s; return s;
@ -72,7 +71,7 @@ static grpc_channel *client_channel_factory_create_channel(
grpc_channel_args *new_args = grpc_channel_args_copy_and_add(args, &arg, 1); grpc_channel_args *new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
grpc_channel *channel = grpc_channel_create(exec_ctx, target, new_args, grpc_channel *channel = grpc_channel_create(exec_ctx, target, new_args,
GRPC_CLIENT_CHANNEL, NULL); GRPC_CLIENT_CHANNEL, NULL);
grpc_channel_args_destroy(new_args); grpc_channel_args_destroy(exec_ctx, new_args);
return channel; return channel;
} }
@ -96,17 +95,16 @@ grpc_channel *grpc_insecure_channel_create(const char *target,
"grpc_insecure_channel_create(target=%p, args=%p, reserved=%p)", 3, "grpc_insecure_channel_create(target=%p, args=%p, reserved=%p)", 3,
(target, args, reserved)); (target, args, reserved));
GPR_ASSERT(reserved == NULL); GPR_ASSERT(reserved == NULL);
grpc_client_channel_factory *factory =
(grpc_client_channel_factory *)&client_channel_factory;
// Add channel arg containing the client channel factory. // Add channel arg containing the client channel factory.
grpc_arg arg = grpc_client_channel_factory_create_channel_arg(factory); grpc_arg arg =
grpc_client_channel_factory_create_channel_arg(&client_channel_factory);
grpc_channel_args *new_args = grpc_channel_args_copy_and_add(args, &arg, 1); grpc_channel_args *new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
// Create channel. // Create channel.
grpc_channel *channel = client_channel_factory_create_channel( grpc_channel *channel = client_channel_factory_create_channel(
&exec_ctx, factory, target, GRPC_CLIENT_CHANNEL_TYPE_REGULAR, new_args); &exec_ctx, &client_channel_factory, target,
GRPC_CLIENT_CHANNEL_TYPE_REGULAR, new_args);
// Clean up. // Clean up.
grpc_channel_args_destroy(new_args); grpc_channel_args_destroy(&exec_ctx, new_args);
grpc_client_channel_factory_unref(&exec_ctx, factory);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
return channel != NULL ? channel : grpc_lame_client_channel_create( return channel != NULL ? channel : grpc_lame_client_channel_create(
target, GRPC_STATUS_INTERNAL, target, GRPC_STATUS_INTERNAL,

@ -74,7 +74,7 @@ grpc_channel *grpc_insecure_channel_create_from_fd(
GPR_ASSERT(transport); GPR_ASSERT(transport);
grpc_channel *channel = grpc_channel_create( grpc_channel *channel = grpc_channel_create(
&exec_ctx, target, final_args, GRPC_CLIENT_DIRECT_CHANNEL, transport); &exec_ctx, target, final_args, GRPC_CLIENT_DIRECT_CHANNEL, transport);
grpc_channel_args_destroy(final_args); grpc_channel_args_destroy(&exec_ctx, final_args);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);

@ -46,40 +46,16 @@
#include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/channel.h"
typedef struct {
grpc_client_channel_factory base;
gpr_refcount refs;
grpc_channel_security_connector *security_connector;
} client_channel_factory;
static void client_channel_factory_ref( static void client_channel_factory_ref(
grpc_client_channel_factory *cc_factory) { grpc_client_channel_factory *cc_factory) {}
client_channel_factory *f = (client_channel_factory *)cc_factory;
gpr_ref(&f->refs);
}
static void client_channel_factory_unref( static void client_channel_factory_unref(
grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory) { grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory) {}
client_channel_factory *f = (client_channel_factory *)cc_factory;
if (gpr_unref(&f->refs)) {
GRPC_SECURITY_CONNECTOR_UNREF(&f->security_connector->base,
"client_channel_factory");
gpr_free(f);
}
}
static void add_handshakers(grpc_exec_ctx *exec_ctx, void *security_connector,
grpc_handshake_manager *handshake_mgr) {
grpc_channel_security_connector_add_handshakers(exec_ctx, security_connector,
handshake_mgr);
}
static grpc_subchannel *client_channel_factory_create_subchannel( static grpc_subchannel *client_channel_factory_create_subchannel(
grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory, grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory,
const grpc_subchannel_args *args) { const grpc_subchannel_args *args) {
client_channel_factory *f = (client_channel_factory *)cc_factory; grpc_connector *connector = grpc_chttp2_connector_create();
grpc_connector *connector = grpc_chttp2_connector_create(
exec_ctx, add_handshakers, f->security_connector);
grpc_subchannel *s = grpc_subchannel_create(exec_ctx, connector, args); grpc_subchannel *s = grpc_subchannel_create(exec_ctx, connector, args);
grpc_connector_unref(exec_ctx, connector); grpc_connector_unref(exec_ctx, connector);
return s; return s;
@ -97,7 +73,7 @@ static grpc_channel *client_channel_factory_create_channel(
grpc_channel_args *new_args = grpc_channel_args_copy_and_add(args, &arg, 1); grpc_channel_args *new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
grpc_channel *channel = grpc_channel_create(exec_ctx, target, new_args, grpc_channel *channel = grpc_channel_create(exec_ctx, target, new_args,
GRPC_CLIENT_CHANNEL, NULL); GRPC_CLIENT_CHANNEL, NULL);
grpc_channel_args_destroy(new_args); grpc_channel_args_destroy(exec_ctx, new_args);
return channel; return channel;
} }
@ -106,6 +82,9 @@ static const grpc_client_channel_factory_vtable client_channel_factory_vtable =
client_channel_factory_create_subchannel, client_channel_factory_create_subchannel,
client_channel_factory_create_channel}; client_channel_factory_create_channel};
static grpc_client_channel_factory client_channel_factory = {
&client_channel_factory_vtable};
/* Create a secure client channel: /* Create a secure client channel:
Asynchronously: - resolve target Asynchronously: - resolve target
- connect to it (trying alternatives as presented) - connect to it (trying alternatives as presented)
@ -132,39 +111,32 @@ grpc_channel *grpc_secure_channel_create(grpc_channel_credentials *creds,
grpc_channel_security_connector *security_connector; grpc_channel_security_connector *security_connector;
grpc_channel_args *new_args_from_connector; grpc_channel_args *new_args_from_connector;
if (grpc_channel_credentials_create_security_connector( if (grpc_channel_credentials_create_security_connector(
creds, target, args, &security_connector, &new_args_from_connector) != &exec_ctx, creds, target, args, &security_connector,
GRPC_SECURITY_OK) { &new_args_from_connector) != GRPC_SECURITY_OK) {
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
return grpc_lame_client_channel_create( return grpc_lame_client_channel_create(
target, GRPC_STATUS_INTERNAL, "Failed to create security connector."); target, GRPC_STATUS_INTERNAL, "Failed to create security connector.");
} }
// Create client channel factory.
client_channel_factory *f = gpr_malloc(sizeof(*f));
memset(f, 0, sizeof(*f));
f->base.vtable = &client_channel_factory_vtable;
gpr_ref_init(&f->refs, 1);
GRPC_SECURITY_CONNECTOR_REF(&security_connector->base,
"grpc_secure_channel_create");
f->security_connector = security_connector;
// Add channel args containing the client channel factory and security // Add channel args containing the client channel factory and security
// connector. // connector.
grpc_arg new_args[2]; grpc_arg args_to_add[2];
new_args[0] = grpc_client_channel_factory_create_channel_arg(&f->base); args_to_add[0] =
new_args[1] = grpc_security_connector_to_arg(&security_connector->base); grpc_client_channel_factory_create_channel_arg(&client_channel_factory);
grpc_channel_args *args_copy = grpc_channel_args_copy_and_add( args_to_add[1] = grpc_security_connector_to_arg(&security_connector->base);
grpc_channel_args *new_args = grpc_channel_args_copy_and_add(
new_args_from_connector != NULL ? new_args_from_connector : args, new_args_from_connector != NULL ? new_args_from_connector : args,
new_args, GPR_ARRAY_SIZE(new_args)); args_to_add, GPR_ARRAY_SIZE(args_to_add));
if (new_args_from_connector != NULL) { if (new_args_from_connector != NULL) {
grpc_channel_args_destroy(new_args_from_connector); grpc_channel_args_destroy(&exec_ctx, new_args_from_connector);
} }
// Create channel. // Create channel.
grpc_channel *channel = client_channel_factory_create_channel( grpc_channel *channel = client_channel_factory_create_channel(
&exec_ctx, &f->base, target, GRPC_CLIENT_CHANNEL_TYPE_REGULAR, args_copy); &exec_ctx, &client_channel_factory, target,
GRPC_CLIENT_CHANNEL_TYPE_REGULAR, new_args);
// Clean up. // Clean up.
GRPC_SECURITY_CONNECTOR_UNREF(&f->security_connector->base, GRPC_SECURITY_CONNECTOR_UNREF(&exec_ctx, &security_connector->base,
"secure_client_channel_factory_create_channel"); "secure_client_channel_factory_create_channel");
grpc_channel_args_destroy(args_copy); grpc_channel_args_destroy(&exec_ctx, new_args);
grpc_client_channel_factory_unref(&exec_ctx, &f->base);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
return channel; /* may be NULL */ return channel; /* may be NULL */
} }

@ -46,31 +46,15 @@
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/handshaker.h" #include "src/core/lib/channel/handshaker.h"
#include "src/core/lib/channel/handshaker_registry.h"
#include "src/core/lib/channel/http_server_filter.h" #include "src/core/lib/channel/http_server_filter.h"
#include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/tcp_server.h" #include "src/core/lib/iomgr/tcp_server.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/server.h" #include "src/core/lib/surface/server.h"
void grpc_chttp2_server_handshaker_factory_add_handshakers(
grpc_exec_ctx *exec_ctx,
grpc_chttp2_server_handshaker_factory *handshaker_factory,
grpc_handshake_manager *handshake_mgr) {
if (handshaker_factory != NULL) {
handshaker_factory->vtable->add_handshakers(exec_ctx, handshaker_factory,
handshake_mgr);
}
}
void grpc_chttp2_server_handshaker_factory_destroy(
grpc_exec_ctx *exec_ctx,
grpc_chttp2_server_handshaker_factory *handshaker_factory) {
if (handshaker_factory != NULL) {
handshaker_factory->vtable->destroy(exec_ctx, handshaker_factory);
}
}
typedef struct pending_handshake_manager_node { typedef struct pending_handshake_manager_node {
grpc_handshake_manager *handshake_mgr; grpc_handshake_manager *handshake_mgr;
struct pending_handshake_manager_node *next; struct pending_handshake_manager_node *next;
@ -80,7 +64,6 @@ typedef struct {
grpc_server *server; grpc_server *server;
grpc_tcp_server *tcp_server; grpc_tcp_server *tcp_server;
grpc_channel_args *args; grpc_channel_args *args;
grpc_chttp2_server_handshaker_factory *handshaker_factory;
gpr_mu mu; gpr_mu mu;
bool shutdown; bool shutdown;
grpc_closure tcp_server_shutdown_complete; grpc_closure tcp_server_shutdown_complete;
@ -148,8 +131,8 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
// point this can be removed. // point this can be removed.
grpc_endpoint_shutdown(exec_ctx, args->endpoint); grpc_endpoint_shutdown(exec_ctx, args->endpoint);
grpc_endpoint_destroy(exec_ctx, args->endpoint); grpc_endpoint_destroy(exec_ctx, args->endpoint);
grpc_channel_args_destroy(args->args); grpc_channel_args_destroy(exec_ctx, args->args);
grpc_slice_buffer_destroy(args->read_buffer); grpc_slice_buffer_destroy_internal(exec_ctx, args->read_buffer);
gpr_free(args->read_buffer); gpr_free(args->read_buffer);
} }
} else { } else {
@ -164,7 +147,7 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
connection_state->accepting_pollset, args->args); connection_state->accepting_pollset, args->args);
grpc_chttp2_transport_start_reading(exec_ctx, transport, grpc_chttp2_transport_start_reading(exec_ctx, transport,
args->read_buffer); args->read_buffer);
grpc_channel_args_destroy(args->args); grpc_channel_args_destroy(exec_ctx, args->args);
} }
} }
pending_handshake_manager_remove_locked(connection_state->server_state, pending_handshake_manager_remove_locked(connection_state->server_state,
@ -197,8 +180,8 @@ static void on_accept(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
connection_state->accepting_pollset = accepting_pollset; connection_state->accepting_pollset = accepting_pollset;
connection_state->acceptor = acceptor; connection_state->acceptor = acceptor;
connection_state->handshake_mgr = handshake_mgr; connection_state->handshake_mgr = handshake_mgr;
grpc_chttp2_server_handshaker_factory_add_handshakers( grpc_handshakers_add(exec_ctx, HANDSHAKER_SERVER, state->args,
exec_ctx, state->handshaker_factory, connection_state->handshake_mgr); connection_state->handshake_mgr);
// TODO(roth): We should really get this timeout value from channel // TODO(roth): We should really get this timeout value from channel
// args instead of hard-coding it. // args instead of hard-coding it.
const gpr_timespec deadline = gpr_time_add( const gpr_timespec deadline = gpr_time_add(
@ -232,13 +215,11 @@ static void tcp_server_shutdown_complete(grpc_exec_ctx *exec_ctx, void *arg,
// Flush queued work before destroying handshaker factory, since that // Flush queued work before destroying handshaker factory, since that
// may do a synchronous unref. // may do a synchronous unref.
grpc_exec_ctx_flush(exec_ctx); grpc_exec_ctx_flush(exec_ctx);
grpc_chttp2_server_handshaker_factory_destroy(exec_ctx,
state->handshaker_factory);
if (destroy_done != NULL) { if (destroy_done != NULL) {
destroy_done->cb(exec_ctx, destroy_done->cb_arg, GRPC_ERROR_REF(error)); destroy_done->cb(exec_ctx, destroy_done->cb_arg, GRPC_ERROR_REF(error));
grpc_exec_ctx_flush(exec_ctx); grpc_exec_ctx_flush(exec_ctx);
} }
grpc_channel_args_destroy(state->args); grpc_channel_args_destroy(exec_ctx, state->args);
gpr_mu_destroy(&state->mu); gpr_mu_destroy(&state->mu);
gpr_free(state); gpr_free(state);
} }
@ -258,10 +239,10 @@ static void server_destroy_listener(grpc_exec_ctx *exec_ctx,
grpc_tcp_server_unref(exec_ctx, tcp_server); grpc_tcp_server_unref(exec_ctx, tcp_server);
} }
grpc_error *grpc_chttp2_server_add_port( grpc_error *grpc_chttp2_server_add_port(grpc_exec_ctx *exec_ctx,
grpc_exec_ctx *exec_ctx, grpc_server *server, const char *addr, grpc_server *server, const char *addr,
grpc_channel_args *args, grpc_channel_args *args,
grpc_chttp2_server_handshaker_factory *handshaker_factory, int *port_num) { int *port_num) {
grpc_resolved_addresses *resolved = NULL; grpc_resolved_addresses *resolved = NULL;
grpc_tcp_server *tcp_server = NULL; grpc_tcp_server *tcp_server = NULL;
size_t i; size_t i;
@ -292,7 +273,6 @@ grpc_error *grpc_chttp2_server_add_port(
state->server = server; state->server = server;
state->tcp_server = tcp_server; state->tcp_server = tcp_server;
state->args = args; state->args = args;
state->handshaker_factory = handshaker_factory;
state->shutdown = true; state->shutdown = true;
gpr_mu_init(&state->mu); gpr_mu_init(&state->mu);
@ -346,8 +326,7 @@ error:
if (tcp_server) { if (tcp_server) {
grpc_tcp_server_unref(exec_ctx, tcp_server); grpc_tcp_server_unref(exec_ctx, tcp_server);
} else { } else {
grpc_channel_args_destroy(args); grpc_channel_args_destroy(exec_ctx, args);
grpc_chttp2_server_handshaker_factory_destroy(exec_ctx, handshaker_factory);
gpr_free(state); gpr_free(state);
} }
*port_num = 0; *port_num = 0;

@ -36,43 +36,12 @@
#include <grpc/impl/codegen/grpc_types.h> #include <grpc/impl/codegen/grpc_types.h>
#include "src/core/lib/channel/handshaker.h"
#include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/exec_ctx.h"
/// A server handshaker factory is used to create handshakers for server
/// connections.
typedef struct grpc_chttp2_server_handshaker_factory
grpc_chttp2_server_handshaker_factory;
typedef struct {
void (*add_handshakers)(
grpc_exec_ctx *exec_ctx,
grpc_chttp2_server_handshaker_factory *handshaker_factory,
grpc_handshake_manager *handshake_mgr);
void (*destroy)(grpc_exec_ctx *exec_ctx,
grpc_chttp2_server_handshaker_factory *handshaker_factory);
} grpc_chttp2_server_handshaker_factory_vtable;
struct grpc_chttp2_server_handshaker_factory {
const grpc_chttp2_server_handshaker_factory_vtable *vtable;
};
void grpc_chttp2_server_handshaker_factory_add_handshakers(
grpc_exec_ctx *exec_ctx,
grpc_chttp2_server_handshaker_factory *handshaker_factory,
grpc_handshake_manager *handshake_mgr);
void grpc_chttp2_server_handshaker_factory_destroy(
grpc_exec_ctx *exec_ctx,
grpc_chttp2_server_handshaker_factory *handshaker_factory);
/// Adds a port to \a server. Sets \a port_num to the port number. /// Adds a port to \a server. Sets \a port_num to the port number.
/// If \a handshaker_factory is not NULL, it will be used to create /// Takes ownership of \a args.
/// handshakers for the port. grpc_error *grpc_chttp2_server_add_port(grpc_exec_ctx *exec_ctx,
/// Takes ownership of \a args and \a handshaker_factory. grpc_server *server, const char *addr,
grpc_error *grpc_chttp2_server_add_port( grpc_channel_args *args, int *port_num);
grpc_exec_ctx *exec_ctx, grpc_server *server, const char *addr,
grpc_channel_args *args,
grpc_chttp2_server_handshaker_factory *handshaker_factory, int *port_num);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H */

@ -47,8 +47,7 @@ int grpc_server_add_insecure_http2_port(grpc_server *server, const char *addr) {
(server, addr)); (server, addr));
grpc_error *err = grpc_chttp2_server_add_port( grpc_error *err = grpc_chttp2_server_add_port(
&exec_ctx, server, addr, &exec_ctx, server, addr,
grpc_channel_args_copy(grpc_server_get_channel_args(server)), grpc_channel_args_copy(grpc_server_get_channel_args(server)), &port_num);
NULL /* handshaker_factory */, &port_num);
if (err != GRPC_ERROR_NONE) { if (err != GRPC_ERROR_NONE) {
const char *msg = grpc_error_string(err); const char *msg = grpc_error_string(err);
gpr_log(GPR_ERROR, "%s", msg); gpr_log(GPR_ERROR, "%s", msg);

@ -62,7 +62,7 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server,
grpc_endpoint *server_endpoint = grpc_endpoint *server_endpoint =
grpc_tcp_create(grpc_fd_create(fd, name), resource_quota, grpc_tcp_create(grpc_fd_create(fd, name), resource_quota,
GRPC_TCP_DEFAULT_READ_SLICE_SIZE, name); GRPC_TCP_DEFAULT_READ_SLICE_SIZE, name);
grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); grpc_resource_quota_unref_internal(&exec_ctx, resource_quota);
gpr_free(name); gpr_free(name);

@ -49,34 +49,6 @@
#include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/server.h" #include "src/core/lib/surface/server.h"
typedef struct {
grpc_chttp2_server_handshaker_factory base;
grpc_server_security_connector *security_connector;
} server_security_handshaker_factory;
static void server_security_handshaker_factory_add_handshakers(
grpc_exec_ctx *exec_ctx, grpc_chttp2_server_handshaker_factory *hf,
grpc_handshake_manager *handshake_mgr) {
server_security_handshaker_factory *handshaker_factory =
(server_security_handshaker_factory *)hf;
grpc_server_security_connector_add_handshakers(
exec_ctx, handshaker_factory->security_connector, handshake_mgr);
}
static void server_security_handshaker_factory_destroy(
grpc_exec_ctx *exec_ctx, grpc_chttp2_server_handshaker_factory *hf) {
server_security_handshaker_factory *handshaker_factory =
(server_security_handshaker_factory *)hf;
GRPC_SECURITY_CONNECTOR_UNREF(&handshaker_factory->security_connector->base,
"server");
gpr_free(hf);
}
static const grpc_chttp2_server_handshaker_factory_vtable
server_security_handshaker_factory_vtable = {
server_security_handshaker_factory_add_handshakers,
server_security_handshaker_factory_destroy};
int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr, int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
grpc_server_credentials *creds) { grpc_server_credentials *creds) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
@ -94,7 +66,7 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
goto done; goto done;
} }
grpc_security_status status = grpc_security_status status =
grpc_server_credentials_create_security_connector(creds, &sc); grpc_server_credentials_create_security_connector(&exec_ctx, creds, &sc);
if (status != GRPC_SECURITY_OK) { if (status != GRPC_SECURITY_OK) {
char *msg; char *msg;
gpr_asprintf(&msg, gpr_asprintf(&msg,
@ -105,20 +77,19 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
gpr_free(msg); gpr_free(msg);
goto done; goto done;
} }
// Create handshaker factory.
server_security_handshaker_factory *handshaker_factory =
gpr_malloc(sizeof(*handshaker_factory));
memset(handshaker_factory, 0, sizeof(*handshaker_factory));
handshaker_factory->base.vtable = &server_security_handshaker_factory_vtable;
handshaker_factory->security_connector = sc;
// Create channel args. // Create channel args.
grpc_arg channel_arg = grpc_server_credentials_to_arg(creds); grpc_arg args_to_add[2];
grpc_channel_args *args = grpc_channel_args_copy_and_add( args_to_add[0] = grpc_server_credentials_to_arg(creds);
grpc_server_get_channel_args(server), &channel_arg, 1); args_to_add[1] = grpc_security_connector_to_arg(&sc->base);
grpc_channel_args *args =
grpc_channel_args_copy_and_add(grpc_server_get_channel_args(server),
args_to_add, GPR_ARRAY_SIZE(args_to_add));
// Add server port. // Add server port.
err = grpc_chttp2_server_add_port(&exec_ctx, server, addr, args, err = grpc_chttp2_server_add_port(&exec_ctx, server, addr, args, &port_num);
&handshaker_factory->base, &port_num);
done: done:
if (sc != NULL) {
GRPC_SECURITY_CONNECTOR_UNREF(&exec_ctx, &sc->base, "server");
}
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
if (err != GRPC_ERROR_NONE) { if (err != GRPC_ERROR_NONE) {
const char *msg = grpc_error_string(err); const char *msg = grpc_error_string(err);

@ -34,6 +34,7 @@
#include "src/core/ext/transport/chttp2/transport/bin_decoder.h" #include "src/core/ext/transport/chttp2/transport/bin_decoder.h"
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h" #include "src/core/lib/support/string.h"
@ -143,7 +144,8 @@ bool grpc_base64_decode_partial(struct grpc_base64_decode_context *ctx) {
return true; return true;
} }
grpc_slice grpc_chttp2_base64_decode(grpc_slice input) { grpc_slice grpc_chttp2_base64_decode(grpc_exec_ctx *exec_ctx,
grpc_slice input) {
size_t input_length = GRPC_SLICE_LENGTH(input); size_t input_length = GRPC_SLICE_LENGTH(input);
size_t output_length = input_length / 4 * 3; size_t output_length = input_length / 4 * 3;
struct grpc_base64_decode_context ctx; struct grpc_base64_decode_context ctx;
@ -179,7 +181,7 @@ grpc_slice grpc_chttp2_base64_decode(grpc_slice input) {
char *s = grpc_dump_slice(input, GPR_DUMP_ASCII); char *s = grpc_dump_slice(input, GPR_DUMP_ASCII);
gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s); gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s);
gpr_free(s); gpr_free(s);
grpc_slice_unref(output); grpc_slice_unref_internal(exec_ctx, output);
return gpr_empty_slice(); return gpr_empty_slice();
} }
GPR_ASSERT(ctx.output_cur == GRPC_SLICE_END_PTR(output)); GPR_ASSERT(ctx.output_cur == GRPC_SLICE_END_PTR(output));
@ -187,7 +189,8 @@ grpc_slice grpc_chttp2_base64_decode(grpc_slice input) {
return output; return output;
} }
grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input, grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx *exec_ctx,
grpc_slice input,
size_t output_length) { size_t output_length) {
size_t input_length = GRPC_SLICE_LENGTH(input); size_t input_length = GRPC_SLICE_LENGTH(input);
grpc_slice output = grpc_slice_malloc(output_length); grpc_slice output = grpc_slice_malloc(output_length);
@ -200,7 +203,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
"grpc_chttp2_base64_decode_with_length has a length of %d, which " "grpc_chttp2_base64_decode_with_length has a length of %d, which "
"has a tail of 1 byte.\n", "has a tail of 1 byte.\n",
(int)input_length); (int)input_length);
grpc_slice_unref(output); grpc_slice_unref_internal(exec_ctx, output);
return gpr_empty_slice(); return gpr_empty_slice();
} }
@ -210,7 +213,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
"than the max possible output length %d.\n", "than the max possible output length %d.\n",
(int)output_length, (int)output_length,
(int)(input_length / 4 * 3 + tail_xtra[input_length % 4])); (int)(input_length / 4 * 3 + tail_xtra[input_length % 4]));
grpc_slice_unref(output); grpc_slice_unref_internal(exec_ctx, output);
return gpr_empty_slice(); return gpr_empty_slice();
} }
@ -224,7 +227,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
char *s = grpc_dump_slice(input, GPR_DUMP_ASCII); char *s = grpc_dump_slice(input, GPR_DUMP_ASCII);
gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s); gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s);
gpr_free(s); gpr_free(s);
grpc_slice_unref(output); grpc_slice_unref_internal(exec_ctx, output);
return gpr_empty_slice(); return gpr_empty_slice();
} }
GPR_ASSERT(ctx.output_cur == GRPC_SLICE_END_PTR(output)); GPR_ASSERT(ctx.output_cur == GRPC_SLICE_END_PTR(output));

@ -55,12 +55,13 @@ bool grpc_base64_decode_partial(struct grpc_base64_decode_context *ctx);
/* base64 decode a slice with pad chars. Returns a new slice, does not take /* base64 decode a slice with pad chars. Returns a new slice, does not take
ownership of the input. Returns an empty slice if decoding is failed. */ ownership of the input. Returns an empty slice if decoding is failed. */
grpc_slice grpc_chttp2_base64_decode(grpc_slice input); grpc_slice grpc_chttp2_base64_decode(grpc_exec_ctx *exec_ctx, grpc_slice input);
/* base64 decode a slice without pad chars, data length is needed. Returns a new /* base64 decode a slice without pad chars, data length is needed. Returns a new
slice, does not take ownership of the input. Returns an empty slice if slice, does not take ownership of the input. Returns an empty slice if
decoding is failed. */ decoding is failed. */
grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input, grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx *exec_ctx,
grpc_slice input,
size_t output_length); size_t output_length);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */

@ -47,7 +47,7 @@ grpc_slice grpc_chttp2_huffman_compress(grpc_slice input);
/* equivalent to: /* equivalent to:
grpc_slice x = grpc_chttp2_base64_encode(input); grpc_slice x = grpc_chttp2_base64_encode(input);
grpc_slice y = grpc_chttp2_huffman_compress(x); grpc_slice y = grpc_chttp2_huffman_compress(x);
grpc_slice_unref(x); grpc_slice_unref_internal(exec_ctx, x);
return y; */ return y; */
grpc_slice grpc_chttp2_base64_encode_and_huffman_compress_impl( grpc_slice grpc_chttp2_base64_encode_and_huffman_compress_impl(
grpc_slice input); grpc_slice input);

@ -47,10 +47,12 @@
#include "src/core/ext/transport/chttp2/transport/http2_errors.h" #include "src/core/ext/transport/chttp2/transport/http2_errors.h"
#include "src/core/ext/transport/chttp2/transport/internal.h" #include "src/core/ext/transport/chttp2/transport/internal.h"
#include "src/core/ext/transport/chttp2/transport/status_conversion.h" #include "src/core/ext/transport/chttp2/transport/status_conversion.h"
#include "src/core/ext/transport/chttp2/transport/varint.h"
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/http/parser.h" #include "src/core/lib/http/parser.h"
#include "src/core/lib/iomgr/workqueue.h" #include "src/core/lib/iomgr/workqueue.h"
#include "src/core/lib/profiling/timers.h" #include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h" #include "src/core/lib/support/string.h"
#include "src/core/lib/transport/static_metadata.h" #include "src/core/lib/transport/static_metadata.h"
@ -131,13 +133,13 @@ static void destruct_transport(grpc_exec_ctx *exec_ctx,
grpc_endpoint_destroy(exec_ctx, t->ep); grpc_endpoint_destroy(exec_ctx, t->ep);
grpc_slice_buffer_destroy(&t->qbuf); grpc_slice_buffer_destroy_internal(exec_ctx, &t->qbuf);
grpc_slice_buffer_destroy(&t->outbuf); grpc_slice_buffer_destroy_internal(exec_ctx, &t->outbuf);
grpc_chttp2_hpack_compressor_destroy(&t->hpack_compressor); grpc_chttp2_hpack_compressor_destroy(exec_ctx, &t->hpack_compressor);
grpc_slice_buffer_destroy(&t->read_buffer); grpc_slice_buffer_destroy_internal(exec_ctx, &t->read_buffer);
grpc_chttp2_hpack_parser_destroy(&t->hpack_parser); grpc_chttp2_hpack_parser_destroy(exec_ctx, &t->hpack_parser);
grpc_chttp2_goaway_parser_destroy(&t->goaway_parser); grpc_chttp2_goaway_parser_destroy(&t->goaway_parser);
for (i = 0; i < STREAM_LIST_COUNT; i++) { for (i = 0; i < STREAM_LIST_COUNT; i++) {
@ -247,7 +249,7 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
grpc_combiner_scheduler(t->combiner, false)); grpc_combiner_scheduler(t->combiner, false));
grpc_chttp2_goaway_parser_init(&t->goaway_parser); grpc_chttp2_goaway_parser_init(&t->goaway_parser);
grpc_chttp2_hpack_parser_init(&t->hpack_parser); grpc_chttp2_hpack_parser_init(exec_ctx, &t->hpack_parser);
grpc_slice_buffer_init(&t->read_buffer); grpc_slice_buffer_init(&t->read_buffer);
@ -515,9 +517,11 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp,
GPR_ASSERT(s->recv_message_ready == NULL); GPR_ASSERT(s->recv_message_ready == NULL);
GPR_ASSERT(s->recv_trailing_metadata_finished == NULL); GPR_ASSERT(s->recv_trailing_metadata_finished == NULL);
grpc_chttp2_data_parser_destroy(exec_ctx, &s->data_parser); grpc_chttp2_data_parser_destroy(exec_ctx, &s->data_parser);
grpc_chttp2_incoming_metadata_buffer_destroy(&s->metadata_buffer[0]); grpc_chttp2_incoming_metadata_buffer_destroy(exec_ctx,
grpc_chttp2_incoming_metadata_buffer_destroy(&s->metadata_buffer[1]); &s->metadata_buffer[0]);
grpc_slice_buffer_destroy(&s->flow_controlled_buffer); grpc_chttp2_incoming_metadata_buffer_destroy(exec_ctx,
&s->metadata_buffer[1]);
grpc_slice_buffer_destroy_internal(exec_ctx, &s->flow_controlled_buffer);
GRPC_ERROR_UNREF(s->read_closed_error); GRPC_ERROR_UNREF(s->read_closed_error);
GRPC_ERROR_UNREF(s->write_closed_error); GRPC_ERROR_UNREF(s->write_closed_error);
@ -752,7 +756,7 @@ void grpc_chttp2_add_incoming_goaway(grpc_exec_ctx *exec_ctx,
char *msg = grpc_dump_slice(goaway_text, GPR_DUMP_HEX | GPR_DUMP_ASCII); char *msg = grpc_dump_slice(goaway_text, GPR_DUMP_HEX | GPR_DUMP_ASCII);
GRPC_CHTTP2_IF_TRACING( GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_DEBUG, "got goaway [%d]: %s", goaway_error, msg)); gpr_log(GPR_DEBUG, "got goaway [%d]: %s", goaway_error, msg));
grpc_slice_unref(goaway_text); grpc_slice_unref_internal(exec_ctx, goaway_text);
t->seen_goaway = 1; t->seen_goaway = 1;
/* lie: use transient failure from the transport to indicate goaway has been /* lie: use transient failure from the transport to indicate goaway has been
* received */ * received */
@ -1271,7 +1275,7 @@ static void perform_transport_op_locked(grpc_exec_ctx *exec_ctx,
if (op->send_goaway) { if (op->send_goaway) {
send_goaway(exec_ctx, t, send_goaway(exec_ctx, t,
grpc_chttp2_grpc_status_to_http2_error(op->goaway_status), grpc_chttp2_grpc_status_to_http2_error(op->goaway_status),
grpc_slice_ref(*op->goaway_message)); grpc_slice_ref_internal(*op->goaway_message));
} }
if (op->set_accept_stream) { if (op->set_accept_stream) {
@ -1502,21 +1506,22 @@ void grpc_chttp2_fake_status(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
char status_string[GPR_LTOA_MIN_BUFSIZE]; char status_string[GPR_LTOA_MIN_BUFSIZE];
gpr_ltoa(status, status_string); gpr_ltoa(status, status_string);
grpc_chttp2_incoming_metadata_buffer_add( grpc_chttp2_incoming_metadata_buffer_add(
&s->metadata_buffer[1], &s->metadata_buffer[1], grpc_mdelem_from_metadata_strings(
grpc_mdelem_from_metadata_strings( exec_ctx, GRPC_MDSTR_GRPC_STATUS,
GRPC_MDSTR_GRPC_STATUS, grpc_mdstr_from_string(status_string))); grpc_mdstr_from_string(status_string)));
if (slice) { if (slice) {
grpc_chttp2_incoming_metadata_buffer_add( grpc_chttp2_incoming_metadata_buffer_add(
&s->metadata_buffer[1], &s->metadata_buffer[1],
grpc_mdelem_from_metadata_strings( grpc_mdelem_from_metadata_strings(
GRPC_MDSTR_GRPC_MESSAGE, exec_ctx, GRPC_MDSTR_GRPC_MESSAGE,
grpc_mdstr_from_slice(grpc_slice_ref(*slice)))); grpc_mdstr_from_slice(exec_ctx,
grpc_slice_ref_internal(*slice))));
} }
s->published_metadata[1] = GRPC_METADATA_SYNTHESIZED_FROM_FAKE; s->published_metadata[1] = GRPC_METADATA_SYNTHESIZED_FROM_FAKE;
grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s);
} }
if (slice) { if (slice) {
grpc_slice_unref(*slice); grpc_slice_unref_internal(exec_ctx, *slice);
} }
} }
@ -1672,8 +1677,9 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
if (optional_message != NULL) { if (optional_message != NULL) {
size_t msg_len = strlen(optional_message); size_t msg_len = strlen(optional_message);
GPR_ASSERT(msg_len < 127); GPR_ASSERT(msg_len <= UINT32_MAX);
message_pfx = grpc_slice_malloc(15); uint32_t msg_len_len = GRPC_CHTTP2_VARINT_LENGTH((uint32_t)msg_len, 0);
message_pfx = grpc_slice_malloc(14 + msg_len_len);
p = GRPC_SLICE_START_PTR(message_pfx); p = GRPC_SLICE_START_PTR(message_pfx);
*p++ = 0x40; *p++ = 0x40;
*p++ = 12; /* len(grpc-message) */ *p++ = 12; /* len(grpc-message) */
@ -1689,7 +1695,9 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
*p++ = 'a'; *p++ = 'a';
*p++ = 'g'; *p++ = 'g';
*p++ = 'e'; *p++ = 'e';
*p++ = (uint8_t)msg_len; GRPC_CHTTP2_WRITE_VARINT((uint32_t)msg_len, 0, 0, p,
(uint32_t)msg_len_len);
p += msg_len_len;
GPR_ASSERT(p == GRPC_SLICE_END_PTR(message_pfx)); GPR_ASSERT(p == GRPC_SLICE_END_PTR(message_pfx));
len += (uint32_t)GRPC_SLICE_LENGTH(message_pfx); len += (uint32_t)GRPC_SLICE_LENGTH(message_pfx);
len += (uint32_t)msg_len; len += (uint32_t)msg_len;
@ -1884,7 +1892,7 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp,
keep_reading = true; keep_reading = true;
GRPC_CHTTP2_REF_TRANSPORT(t, "keep_reading"); GRPC_CHTTP2_REF_TRANSPORT(t, "keep_reading");
} }
grpc_slice_buffer_reset_and_unref(&t->read_buffer); grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &t->read_buffer);
if (keep_reading) { if (keep_reading) {
grpc_endpoint_read(exec_ctx, t->ep, &t->read_buffer, grpc_endpoint_read(exec_ctx, t->ep, &t->read_buffer,
@ -1939,7 +1947,7 @@ static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx,
grpc_chttp2_incoming_byte_stream *bs) { grpc_chttp2_incoming_byte_stream *bs) {
if (gpr_unref(&bs->refs)) { if (gpr_unref(&bs->refs)) {
GRPC_ERROR_UNREF(bs->error); GRPC_ERROR_UNREF(bs->error);
grpc_slice_buffer_destroy(&bs->slices); grpc_slice_buffer_destroy_internal(exec_ctx, &bs->slices);
gpr_mu_destroy(&bs->slice_mu); gpr_mu_destroy(&bs->slice_mu);
gpr_free(bs); gpr_free(bs);
} }

@ -109,7 +109,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[2]) << 8) |
(((uint32_t)p->reason_bytes[3])); (((uint32_t)p->reason_bytes[3]));
grpc_error *error = GRPC_ERROR_NONE; grpc_error *error = GRPC_ERROR_NONE;
if (reason != GRPC_CHTTP2_NO_ERROR) { if (reason != GRPC_CHTTP2_NO_ERROR || s->header_frames_received < 2) {
error = grpc_error_set_int(GRPC_ERROR_CREATE("RST_STREAM"), error = grpc_error_set_int(GRPC_ERROR_CREATE("RST_STREAM"),
GRPC_ERROR_INT_HTTP2_ERROR, (intptr_t)reason); GRPC_ERROR_INT_HTTP2_ERROR, (intptr_t)reason);
grpc_status_code status_code = grpc_chttp2_http2_error_to_grpc_status( grpc_status_code status_code = grpc_chttp2_http2_error_to_grpc_status(

@ -48,6 +48,7 @@
#include "src/core/ext/transport/chttp2/transport/bin_encoder.h" #include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
#include "src/core/ext/transport/chttp2/transport/hpack_table.h" #include "src/core/ext/transport/chttp2/transport/hpack_table.h"
#include "src/core/ext/transport/chttp2/transport/varint.h" #include "src/core/ext/transport/chttp2/transport/varint.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata.h" #include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/static_metadata.h" #include "src/core/lib/transport/static_metadata.h"
#include "src/core/lib/transport/timeout_encoding.h" #include "src/core/lib/transport/timeout_encoding.h"
@ -183,7 +184,8 @@ static void evict_entry(grpc_chttp2_hpack_compressor *c) {
} }
/* add an element to the decoder table */ /* add an element to the decoder table */
static void add_elem(grpc_chttp2_hpack_compressor *c, grpc_mdelem *elem) { static void add_elem(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_compressor *c,
grpc_mdelem *elem) {
uint32_t key_hash = elem->key->hash; uint32_t key_hash = elem->key->hash;
uint32_t elem_hash = GRPC_MDSTR_KV_HASH(key_hash, elem->value->hash); uint32_t elem_hash = GRPC_MDSTR_KV_HASH(key_hash, elem->value->hash);
uint32_t new_index = c->tail_remote_index + c->table_elems + 1; uint32_t new_index = c->tail_remote_index + c->table_elems + 1;
@ -227,12 +229,12 @@ static void add_elem(grpc_chttp2_hpack_compressor *c, grpc_mdelem *elem) {
} else if (c->indices_elems[HASH_FRAGMENT_2(elem_hash)] < } else if (c->indices_elems[HASH_FRAGMENT_2(elem_hash)] <
c->indices_elems[HASH_FRAGMENT_3(elem_hash)]) { c->indices_elems[HASH_FRAGMENT_3(elem_hash)]) {
/* not there: replace oldest */ /* not there: replace oldest */
GRPC_MDELEM_UNREF(c->entries_elems[HASH_FRAGMENT_2(elem_hash)]); GRPC_MDELEM_UNREF(exec_ctx, c->entries_elems[HASH_FRAGMENT_2(elem_hash)]);
c->entries_elems[HASH_FRAGMENT_2(elem_hash)] = GRPC_MDELEM_REF(elem); c->entries_elems[HASH_FRAGMENT_2(elem_hash)] = GRPC_MDELEM_REF(elem);
c->indices_elems[HASH_FRAGMENT_2(elem_hash)] = new_index; c->indices_elems[HASH_FRAGMENT_2(elem_hash)] = new_index;
} else { } else {
/* not there: replace oldest */ /* not there: replace oldest */
GRPC_MDELEM_UNREF(c->entries_elems[HASH_FRAGMENT_3(elem_hash)]); GRPC_MDELEM_UNREF(exec_ctx, c->entries_elems[HASH_FRAGMENT_3(elem_hash)]);
c->entries_elems[HASH_FRAGMENT_3(elem_hash)] = GRPC_MDELEM_REF(elem); c->entries_elems[HASH_FRAGMENT_3(elem_hash)] = GRPC_MDELEM_REF(elem);
c->indices_elems[HASH_FRAGMENT_3(elem_hash)] = new_index; c->indices_elems[HASH_FRAGMENT_3(elem_hash)] = new_index;
} }
@ -251,11 +253,11 @@ static void add_elem(grpc_chttp2_hpack_compressor *c, grpc_mdelem *elem) {
c->indices_keys[HASH_FRAGMENT_3(key_hash)] = new_index; c->indices_keys[HASH_FRAGMENT_3(key_hash)] = new_index;
} else if (c->indices_keys[HASH_FRAGMENT_2(key_hash)] < } else if (c->indices_keys[HASH_FRAGMENT_2(key_hash)] <
c->indices_keys[HASH_FRAGMENT_3(key_hash)]) { c->indices_keys[HASH_FRAGMENT_3(key_hash)]) {
GRPC_MDSTR_UNREF(c->entries_keys[HASH_FRAGMENT_2(key_hash)]); GRPC_MDSTR_UNREF(exec_ctx, c->entries_keys[HASH_FRAGMENT_2(key_hash)]);
c->entries_keys[HASH_FRAGMENT_2(key_hash)] = GRPC_MDSTR_REF(elem->key); c->entries_keys[HASH_FRAGMENT_2(key_hash)] = GRPC_MDSTR_REF(elem->key);
c->indices_keys[HASH_FRAGMENT_2(key_hash)] = new_index; c->indices_keys[HASH_FRAGMENT_2(key_hash)] = new_index;
} else { } else {
GRPC_MDSTR_UNREF(c->entries_keys[HASH_FRAGMENT_3(key_hash)]); GRPC_MDSTR_UNREF(exec_ctx, c->entries_keys[HASH_FRAGMENT_3(key_hash)]);
c->entries_keys[HASH_FRAGMENT_3(key_hash)] = GRPC_MDSTR_REF(elem->key); c->entries_keys[HASH_FRAGMENT_3(key_hash)] = GRPC_MDSTR_REF(elem->key);
c->indices_keys[HASH_FRAGMENT_3(key_hash)] = new_index; c->indices_keys[HASH_FRAGMENT_3(key_hash)] = new_index;
} }
@ -294,7 +296,7 @@ static void emit_lithdr_incidx(grpc_chttp2_hpack_compressor *c,
add_tiny_header_data(st, len_pfx), len_pfx); add_tiny_header_data(st, len_pfx), len_pfx);
GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, huffman_prefix, GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, huffman_prefix,
add_tiny_header_data(st, len_val_len), len_val_len); add_tiny_header_data(st, len_val_len), len_val_len);
add_header_data(st, grpc_slice_ref(value_slice)); add_header_data(st, grpc_slice_ref_internal(value_slice));
} }
static void emit_lithdr_noidx(grpc_chttp2_hpack_compressor *c, static void emit_lithdr_noidx(grpc_chttp2_hpack_compressor *c,
@ -311,7 +313,7 @@ static void emit_lithdr_noidx(grpc_chttp2_hpack_compressor *c,
add_tiny_header_data(st, len_pfx), len_pfx); add_tiny_header_data(st, len_pfx), len_pfx);
GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, huffman_prefix, GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, huffman_prefix,
add_tiny_header_data(st, len_val_len), len_val_len); add_tiny_header_data(st, len_val_len), len_val_len);
add_header_data(st, grpc_slice_ref(value_slice)); add_header_data(st, grpc_slice_ref_internal(value_slice));
} }
static void emit_lithdr_incidx_v(grpc_chttp2_hpack_compressor *c, static void emit_lithdr_incidx_v(grpc_chttp2_hpack_compressor *c,
@ -327,10 +329,10 @@ static void emit_lithdr_incidx_v(grpc_chttp2_hpack_compressor *c,
*add_tiny_header_data(st, 1) = 0x40; *add_tiny_header_data(st, 1) = 0x40;
GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00, GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00,
add_tiny_header_data(st, len_key_len), len_key_len); add_tiny_header_data(st, len_key_len), len_key_len);
add_header_data(st, grpc_slice_ref(elem->key->slice)); add_header_data(st, grpc_slice_ref_internal(elem->key->slice));
GRPC_CHTTP2_WRITE_VARINT(len_val, 1, huffman_prefix, GRPC_CHTTP2_WRITE_VARINT(len_val, 1, huffman_prefix,
add_tiny_header_data(st, len_val_len), len_val_len); add_tiny_header_data(st, len_val_len), len_val_len);
add_header_data(st, grpc_slice_ref(value_slice)); add_header_data(st, grpc_slice_ref_internal(value_slice));
} }
static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor *c, static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor *c,
@ -346,10 +348,10 @@ static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor *c,
*add_tiny_header_data(st, 1) = 0x00; *add_tiny_header_data(st, 1) = 0x00;
GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00, GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00,
add_tiny_header_data(st, len_key_len), len_key_len); add_tiny_header_data(st, len_key_len), len_key_len);
add_header_data(st, grpc_slice_ref(elem->key->slice)); add_header_data(st, grpc_slice_ref_internal(elem->key->slice));
GRPC_CHTTP2_WRITE_VARINT(len_val, 1, huffman_prefix, GRPC_CHTTP2_WRITE_VARINT(len_val, 1, huffman_prefix,
add_tiny_header_data(st, len_val_len), len_val_len); add_tiny_header_data(st, len_val_len), len_val_len);
add_header_data(st, grpc_slice_ref(value_slice)); add_header_data(st, grpc_slice_ref_internal(value_slice));
} }
static void emit_advertise_table_size_change(grpc_chttp2_hpack_compressor *c, static void emit_advertise_table_size_change(grpc_chttp2_hpack_compressor *c,
@ -366,8 +368,8 @@ static uint32_t dynidx(grpc_chttp2_hpack_compressor *c, uint32_t elem_index) {
} }
/* encode an mdelem */ /* encode an mdelem */
static void hpack_enc(grpc_chttp2_hpack_compressor *c, grpc_mdelem *elem, static void hpack_enc(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_compressor *c,
framer_state *st) { grpc_mdelem *elem, framer_state *st) {
uint32_t key_hash = elem->key->hash; uint32_t key_hash = elem->key->hash;
uint32_t elem_hash = GRPC_MDSTR_KV_HASH(key_hash, elem->value->hash); uint32_t elem_hash = GRPC_MDSTR_KV_HASH(key_hash, elem->value->hash);
size_t decoder_space_usage; size_t decoder_space_usage;
@ -417,7 +419,7 @@ static void hpack_enc(grpc_chttp2_hpack_compressor *c, grpc_mdelem *elem,
/* HIT: key (first cuckoo hash) */ /* HIT: key (first cuckoo hash) */
if (should_add_elem) { if (should_add_elem) {
emit_lithdr_incidx(c, dynidx(c, indices_key), elem, st); emit_lithdr_incidx(c, dynidx(c, indices_key), elem, st);
add_elem(c, elem); add_elem(exec_ctx, c, elem);
return; return;
} else { } else {
emit_lithdr_noidx(c, dynidx(c, indices_key), elem, st); emit_lithdr_noidx(c, dynidx(c, indices_key), elem, st);
@ -432,7 +434,7 @@ static void hpack_enc(grpc_chttp2_hpack_compressor *c, grpc_mdelem *elem,
/* HIT: key (first cuckoo hash) */ /* HIT: key (first cuckoo hash) */
if (should_add_elem) { if (should_add_elem) {
emit_lithdr_incidx(c, dynidx(c, indices_key), elem, st); emit_lithdr_incidx(c, dynidx(c, indices_key), elem, st);
add_elem(c, elem); add_elem(exec_ctx, c, elem);
return; return;
} else { } else {
emit_lithdr_noidx(c, dynidx(c, indices_key), elem, st); emit_lithdr_noidx(c, dynidx(c, indices_key), elem, st);
@ -445,7 +447,7 @@ static void hpack_enc(grpc_chttp2_hpack_compressor *c, grpc_mdelem *elem,
if (should_add_elem) { if (should_add_elem) {
emit_lithdr_incidx_v(c, elem, st); emit_lithdr_incidx_v(c, elem, st);
add_elem(c, elem); add_elem(exec_ctx, c, elem);
return; return;
} else { } else {
emit_lithdr_noidx_v(c, elem, st); emit_lithdr_noidx_v(c, elem, st);
@ -457,16 +459,17 @@ static void hpack_enc(grpc_chttp2_hpack_compressor *c, grpc_mdelem *elem,
#define STRLEN_LIT(x) (sizeof(x) - 1) #define STRLEN_LIT(x) (sizeof(x) - 1)
#define TIMEOUT_KEY "grpc-timeout" #define TIMEOUT_KEY "grpc-timeout"
static void deadline_enc(grpc_chttp2_hpack_compressor *c, gpr_timespec deadline, static void deadline_enc(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hpack_compressor *c, gpr_timespec deadline,
framer_state *st) { framer_state *st) {
char timeout_str[GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE]; char timeout_str[GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE];
grpc_mdelem *mdelem; grpc_mdelem *mdelem;
grpc_http2_encode_timeout( grpc_http2_encode_timeout(
gpr_time_sub(deadline, gpr_now(deadline.clock_type)), timeout_str); gpr_time_sub(deadline, gpr_now(deadline.clock_type)), timeout_str);
mdelem = grpc_mdelem_from_metadata_strings( mdelem = grpc_mdelem_from_metadata_strings(
GRPC_MDSTR_GRPC_TIMEOUT, grpc_mdstr_from_string(timeout_str)); exec_ctx, GRPC_MDSTR_GRPC_TIMEOUT, grpc_mdstr_from_string(timeout_str));
hpack_enc(c, mdelem, st); hpack_enc(exec_ctx, c, mdelem, st);
GRPC_MDELEM_UNREF(mdelem); GRPC_MDELEM_UNREF(exec_ctx, mdelem);
} }
static uint32_t elems_for_bytes(uint32_t bytes) { return (bytes + 31) / 32; } static uint32_t elems_for_bytes(uint32_t bytes) { return (bytes + 31) / 32; }
@ -483,11 +486,12 @@ void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor *c) {
sizeof(*c->table_elem_size) * c->cap_table_elems); sizeof(*c->table_elem_size) * c->cap_table_elems);
} }
void grpc_chttp2_hpack_compressor_destroy(grpc_chttp2_hpack_compressor *c) { void grpc_chttp2_hpack_compressor_destroy(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hpack_compressor *c) {
int i; int i;
for (i = 0; i < GRPC_CHTTP2_HPACKC_NUM_VALUES; i++) { for (i = 0; i < GRPC_CHTTP2_HPACKC_NUM_VALUES; i++) {
if (c->entries_keys[i]) GRPC_MDSTR_UNREF(c->entries_keys[i]); if (c->entries_keys[i]) GRPC_MDSTR_UNREF(exec_ctx, c->entries_keys[i]);
if (c->entries_elems[i]) GRPC_MDELEM_UNREF(c->entries_elems[i]); if (c->entries_elems[i]) GRPC_MDELEM_UNREF(exec_ctx, c->entries_elems[i]);
} }
gpr_free(c->table_elem_size); gpr_free(c->table_elem_size);
} }
@ -542,7 +546,8 @@ void grpc_chttp2_hpack_compressor_set_max_table_size(
} }
} }
void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor *c, void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hpack_compressor *c,
uint32_t stream_id, uint32_t stream_id,
grpc_metadata_batch *metadata, int is_eof, grpc_metadata_batch *metadata, int is_eof,
size_t max_frame_size, size_t max_frame_size,
@ -571,11 +576,11 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor *c,
} }
grpc_metadata_batch_assert_ok(metadata); grpc_metadata_batch_assert_ok(metadata);
for (l = metadata->list.head; l; l = l->next) { for (l = metadata->list.head; l; l = l->next) {
hpack_enc(c, l->md, &st); hpack_enc(exec_ctx, c, l->md, &st);
} }
deadline = metadata->deadline; deadline = metadata->deadline;
if (gpr_time_cmp(deadline, gpr_inf_future(deadline.clock_type)) != 0) { if (gpr_time_cmp(deadline, gpr_inf_future(deadline.clock_type)) != 0) {
deadline_enc(c, deadline, &st); deadline_enc(exec_ctx, c, deadline, &st);
} }
finish_frame(&st, 1, is_eof); finish_frame(&st, 1, is_eof);

@ -83,13 +83,15 @@ typedef struct {
} grpc_chttp2_hpack_compressor; } grpc_chttp2_hpack_compressor;
void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor *c); void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor *c);
void grpc_chttp2_hpack_compressor_destroy(grpc_chttp2_hpack_compressor *c); void grpc_chttp2_hpack_compressor_destroy(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hpack_compressor *c);
void grpc_chttp2_hpack_compressor_set_max_table_size( void grpc_chttp2_hpack_compressor_set_max_table_size(
grpc_chttp2_hpack_compressor *c, uint32_t max_table_size); grpc_chttp2_hpack_compressor *c, uint32_t max_table_size);
void grpc_chttp2_hpack_compressor_set_max_usable_size( void grpc_chttp2_hpack_compressor_set_max_usable_size(
grpc_chttp2_hpack_compressor *c, uint32_t max_table_size); grpc_chttp2_hpack_compressor *c, uint32_t max_table_size);
void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor *c, uint32_t id, void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hpack_compressor *c, uint32_t id,
grpc_metadata_batch *metadata, int is_eof, grpc_metadata_batch *metadata, int is_eof,
size_t max_frame_size, size_t max_frame_size,
grpc_transport_one_way_stats *stats, grpc_transport_one_way_stats *stats,

@ -670,11 +670,11 @@ static const uint8_t inverse_base64[256] = {
static grpc_error *on_hdr(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_parser *p, static grpc_error *on_hdr(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_parser *p,
grpc_mdelem *md, int add_to_table) { grpc_mdelem *md, int add_to_table) {
if (add_to_table) { if (add_to_table) {
grpc_error *err = grpc_chttp2_hptbl_add(&p->table, md); grpc_error *err = grpc_chttp2_hptbl_add(exec_ctx, &p->table, md);
if (err != GRPC_ERROR_NONE) return err; if (err != GRPC_ERROR_NONE) return err;
} }
if (p->on_header == NULL) { if (p->on_header == NULL) {
GRPC_MDELEM_UNREF(md); GRPC_MDELEM_UNREF(exec_ctx, md);
return GRPC_ERROR_CREATE("on_header callback not set"); return GRPC_ERROR_CREATE("on_header callback not set");
} }
p->on_header(exec_ctx, p->on_header_user_data, md); p->on_header(exec_ctx, p->on_header_user_data, md);
@ -815,10 +815,10 @@ static grpc_error *finish_lithdr_incidx(grpc_exec_ctx *exec_ctx,
const uint8_t *end) { const uint8_t *end) {
grpc_mdelem *md = grpc_chttp2_hptbl_lookup(&p->table, p->index); grpc_mdelem *md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
GPR_ASSERT(md != NULL); /* handled in string parsing */ GPR_ASSERT(md != NULL); /* handled in string parsing */
grpc_error *err = on_hdr( grpc_error *err = on_hdr(exec_ctx, p, grpc_mdelem_from_metadata_strings(
exec_ctx, p, grpc_mdelem_from_metadata_strings(GRPC_MDSTR_REF(md->key), exec_ctx, GRPC_MDSTR_REF(md->key),
take_string(p, &p->value)), take_string(p, &p->value)),
1); 1);
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err); if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
return parse_begin(exec_ctx, p, cur, end); return parse_begin(exec_ctx, p, cur, end);
} }
@ -828,10 +828,10 @@ static grpc_error *finish_lithdr_incidx_v(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hpack_parser *p, grpc_chttp2_hpack_parser *p,
const uint8_t *cur, const uint8_t *cur,
const uint8_t *end) { const uint8_t *end) {
grpc_error *err = on_hdr( grpc_error *err = on_hdr(exec_ctx, p, grpc_mdelem_from_metadata_strings(
exec_ctx, p, grpc_mdelem_from_metadata_strings(take_string(p, &p->key), exec_ctx, take_string(p, &p->key),
take_string(p, &p->value)), take_string(p, &p->value)),
1); 1);
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err); if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
return parse_begin(exec_ctx, p, cur, end); return parse_begin(exec_ctx, p, cur, end);
} }
@ -883,10 +883,10 @@ static grpc_error *finish_lithdr_notidx(grpc_exec_ctx *exec_ctx,
const uint8_t *end) { const uint8_t *end) {
grpc_mdelem *md = grpc_chttp2_hptbl_lookup(&p->table, p->index); grpc_mdelem *md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
GPR_ASSERT(md != NULL); /* handled in string parsing */ GPR_ASSERT(md != NULL); /* handled in string parsing */
grpc_error *err = on_hdr( grpc_error *err = on_hdr(exec_ctx, p, grpc_mdelem_from_metadata_strings(
exec_ctx, p, grpc_mdelem_from_metadata_strings(GRPC_MDSTR_REF(md->key), exec_ctx, GRPC_MDSTR_REF(md->key),
take_string(p, &p->value)), take_string(p, &p->value)),
0); 0);
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err); if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
return parse_begin(exec_ctx, p, cur, end); return parse_begin(exec_ctx, p, cur, end);
} }
@ -896,10 +896,10 @@ static grpc_error *finish_lithdr_notidx_v(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hpack_parser *p, grpc_chttp2_hpack_parser *p,
const uint8_t *cur, const uint8_t *cur,
const uint8_t *end) { const uint8_t *end) {
grpc_error *err = on_hdr( grpc_error *err = on_hdr(exec_ctx, p, grpc_mdelem_from_metadata_strings(
exec_ctx, p, grpc_mdelem_from_metadata_strings(take_string(p, &p->key), exec_ctx, take_string(p, &p->key),
take_string(p, &p->value)), take_string(p, &p->value)),
0); 0);
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err); if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
return parse_begin(exec_ctx, p, cur, end); return parse_begin(exec_ctx, p, cur, end);
} }
@ -951,10 +951,10 @@ static grpc_error *finish_lithdr_nvridx(grpc_exec_ctx *exec_ctx,
const uint8_t *end) { const uint8_t *end) {
grpc_mdelem *md = grpc_chttp2_hptbl_lookup(&p->table, p->index); grpc_mdelem *md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
GPR_ASSERT(md != NULL); /* handled in string parsing */ GPR_ASSERT(md != NULL); /* handled in string parsing */
grpc_error *err = on_hdr( grpc_error *err = on_hdr(exec_ctx, p, grpc_mdelem_from_metadata_strings(
exec_ctx, p, grpc_mdelem_from_metadata_strings(GRPC_MDSTR_REF(md->key), exec_ctx, GRPC_MDSTR_REF(md->key),
take_string(p, &p->value)), take_string(p, &p->value)),
0); 0);
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err); if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
return parse_begin(exec_ctx, p, cur, end); return parse_begin(exec_ctx, p, cur, end);
} }
@ -964,10 +964,10 @@ static grpc_error *finish_lithdr_nvridx_v(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hpack_parser *p, grpc_chttp2_hpack_parser *p,
const uint8_t *cur, const uint8_t *cur,
const uint8_t *end) { const uint8_t *end) {
grpc_error *err = on_hdr( grpc_error *err = on_hdr(exec_ctx, p, grpc_mdelem_from_metadata_strings(
exec_ctx, p, grpc_mdelem_from_metadata_strings(take_string(p, &p->key), exec_ctx, take_string(p, &p->key),
take_string(p, &p->value)), take_string(p, &p->value)),
0); 0);
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err); if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
return parse_begin(exec_ctx, p, cur, end); return parse_begin(exec_ctx, p, cur, end);
} }
@ -1020,7 +1020,7 @@ static grpc_error *finish_max_tbl_size(grpc_exec_ctx *exec_ctx,
gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index); gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index);
} }
grpc_error *err = grpc_error *err =
grpc_chttp2_hptbl_set_current_table_size(&p->table, p->index); grpc_chttp2_hptbl_set_current_table_size(exec_ctx, &p->table, p->index);
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err); if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
return parse_begin(exec_ctx, p, cur, end); return parse_begin(exec_ctx, p, cur, end);
} }
@ -1534,7 +1534,8 @@ static grpc_error *parse_value_string_with_literal_key(
/* PUBLIC INTERFACE */ /* PUBLIC INTERFACE */
void grpc_chttp2_hpack_parser_init(grpc_chttp2_hpack_parser *p) { void grpc_chttp2_hpack_parser_init(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hpack_parser *p) {
p->on_header = NULL; p->on_header = NULL;
p->on_header_user_data = NULL; p->on_header_user_data = NULL;
p->state = parse_begin; p->state = parse_begin;
@ -1546,7 +1547,7 @@ void grpc_chttp2_hpack_parser_init(grpc_chttp2_hpack_parser *p) {
p->value.length = 0; p->value.length = 0;
p->dynamic_table_update_allowed = 2; p->dynamic_table_update_allowed = 2;
p->last_error = GRPC_ERROR_NONE; p->last_error = GRPC_ERROR_NONE;
grpc_chttp2_hptbl_init(&p->table); grpc_chttp2_hptbl_init(exec_ctx, &p->table);
} }
void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser *p) { void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser *p) {
@ -1554,8 +1555,9 @@ void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser *p) {
p->state = parse_stream_dep0; p->state = parse_stream_dep0;
} }
void grpc_chttp2_hpack_parser_destroy(grpc_chttp2_hpack_parser *p) { void grpc_chttp2_hpack_parser_destroy(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hptbl_destroy(&p->table); grpc_chttp2_hpack_parser *p) {
grpc_chttp2_hptbl_destroy(exec_ctx, &p->table);
GRPC_ERROR_UNREF(p->last_error); GRPC_ERROR_UNREF(p->last_error);
gpr_free(p->key.str); gpr_free(p->key.str);
gpr_free(p->value.str); gpr_free(p->value.str);

@ -99,8 +99,10 @@ struct grpc_chttp2_hpack_parser {
grpc_chttp2_hptbl table; grpc_chttp2_hptbl table;
}; };
void grpc_chttp2_hpack_parser_init(grpc_chttp2_hpack_parser *p); void grpc_chttp2_hpack_parser_init(grpc_exec_ctx *exec_ctx,
void grpc_chttp2_hpack_parser_destroy(grpc_chttp2_hpack_parser *p); grpc_chttp2_hpack_parser *p);
void grpc_chttp2_hpack_parser_destroy(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hpack_parser *p);
void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser *p); void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser *p);

@ -179,7 +179,7 @@ static uint32_t entries_for_bytes(uint32_t bytes) {
GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD; GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
} }
void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl *tbl) { void grpc_chttp2_hptbl_init(grpc_exec_ctx *exec_ctx, grpc_chttp2_hptbl *tbl) {
size_t i; size_t i;
memset(tbl, 0, sizeof(*tbl)); memset(tbl, 0, sizeof(*tbl));
@ -190,18 +190,20 @@ void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl *tbl) {
tbl->ents = gpr_malloc(sizeof(*tbl->ents) * tbl->cap_entries); tbl->ents = gpr_malloc(sizeof(*tbl->ents) * tbl->cap_entries);
memset(tbl->ents, 0, sizeof(*tbl->ents) * tbl->cap_entries); memset(tbl->ents, 0, sizeof(*tbl->ents) * tbl->cap_entries);
for (i = 1; i <= GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) { for (i = 1; i <= GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) {
tbl->static_ents[i - 1] = tbl->static_ents[i - 1] = grpc_mdelem_from_strings(
grpc_mdelem_from_strings(static_table[i].key, static_table[i].value); exec_ctx, static_table[i].key, static_table[i].value);
} }
} }
void grpc_chttp2_hptbl_destroy(grpc_chttp2_hptbl *tbl) { void grpc_chttp2_hptbl_destroy(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hptbl *tbl) {
size_t i; size_t i;
for (i = 0; i < GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) { for (i = 0; i < GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) {
GRPC_MDELEM_UNREF(tbl->static_ents[i]); GRPC_MDELEM_UNREF(exec_ctx, tbl->static_ents[i]);
} }
for (i = 0; i < tbl->num_ents; i++) { for (i = 0; i < tbl->num_ents; i++) {
GRPC_MDELEM_UNREF(tbl->ents[(tbl->first_ent + i) % tbl->cap_entries]); GRPC_MDELEM_UNREF(exec_ctx,
tbl->ents[(tbl->first_ent + i) % tbl->cap_entries]);
} }
gpr_free(tbl->ents); gpr_free(tbl->ents);
} }
@ -224,7 +226,7 @@ grpc_mdelem *grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl *tbl,
} }
/* Evict one element from the table */ /* Evict one element from the table */
static void evict1(grpc_chttp2_hptbl *tbl) { static void evict1(grpc_exec_ctx *exec_ctx, grpc_chttp2_hptbl *tbl) {
grpc_mdelem *first_ent = tbl->ents[tbl->first_ent]; grpc_mdelem *first_ent = tbl->ents[tbl->first_ent];
size_t elem_bytes = GRPC_SLICE_LENGTH(first_ent->key->slice) + size_t elem_bytes = GRPC_SLICE_LENGTH(first_ent->key->slice) +
GRPC_SLICE_LENGTH(first_ent->value->slice) + GRPC_SLICE_LENGTH(first_ent->value->slice) +
@ -233,7 +235,7 @@ static void evict1(grpc_chttp2_hptbl *tbl) {
tbl->mem_used -= (uint32_t)elem_bytes; tbl->mem_used -= (uint32_t)elem_bytes;
tbl->first_ent = ((tbl->first_ent + 1) % tbl->cap_entries); tbl->first_ent = ((tbl->first_ent + 1) % tbl->cap_entries);
tbl->num_ents--; tbl->num_ents--;
GRPC_MDELEM_UNREF(first_ent); GRPC_MDELEM_UNREF(exec_ctx, first_ent);
} }
static void rebuild_ents(grpc_chttp2_hptbl *tbl, uint32_t new_cap) { static void rebuild_ents(grpc_chttp2_hptbl *tbl, uint32_t new_cap) {
@ -249,7 +251,8 @@ static void rebuild_ents(grpc_chttp2_hptbl *tbl, uint32_t new_cap) {
tbl->first_ent = 0; tbl->first_ent = 0;
} }
void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl *tbl, void grpc_chttp2_hptbl_set_max_bytes(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hptbl *tbl,
uint32_t max_bytes) { uint32_t max_bytes) {
if (tbl->max_bytes == max_bytes) { if (tbl->max_bytes == max_bytes) {
return; return;
@ -258,12 +261,13 @@ void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl *tbl,
gpr_log(GPR_DEBUG, "Update hpack parser max size to %d", max_bytes); gpr_log(GPR_DEBUG, "Update hpack parser max size to %d", max_bytes);
} }
while (tbl->mem_used > max_bytes) { while (tbl->mem_used > max_bytes) {
evict1(tbl); evict1(exec_ctx, tbl);
} }
tbl->max_bytes = max_bytes; tbl->max_bytes = max_bytes;
} }
grpc_error *grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl *tbl, grpc_error *grpc_chttp2_hptbl_set_current_table_size(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hptbl *tbl,
uint32_t bytes) { uint32_t bytes) {
if (tbl->current_table_bytes == bytes) { if (tbl->current_table_bytes == bytes) {
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
@ -281,7 +285,7 @@ grpc_error *grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl *tbl,
gpr_log(GPR_DEBUG, "Update hpack parser table size to %d", bytes); gpr_log(GPR_DEBUG, "Update hpack parser table size to %d", bytes);
} }
while (tbl->mem_used > bytes) { while (tbl->mem_used > bytes) {
evict1(tbl); evict1(exec_ctx, tbl);
} }
tbl->current_table_bytes = bytes; tbl->current_table_bytes = bytes;
tbl->max_entries = entries_for_bytes(bytes); tbl->max_entries = entries_for_bytes(bytes);
@ -296,7 +300,8 @@ grpc_error *grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl *tbl,
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
grpc_error *grpc_chttp2_hptbl_add(grpc_chttp2_hptbl *tbl, grpc_mdelem *md) { grpc_error *grpc_chttp2_hptbl_add(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hptbl *tbl, grpc_mdelem *md) {
/* determine how many bytes of buffer this entry represents */ /* determine how many bytes of buffer this entry represents */
size_t elem_bytes = GRPC_SLICE_LENGTH(md->key->slice) + size_t elem_bytes = GRPC_SLICE_LENGTH(md->key->slice) +
GRPC_SLICE_LENGTH(md->value->slice) + GRPC_SLICE_LENGTH(md->value->slice) +
@ -326,14 +331,14 @@ grpc_error *grpc_chttp2_hptbl_add(grpc_chttp2_hptbl *tbl, grpc_mdelem *md) {
* empty table. * empty table.
*/ */
while (tbl->num_ents) { while (tbl->num_ents) {
evict1(tbl); evict1(exec_ctx, tbl);
} }
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
/* evict entries to ensure no overflow */ /* evict entries to ensure no overflow */
while (elem_bytes > (size_t)tbl->current_table_bytes - tbl->mem_used) { while (elem_bytes > (size_t)tbl->current_table_bytes - tbl->mem_used) {
evict1(tbl); evict1(exec_ctx, tbl);
} }
/* copy the finalized entry in */ /* copy the finalized entry in */

@ -84,18 +84,21 @@ typedef struct {
} grpc_chttp2_hptbl; } grpc_chttp2_hptbl;
/* initialize a hpack table */ /* initialize a hpack table */
void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl *tbl); void grpc_chttp2_hptbl_init(grpc_exec_ctx *exec_ctx, grpc_chttp2_hptbl *tbl);
void grpc_chttp2_hptbl_destroy(grpc_chttp2_hptbl *tbl); void grpc_chttp2_hptbl_destroy(grpc_exec_ctx *exec_ctx, grpc_chttp2_hptbl *tbl);
void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl *tbl, void grpc_chttp2_hptbl_set_max_bytes(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hptbl *tbl,
uint32_t max_bytes); uint32_t max_bytes);
grpc_error *grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl *tbl, grpc_error *grpc_chttp2_hptbl_set_current_table_size(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hptbl *tbl,
uint32_t bytes); uint32_t bytes);
/* lookup a table entry based on its hpack index */ /* lookup a table entry based on its hpack index */
grpc_mdelem *grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl *tbl, grpc_mdelem *grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl *tbl,
uint32_t index); uint32_t index);
/* add a table entry to the index */ /* add a table entry to the index */
grpc_error *grpc_chttp2_hptbl_add(grpc_chttp2_hptbl *tbl, grpc_error *grpc_chttp2_hptbl_add(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hptbl *tbl,
grpc_mdelem *md) GRPC_MUST_USE_RESULT; grpc_mdelem *md) GRPC_MUST_USE_RESULT;
/* Find a key/value pair in the table... returns the index in the table of the /* Find a key/value pair in the table... returns the index in the table of the
most similar entry, or 0 if the value was not found */ most similar entry, or 0 if the value was not found */

@ -46,11 +46,11 @@ void grpc_chttp2_incoming_metadata_buffer_init(
} }
void grpc_chttp2_incoming_metadata_buffer_destroy( void grpc_chttp2_incoming_metadata_buffer_destroy(
grpc_chttp2_incoming_metadata_buffer *buffer) { grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_metadata_buffer *buffer) {
size_t i; size_t i;
if (!buffer->published) { if (!buffer->published) {
for (i = 0; i < buffer->count; i++) { for (i = 0; i < buffer->count; i++) {
GRPC_MDELEM_UNREF(buffer->elems[i].md); GRPC_MDELEM_UNREF(exec_ctx, buffer->elems[i].md);
} }
} }
gpr_free(buffer->elems); gpr_free(buffer->elems);

@ -49,7 +49,7 @@ typedef struct {
void grpc_chttp2_incoming_metadata_buffer_init( void grpc_chttp2_incoming_metadata_buffer_init(
grpc_chttp2_incoming_metadata_buffer *buffer); grpc_chttp2_incoming_metadata_buffer *buffer);
void grpc_chttp2_incoming_metadata_buffer_destroy( void grpc_chttp2_incoming_metadata_buffer_destroy(
grpc_chttp2_incoming_metadata_buffer *buffer); grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_metadata_buffer *buffer);
void grpc_chttp2_incoming_metadata_buffer_publish( void grpc_chttp2_incoming_metadata_buffer_publish(
grpc_chttp2_incoming_metadata_buffer *buffer, grpc_metadata_batch *batch); grpc_chttp2_incoming_metadata_buffer *buffer, grpc_metadata_batch *batch);

@ -336,7 +336,7 @@ static grpc_error *skip_parser(grpc_exec_ctx *exec_ctx, void *parser,
} }
static void skip_header(grpc_exec_ctx *exec_ctx, void *tp, grpc_mdelem *md) { static void skip_header(grpc_exec_ctx *exec_ctx, void *tp, grpc_mdelem *md) {
GRPC_MDELEM_UNREF(md); GRPC_MDELEM_UNREF(exec_ctx, md);
} }
static grpc_error *init_skip_frame_parser(grpc_exec_ctx *exec_ctx, static grpc_error *init_skip_frame_parser(grpc_exec_ctx *exec_ctx,
@ -477,7 +477,7 @@ static void on_initial_header(grpc_exec_ctx *exec_ctx, void *tp,
grpc_chttp2_incoming_metadata_buffer_set_deadline( grpc_chttp2_incoming_metadata_buffer_set_deadline(
&s->metadata_buffer[0], &s->metadata_buffer[0],
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), *cached_timeout)); gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), *cached_timeout));
GRPC_MDELEM_UNREF(md); GRPC_MDELEM_UNREF(exec_ctx, md);
} else { } else {
const size_t new_size = s->metadata_buffer[0].size + GRPC_MDELEM_LENGTH(md); const size_t new_size = s->metadata_buffer[0].size + GRPC_MDELEM_LENGTH(md);
const size_t metadata_size_limit = const size_t metadata_size_limit =
@ -495,7 +495,7 @@ static void on_initial_header(grpc_exec_ctx *exec_ctx, void *tp,
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED)); GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED));
grpc_chttp2_parsing_become_skip_parser(exec_ctx, t); grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
s->seen_error = true; s->seen_error = true;
GRPC_MDELEM_UNREF(md); GRPC_MDELEM_UNREF(exec_ctx, md);
} else { } else {
grpc_chttp2_incoming_metadata_buffer_add(&s->metadata_buffer[0], md); grpc_chttp2_incoming_metadata_buffer_add(&s->metadata_buffer[0], md);
} }
@ -538,7 +538,7 @@ static void on_trailing_header(grpc_exec_ctx *exec_ctx, void *tp,
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED)); GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED));
grpc_chttp2_parsing_become_skip_parser(exec_ctx, t); grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
s->seen_error = true; s->seen_error = true;
GRPC_MDELEM_UNREF(md); GRPC_MDELEM_UNREF(exec_ctx, md);
} else { } else {
grpc_chttp2_incoming_metadata_buffer_add(&s->metadata_buffer[1], md); grpc_chttp2_incoming_metadata_buffer_add(&s->metadata_buffer[1], md);
} }
@ -712,7 +712,7 @@ static grpc_error *init_settings_frame_parser(grpc_exec_ctx *exec_ctx,
memcpy(t->settings[GRPC_ACKED_SETTINGS], t->settings[GRPC_SENT_SETTINGS], memcpy(t->settings[GRPC_ACKED_SETTINGS], t->settings[GRPC_SENT_SETTINGS],
GRPC_CHTTP2_NUM_SETTINGS * sizeof(uint32_t)); GRPC_CHTTP2_NUM_SETTINGS * sizeof(uint32_t));
grpc_chttp2_hptbl_set_max_bytes( grpc_chttp2_hptbl_set_max_bytes(
&t->hpack_parser.table, exec_ctx, &t->hpack_parser.table,
t->settings[GRPC_ACKED_SETTINGS] t->settings[GRPC_ACKED_SETTINGS]
[GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE]); [GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE]);
t->sent_local_settings = 0; t->sent_local_settings = 0;

@ -39,6 +39,7 @@
#include "src/core/ext/transport/chttp2/transport/http2_errors.h" #include "src/core/ext/transport/chttp2/transport/http2_errors.h"
#include "src/core/lib/profiling/timers.h" #include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"
static void add_to_write_list(grpc_chttp2_write_cb **list, static void add_to_write_list(grpc_chttp2_write_cb **list,
grpc_chttp2_write_cb *cb) { grpc_chttp2_write_cb *cb) {
@ -119,7 +120,7 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
/* send initial metadata if it's available */ /* send initial metadata if it's available */
if (!sent_initial_metadata && s->send_initial_metadata) { if (!sent_initial_metadata && s->send_initial_metadata) {
grpc_chttp2_encode_header( grpc_chttp2_encode_header(
&t->hpack_compressor, s->id, s->send_initial_metadata, 0, exec_ctx, &t->hpack_compressor, s->id, s->send_initial_metadata, 0,
t->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], t->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE],
&s->stats.outgoing, &t->outbuf); &s->stats.outgoing, &t->outbuf);
s->send_initial_metadata = NULL; s->send_initial_metadata = NULL;
@ -186,9 +187,9 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
&s->stats.outgoing, &t->outbuf); &s->stats.outgoing, &t->outbuf);
} else { } else {
grpc_chttp2_encode_header( grpc_chttp2_encode_header(
&t->hpack_compressor, s->id, s->send_trailing_metadata, true, exec_ctx, &t->hpack_compressor, s->id, s->send_trailing_metadata,
t->settings[GRPC_ACKED_SETTINGS] true, t->settings[GRPC_ACKED_SETTINGS]
[GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE],
&s->stats.outgoing, &t->outbuf); &s->stats.outgoing, &t->outbuf);
} }
s->send_trailing_metadata = NULL; s->send_trailing_metadata = NULL;
@ -254,7 +255,7 @@ void grpc_chttp2_end_write(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
} }
GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:end"); GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:end");
} }
grpc_slice_buffer_reset_and_unref(&t->outbuf); grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &t->outbuf);
GRPC_ERROR_UNREF(error); GRPC_ERROR_UNREF(error);
GPR_TIMER_END("grpc_chttp2_end_write", 0); GPR_TIMER_END("grpc_chttp2_end_write", 0);
} }

@ -443,6 +443,7 @@ static void on_response_headers_received(
cronet_bidirectional_stream *stream, cronet_bidirectional_stream *stream,
const cronet_bidirectional_stream_header_array *headers, const cronet_bidirectional_stream_header_array *headers,
const char *negotiated_protocol) { const char *negotiated_protocol) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
CRONET_LOG(GPR_DEBUG, "R: on_response_headers_received(%p, %p, %s)", stream, CRONET_LOG(GPR_DEBUG, "R: on_response_headers_received(%p, %p, %s)", stream,
headers, negotiated_protocol); headers, negotiated_protocol);
stream_obj *s = (stream_obj *)stream->annotation; stream_obj *s = (stream_obj *)stream->annotation;
@ -454,7 +455,7 @@ static void on_response_headers_received(
grpc_chttp2_incoming_metadata_buffer_add( grpc_chttp2_incoming_metadata_buffer_add(
&s->state.rs.initial_metadata, &s->state.rs.initial_metadata,
grpc_mdelem_from_metadata_strings( grpc_mdelem_from_metadata_strings(
grpc_mdstr_from_string(headers->headers[i].key), &exec_ctx, grpc_mdstr_from_string(headers->headers[i].key),
grpc_mdstr_from_string(headers->headers[i].value))); grpc_mdstr_from_string(headers->headers[i].value)));
} }
s->state.state_callback_received[OP_RECV_INITIAL_METADATA] = true; s->state.state_callback_received[OP_RECV_INITIAL_METADATA] = true;
@ -471,6 +472,7 @@ static void on_response_headers_received(
s->state.rs.remaining_bytes); s->state.rs.remaining_bytes);
} }
gpr_mu_unlock(&s->mu); gpr_mu_unlock(&s->mu);
grpc_exec_ctx_finish(&exec_ctx);
execute_from_storage(s); execute_from_storage(s);
} }
@ -536,6 +538,7 @@ static void on_read_completed(cronet_bidirectional_stream *stream, char *data,
static void on_response_trailers_received( static void on_response_trailers_received(
cronet_bidirectional_stream *stream, cronet_bidirectional_stream *stream,
const cronet_bidirectional_stream_header_array *trailers) { const cronet_bidirectional_stream_header_array *trailers) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
CRONET_LOG(GPR_DEBUG, "R: on_response_trailers_received(%p,%p)", stream, CRONET_LOG(GPR_DEBUG, "R: on_response_trailers_received(%p,%p)", stream,
trailers); trailers);
stream_obj *s = (stream_obj *)stream->annotation; stream_obj *s = (stream_obj *)stream->annotation;
@ -550,7 +553,7 @@ static void on_response_trailers_received(
grpc_chttp2_incoming_metadata_buffer_add( grpc_chttp2_incoming_metadata_buffer_add(
&s->state.rs.trailing_metadata, &s->state.rs.trailing_metadata,
grpc_mdelem_from_metadata_strings( grpc_mdelem_from_metadata_strings(
grpc_mdstr_from_string(trailers->headers[i].key), &exec_ctx, grpc_mdstr_from_string(trailers->headers[i].key),
grpc_mdstr_from_string(trailers->headers[i].value))); grpc_mdstr_from_string(trailers->headers[i].value)));
s->state.rs.trailing_metadata_valid = true; s->state.rs.trailing_metadata_valid = true;
if (0 == strcmp(trailers->headers[i].key, "grpc-status") && if (0 == strcmp(trailers->headers[i].key, "grpc-status") &&
@ -574,8 +577,10 @@ static void on_response_trailers_received(
s->state.state_op_done[OP_SEND_TRAILING_METADATA] = true; s->state.state_op_done[OP_SEND_TRAILING_METADATA] = true;
gpr_mu_unlock(&s->mu); gpr_mu_unlock(&s->mu);
grpc_exec_ctx_finish(&exec_ctx);
} else { } else {
gpr_mu_unlock(&s->mu); gpr_mu_unlock(&s->mu);
grpc_exec_ctx_finish(&exec_ctx);
execute_from_storage(s); execute_from_storage(s);
} }
} }

@ -0,0 +1,6 @@
Required elements of gRPC Core: Each module in this directory is required to
build gRPC. If it's possible to envisage a configuration where code is not
required, then that code belongs in ext/ instead.
NOTE: The movement of code between lib and ext is an ongoing effort, so this
directory currently contains too much of the core library.

@ -0,0 +1,4 @@
# Channel
Provides channel/call stack implementation, and implementation of common filters
for that implementation.

@ -184,7 +184,7 @@ grpc_channel_args *grpc_channel_args_normalize(const grpc_channel_args *a) {
return b; return b;
} }
void grpc_channel_args_destroy(grpc_channel_args *a) { void grpc_channel_args_destroy(grpc_exec_ctx *exec_ctx, grpc_channel_args *a) {
size_t i; size_t i;
if (!a) return; if (!a) return;
for (i = 0; i < a->num_args; i++) { for (i = 0; i < a->num_args; i++) {
@ -195,7 +195,8 @@ void grpc_channel_args_destroy(grpc_channel_args *a) {
case GRPC_ARG_INTEGER: case GRPC_ARG_INTEGER:
break; break;
case GRPC_ARG_POINTER: case GRPC_ARG_POINTER:
a->args[i].value.pointer.vtable->destroy(a->args[i].value.pointer.p); a->args[i].value.pointer.vtable->destroy(exec_ctx,
a->args[i].value.pointer.p);
break; break;
} }
gpr_free(a->args[i].key); gpr_free(a->args[i].key);
@ -249,7 +250,8 @@ static int find_compression_algorithm_states_bitset(const grpc_channel_args *a,
} }
grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( grpc_channel_args *grpc_channel_args_compression_algorithm_set_state(
grpc_channel_args **a, grpc_compression_algorithm algorithm, int state) { grpc_exec_ctx *exec_ctx, grpc_channel_args **a,
grpc_compression_algorithm algorithm, int state) {
int *states_arg = NULL; int *states_arg = NULL;
grpc_channel_args *result = *a; grpc_channel_args *result = *a;
const int states_arg_found = const int states_arg_found =
@ -282,7 +284,7 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state(
GPR_BITCLEAR((unsigned *)&tmp.value.integer, algorithm); GPR_BITCLEAR((unsigned *)&tmp.value.integer, algorithm);
} }
result = grpc_channel_args_copy_and_add(*a, &tmp, 1); result = grpc_channel_args_copy_and_add(*a, &tmp, 1);
grpc_channel_args_destroy(*a); grpc_channel_args_destroy(exec_ctx, *a);
*a = result; *a = result;
} }
return result; return result;

@ -68,7 +68,7 @@ grpc_channel_args *grpc_channel_args_merge(const grpc_channel_args *a,
const grpc_channel_args *b); const grpc_channel_args *b);
/** Destroy arguments created by \a grpc_channel_args_copy */ /** Destroy arguments created by \a grpc_channel_args_copy */
void grpc_channel_args_destroy(grpc_channel_args *a); void grpc_channel_args_destroy(grpc_exec_ctx *exec_ctx, grpc_channel_args *a);
/** Returns the compression algorithm set in \a a. */ /** Returns the compression algorithm set in \a a. */
grpc_compression_algorithm grpc_channel_args_get_compression_algorithm( grpc_compression_algorithm grpc_channel_args_get_compression_algorithm(
@ -88,7 +88,8 @@ grpc_channel_args *grpc_channel_args_set_compression_algorithm(
* modified to point to the returned instance (which may be different from the * modified to point to the returned instance (which may be different from the
* input value of \a a). */ * input value of \a a). */
grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( grpc_channel_args *grpc_channel_args_compression_algorithm_set_state(
grpc_channel_args **a, grpc_compression_algorithm algorithm, int enabled); grpc_exec_ctx *exec_ctx, grpc_channel_args **a,
grpc_compression_algorithm algorithm, int enabled);
/** Returns the bitset representing the support state (true for enabled, false /** Returns the bitset representing the support state (true for enabled, false
* for disabled) for compression algorithms. * for disabled) for compression algorithms.

@ -310,7 +310,7 @@ void grpc_call_element_send_cancel_with_message(grpc_exec_ctx *exec_ctx,
memset(op, 0, sizeof(*op)); memset(op, 0, sizeof(*op));
op->on_complete = op->on_complete =
grpc_closure_create(destroy_op, op, grpc_schedule_on_exec_ctx); grpc_closure_create(destroy_op, op, grpc_schedule_on_exec_ctx);
grpc_transport_stream_op_add_cancellation_with_message(op, status, grpc_transport_stream_op_add_cancellation_with_message(exec_ctx, op, status,
optional_message); optional_message);
elem->filter->start_transport_stream_op(exec_ctx, elem, op); elem->filter->start_transport_stream_op(exec_ctx, elem, op);
} }
@ -323,6 +323,6 @@ void grpc_call_element_send_close_with_message(grpc_exec_ctx *exec_ctx,
memset(op, 0, sizeof(*op)); memset(op, 0, sizeof(*op));
op->on_complete = op->on_complete =
grpc_closure_create(destroy_op, op, grpc_schedule_on_exec_ctx); grpc_closure_create(destroy_op, op, grpc_schedule_on_exec_ctx);
grpc_transport_stream_op_add_close(op, status, optional_message); grpc_transport_stream_op_add_close(exec_ctx, op, status, optional_message);
elem->filter->start_transport_stream_op(exec_ctx, elem, op); elem->filter->start_transport_stream_op(exec_ctx, elem, op);
} }

@ -138,9 +138,10 @@ void grpc_channel_stack_builder_set_name(grpc_channel_stack_builder *builder,
} }
void grpc_channel_stack_builder_set_channel_arguments( void grpc_channel_stack_builder_set_channel_arguments(
grpc_channel_stack_builder *builder, const grpc_channel_args *args) { grpc_exec_ctx *exec_ctx, grpc_channel_stack_builder *builder,
const grpc_channel_args *args) {
if (builder->args != NULL) { if (builder->args != NULL) {
grpc_channel_args_destroy(builder->args); grpc_channel_args_destroy(exec_ctx, builder->args);
} }
builder->args = grpc_channel_args_copy(args); builder->args = grpc_channel_args_copy(args);
} }
@ -213,7 +214,8 @@ bool grpc_channel_stack_builder_add_filter_after(
return true; return true;
} }
void grpc_channel_stack_builder_destroy(grpc_channel_stack_builder *builder) { void grpc_channel_stack_builder_destroy(grpc_exec_ctx *exec_ctx,
grpc_channel_stack_builder *builder) {
filter_node *p = builder->begin.next; filter_node *p = builder->begin.next;
while (p != &builder->end) { while (p != &builder->end) {
filter_node *next = p->next; filter_node *next = p->next;
@ -221,7 +223,7 @@ void grpc_channel_stack_builder_destroy(grpc_channel_stack_builder *builder) {
p = next; p = next;
} }
if (builder->args != NULL) { if (builder->args != NULL) {
grpc_channel_args_destroy(builder->args); grpc_channel_args_destroy(exec_ctx, builder->args);
} }
gpr_free(builder->target); gpr_free(builder->target);
gpr_free(builder); gpr_free(builder);
@ -276,7 +278,7 @@ grpc_error *grpc_channel_stack_builder_finish(
} }
} }
grpc_channel_stack_builder_destroy(builder); grpc_channel_stack_builder_destroy(exec_ctx, builder);
gpr_free((grpc_channel_filter **)filters); gpr_free((grpc_channel_filter **)filters);
return error; return error;

@ -73,7 +73,8 @@ grpc_transport *grpc_channel_stack_builder_get_transport(
/// Set channel arguments: copies args /// Set channel arguments: copies args
void grpc_channel_stack_builder_set_channel_arguments( void grpc_channel_stack_builder_set_channel_arguments(
grpc_channel_stack_builder *builder, const grpc_channel_args *args); grpc_exec_ctx *exec_ctx, grpc_channel_stack_builder *builder,
const grpc_channel_args *args);
/// Return a borrowed pointer to the channel arguments /// Return a borrowed pointer to the channel arguments
const grpc_channel_args *grpc_channel_stack_builder_get_channel_arguments( const grpc_channel_args *grpc_channel_stack_builder_get_channel_arguments(
@ -157,7 +158,8 @@ grpc_error *grpc_channel_stack_builder_finish(
void *destroy_arg, void **result); void *destroy_arg, void **result);
/// Destroy the builder without creating a channel stack /// Destroy the builder without creating a channel stack
void grpc_channel_stack_builder_destroy(grpc_channel_stack_builder *builder); void grpc_channel_stack_builder_destroy(grpc_exec_ctx *exec_ctx,
grpc_channel_stack_builder *builder);
extern int grpc_trace_channel_stack_builder; extern int grpc_trace_channel_stack_builder;

@ -44,6 +44,7 @@
#include "src/core/lib/compression/algorithm_metadata.h" #include "src/core/lib/compression/algorithm_metadata.h"
#include "src/core/lib/compression/message_compress.h" #include "src/core/lib/compression/message_compress.h"
#include "src/core/lib/profiling/timers.h" #include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/support/string.h" #include "src/core/lib/support/string.h"
#include "src/core/lib/transport/static_metadata.h" #include "src/core/lib/transport/static_metadata.h"
@ -82,7 +83,8 @@ typedef struct channel_data {
/** For each \a md element from the incoming metadata, filter out the entry for /** For each \a md element from the incoming metadata, filter out the entry for
* "grpc-encoding", using its value to populate the call data's * "grpc-encoding", using its value to populate the call data's
* compression_algorithm field. */ * compression_algorithm field. */
static grpc_mdelem *compression_md_filter(void *user_data, grpc_mdelem *md) { static grpc_mdelem *compression_md_filter(grpc_exec_ctx *exec_ctx,
void *user_data, grpc_mdelem *md) {
grpc_call_element *elem = user_data; grpc_call_element *elem = user_data;
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
channel_data *channeld = elem->channel_data; channel_data *channeld = elem->channel_data;
@ -130,12 +132,14 @@ static int skip_compression(grpc_call_element *elem, uint32_t flags) {
/** Filter initial metadata */ /** Filter initial metadata */
static void process_send_initial_metadata( static void process_send_initial_metadata(
grpc_call_element *elem, grpc_metadata_batch *initial_metadata) { grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
grpc_metadata_batch *initial_metadata) {
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
channel_data *channeld = elem->channel_data; channel_data *channeld = elem->channel_data;
/* Parse incoming request for compression. If any, it'll be available /* Parse incoming request for compression. If any, it'll be available
* at calld->compression_algorithm */ * at calld->compression_algorithm */
grpc_metadata_batch_filter(initial_metadata, compression_md_filter, elem); grpc_metadata_batch_filter(exec_ctx, initial_metadata, compression_md_filter,
elem);
if (!calld->has_compression_algorithm) { if (!calld->has_compression_algorithm) {
/* If no algorithm was found in the metadata and we aren't /* If no algorithm was found in the metadata and we aren't
* exceptionally skipping compression, fall back to the channel * exceptionally skipping compression, fall back to the channel
@ -161,7 +165,7 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx,
static void send_done(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) { static void send_done(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) {
grpc_call_element *elem = elemp; grpc_call_element *elem = elemp;
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
grpc_slice_buffer_reset_and_unref(&calld->slices); grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &calld->slices);
calld->post_send->cb(exec_ctx, calld->post_send->cb_arg, error); calld->post_send->cb(exec_ctx, calld->post_send->cb_arg, error);
} }
@ -171,8 +175,8 @@ static void finish_send_message(grpc_exec_ctx *exec_ctx,
int did_compress; int did_compress;
grpc_slice_buffer tmp; grpc_slice_buffer tmp;
grpc_slice_buffer_init(&tmp); grpc_slice_buffer_init(&tmp);
did_compress = did_compress = grpc_msg_compress(exec_ctx, calld->compression_algorithm,
grpc_msg_compress(calld->compression_algorithm, &calld->slices, &tmp); &calld->slices, &tmp);
if (did_compress) { if (did_compress) {
if (grpc_compression_trace) { if (grpc_compression_trace) {
char *algo_name; char *algo_name;
@ -199,7 +203,7 @@ static void finish_send_message(grpc_exec_ctx *exec_ctx,
} }
} }
grpc_slice_buffer_destroy(&tmp); grpc_slice_buffer_destroy_internal(exec_ctx, &tmp);
grpc_slice_buffer_stream_init(&calld->replacement_stream, &calld->slices, grpc_slice_buffer_stream_init(&calld->replacement_stream, &calld->slices,
calld->send_flags); calld->send_flags);
@ -243,7 +247,7 @@ static void compress_start_transport_stream_op(grpc_exec_ctx *exec_ctx,
GPR_TIMER_BEGIN("compress_start_transport_stream_op", 0); GPR_TIMER_BEGIN("compress_start_transport_stream_op", 0);
if (op->send_initial_metadata) { if (op->send_initial_metadata) {
process_send_initial_metadata(elem, op->send_initial_metadata); process_send_initial_metadata(exec_ctx, elem, op->send_initial_metadata);
} }
if (op->send_message != NULL && if (op->send_message != NULL &&
!skip_compression(elem, op->send_message->flags)) { !skip_compression(elem, op->send_message->flags)) {
@ -283,7 +287,7 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
void *ignored) { void *ignored) {
/* grab pointers to our data from the call element */ /* grab pointers to our data from the call element */
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
grpc_slice_buffer_destroy(&calld->slices); grpc_slice_buffer_destroy_internal(exec_ctx, &calld->slices);
} }
/* Constructor for channel_data */ /* Constructor for channel_data */

@ -171,7 +171,8 @@ static void bind_transport(grpc_channel_stack *channel_stack,
channel_stack->call_stack_size += grpc_transport_stream_size(t); channel_stack->call_stack_size += grpc_transport_stream_size(t);
} }
bool grpc_add_connected_filter(grpc_channel_stack_builder *builder, bool grpc_add_connected_filter(grpc_exec_ctx *exec_ctx,
grpc_channel_stack_builder *builder,
void *arg_must_be_null) { void *arg_must_be_null) {
GPR_ASSERT(arg_must_be_null == NULL); GPR_ASSERT(arg_must_be_null == NULL);
grpc_transport *t = grpc_channel_stack_builder_get_transport(builder); grpc_transport *t = grpc_channel_stack_builder_get_transport(builder);

@ -36,7 +36,8 @@
#include "src/core/lib/channel/channel_stack_builder.h" #include "src/core/lib/channel/channel_stack_builder.h"
bool grpc_add_connected_filter(grpc_channel_stack_builder *builder, bool grpc_add_connected_filter(grpc_exec_ctx *exec_ctx,
grpc_channel_stack_builder *builder,
void *arg_must_be_null); void *arg_must_be_null);
#endif /* GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H */ #endif /* GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H */

@ -41,6 +41,7 @@
#include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/timer.h" #include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/slice/slice_internal.h"
// //
// grpc_deadline_state // grpc_deadline_state
@ -58,7 +59,7 @@ static void timer_callback(grpc_exec_ctx* exec_ctx, void* arg,
grpc_slice msg = grpc_slice_from_static_string("Deadline Exceeded"); grpc_slice msg = grpc_slice_from_static_string("Deadline Exceeded");
grpc_call_element_send_cancel_with_message( grpc_call_element_send_cancel_with_message(
exec_ctx, elem, GRPC_STATUS_DEADLINE_EXCEEDED, &msg); exec_ctx, elem, GRPC_STATUS_DEADLINE_EXCEEDED, &msg);
grpc_slice_unref(msg); grpc_slice_unref_internal(exec_ctx, msg);
} }
GRPC_CALL_STACK_UNREF(exec_ctx, deadline_state->call_stack, "deadline_timer"); GRPC_CALL_STACK_UNREF(exec_ctx, deadline_state->call_stack, "deadline_timer");
} }
@ -82,8 +83,11 @@ static void start_timer_if_needed_locked(grpc_exec_ctx* exec_ctx,
// Take a reference to the call stack, to be owned by the timer. // Take a reference to the call stack, to be owned by the timer.
GRPC_CALL_STACK_REF(deadline_state->call_stack, "deadline_timer"); GRPC_CALL_STACK_REF(deadline_state->call_stack, "deadline_timer");
deadline_state->timer_pending = true; deadline_state->timer_pending = true;
grpc_timer_init(exec_ctx, &deadline_state->timer, deadline, timer_callback, grpc_closure_init(&deadline_state->timer_callback, timer_callback, elem,
elem, gpr_now(GPR_CLOCK_MONOTONIC)); grpc_schedule_on_exec_ctx);
grpc_timer_init(exec_ctx, &deadline_state->timer, deadline,
&deadline_state->timer_callback,
gpr_now(GPR_CLOCK_MONOTONIC));
} }
} }
static void start_timer_if_needed(grpc_exec_ctx* exec_ctx, static void start_timer_if_needed(grpc_exec_ctx* exec_ctx,

@ -46,6 +46,7 @@ typedef struct grpc_deadline_state {
bool timer_pending; bool timer_pending;
// The deadline timer. // The deadline timer.
grpc_timer timer; grpc_timer timer;
grpc_closure timer_callback;
// Closure to invoke when the call is complete. // Closure to invoke when the call is complete.
// We use this to cancel the timer. // We use this to cancel the timer.
grpc_closure on_complete; grpc_closure on_complete;

@ -86,6 +86,7 @@ struct grpc_handshake_manager {
grpc_tcp_server_acceptor* acceptor; grpc_tcp_server_acceptor* acceptor;
// Deadline timer across all handshakers. // Deadline timer across all handshakers.
grpc_timer deadline_timer; grpc_timer deadline_timer;
grpc_closure on_timeout;
// The final callback and user_data to invoke after the last handshaker. // The final callback and user_data to invoke after the last handshaker.
grpc_closure on_handshake_done; grpc_closure on_handshake_done;
void* user_data; void* user_data;
@ -224,9 +225,11 @@ void grpc_handshake_manager_do_handshake(
grpc_schedule_on_exec_ctx); grpc_schedule_on_exec_ctx);
// Start deadline timer, which owns a ref. // Start deadline timer, which owns a ref.
gpr_ref(&mgr->refs); gpr_ref(&mgr->refs);
grpc_closure_init(&mgr->on_timeout, on_timeout, mgr,
grpc_schedule_on_exec_ctx);
grpc_timer_init(exec_ctx, &mgr->deadline_timer, grpc_timer_init(exec_ctx, &mgr->deadline_timer,
gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC), gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC),
on_timeout, mgr, gpr_now(GPR_CLOCK_MONOTONIC)); &mgr->on_timeout, gpr_now(GPR_CLOCK_MONOTONIC));
// Start first handshaker, which also owns a ref. // Start first handshaker, which also owns a ref.
gpr_ref(&mgr->refs); gpr_ref(&mgr->refs);
bool done = call_next_handshaker_locked(exec_ctx, mgr, GRPC_ERROR_NONE); bool done = call_next_handshaker_locked(exec_ctx, mgr, GRPC_ERROR_NONE);

@ -0,0 +1,54 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/lib/channel/handshaker_factory.h"
#include <grpc/support/log.h>
void grpc_handshaker_factory_add_handshakers(
grpc_exec_ctx *exec_ctx, grpc_handshaker_factory *handshaker_factory,
const grpc_channel_args *args, grpc_handshake_manager *handshake_mgr) {
if (handshaker_factory != NULL) {
GPR_ASSERT(handshaker_factory->vtable != NULL);
handshaker_factory->vtable->add_handshakers(exec_ctx, handshaker_factory,
args, handshake_mgr);
}
}
void grpc_handshaker_factory_destroy(
grpc_exec_ctx *exec_ctx, grpc_handshaker_factory *handshaker_factory) {
if (handshaker_factory != NULL) {
GPR_ASSERT(handshaker_factory->vtable != NULL);
handshaker_factory->vtable->destroy(exec_ctx, handshaker_factory);
}
}

@ -0,0 +1,66 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H
#define GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H
#include <grpc/impl/codegen/grpc_types.h>
#include "src/core/lib/channel/handshaker.h"
#include "src/core/lib/iomgr/exec_ctx.h"
// A handshaker factory is used to create handshakers.
typedef struct grpc_handshaker_factory grpc_handshaker_factory;
typedef struct {
void (*add_handshakers)(grpc_exec_ctx *exec_ctx,
grpc_handshaker_factory *handshaker_factory,
const grpc_channel_args *args,
grpc_handshake_manager *handshake_mgr);
void (*destroy)(grpc_exec_ctx *exec_ctx,
grpc_handshaker_factory *handshaker_factory);
} grpc_handshaker_factory_vtable;
struct grpc_handshaker_factory {
const grpc_handshaker_factory_vtable *vtable;
};
void grpc_handshaker_factory_add_handshakers(
grpc_exec_ctx *exec_ctx, grpc_handshaker_factory *handshaker_factory,
const grpc_channel_args *args, grpc_handshake_manager *handshake_mgr);
void grpc_handshaker_factory_destroy(
grpc_exec_ctx *exec_ctx, grpc_handshaker_factory *handshaker_factory);
#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H */

@ -0,0 +1,113 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/lib/channel/handshaker_registry.h"
#include <string.h>
#include <grpc/support/alloc.h>
//
// grpc_handshaker_factory_list
//
typedef struct {
grpc_handshaker_factory** list;
size_t num_factories;
} grpc_handshaker_factory_list;
static void grpc_handshaker_factory_list_register(
grpc_handshaker_factory_list* list, bool at_start,
grpc_handshaker_factory* factory) {
list->list = gpr_realloc(
list->list, (list->num_factories + 1) * sizeof(grpc_handshaker_factory*));
if (at_start) {
memmove(list->list + 1, list->list,
sizeof(grpc_handshaker_factory*) * list->num_factories);
list->list[0] = factory;
} else {
list->list[list->num_factories] = factory;
}
++list->num_factories;
}
static void grpc_handshaker_factory_list_add_handshakers(
grpc_exec_ctx* exec_ctx, grpc_handshaker_factory_list* list,
const grpc_channel_args* args, grpc_handshake_manager* handshake_mgr) {
for (size_t i = 0; i < list->num_factories; ++i) {
grpc_handshaker_factory_add_handshakers(exec_ctx, list->list[i], args,
handshake_mgr);
}
}
static void grpc_handshaker_factory_list_destroy(
grpc_exec_ctx* exec_ctx, grpc_handshaker_factory_list* list) {
for (size_t i = 0; i < list->num_factories; ++i) {
grpc_handshaker_factory_destroy(exec_ctx, list->list[i]);
}
gpr_free(list->list);
}
//
// plugin
//
static grpc_handshaker_factory_list
g_handshaker_factory_lists[NUM_HANDSHAKER_TYPES];
void grpc_handshaker_factory_registry_init() {
memset(g_handshaker_factory_lists, 0, sizeof(g_handshaker_factory_lists));
}
void grpc_handshaker_factory_registry_shutdown(grpc_exec_ctx* exec_ctx) {
for (size_t i = 0; i < NUM_HANDSHAKER_TYPES; ++i) {
grpc_handshaker_factory_list_destroy(exec_ctx,
&g_handshaker_factory_lists[i]);
}
}
void grpc_handshaker_factory_register(bool at_start,
grpc_handshaker_type handshaker_type,
grpc_handshaker_factory* factory) {
grpc_handshaker_factory_list_register(
&g_handshaker_factory_lists[handshaker_type], at_start, factory);
}
void grpc_handshakers_add(grpc_exec_ctx* exec_ctx,
grpc_handshaker_type handshaker_type,
const grpc_channel_args* args,
grpc_handshake_manager* handshake_mgr) {
grpc_handshaker_factory_list_add_handshakers(
exec_ctx, &g_handshaker_factory_lists[handshaker_type], args,
handshake_mgr);
}

@ -0,0 +1,63 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H
#define GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H
#include <grpc/impl/codegen/grpc_types.h>
#include "src/core/lib/channel/handshaker_factory.h"
#include "src/core/lib/iomgr/exec_ctx.h"
typedef enum {
HANDSHAKER_CLIENT = 0,
HANDSHAKER_SERVER,
NUM_HANDSHAKER_TYPES, // Must be last.
} grpc_handshaker_type;
void grpc_handshaker_factory_registry_init();
void grpc_handshaker_factory_registry_shutdown(grpc_exec_ctx* exec_ctx);
/// Registers a new handshaker factory. Takes ownership.
/// If \a at_start is true, the new handshaker will be at the beginning of
/// the list. Otherwise, it will be added to the end.
void grpc_handshaker_factory_register(bool at_start,
grpc_handshaker_type handshaker_type,
grpc_handshaker_factory* factory);
void grpc_handshakers_add(grpc_exec_ctx* exec_ctx,
grpc_handshaker_type handshaker_type,
const grpc_channel_args* args,
grpc_handshake_manager* handshake_mgr);
#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H */

@ -37,6 +37,7 @@
#include <string.h> #include <string.h>
#include "src/core/lib/profiling/timers.h" #include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/percent_encoding.h" #include "src/core/lib/slice/percent_encoding.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/support/string.h" #include "src/core/lib/support/string.h"
#include "src/core/lib/transport/static_metadata.h" #include "src/core/lib/transport/static_metadata.h"
#include "src/core/lib/transport/transport_impl.h" #include "src/core/lib/transport/transport_impl.h"
@ -92,13 +93,9 @@ typedef struct channel_data {
size_t max_payload_size_for_get; size_t max_payload_size_for_get;
} channel_data; } channel_data;
typedef struct { static grpc_mdelem *client_recv_filter(grpc_exec_ctx *exec_ctx, void *user_data,
grpc_call_element *elem; grpc_mdelem *md) {
grpc_exec_ctx *exec_ctx; grpc_call_element *elem = user_data;
} client_recv_filter_args;
static grpc_mdelem *client_recv_filter(void *user_data, grpc_mdelem *md) {
client_recv_filter_args *a = user_data;
if (md == GRPC_MDELEM_STATUS_200) { if (md == GRPC_MDELEM_STATUS_200) {
return NULL; return NULL;
} else if (md->key == GRPC_MDSTR_STATUS) { } else if (md->key == GRPC_MDSTR_STATUS) {
@ -107,18 +104,19 @@ static grpc_mdelem *client_recv_filter(void *user_data, grpc_mdelem *md) {
grpc_mdstr_as_c_string(md->value)); grpc_mdstr_as_c_string(md->value));
grpc_slice message = grpc_slice_from_copied_string(message_string); grpc_slice message = grpc_slice_from_copied_string(message_string);
gpr_free(message_string); gpr_free(message_string);
grpc_call_element_send_close_with_message(a->exec_ctx, a->elem, grpc_call_element_send_close_with_message(exec_ctx, elem,
GRPC_STATUS_CANCELLED, &message); GRPC_STATUS_CANCELLED, &message);
return NULL; return NULL;
} else if (md->key == GRPC_MDSTR_GRPC_MESSAGE) { } else if (md->key == GRPC_MDSTR_GRPC_MESSAGE) {
grpc_slice pct_decoded_msg = grpc_slice pct_decoded_msg =
grpc_permissive_percent_decode_slice(md->value->slice); grpc_permissive_percent_decode_slice(md->value->slice);
if (grpc_slice_is_equivalent(pct_decoded_msg, md->value->slice)) { if (grpc_slice_is_equivalent(pct_decoded_msg, md->value->slice)) {
grpc_slice_unref(pct_decoded_msg); grpc_slice_unref_internal(exec_ctx, pct_decoded_msg);
return md; return md;
} else { } else {
return grpc_mdelem_from_metadata_strings( return grpc_mdelem_from_metadata_strings(
GRPC_MDSTR_GRPC_MESSAGE, grpc_mdstr_from_slice(pct_decoded_msg)); exec_ctx, GRPC_MDSTR_GRPC_MESSAGE,
grpc_mdstr_from_slice(exec_ctx, pct_decoded_msg));
} }
} else if (md == GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC) { } else if (md == GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC) {
return NULL; return NULL;
@ -147,11 +145,8 @@ static void hc_on_recv_initial_metadata(grpc_exec_ctx *exec_ctx,
void *user_data, grpc_error *error) { void *user_data, grpc_error *error) {
grpc_call_element *elem = user_data; grpc_call_element *elem = user_data;
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
client_recv_filter_args a; grpc_metadata_batch_filter(exec_ctx, calld->recv_initial_metadata,
a.elem = elem; client_recv_filter, elem);
a.exec_ctx = exec_ctx;
grpc_metadata_batch_filter(calld->recv_initial_metadata, client_recv_filter,
&a);
grpc_closure_run(exec_ctx, calld->on_done_recv_initial_metadata, grpc_closure_run(exec_ctx, calld->on_done_recv_initial_metadata,
GRPC_ERROR_REF(error)); GRPC_ERROR_REF(error));
} }
@ -160,11 +155,8 @@ static void hc_on_recv_trailing_metadata(grpc_exec_ctx *exec_ctx,
void *user_data, grpc_error *error) { void *user_data, grpc_error *error) {
grpc_call_element *elem = user_data; grpc_call_element *elem = user_data;
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
client_recv_filter_args a; grpc_metadata_batch_filter(exec_ctx, calld->recv_trailing_metadata,
a.elem = elem; client_recv_filter, elem);
a.exec_ctx = exec_ctx;
grpc_metadata_batch_filter(calld->recv_trailing_metadata, client_recv_filter,
&a);
grpc_closure_run(exec_ctx, calld->on_done_recv_trailing_metadata, grpc_closure_run(exec_ctx, calld->on_done_recv_trailing_metadata,
GRPC_ERROR_REF(error)); GRPC_ERROR_REF(error));
} }
@ -183,11 +175,12 @@ static void hc_on_complete(grpc_exec_ctx *exec_ctx, void *user_data,
static void send_done(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) { static void send_done(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) {
grpc_call_element *elem = elemp; grpc_call_element *elem = elemp;
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
grpc_slice_buffer_reset_and_unref(&calld->slices); grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &calld->slices);
calld->post_send->cb(exec_ctx, calld->post_send->cb_arg, error); calld->post_send->cb(exec_ctx, calld->post_send->cb_arg, error);
} }
static grpc_mdelem *client_strip_filter(void *user_data, grpc_mdelem *md) { static grpc_mdelem *client_strip_filter(grpc_exec_ctx *exec_ctx,
void *user_data, grpc_mdelem *md) {
/* eat the things we'd like to set ourselves */ /* eat the things we'd like to set ourselves */
if (md->key == GRPC_MDSTR_METHOD) return NULL; if (md->key == GRPC_MDSTR_METHOD) return NULL;
if (md->key == GRPC_MDSTR_SCHEME) return NULL; if (md->key == GRPC_MDSTR_SCHEME) return NULL;
@ -275,7 +268,7 @@ static void hc_mutate_op(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
/* when all the send_message data is available, then create a MDELEM and /* when all the send_message data is available, then create a MDELEM and
append to headers */ append to headers */
grpc_mdelem *payload_bin = grpc_mdelem_from_metadata_strings( grpc_mdelem *payload_bin = grpc_mdelem_from_metadata_strings(
GRPC_MDSTR_GRPC_PAYLOAD_BIN, exec_ctx, GRPC_MDSTR_GRPC_PAYLOAD_BIN,
grpc_mdstr_from_buffer(calld->payload_bytes, grpc_mdstr_from_buffer(calld->payload_bytes,
op->send_message->length)); op->send_message->length));
grpc_metadata_batch_add_tail(op->send_initial_metadata, grpc_metadata_batch_add_tail(op->send_initial_metadata,
@ -292,8 +285,8 @@ static void hc_mutate_op(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
} }
} }
grpc_metadata_batch_filter(op->send_initial_metadata, client_strip_filter, grpc_metadata_batch_filter(exec_ctx, op->send_initial_metadata,
elem); client_strip_filter, elem);
/* Send : prefixed headers, which have to be before any application /* Send : prefixed headers, which have to be before any application
layer headers. */ layer headers. */
grpc_metadata_batch_add_head(op->send_initial_metadata, &calld->method, grpc_metadata_batch_add_head(op->send_initial_metadata, &calld->method,
@ -371,7 +364,7 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
const grpc_call_final_info *final_info, const grpc_call_final_info *final_info,
void *ignored) { void *ignored) {
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
grpc_slice_buffer_destroy(&calld->slices); grpc_slice_buffer_destroy_internal(exec_ctx, &calld->slices);
} }
static grpc_mdelem *scheme_from_args(const grpc_channel_args *args) { static grpc_mdelem *scheme_from_args(const grpc_channel_args *args) {
@ -472,7 +465,7 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx,
chand->max_payload_size_for_get = chand->max_payload_size_for_get =
max_payload_size_from_args(args->channel_args); max_payload_size_from_args(args->channel_args);
chand->user_agent = grpc_mdelem_from_metadata_strings( chand->user_agent = grpc_mdelem_from_metadata_strings(
GRPC_MDSTR_USER_AGENT, exec_ctx, GRPC_MDSTR_USER_AGENT,
user_agent_from_args(args->channel_args, user_agent_from_args(args->channel_args,
args->optional_transport->vtable->name)); args->optional_transport->vtable->name));
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
@ -482,7 +475,7 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx,
static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem) { grpc_channel_element *elem) {
channel_data *chand = elem->channel_data; channel_data *chand = elem->channel_data;
GRPC_MDELEM_UNREF(chand->user_agent); GRPC_MDELEM_UNREF(exec_ctx, chand->user_agent);
} }
const grpc_channel_filter grpc_http_client_filter = { const grpc_channel_filter grpc_http_client_filter = {

@ -38,6 +38,7 @@
#include <string.h> #include <string.h>
#include "src/core/lib/profiling/timers.h" #include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/percent_encoding.h" #include "src/core/lib/slice/percent_encoding.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/static_metadata.h" #include "src/core/lib/transport/static_metadata.h"
#define EXPECTED_CONTENT_TYPE "application/grpc" #define EXPECTED_CONTENT_TYPE "application/grpc"
@ -82,31 +83,28 @@ typedef struct call_data {
typedef struct channel_data { uint8_t unused; } channel_data; typedef struct channel_data { uint8_t unused; } channel_data;
typedef struct { static grpc_mdelem *server_filter_outgoing_metadata(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem; void *user_data,
grpc_exec_ctx *exec_ctx;
} server_filter_args;
static grpc_mdelem *server_filter_outgoing_metadata(void *user_data,
grpc_mdelem *md) { grpc_mdelem *md) {
if (md->key == GRPC_MDSTR_GRPC_MESSAGE) { if (md->key == GRPC_MDSTR_GRPC_MESSAGE) {
grpc_slice pct_encoded_msg = grpc_percent_encode_slice( grpc_slice pct_encoded_msg = grpc_percent_encode_slice(
md->value->slice, grpc_compatible_percent_encoding_unreserved_bytes); md->value->slice, grpc_compatible_percent_encoding_unreserved_bytes);
if (grpc_slice_is_equivalent(pct_encoded_msg, md->value->slice)) { if (grpc_slice_is_equivalent(pct_encoded_msg, md->value->slice)) {
grpc_slice_unref(pct_encoded_msg); grpc_slice_unref_internal(exec_ctx, pct_encoded_msg);
return md; return md;
} else { } else {
return grpc_mdelem_from_metadata_strings( return grpc_mdelem_from_metadata_strings(
GRPC_MDSTR_GRPC_MESSAGE, grpc_mdstr_from_slice(pct_encoded_msg)); exec_ctx, GRPC_MDSTR_GRPC_MESSAGE,
grpc_mdstr_from_slice(exec_ctx, pct_encoded_msg));
} }
} else { } else {
return md; return md;
} }
} }
static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) { static grpc_mdelem *server_filter(grpc_exec_ctx *exec_ctx, void *user_data,
server_filter_args *a = user_data; grpc_mdelem *md) {
grpc_call_element *elem = a->elem; grpc_call_element *elem = user_data;
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
/* Check if it is one of the headers we care about. */ /* Check if it is one of the headers we care about. */
@ -157,7 +155,7 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
/* swallow it and error everything out. */ /* swallow it and error everything out. */
/* TODO(klempner): We ought to generate more descriptive error messages /* TODO(klempner): We ought to generate more descriptive error messages
on the wire here. */ on the wire here. */
grpc_call_element_send_cancel(a->exec_ctx, elem); grpc_call_element_send_cancel(exec_ctx, elem);
return NULL; return NULL;
} else if (md->key == GRPC_MDSTR_PATH) { } else if (md->key == GRPC_MDSTR_PATH) {
if (calld->seen_path) { if (calld->seen_path) {
@ -173,7 +171,7 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
/* translate host to :authority since :authority may be /* translate host to :authority since :authority may be
omitted */ omitted */
grpc_mdelem *authority = grpc_mdelem_from_metadata_strings( grpc_mdelem *authority = grpc_mdelem_from_metadata_strings(
GRPC_MDSTR_AUTHORITY, GRPC_MDSTR_REF(md->value)); exec_ctx, GRPC_MDSTR_AUTHORITY, GRPC_MDSTR_REF(md->value));
calld->seen_authority = 1; calld->seen_authority = 1;
return authority; return authority;
} else if (md->key == GRPC_MDSTR_GRPC_PAYLOAD_BIN) { } else if (md->key == GRPC_MDSTR_GRPC_PAYLOAD_BIN) {
@ -181,7 +179,7 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
header field */ header field */
calld->seen_payload_bin = 1; calld->seen_payload_bin = 1;
grpc_slice_buffer_add(&calld->read_slice_buffer, grpc_slice_buffer_add(&calld->read_slice_buffer,
grpc_slice_ref(md->value->slice)); grpc_slice_ref_internal(md->value->slice));
grpc_slice_buffer_stream_init(&calld->read_stream, grpc_slice_buffer_stream_init(&calld->read_stream,
&calld->read_slice_buffer, 0); &calld->read_slice_buffer, 0);
return NULL; return NULL;
@ -195,10 +193,8 @@ static void hs_on_recv(grpc_exec_ctx *exec_ctx, void *user_data,
grpc_call_element *elem = user_data; grpc_call_element *elem = user_data;
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
if (err == GRPC_ERROR_NONE) { if (err == GRPC_ERROR_NONE) {
server_filter_args a; grpc_metadata_batch_filter(exec_ctx, calld->recv_initial_metadata,
a.elem = elem; server_filter, elem);
a.exec_ctx = exec_ctx;
grpc_metadata_batch_filter(calld->recv_initial_metadata, server_filter, &a);
/* Have we seen the required http2 transport headers? /* Have we seen the required http2 transport headers?
(:method, :scheme, content-type, with :path and :authority covered (:method, :scheme, content-type, with :path and :authority covered
at the channel level right now) */ at the channel level right now) */
@ -310,9 +306,8 @@ static void hs_mutate_op(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
} }
if (op->send_trailing_metadata) { if (op->send_trailing_metadata) {
server_filter_args a = {elem, exec_ctx}; grpc_metadata_batch_filter(exec_ctx, op->send_trailing_metadata,
grpc_metadata_batch_filter(op->send_trailing_metadata, server_filter_outgoing_metadata, elem);
server_filter_outgoing_metadata, &a);
} }
} }
@ -349,7 +344,7 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
const grpc_call_final_info *final_info, const grpc_call_final_info *final_info,
void *ignored) { void *ignored) {
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
grpc_slice_buffer_destroy(&calld->read_slice_buffer); grpc_slice_buffer_destroy_internal(exec_ctx, &calld->read_slice_buffer);
} }
/* Constructor for channel_data */ /* Constructor for channel_data */

@ -54,8 +54,12 @@ static void* message_size_limits_copy(void* value) {
return new_value; return new_value;
} }
static void message_size_limits_free(grpc_exec_ctx* exec_ctx, void* value) {
gpr_free(value);
}
static const grpc_mdstr_hash_table_vtable message_size_limits_vtable = { static const grpc_mdstr_hash_table_vtable message_size_limits_vtable = {
gpr_free, message_size_limits_copy}; message_size_limits_free, message_size_limits_copy};
static void* message_size_limits_create_from_json(const grpc_json* json) { static void* message_size_limits_create_from_json(const grpc_json* json) {
int max_request_message_bytes = -1; int max_request_message_bytes = -1;
@ -169,8 +173,8 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
calld->max_send_size = chand->max_send_size; calld->max_send_size = chand->max_send_size;
calld->max_recv_size = chand->max_recv_size; calld->max_recv_size = chand->max_recv_size;
if (chand->method_limit_table != NULL) { if (chand->method_limit_table != NULL) {
message_size_limits* limits = message_size_limits* limits = grpc_method_config_table_get(
grpc_method_config_table_get(chand->method_limit_table, args->path); exec_ctx, chand->method_limit_table, args->path);
if (limits != NULL) { if (limits != NULL) {
if (limits->max_send_size >= 0 && if (limits->max_send_size >= 0 &&
(limits->max_send_size < calld->max_send_size || (limits->max_send_size < calld->max_send_size ||
@ -227,7 +231,7 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
if (service_config != NULL) { if (service_config != NULL) {
chand->method_limit_table = chand->method_limit_table =
grpc_service_config_create_method_config_table( grpc_service_config_create_method_config_table(
service_config, message_size_limits_create_from_json, exec_ctx, service_config, message_size_limits_create_from_json,
&message_size_limits_vtable); &message_size_limits_vtable);
grpc_service_config_destroy(service_config); grpc_service_config_destroy(service_config);
} }
@ -239,7 +243,7 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
static void destroy_channel_elem(grpc_exec_ctx* exec_ctx, static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
grpc_channel_element* elem) { grpc_channel_element* elem) {
channel_data* chand = elem->channel_data; channel_data* chand = elem->channel_data;
grpc_mdstr_hash_table_unref(chand->method_limit_table); grpc_mdstr_hash_table_unref(exec_ctx, chand->method_limit_table);
} }
const grpc_channel_filter grpc_message_size_filter = { const grpc_channel_filter grpc_message_size_filter = {

@ -40,10 +40,12 @@
#include <zlib.h> #include <zlib.h>
#include "src/core/lib/slice/slice_internal.h"
#define OUTPUT_BLOCK_SIZE 1024 #define OUTPUT_BLOCK_SIZE 1024
static int zlib_body(z_stream* zs, grpc_slice_buffer* input, static int zlib_body(grpc_exec_ctx* exec_ctx, z_stream* zs,
grpc_slice_buffer* output, grpc_slice_buffer* input, grpc_slice_buffer* output,
int (*flate)(z_stream* zs, int flush)) { int (*flate)(z_stream* zs, int flush)) {
int r; int r;
int flush; int flush;
@ -87,7 +89,7 @@ static int zlib_body(z_stream* zs, grpc_slice_buffer* input,
return 1; return 1;
error: error:
grpc_slice_unref(outbuf); grpc_slice_unref_internal(exec_ctx, outbuf);
return 0; return 0;
} }
@ -97,8 +99,8 @@ static void* zalloc_gpr(void* opaque, unsigned int items, unsigned int size) {
static void zfree_gpr(void* opaque, void* address) { gpr_free(address); } static void zfree_gpr(void* opaque, void* address) { gpr_free(address); }
static int zlib_compress(grpc_slice_buffer* input, grpc_slice_buffer* output, static int zlib_compress(grpc_exec_ctx* exec_ctx, grpc_slice_buffer* input,
int gzip) { grpc_slice_buffer* output, int gzip) {
z_stream zs; z_stream zs;
int r; int r;
size_t i; size_t i;
@ -110,10 +112,11 @@ static int zlib_compress(grpc_slice_buffer* input, grpc_slice_buffer* output,
r = deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15 | (gzip ? 16 : 0), r = deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15 | (gzip ? 16 : 0),
8, Z_DEFAULT_STRATEGY); 8, Z_DEFAULT_STRATEGY);
GPR_ASSERT(r == Z_OK); GPR_ASSERT(r == Z_OK);
r = zlib_body(&zs, input, output, deflate) && output->length < input->length; r = zlib_body(exec_ctx, &zs, input, output, deflate) &&
output->length < input->length;
if (!r) { if (!r) {
for (i = count_before; i < output->count; i++) { for (i = count_before; i < output->count; i++) {
grpc_slice_unref(output->slices[i]); grpc_slice_unref_internal(exec_ctx, output->slices[i]);
} }
output->count = count_before; output->count = count_before;
output->length = length_before; output->length = length_before;
@ -122,8 +125,8 @@ static int zlib_compress(grpc_slice_buffer* input, grpc_slice_buffer* output,
return r; return r;
} }
static int zlib_decompress(grpc_slice_buffer* input, grpc_slice_buffer* output, static int zlib_decompress(grpc_exec_ctx* exec_ctx, grpc_slice_buffer* input,
int gzip) { grpc_slice_buffer* output, int gzip) {
z_stream zs; z_stream zs;
int r; int r;
size_t i; size_t i;
@ -134,10 +137,10 @@ static int zlib_decompress(grpc_slice_buffer* input, grpc_slice_buffer* output,
zs.zfree = zfree_gpr; zs.zfree = zfree_gpr;
r = inflateInit2(&zs, 15 | (gzip ? 16 : 0)); r = inflateInit2(&zs, 15 | (gzip ? 16 : 0));
GPR_ASSERT(r == Z_OK); GPR_ASSERT(r == Z_OK);
r = zlib_body(&zs, input, output, inflate); r = zlib_body(exec_ctx, &zs, input, output, inflate);
if (!r) { if (!r) {
for (i = count_before; i < output->count; i++) { for (i = count_before; i < output->count; i++) {
grpc_slice_unref(output->slices[i]); grpc_slice_unref_internal(exec_ctx, output->slices[i]);
} }
output->count = count_before; output->count = count_before;
output->length = length_before; output->length = length_before;
@ -149,12 +152,13 @@ static int zlib_decompress(grpc_slice_buffer* input, grpc_slice_buffer* output,
static int copy(grpc_slice_buffer* input, grpc_slice_buffer* output) { static int copy(grpc_slice_buffer* input, grpc_slice_buffer* output) {
size_t i; size_t i;
for (i = 0; i < input->count; i++) { for (i = 0; i < input->count; i++) {
grpc_slice_buffer_add(output, grpc_slice_ref(input->slices[i])); grpc_slice_buffer_add(output, grpc_slice_ref_internal(input->slices[i]));
} }
return 1; return 1;
} }
static int compress_inner(grpc_compression_algorithm algorithm, static int compress_inner(grpc_exec_ctx* exec_ctx,
grpc_compression_algorithm algorithm,
grpc_slice_buffer* input, grpc_slice_buffer* output) { grpc_slice_buffer* input, grpc_slice_buffer* output) {
switch (algorithm) { switch (algorithm) {
case GRPC_COMPRESS_NONE: case GRPC_COMPRESS_NONE:
@ -162,9 +166,9 @@ static int compress_inner(grpc_compression_algorithm algorithm,
rely on that here */ rely on that here */
return 0; return 0;
case GRPC_COMPRESS_DEFLATE: case GRPC_COMPRESS_DEFLATE:
return zlib_compress(input, output, 0); return zlib_compress(exec_ctx, input, output, 0);
case GRPC_COMPRESS_GZIP: case GRPC_COMPRESS_GZIP:
return zlib_compress(input, output, 1); return zlib_compress(exec_ctx, input, output, 1);
case GRPC_COMPRESS_ALGORITHMS_COUNT: case GRPC_COMPRESS_ALGORITHMS_COUNT:
break; break;
} }
@ -172,24 +176,26 @@ static int compress_inner(grpc_compression_algorithm algorithm,
return 0; return 0;
} }
int grpc_msg_compress(grpc_compression_algorithm algorithm, int grpc_msg_compress(grpc_exec_ctx* exec_ctx,
grpc_compression_algorithm algorithm,
grpc_slice_buffer* input, grpc_slice_buffer* output) { grpc_slice_buffer* input, grpc_slice_buffer* output) {
if (!compress_inner(algorithm, input, output)) { if (!compress_inner(exec_ctx, algorithm, input, output)) {
copy(input, output); copy(input, output);
return 0; return 0;
} }
return 1; return 1;
} }
int grpc_msg_decompress(grpc_compression_algorithm algorithm, int grpc_msg_decompress(grpc_exec_ctx* exec_ctx,
grpc_compression_algorithm algorithm,
grpc_slice_buffer* input, grpc_slice_buffer* output) { grpc_slice_buffer* input, grpc_slice_buffer* output) {
switch (algorithm) { switch (algorithm) {
case GRPC_COMPRESS_NONE: case GRPC_COMPRESS_NONE:
return copy(input, output); return copy(input, output);
case GRPC_COMPRESS_DEFLATE: case GRPC_COMPRESS_DEFLATE:
return zlib_decompress(input, output, 0); return zlib_decompress(exec_ctx, input, output, 0);
case GRPC_COMPRESS_GZIP: case GRPC_COMPRESS_GZIP:
return zlib_decompress(input, output, 1); return zlib_decompress(exec_ctx, input, output, 1);
case GRPC_COMPRESS_ALGORITHMS_COUNT: case GRPC_COMPRESS_ALGORITHMS_COUNT:
break; break;
} }

@ -40,13 +40,15 @@
/* compress 'input' to 'output' using 'algorithm'. /* compress 'input' to 'output' using 'algorithm'.
On success, appends compressed slices to output and returns 1. On success, appends compressed slices to output and returns 1.
On failure, appends uncompressed slices to output and returns 0. */ On failure, appends uncompressed slices to output and returns 0. */
int grpc_msg_compress(grpc_compression_algorithm algorithm, int grpc_msg_compress(grpc_exec_ctx* exec_ctx,
grpc_compression_algorithm algorithm,
grpc_slice_buffer* input, grpc_slice_buffer* output); grpc_slice_buffer* input, grpc_slice_buffer* output);
/* decompress 'input' to 'output' using 'algorithm'. /* decompress 'input' to 'output' using 'algorithm'.
On success, appends slices to output and returns 1. On success, appends slices to output and returns 1.
On failure, output is unchanged, and returns 0. */ On failure, output is unchanged, and returns 0. */
int grpc_msg_decompress(grpc_compression_algorithm algorithm, int grpc_msg_decompress(grpc_exec_ctx* exec_ctx,
grpc_compression_algorithm algorithm,
grpc_slice_buffer* input, grpc_slice_buffer* output); grpc_slice_buffer* input, grpc_slice_buffer* output);
#endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */ #endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */

@ -47,6 +47,7 @@
#include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/sockaddr_utils.h" #include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/tcp_client.h" #include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/support/string.h" #include "src/core/lib/support/string.h"
typedef struct { typedef struct {
@ -111,14 +112,14 @@ static void finish(grpc_exec_ctx *exec_ctx, internal_request *req,
if (req->ep != NULL) { if (req->ep != NULL) {
grpc_endpoint_destroy(exec_ctx, req->ep); grpc_endpoint_destroy(exec_ctx, req->ep);
} }
grpc_slice_unref(req->request_text); grpc_slice_unref_internal(exec_ctx, req->request_text);
gpr_free(req->host); gpr_free(req->host);
gpr_free(req->ssl_host_override); gpr_free(req->ssl_host_override);
grpc_iomgr_unregister_object(&req->iomgr_obj); grpc_iomgr_unregister_object(&req->iomgr_obj);
grpc_slice_buffer_destroy(&req->incoming); grpc_slice_buffer_destroy_internal(exec_ctx, &req->incoming);
grpc_slice_buffer_destroy(&req->outgoing); grpc_slice_buffer_destroy_internal(exec_ctx, &req->outgoing);
GRPC_ERROR_UNREF(req->overall_error); GRPC_ERROR_UNREF(req->overall_error);
grpc_resource_quota_internal_unref(exec_ctx, req->resource_quota); grpc_resource_quota_unref_internal(exec_ctx, req->resource_quota);
gpr_free(req); gpr_free(req);
} }
@ -178,7 +179,7 @@ static void done_write(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
} }
static void start_write(grpc_exec_ctx *exec_ctx, internal_request *req) { static void start_write(grpc_exec_ctx *exec_ctx, internal_request *req) {
grpc_slice_ref(req->request_text); grpc_slice_ref_internal(req->request_text);
grpc_slice_buffer_add(&req->outgoing, req->request_text); grpc_slice_buffer_add(&req->outgoing, req->request_text);
grpc_endpoint_write(exec_ctx, req->ep, &req->outgoing, &req->done_write); grpc_endpoint_write(exec_ctx, req->ep, &req->outgoing, &req->done_write);
} }
@ -266,7 +267,7 @@ static void internal_request_begin(grpc_exec_ctx *exec_ctx,
req->context = context; req->context = context;
req->pollent = pollent; req->pollent = pollent;
req->overall_error = GRPC_ERROR_NONE; req->overall_error = GRPC_ERROR_NONE;
req->resource_quota = grpc_resource_quota_internal_ref(resource_quota); req->resource_quota = grpc_resource_quota_ref_internal(resource_quota);
grpc_closure_init(&req->on_read, on_read, req, grpc_schedule_on_exec_ctx); grpc_closure_init(&req->on_read, on_read, req, grpc_schedule_on_exec_ctx);
grpc_closure_init(&req->done_write, done_write, req, grpc_closure_init(&req->done_write, done_write, req,
grpc_schedule_on_exec_ctx); grpc_schedule_on_exec_ctx);

@ -41,6 +41,7 @@
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/security/transport/security_handshaker.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" #include "src/core/lib/support/string.h"
#include "src/core/lib/tsi/ssl_transport_security.h" #include "src/core/lib/tsi/ssl_transport_security.h"
@ -50,7 +51,8 @@ typedef struct {
char *secure_peer_name; char *secure_peer_name;
} grpc_httpcli_ssl_channel_security_connector; } grpc_httpcli_ssl_channel_security_connector;
static void httpcli_ssl_destroy(grpc_security_connector *sc) { static void httpcli_ssl_destroy(grpc_exec_ctx *exec_ctx,
grpc_security_connector *sc) {
grpc_httpcli_ssl_channel_security_connector *c = grpc_httpcli_ssl_channel_security_connector *c =
(grpc_httpcli_ssl_channel_security_connector *)sc; (grpc_httpcli_ssl_channel_security_connector *)sc;
if (c->handshaker_factory != NULL) { if (c->handshaker_factory != NULL) {
@ -104,8 +106,9 @@ static grpc_security_connector_vtable httpcli_ssl_vtable = {
httpcli_ssl_destroy, httpcli_ssl_check_peer}; httpcli_ssl_destroy, httpcli_ssl_check_peer};
static grpc_security_status httpcli_ssl_channel_security_connector_create( static grpc_security_status httpcli_ssl_channel_security_connector_create(
const unsigned char *pem_root_certs, size_t pem_root_certs_size, grpc_exec_ctx *exec_ctx, const unsigned char *pem_root_certs,
const char *secure_peer_name, grpc_channel_security_connector **sc) { size_t pem_root_certs_size, const char *secure_peer_name,
grpc_channel_security_connector **sc) {
tsi_result result = TSI_OK; tsi_result result = TSI_OK;
grpc_httpcli_ssl_channel_security_connector *c; grpc_httpcli_ssl_channel_security_connector *c;
@ -129,7 +132,7 @@ static grpc_security_status httpcli_ssl_channel_security_connector_create(
if (result != TSI_OK) { if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.", gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
tsi_result_to_string(result)); tsi_result_to_string(result));
httpcli_ssl_destroy(&c->base.base); httpcli_ssl_destroy(exec_ctx, &c->base.base);
*sc = NULL; *sc = NULL;
return GRPC_SECURITY_ERROR; return GRPC_SECURITY_ERROR;
} }
@ -156,8 +159,8 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error_free_string(msg); grpc_error_free_string(msg);
c->func(exec_ctx, c->arg, NULL); c->func(exec_ctx, c->arg, NULL);
} else { } else {
grpc_channel_args_destroy(args->args); grpc_channel_args_destroy(exec_ctx, args->args);
grpc_slice_buffer_destroy(args->read_buffer); grpc_slice_buffer_destroy_internal(exec_ctx, args->read_buffer);
gpr_free(args->read_buffer); gpr_free(args->read_buffer);
c->func(exec_ctx, c->arg, args->endpoint); c->func(exec_ctx, c->arg, args->endpoint);
} }
@ -184,14 +187,14 @@ static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg,
c->arg = arg; c->arg = arg;
c->handshake_mgr = grpc_handshake_manager_create(); c->handshake_mgr = grpc_handshake_manager_create();
GPR_ASSERT(httpcli_ssl_channel_security_connector_create( GPR_ASSERT(httpcli_ssl_channel_security_connector_create(
pem_root_certs, pem_root_certs_size, host, &sc) == exec_ctx, pem_root_certs, pem_root_certs_size, host, &sc) ==
GRPC_SECURITY_OK); GRPC_SECURITY_OK);
grpc_channel_security_connector_add_handshakers(exec_ctx, sc, grpc_channel_security_connector_add_handshakers(exec_ctx, sc,
c->handshake_mgr); c->handshake_mgr);
grpc_handshake_manager_do_handshake( grpc_handshake_manager_do_handshake(
exec_ctx, c->handshake_mgr, tcp, NULL /* channel_args */, deadline, exec_ctx, c->handshake_mgr, tcp, NULL /* channel_args */, deadline,
NULL /* acceptor */, on_handshake_done, c /* user_data */); NULL /* acceptor */, on_handshake_done, c /* user_data */);
GRPC_SECURITY_CONNECTOR_UNREF(&sc->base, "httpcli"); GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, &sc->base, "httpcli");
} }
const grpc_httpcli_handshaker grpc_httpcli_ssl = {"https", ssl_handshake}; const grpc_httpcli_handshaker grpc_httpcli_ssl = {"https", ssl_handshake};

@ -0,0 +1,6 @@
# iomgr
Platform abstractions for I/O (mostly network).
Provides abstractions over TCP/UDP I/O, file loading, polling, and concurrency
management for various operating systems.

@ -35,6 +35,8 @@
#define GRPC_CORE_LIB_IOMGR_CLOSURE_H #define GRPC_CORE_LIB_IOMGR_CLOSURE_H
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
#include <grpc/impl/codegen/exec_ctx_fwd.h>
#include <stdbool.h> #include <stdbool.h>
#include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/error.h"
#include "src/core/lib/support/mpscq.h" #include "src/core/lib/support/mpscq.h"
@ -42,10 +44,6 @@
struct grpc_closure; struct grpc_closure;
typedef struct grpc_closure grpc_closure; typedef struct grpc_closure grpc_closure;
/* forward declaration for exec_ctx.h */
struct grpc_exec_ctx;
typedef struct grpc_exec_ctx grpc_exec_ctx;
typedef struct grpc_closure_list { typedef struct grpc_closure_list {
grpc_closure *head; grpc_closure *head;
grpc_closure *tail; grpc_closure *tail;

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

@ -130,9 +130,8 @@ static void executor_push(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
gpr_mu_unlock(&g_executor.mu); gpr_mu_unlock(&g_executor.mu);
} }
void grpc_executor_shutdown() { void grpc_executor_shutdown(grpc_exec_ctx *exec_ctx) {
int pending_join; int pending_join;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_mu_lock(&g_executor.mu); gpr_mu_lock(&g_executor.mu);
pending_join = g_executor.pending_join; pending_join = g_executor.pending_join;
@ -147,11 +146,11 @@ void grpc_executor_shutdown() {
while (c != NULL) { while (c != NULL) {
grpc_closure *next = c->next_data.next; grpc_closure *next = c->next_data.next;
grpc_error *error = c->error_data.error; grpc_error *error = c->error_data.error;
c->cb(&exec_ctx, c->cb_arg, error); c->cb(exec_ctx, c->cb_arg, error);
GRPC_ERROR_UNREF(error); GRPC_ERROR_UNREF(error);
c = next; c = next;
} }
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_flush(exec_ctx);
GPR_ASSERT(grpc_closure_list_empty(g_executor.closures)); GPR_ASSERT(grpc_closure_list_empty(g_executor.closures));
if (pending_join) { if (pending_join) {
gpr_thd_join(g_executor.tid); gpr_thd_join(g_executor.tid);

@ -46,6 +46,6 @@ void grpc_executor_init();
extern grpc_closure_scheduler *grpc_executor_scheduler; extern grpc_closure_scheduler *grpc_executor_scheduler;
/** Shutdown the executor, running all pending work as part of the call */ /** Shutdown the executor, running all pending work as part of the call */
void grpc_executor_shutdown(); void grpc_executor_shutdown(grpc_exec_ctx *exec_ctx);
#endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_H */ #endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_H */

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

Loading…
Cancel
Save