grpc 1.30.0 → 1.31.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (383) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +560 -619
  3. data/include/grpc/grpc_security.h +8 -0
  4. data/include/grpc/grpc_security_constants.h +3 -0
  5. data/include/grpc/impl/codegen/grpc_types.h +7 -5
  6. data/include/grpc/impl/codegen/port_platform.h +0 -32
  7. data/src/core/ext/filters/client_channel/backend_metric.cc +12 -9
  8. data/src/core/ext/filters/client_channel/client_channel.cc +406 -261
  9. data/src/core/ext/filters/client_channel/config_selector.cc +62 -0
  10. data/src/core/ext/filters/client_channel/config_selector.h +93 -0
  11. data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +24 -2
  12. data/src/core/ext/filters/client_channel/health/health_check_client.cc +2 -0
  13. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +6 -5
  14. data/src/core/ext/filters/client_channel/http_proxy.cc +6 -4
  15. data/src/core/ext/filters/client_channel/lb_policy.h +2 -0
  16. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +39 -23
  17. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +4 -6
  18. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +3 -4
  19. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +381 -72
  20. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +4 -5
  21. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +5 -2
  22. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +6 -5
  23. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +8 -6
  24. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +9 -7
  25. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +7 -5
  26. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +33 -48
  27. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +6 -2
  28. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +21 -18
  29. data/src/core/ext/filters/client_channel/resolver_registry.cc +13 -14
  30. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +6 -7
  31. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +33 -28
  32. data/src/core/ext/filters/client_channel/resolving_lb_policy.h +39 -20
  33. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +142 -0
  34. data/src/core/ext/filters/client_channel/subchannel.cc +1 -1
  35. data/src/core/ext/filters/client_channel/xds/xds_api.cc +327 -123
  36. data/src/core/ext/filters/client_channel/xds/xds_api.h +72 -7
  37. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +12 -23
  38. data/src/core/ext/filters/client_channel/xds/xds_client.cc +112 -33
  39. data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +10 -10
  40. data/src/core/ext/filters/http/client/http_client_filter.cc +5 -5
  41. data/src/core/ext/filters/http/http_filters_plugin.cc +2 -1
  42. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +74 -33
  43. data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +3 -1
  44. data/src/core/ext/filters/message_size/message_size_filter.cc +56 -80
  45. data/src/core/ext/filters/message_size/message_size_filter.h +6 -0
  46. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +383 -347
  47. data/src/core/ext/transport/chttp2/server/chttp2_server.h +6 -2
  48. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +1 -1
  49. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +7 -13
  50. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +7 -8
  51. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +19 -4
  52. data/src/core/ext/transport/chttp2/transport/flow_control.cc +22 -27
  53. data/src/core/ext/transport/chttp2/transport/flow_control.h +14 -16
  54. data/src/core/ext/transport/chttp2/transport/frame_data.cc +9 -12
  55. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +4 -6
  56. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -6
  57. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +12 -13
  58. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +6 -7
  59. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +9 -12
  60. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +25 -29
  61. data/src/core/ext/transport/chttp2/transport/hpack_table.cc +13 -17
  62. data/src/core/ext/transport/chttp2/transport/internal.h +13 -0
  63. data/src/core/ext/transport/chttp2/transport/parsing.cc +33 -43
  64. data/src/core/ext/transport/chttp2/transport/writing.cc +9 -14
  65. data/src/core/ext/transport/inproc/inproc_transport.cc +35 -15
  66. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +0 -1
  67. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +3 -4
  68. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +0 -1
  69. data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +80 -69
  70. data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +24 -23
  71. data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +66 -56
  72. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +1 -2
  73. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +2 -2
  74. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +317 -311
  75. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +42 -34
  76. data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +7 -7
  77. data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +79 -61
  78. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +55 -49
  79. data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +9 -8
  80. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +1 -1
  81. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +163 -169
  82. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +51 -45
  83. data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +4 -5
  84. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +107 -100
  85. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +137 -117
  86. data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +9 -9
  87. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +105 -87
  88. data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +12 -13
  89. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +1 -1
  90. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +95 -101
  91. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +1 -2
  92. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +1 -1
  93. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +49 -65
  94. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -1
  95. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +49 -42
  96. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +70 -62
  97. data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +1 -2
  98. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +81 -65
  99. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -1
  100. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +1 -1
  101. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +91 -80
  102. data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +9 -10
  103. data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +1 -2
  104. data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +36 -31
  105. data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -1
  106. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +7 -7
  107. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +648 -696
  108. data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +16 -15
  109. data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +1 -2
  110. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +1 -1
  111. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +95 -88
  112. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +234 -199
  113. data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +5 -5
  114. data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +13 -13
  115. data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +1 -2
  116. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +20 -18
  117. data/src/core/ext/upb-generated/envoy/type/http.upb.h +0 -1
  118. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +18 -17
  119. data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +14 -14
  120. data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +23 -23
  121. data/src/core/ext/upb-generated/envoy/type/percent.upb.h +8 -9
  122. data/src/core/ext/upb-generated/envoy/type/range.upb.h +15 -16
  123. data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +7 -8
  124. data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +36 -35
  125. data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +0 -1
  126. data/src/core/ext/upb-generated/google/api/annotations.upb.h +0 -1
  127. data/src/core/ext/upb-generated/google/api/http.upb.h +29 -28
  128. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +5 -6
  129. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +3 -3
  130. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +412 -386
  131. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +5 -6
  132. data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +1 -2
  133. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +1 -1
  134. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +33 -54
  135. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +5 -6
  136. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +27 -28
  137. data/src/core/ext/upb-generated/google/rpc/status.upb.h +8 -8
  138. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +1 -1
  139. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +32 -45
  140. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +4 -4
  141. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +157 -178
  142. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +14 -13
  143. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +6 -7
  144. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +59 -56
  145. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +11 -12
  146. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +0 -1
  147. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +5 -6
  148. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +6 -6
  149. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +41 -68
  150. data/src/core/ext/upb-generated/validate/validate.upb.h +536 -535
  151. data/src/core/lib/channel/channel_trace.cc +2 -6
  152. data/src/core/lib/channel/channelz.cc +5 -15
  153. data/src/core/lib/gpr/log_linux.cc +6 -8
  154. data/src/core/lib/gpr/log_posix.cc +6 -8
  155. data/src/core/lib/gpr/string.cc +10 -9
  156. data/src/core/lib/gpr/string.h +4 -2
  157. data/src/core/lib/gprpp/global_config_env.cc +8 -6
  158. data/src/core/lib/http/httpcli.cc +13 -10
  159. data/src/core/lib/http/httpcli_security_connector.cc +5 -5
  160. data/src/core/lib/iomgr/cfstream_handle.cc +1 -0
  161. data/src/core/lib/iomgr/endpoint_pair_posix.cc +10 -10
  162. data/src/core/lib/iomgr/error_cfstream.cc +9 -8
  163. data/src/core/lib/iomgr/ev_epoll1_linux.cc +5 -6
  164. data/src/core/lib/iomgr/ev_epollex_linux.cc +15 -21
  165. data/src/core/lib/iomgr/ev_poll_posix.cc +6 -5
  166. data/src/core/lib/iomgr/ev_posix.cc +2 -0
  167. data/src/core/lib/iomgr/iomgr.cc +10 -0
  168. data/src/core/lib/iomgr/iomgr.h +10 -0
  169. data/src/core/lib/iomgr/is_epollexclusive_available.cc +14 -0
  170. data/src/core/lib/iomgr/port.h +1 -21
  171. data/src/core/lib/iomgr/resolve_address_custom.cc +13 -18
  172. data/src/core/lib/iomgr/resolve_address_windows.cc +8 -8
  173. data/src/core/lib/iomgr/resource_quota.cc +34 -31
  174. data/src/core/lib/iomgr/sockaddr_utils.cc +7 -5
  175. data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
  176. data/src/core/lib/iomgr/socket_utils_common_posix.cc +95 -55
  177. data/src/core/lib/iomgr/socket_windows.cc +4 -5
  178. data/src/core/lib/iomgr/tcp_client_cfstream.cc +9 -11
  179. data/src/core/lib/iomgr/tcp_client_custom.cc +6 -9
  180. data/src/core/lib/iomgr/tcp_client_posix.cc +27 -36
  181. data/src/core/lib/iomgr/tcp_client_windows.cc +9 -9
  182. data/src/core/lib/iomgr/tcp_custom.cc +1 -1
  183. data/src/core/lib/iomgr/tcp_custom.h +1 -1
  184. data/src/core/lib/iomgr/tcp_server.cc +3 -4
  185. data/src/core/lib/iomgr/tcp_server.h +7 -5
  186. data/src/core/lib/iomgr/tcp_server_custom.cc +6 -14
  187. data/src/core/lib/iomgr/tcp_server_posix.cc +34 -41
  188. data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -4
  189. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -7
  190. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +4 -9
  191. data/src/core/lib/iomgr/tcp_server_windows.cc +16 -16
  192. data/src/core/lib/iomgr/timer_generic.cc +13 -12
  193. data/src/core/lib/iomgr/udp_server.cc +24 -23
  194. data/src/core/lib/iomgr/udp_server.h +5 -2
  195. data/src/core/lib/iomgr/unix_sockets_posix.cc +9 -14
  196. data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
  197. data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +5 -2
  198. data/src/core/lib/json/json_reader.cc +20 -21
  199. data/src/core/lib/security/credentials/credentials.h +5 -3
  200. data/src/core/lib/security/credentials/google_default/credentials_generic.cc +8 -6
  201. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +12 -9
  202. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +7 -4
  203. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +19 -28
  204. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -6
  205. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +20 -0
  206. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +10 -0
  207. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +10 -0
  208. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +10 -10
  209. data/src/core/lib/security/security_connector/security_connector.cc +2 -0
  210. data/src/core/lib/security/security_connector/security_connector.h +1 -1
  211. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +18 -11
  212. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +5 -0
  213. data/src/core/lib/security/security_connector/ssl_utils.cc +44 -23
  214. data/src/core/lib/security/security_connector/ssl_utils.h +6 -2
  215. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +27 -24
  216. data/src/core/lib/security/transport/auth_filters.h +0 -5
  217. data/src/core/lib/security/transport/client_auth_filter.cc +10 -9
  218. data/src/core/lib/security/util/json_util.cc +12 -13
  219. data/src/core/lib/slice/slice.cc +38 -1
  220. data/src/core/lib/slice/slice_internal.h +1 -0
  221. data/src/core/lib/surface/call.cc +40 -41
  222. data/src/core/lib/surface/completion_queue.cc +271 -14
  223. data/src/core/lib/surface/completion_queue.h +8 -0
  224. data/src/core/lib/surface/init.cc +2 -0
  225. data/src/core/lib/surface/server.cc +565 -632
  226. data/src/core/lib/surface/server.h +34 -12
  227. data/src/core/lib/surface/version.cc +2 -2
  228. data/src/core/lib/transport/transport.h +6 -0
  229. data/src/core/lib/uri/uri_parser.cc +8 -15
  230. data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
  231. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +23 -13
  232. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -0
  233. data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +2 -0
  234. data/src/core/tsi/ssl_transport_security.cc +108 -11
  235. data/src/core/tsi/ssl_transport_security.h +14 -2
  236. data/src/core/tsi/transport_security_interface.h +5 -0
  237. data/src/ruby/bin/math_services_pb.rb +4 -4
  238. data/src/ruby/ext/grpc/extconf.rb +5 -2
  239. data/src/ruby/ext/grpc/rb_call.c +3 -2
  240. data/src/ruby/ext/grpc/rb_call.h +4 -0
  241. data/src/ruby/ext/grpc/rb_call_credentials.c +57 -12
  242. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  243. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
  244. data/src/ruby/lib/grpc/generic/client_stub.rb +1 -1
  245. data/src/ruby/lib/grpc/generic/interceptors.rb +1 -1
  246. data/src/ruby/lib/grpc/version.rb +1 -1
  247. data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +2 -2
  248. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +5 -0
  249. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +28 -12
  250. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto +23 -0
  251. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +2 -0
  252. data/src/ruby/spec/pb/codegen/grpc/testing/same_package_service_name.proto +27 -0
  253. data/src/ruby/spec/pb/codegen/grpc/testing/same_ruby_package_service_name.proto +29 -0
  254. data/src/ruby/spec/pb/codegen/package_option_spec.rb +25 -1
  255. data/src/ruby/spec/support/services.rb +10 -4
  256. data/src/ruby/spec/user_agent_spec.rb +74 -0
  257. data/third_party/boringssl-with-bazel/err_data.c +89 -83
  258. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +3 -3
  259. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_enum.c +3 -3
  260. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.c +1 -1
  261. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +3 -3
  262. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +2 -2
  263. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +1 -1
  264. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +1 -1
  265. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.c +1 -1
  266. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_enum.c +1 -1
  267. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.c +1 -1
  268. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_string.c +1 -1
  269. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +1 -0
  270. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +12 -52
  271. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +0 -22
  272. data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +143 -0
  273. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.c +17 -1
  274. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +11 -1
  275. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +2 -1
  276. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +13 -11
  277. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +24 -23
  278. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +20 -16
  279. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +2 -2
  280. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/util.c +3 -3
  281. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +62 -0
  282. data/third_party/boringssl-with-bazel/src/crypto/mem.c +29 -15
  283. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +7 -0
  284. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +36 -5
  285. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +0 -29
  286. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +116 -363
  287. data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +7 -45
  288. data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +4 -4
  289. data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +8 -0
  290. data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +4 -4
  291. data/third_party/boringssl-with-bazel/src/crypto/x509/x509.c +0 -67
  292. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +13 -6
  293. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +10 -0
  294. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +41 -0
  295. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +4 -1
  296. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +28 -9
  297. data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +25 -0
  298. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +35 -13
  299. data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +0 -154
  300. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +28 -6
  301. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +5 -0
  302. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +74 -35
  303. data/third_party/boringssl-with-bazel/src/include/openssl/aes.h +16 -4
  304. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +22 -22
  305. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +1 -1
  306. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +69 -0
  307. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +33 -16
  308. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +1 -10
  309. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +789 -715
  310. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +3 -3
  311. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +9 -2
  312. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +2 -2
  313. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +9 -0
  314. data/third_party/boringssl-with-bazel/src/ssl/internal.h +17 -14
  315. data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +7 -7
  316. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +28 -0
  317. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +4 -24
  318. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +5 -5
  319. data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +45 -24
  320. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +31 -21
  321. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +12 -9
  322. data/third_party/re2/re2/bitmap256.h +117 -0
  323. data/third_party/re2/re2/bitstate.cc +385 -0
  324. data/third_party/re2/re2/compile.cc +1279 -0
  325. data/third_party/re2/re2/dfa.cc +2130 -0
  326. data/third_party/re2/re2/filtered_re2.cc +121 -0
  327. data/third_party/re2/re2/filtered_re2.h +109 -0
  328. data/third_party/re2/re2/mimics_pcre.cc +197 -0
  329. data/third_party/re2/re2/nfa.cc +713 -0
  330. data/third_party/re2/re2/onepass.cc +623 -0
  331. data/third_party/re2/re2/parse.cc +2464 -0
  332. data/third_party/re2/re2/perl_groups.cc +119 -0
  333. data/third_party/re2/re2/pod_array.h +55 -0
  334. data/third_party/re2/re2/prefilter.cc +710 -0
  335. data/third_party/re2/re2/prefilter.h +108 -0
  336. data/third_party/re2/re2/prefilter_tree.cc +407 -0
  337. data/third_party/re2/re2/prefilter_tree.h +139 -0
  338. data/third_party/re2/re2/prog.cc +988 -0
  339. data/third_party/re2/re2/prog.h +436 -0
  340. data/third_party/re2/re2/re2.cc +1362 -0
  341. data/third_party/re2/re2/re2.h +1002 -0
  342. data/third_party/re2/re2/regexp.cc +980 -0
  343. data/third_party/re2/re2/regexp.h +659 -0
  344. data/third_party/re2/re2/set.cc +154 -0
  345. data/third_party/re2/re2/set.h +80 -0
  346. data/third_party/re2/re2/simplify.cc +657 -0
  347. data/third_party/re2/re2/sparse_array.h +392 -0
  348. data/third_party/re2/re2/sparse_set.h +264 -0
  349. data/third_party/re2/re2/stringpiece.cc +65 -0
  350. data/third_party/re2/re2/stringpiece.h +210 -0
  351. data/third_party/re2/re2/tostring.cc +351 -0
  352. data/third_party/re2/re2/unicode_casefold.cc +582 -0
  353. data/third_party/re2/re2/unicode_casefold.h +78 -0
  354. data/third_party/re2/re2/unicode_groups.cc +6269 -0
  355. data/third_party/re2/re2/unicode_groups.h +67 -0
  356. data/third_party/re2/re2/walker-inl.h +246 -0
  357. data/third_party/re2/util/benchmark.h +156 -0
  358. data/third_party/re2/util/flags.h +26 -0
  359. data/third_party/re2/util/logging.h +109 -0
  360. data/third_party/re2/util/malloc_counter.h +19 -0
  361. data/third_party/re2/util/mix.h +41 -0
  362. data/third_party/re2/util/mutex.h +148 -0
  363. data/third_party/re2/util/pcre.cc +1025 -0
  364. data/third_party/re2/util/pcre.h +681 -0
  365. data/third_party/re2/util/rune.cc +260 -0
  366. data/third_party/re2/util/strutil.cc +149 -0
  367. data/third_party/re2/util/strutil.h +21 -0
  368. data/third_party/re2/util/test.h +50 -0
  369. data/third_party/re2/util/utf.h +44 -0
  370. data/third_party/re2/util/util.h +42 -0
  371. data/third_party/upb/upb/decode.c +467 -504
  372. data/third_party/upb/upb/encode.c +163 -121
  373. data/third_party/upb/upb/msg.c +130 -64
  374. data/third_party/upb/upb/msg.h +418 -14
  375. data/third_party/upb/upb/port_def.inc +35 -6
  376. data/third_party/upb/upb/port_undef.inc +8 -1
  377. data/third_party/upb/upb/table.c +53 -75
  378. data/third_party/upb/upb/table.int.h +11 -43
  379. data/third_party/upb/upb/upb.c +148 -124
  380. data/third_party/upb/upb/upb.h +65 -147
  381. data/third_party/upb/upb/upb.hpp +86 -0
  382. metadata +90 -30
  383. data/third_party/upb/upb/generated_util.h +0 -105
@@ -40,6 +40,9 @@ class MessageSizeParsedConfig : public ServiceConfigParser::ParsedConfig {
40
40
 
41
41
  const message_size_limits& limits() const { return limits_; }
42
42
 
43
+ static const MessageSizeParsedConfig* GetFromCallContext(
44
+ const grpc_call_context_element* context);
45
+
43
46
  private:
44
47
  message_size_limits limits_;
45
48
  };
@@ -54,6 +57,9 @@ class MessageSizeParser : public ServiceConfigParser::Parser {
54
57
  static size_t ParserIndex();
55
58
  };
56
59
 
60
+ int GetMaxRecvSizeFromChannelArgs(const grpc_channel_args* args);
61
+ int GetMaxSendSizeFromChannelArgs(const grpc_channel_args* args);
62
+
57
63
  } // namespace grpc_core
58
64
 
59
65
  #endif /* GRPC_CORE_EXT_FILTERS_MESSAGE_SIZE_MESSAGE_SIZE_FILTER_H */
@@ -23,22 +23,25 @@
23
23
  #include <inttypes.h>
24
24
  #include <limits.h>
25
25
  #include <string.h>
26
+ #include <vector>
27
+
28
+ #include "absl/strings/str_cat.h"
29
+ #include "absl/strings/str_format.h"
26
30
 
27
31
  #include <grpc/grpc.h>
28
32
  #include <grpc/impl/codegen/grpc_types.h>
29
33
  #include <grpc/support/alloc.h>
30
34
  #include <grpc/support/log.h>
31
- #include <grpc/support/string_util.h>
32
35
  #include <grpc/support/sync.h>
33
36
 
34
- #include "absl/strings/str_format.h"
35
-
36
37
  #include "src/core/ext/filters/http/server/http_server_filter.h"
37
38
  #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
38
39
  #include "src/core/ext/transport/chttp2/transport/internal.h"
39
40
  #include "src/core/lib/channel/channel_args.h"
40
41
  #include "src/core/lib/channel/handshaker.h"
41
42
  #include "src/core/lib/channel/handshaker_registry.h"
43
+ #include "src/core/lib/gprpp/ref_counted.h"
44
+ #include "src/core/lib/gprpp/ref_counted_ptr.h"
42
45
  #include "src/core/lib/iomgr/endpoint.h"
43
46
  #include "src/core/lib/iomgr/resolve_address.h"
44
47
  #include "src/core/lib/iomgr/resource_quota.h"
@@ -47,405 +50,438 @@
47
50
  #include "src/core/lib/surface/api_trace.h"
48
51
  #include "src/core/lib/surface/server.h"
49
52
 
50
- struct server_state {
51
- grpc_server* server;
52
- grpc_tcp_server* tcp_server;
53
- grpc_channel_args* args;
54
- gpr_mu mu;
55
- bool shutdown;
56
- grpc_closure tcp_server_shutdown_complete;
57
- grpc_closure* server_destroy_listener_done;
58
- grpc_core::HandshakeManager* pending_handshake_mgrs;
59
- grpc_core::RefCountedPtr<grpc_core::channelz::ListenSocketNode>
60
- channelz_listen_socket;
61
- };
53
+ namespace grpc_core {
54
+ namespace {
55
+
56
+ class Chttp2ServerListener : public ServerListenerInterface {
57
+ public:
58
+ static grpc_error* Create(grpc_server* server, const char* addr,
59
+ grpc_channel_args* args, int* port_num);
60
+
61
+ static grpc_error* CreateWithAcceptor(grpc_server* server, const char* name,
62
+ grpc_channel_args* args);
63
+
64
+ // Do not instantiate directly. Use one of the factory methods above.
65
+ Chttp2ServerListener(grpc_server* server, grpc_channel_args* args);
66
+ ~Chttp2ServerListener();
67
+
68
+ void Start(grpc_server* server,
69
+ const std::vector<grpc_pollset*>* pollsets) override;
70
+
71
+ channelz::ListenSocketNode* channelz_listen_socket_node() const override {
72
+ return channelz_listen_socket_.get();
73
+ }
74
+
75
+ void SetOnDestroyDone(grpc_closure* on_destroy_done) override;
62
76
 
63
- struct server_connection_state {
64
- gpr_refcount refs;
65
- server_state* svr_state;
66
- grpc_pollset* accepting_pollset;
67
- grpc_tcp_server_acceptor* acceptor;
68
- grpc_core::RefCountedPtr<grpc_core::HandshakeManager> handshake_mgr;
69
- // State for enforcing handshake timeout on receiving HTTP/2 settings.
70
- grpc_chttp2_transport* transport;
71
- grpc_millis deadline;
72
- grpc_timer timer;
73
- grpc_closure on_timeout;
74
- grpc_closure on_receive_settings;
75
- grpc_pollset_set* interested_parties;
77
+ void Orphan() override;
78
+
79
+ private:
80
+ class ConnectionState : public RefCounted<ConnectionState> {
81
+ public:
82
+ ConnectionState(Chttp2ServerListener* listener,
83
+ grpc_pollset* accepting_pollset,
84
+ grpc_tcp_server_acceptor* acceptor,
85
+ RefCountedPtr<HandshakeManager> handshake_mgr,
86
+ grpc_channel_args* args, grpc_endpoint* endpoint);
87
+
88
+ ~ConnectionState();
89
+
90
+ private:
91
+ static void OnTimeout(void* arg, grpc_error* error);
92
+ static void OnReceiveSettings(void* arg, grpc_error* error);
93
+ static void OnHandshakeDone(void* arg, grpc_error* error);
94
+
95
+ Chttp2ServerListener* const listener_;
96
+ grpc_pollset* const accepting_pollset_;
97
+ grpc_tcp_server_acceptor* const acceptor_;
98
+ RefCountedPtr<HandshakeManager> handshake_mgr_;
99
+ // State for enforcing handshake timeout on receiving HTTP/2 settings.
100
+ grpc_chttp2_transport* transport_ = nullptr;
101
+ grpc_millis deadline_;
102
+ grpc_timer timer_;
103
+ grpc_closure on_timeout_;
104
+ grpc_closure on_receive_settings_;
105
+ grpc_pollset_set* const interested_parties_;
106
+ };
107
+
108
+ static void OnAccept(void* arg, grpc_endpoint* tcp,
109
+ grpc_pollset* accepting_pollset,
110
+ grpc_tcp_server_acceptor* acceptor);
111
+
112
+ RefCountedPtr<HandshakeManager> CreateHandshakeManager();
113
+
114
+ static void TcpServerShutdownComplete(void* arg, grpc_error* error);
115
+
116
+ static void DestroyListener(grpc_server* /*server*/, void* arg,
117
+ grpc_closure* destroy_done);
118
+
119
+ grpc_server* const server_;
120
+ grpc_channel_args* const args_;
121
+ grpc_tcp_server* tcp_server_;
122
+ Mutex mu_;
123
+ bool shutdown_ = true;
124
+ grpc_closure tcp_server_shutdown_complete_;
125
+ grpc_closure* on_destroy_done_ = nullptr;
126
+ HandshakeManager* pending_handshake_mgrs_ = nullptr;
127
+ RefCountedPtr<channelz::ListenSocketNode> channelz_listen_socket_;
76
128
  };
77
129
 
78
- static void server_connection_state_unref(
79
- server_connection_state* connection_state) {
80
- if (gpr_unref(&connection_state->refs)) {
81
- if (connection_state->transport != nullptr) {
82
- GRPC_CHTTP2_UNREF_TRANSPORT(connection_state->transport,
83
- "receive settings timeout");
84
- }
85
- grpc_pollset_set_del_pollset(connection_state->interested_parties,
86
- connection_state->accepting_pollset);
87
- grpc_pollset_set_destroy(connection_state->interested_parties);
88
- gpr_free(connection_state);
130
+ //
131
+ // Chttp2ServerListener::ConnectionState
132
+ //
133
+
134
+ grpc_millis GetConnectionDeadline(const grpc_channel_args* args) {
135
+ int timeout_ms =
136
+ grpc_channel_args_find_integer(args, GRPC_ARG_SERVER_HANDSHAKE_TIMEOUT_MS,
137
+ {120 * GPR_MS_PER_SEC, 1, INT_MAX});
138
+ return ExecCtx::Get()->Now() + timeout_ms;
139
+ }
140
+
141
+ Chttp2ServerListener::ConnectionState::ConnectionState(
142
+ Chttp2ServerListener* listener, grpc_pollset* accepting_pollset,
143
+ grpc_tcp_server_acceptor* acceptor,
144
+ RefCountedPtr<HandshakeManager> handshake_mgr, grpc_channel_args* args,
145
+ grpc_endpoint* endpoint)
146
+ : listener_(listener),
147
+ accepting_pollset_(accepting_pollset),
148
+ acceptor_(acceptor),
149
+ handshake_mgr_(std::move(handshake_mgr)),
150
+ deadline_(GetConnectionDeadline(args)),
151
+ interested_parties_(grpc_pollset_set_create()) {
152
+ grpc_pollset_set_add_pollset(interested_parties_, accepting_pollset_);
153
+ HandshakerRegistry::AddHandshakers(HANDSHAKER_SERVER, args,
154
+ interested_parties_, handshake_mgr_.get());
155
+ handshake_mgr_->DoHandshake(endpoint, args, deadline_, acceptor_,
156
+ OnHandshakeDone, this);
157
+ }
158
+
159
+ Chttp2ServerListener::ConnectionState::~ConnectionState() {
160
+ if (transport_ != nullptr) {
161
+ GRPC_CHTTP2_UNREF_TRANSPORT(transport_, "receive settings timeout");
89
162
  }
163
+ grpc_pollset_set_del_pollset(interested_parties_, accepting_pollset_);
164
+ grpc_pollset_set_destroy(interested_parties_);
90
165
  }
91
166
 
92
- static void on_timeout(void* arg, grpc_error* error) {
93
- server_connection_state* connection_state =
94
- static_cast<server_connection_state*>(arg);
167
+ void Chttp2ServerListener::ConnectionState::OnTimeout(void* arg,
168
+ grpc_error* error) {
169
+ ConnectionState* self = static_cast<ConnectionState*>(arg);
95
170
  // Note that we may be called with GRPC_ERROR_NONE when the timer fires
96
171
  // or with an error indicating that the timer system is being shut down.
97
172
  if (error != GRPC_ERROR_CANCELLED) {
98
173
  grpc_transport_op* op = grpc_make_transport_op(nullptr);
99
174
  op->disconnect_with_error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
100
175
  "Did not receive HTTP/2 settings before handshake timeout");
101
- grpc_transport_perform_op(&connection_state->transport->base, op);
176
+ grpc_transport_perform_op(&self->transport_->base, op);
102
177
  }
103
- server_connection_state_unref(connection_state);
178
+ self->Unref();
104
179
  }
105
180
 
106
- static void on_receive_settings(void* arg, grpc_error* error) {
107
- server_connection_state* connection_state =
108
- static_cast<server_connection_state*>(arg);
181
+ void Chttp2ServerListener::ConnectionState::OnReceiveSettings(
182
+ void* arg, grpc_error* error) {
183
+ ConnectionState* self = static_cast<ConnectionState*>(arg);
109
184
  if (error == GRPC_ERROR_NONE) {
110
- grpc_timer_cancel(&connection_state->timer);
185
+ grpc_timer_cancel(&self->timer_);
111
186
  }
112
- server_connection_state_unref(connection_state);
187
+ self->Unref();
113
188
  }
114
189
 
115
- static void on_handshake_done(void* arg, grpc_error* error) {
116
- auto* args = static_cast<grpc_core::HandshakerArgs*>(arg);
117
- server_connection_state* connection_state =
118
- static_cast<server_connection_state*>(args->user_data);
119
- gpr_mu_lock(&connection_state->svr_state->mu);
120
- grpc_resource_user* resource_user = grpc_server_get_default_resource_user(
121
- connection_state->svr_state->server);
122
- if (error != GRPC_ERROR_NONE || connection_state->svr_state->shutdown) {
123
- const char* error_str = grpc_error_string(error);
124
- gpr_log(GPR_DEBUG, "Handshaking failed: %s", error_str);
125
- grpc_resource_user* resource_user = grpc_server_get_default_resource_user(
126
- connection_state->svr_state->server);
127
- if (resource_user != nullptr) {
128
- grpc_resource_user_free(resource_user, GRPC_RESOURCE_QUOTA_CHANNEL_SIZE);
129
- }
130
- if (error == GRPC_ERROR_NONE && args->endpoint != nullptr) {
131
- // We were shut down after handshaking completed successfully, so
132
- // destroy the endpoint here.
133
- // TODO(ctiller): It is currently necessary to shutdown endpoints
134
- // before destroying them, even if we know that there are no
135
- // pending read/write callbacks. This should be fixed, at which
136
- // point this can be removed.
137
- grpc_endpoint_shutdown(args->endpoint, GRPC_ERROR_NONE);
138
- grpc_endpoint_destroy(args->endpoint);
139
- grpc_channel_args_destroy(args->args);
140
- grpc_slice_buffer_destroy_internal(args->read_buffer);
141
- gpr_free(args->read_buffer);
142
- }
143
- } else {
144
- // If the handshaking succeeded but there is no endpoint, then the
145
- // handshaker may have handed off the connection to some external
146
- // code, so we can just clean up here without creating a transport.
147
- if (args->endpoint != nullptr) {
148
- grpc_transport* transport = grpc_create_chttp2_transport(
149
- args->args, args->endpoint, false, resource_user);
150
- grpc_server_setup_transport(
151
- connection_state->svr_state->server, transport,
152
- connection_state->accepting_pollset, args->args,
153
- grpc_chttp2_transport_get_socket_node(transport), resource_user);
154
- // Use notify_on_receive_settings callback to enforce the
155
- // handshake deadline.
156
- connection_state->transport =
157
- reinterpret_cast<grpc_chttp2_transport*>(transport);
158
- gpr_ref(&connection_state->refs);
159
- GRPC_CLOSURE_INIT(&connection_state->on_receive_settings,
160
- on_receive_settings, connection_state,
161
- grpc_schedule_on_exec_ctx);
162
- grpc_chttp2_transport_start_reading(
163
- transport, args->read_buffer, &connection_state->on_receive_settings);
164
- grpc_channel_args_destroy(args->args);
165
- gpr_ref(&connection_state->refs);
166
- GRPC_CHTTP2_REF_TRANSPORT((grpc_chttp2_transport*)transport,
167
- "receive settings timeout");
168
- GRPC_CLOSURE_INIT(&connection_state->on_timeout, on_timeout,
169
- connection_state, grpc_schedule_on_exec_ctx);
170
- grpc_timer_init(&connection_state->timer, connection_state->deadline,
171
- &connection_state->on_timeout);
172
- } else {
190
+ void Chttp2ServerListener::ConnectionState::OnHandshakeDone(void* arg,
191
+ grpc_error* error) {
192
+ auto* args = static_cast<HandshakerArgs*>(arg);
193
+ ConnectionState* self = static_cast<ConnectionState*>(args->user_data);
194
+ {
195
+ MutexLock lock(&self->listener_->mu_);
196
+ grpc_resource_user* resource_user =
197
+ grpc_server_get_default_resource_user(self->listener_->server_);
198
+ if (error != GRPC_ERROR_NONE || self->listener_->shutdown_) {
199
+ const char* error_str = grpc_error_string(error);
200
+ gpr_log(GPR_DEBUG, "Handshaking failed: %s", error_str);
201
+ grpc_resource_user* resource_user =
202
+ grpc_server_get_default_resource_user(self->listener_->server_);
173
203
  if (resource_user != nullptr) {
174
204
  grpc_resource_user_free(resource_user,
175
205
  GRPC_RESOURCE_QUOTA_CHANNEL_SIZE);
176
206
  }
207
+ if (error == GRPC_ERROR_NONE && args->endpoint != nullptr) {
208
+ // We were shut down after handshaking completed successfully, so
209
+ // destroy the endpoint here.
210
+ // TODO(ctiller): It is currently necessary to shutdown endpoints
211
+ // before destroying them, even if we know that there are no
212
+ // pending read/write callbacks. This should be fixed, at which
213
+ // point this can be removed.
214
+ grpc_endpoint_shutdown(args->endpoint, GRPC_ERROR_NONE);
215
+ grpc_endpoint_destroy(args->endpoint);
216
+ grpc_channel_args_destroy(args->args);
217
+ grpc_slice_buffer_destroy_internal(args->read_buffer);
218
+ gpr_free(args->read_buffer);
219
+ }
220
+ } else {
221
+ // If the handshaking succeeded but there is no endpoint, then the
222
+ // handshaker may have handed off the connection to some external
223
+ // code, so we can just clean up here without creating a transport.
224
+ if (args->endpoint != nullptr) {
225
+ grpc_transport* transport = grpc_create_chttp2_transport(
226
+ args->args, args->endpoint, false, resource_user);
227
+ grpc_server_setup_transport(
228
+ self->listener_->server_, transport, self->accepting_pollset_,
229
+ args->args, grpc_chttp2_transport_get_socket_node(transport),
230
+ resource_user);
231
+ // Use notify_on_receive_settings callback to enforce the
232
+ // handshake deadline.
233
+ // Note: The reinterpret_cast<>s here are safe, because
234
+ // grpc_chttp2_transport is a C-style extension of
235
+ // grpc_transport, so this is morally equivalent of a
236
+ // static_cast<> to a derived class.
237
+ // TODO(roth): Change to static_cast<> when we C++-ify the
238
+ // transport API.
239
+ self->transport_ = reinterpret_cast<grpc_chttp2_transport*>(transport);
240
+ self->Ref().release(); // Held by OnReceiveSettings().
241
+ GRPC_CLOSURE_INIT(&self->on_receive_settings_, OnReceiveSettings, self,
242
+ grpc_schedule_on_exec_ctx);
243
+ grpc_chttp2_transport_start_reading(transport, args->read_buffer,
244
+ &self->on_receive_settings_);
245
+ grpc_channel_args_destroy(args->args);
246
+ self->Ref().release(); // Held by OnTimeout().
247
+ GRPC_CHTTP2_REF_TRANSPORT(
248
+ reinterpret_cast<grpc_chttp2_transport*>(transport),
249
+ "receive settings timeout");
250
+ GRPC_CLOSURE_INIT(&self->on_timeout_, OnTimeout, self,
251
+ grpc_schedule_on_exec_ctx);
252
+ grpc_timer_init(&self->timer_, self->deadline_, &self->on_timeout_);
253
+ } else {
254
+ if (resource_user != nullptr) {
255
+ grpc_resource_user_free(resource_user,
256
+ GRPC_RESOURCE_QUOTA_CHANNEL_SIZE);
257
+ }
258
+ }
177
259
  }
260
+ self->handshake_mgr_->RemoveFromPendingMgrList(
261
+ &self->listener_->pending_handshake_mgrs_);
178
262
  }
179
- connection_state->handshake_mgr->RemoveFromPendingMgrList(
180
- &connection_state->svr_state->pending_handshake_mgrs);
181
- gpr_mu_unlock(&connection_state->svr_state->mu);
182
- connection_state->handshake_mgr.reset();
183
- gpr_free(connection_state->acceptor);
184
- grpc_tcp_server_unref(connection_state->svr_state->tcp_server);
185
- server_connection_state_unref(connection_state);
263
+ self->handshake_mgr_.reset();
264
+ gpr_free(self->acceptor_);
265
+ grpc_tcp_server_unref(self->listener_->tcp_server_);
266
+ self->Unref();
186
267
  }
187
268
 
188
- static void on_accept(void* arg, grpc_endpoint* tcp,
189
- grpc_pollset* accepting_pollset,
190
- grpc_tcp_server_acceptor* acceptor) {
191
- server_state* state = static_cast<server_state*>(arg);
192
- gpr_mu_lock(&state->mu);
193
- if (state->shutdown) {
194
- gpr_mu_unlock(&state->mu);
195
- grpc_endpoint_shutdown(tcp, GRPC_ERROR_NONE);
196
- grpc_endpoint_destroy(tcp);
197
- gpr_free(acceptor);
198
- return;
269
+ //
270
+ // Chttp2ServerListener
271
+ //
272
+
273
+ grpc_error* Chttp2ServerListener::Create(grpc_server* server, const char* addr,
274
+ grpc_channel_args* args,
275
+ int* port_num) {
276
+ std::vector<grpc_error*> error_list;
277
+ grpc_resolved_addresses* resolved = nullptr;
278
+ Chttp2ServerListener* listener = nullptr;
279
+ // The bulk of this method is inside of a lambda to make cleanup
280
+ // easier without using goto.
281
+ grpc_error* error = [&]() {
282
+ *port_num = -1;
283
+ /* resolve address */
284
+ grpc_error* error = grpc_blocking_resolve_address(addr, "https", &resolved);
285
+ if (error != GRPC_ERROR_NONE) return error;
286
+ // Create Chttp2ServerListener.
287
+ listener = new Chttp2ServerListener(server, args);
288
+ error = grpc_tcp_server_create(&listener->tcp_server_shutdown_complete_,
289
+ args, &listener->tcp_server_);
290
+ if (error != GRPC_ERROR_NONE) return error;
291
+ for (size_t i = 0; i < resolved->naddrs; i++) {
292
+ int port_temp;
293
+ error = grpc_tcp_server_add_port(listener->tcp_server_,
294
+ &resolved->addrs[i], &port_temp);
295
+ if (error != GRPC_ERROR_NONE) {
296
+ error_list.push_back(error);
297
+ } else {
298
+ if (*port_num == -1) {
299
+ *port_num = port_temp;
300
+ } else {
301
+ GPR_ASSERT(*port_num == port_temp);
302
+ }
303
+ }
304
+ }
305
+ if (error_list.size() == resolved->naddrs) {
306
+ std::string msg =
307
+ absl::StrFormat("No address added out of total %" PRIuPTR " resolved",
308
+ resolved->naddrs);
309
+ return GRPC_ERROR_CREATE_REFERENCING_FROM_COPIED_STRING(
310
+ msg.c_str(), error_list.data(), error_list.size());
311
+ } else if (!error_list.empty()) {
312
+ std::string msg = absl::StrFormat(
313
+ "Only %" PRIuPTR " addresses added out of total %" PRIuPTR
314
+ " resolved",
315
+ resolved->naddrs - error_list.size(), resolved->naddrs);
316
+ error = GRPC_ERROR_CREATE_REFERENCING_FROM_COPIED_STRING(
317
+ msg.c_str(), error_list.data(), error_list.size());
318
+ gpr_log(GPR_INFO, "WARNING: %s", grpc_error_string(error));
319
+ GRPC_ERROR_UNREF(error);
320
+ /* we managed to bind some addresses: continue */
321
+ }
322
+ // Create channelz node.
323
+ if (grpc_channel_args_find_bool(args, GRPC_ARG_ENABLE_CHANNELZ,
324
+ GRPC_ENABLE_CHANNELZ_DEFAULT)) {
325
+ listener->channelz_listen_socket_ =
326
+ MakeRefCounted<channelz::ListenSocketNode>(
327
+ addr, absl::StrFormat("chttp2 listener %s", addr));
328
+ }
329
+ /* Register with the server only upon success */
330
+ grpc_server_add_listener(server,
331
+ OrphanablePtr<ServerListenerInterface>(listener));
332
+ return GRPC_ERROR_NONE;
333
+ }();
334
+ if (resolved != nullptr) {
335
+ grpc_resolved_addresses_destroy(resolved);
336
+ }
337
+ if (error != GRPC_ERROR_NONE) {
338
+ if (listener != nullptr) {
339
+ if (listener->tcp_server_ != nullptr) {
340
+ grpc_tcp_server_unref(listener->tcp_server_);
341
+ } else {
342
+ delete listener;
343
+ }
344
+ } else {
345
+ grpc_channel_args_destroy(args);
346
+ }
347
+ *port_num = 0;
199
348
  }
349
+ for (grpc_error* error : error_list) {
350
+ GRPC_ERROR_UNREF(error);
351
+ }
352
+ return error;
353
+ }
354
+
355
+ grpc_error* Chttp2ServerListener::CreateWithAcceptor(grpc_server* server,
356
+ const char* name,
357
+ grpc_channel_args* args) {
358
+ Chttp2ServerListener* listener = new Chttp2ServerListener(server, args);
359
+ grpc_error* error = grpc_tcp_server_create(
360
+ &listener->tcp_server_shutdown_complete_, args, &listener->tcp_server_);
361
+ if (error != GRPC_ERROR_NONE) {
362
+ delete listener;
363
+ return error;
364
+ }
365
+ // TODO(yangg) channelz
366
+ TcpServerFdHandler** arg_val =
367
+ grpc_channel_args_find_pointer<TcpServerFdHandler*>(args, name);
368
+ *arg_val = grpc_tcp_server_create_fd_handler(listener->tcp_server_);
369
+ grpc_server_add_listener(server,
370
+ OrphanablePtr<ServerListenerInterface>(listener));
371
+ return GRPC_ERROR_NONE;
372
+ }
373
+
374
+ Chttp2ServerListener::Chttp2ServerListener(grpc_server* server,
375
+ grpc_channel_args* args)
376
+ : server_(server), args_(args) {
377
+ GRPC_CLOSURE_INIT(&tcp_server_shutdown_complete_, TcpServerShutdownComplete,
378
+ this, grpc_schedule_on_exec_ctx);
379
+ }
380
+
381
+ Chttp2ServerListener::~Chttp2ServerListener() {
382
+ grpc_channel_args_destroy(args_);
383
+ }
384
+
385
+ /* Server callback: start listening on our ports */
386
+ void Chttp2ServerListener::Start(grpc_server* /*server*/,
387
+ const std::vector<grpc_pollset*>* pollsets) {
388
+ {
389
+ MutexLock lock(&mu_);
390
+ shutdown_ = false;
391
+ }
392
+ grpc_tcp_server_start(tcp_server_, pollsets, OnAccept, this);
393
+ }
394
+
395
+ void Chttp2ServerListener::SetOnDestroyDone(grpc_closure* on_destroy_done) {
396
+ MutexLock lock(&mu_);
397
+ on_destroy_done_ = on_destroy_done;
398
+ }
399
+
400
+ RefCountedPtr<HandshakeManager> Chttp2ServerListener::CreateHandshakeManager() {
401
+ MutexLock lock(&mu_);
402
+ if (shutdown_) return nullptr;
200
403
  grpc_resource_user* resource_user =
201
- grpc_server_get_default_resource_user(state->server);
404
+ grpc_server_get_default_resource_user(server_);
202
405
  if (resource_user != nullptr &&
203
406
  !grpc_resource_user_safe_alloc(resource_user,
204
407
  GRPC_RESOURCE_QUOTA_CHANNEL_SIZE)) {
205
- gpr_log(
206
- GPR_ERROR,
207
- "Memory quota exhausted, rejecting the connection, no handshaking.");
208
- gpr_mu_unlock(&state->mu);
408
+ gpr_log(GPR_ERROR,
409
+ "Memory quota exhausted, rejecting connection, no handshaking.");
410
+ return nullptr;
411
+ }
412
+ auto handshake_mgr = MakeRefCounted<HandshakeManager>();
413
+ handshake_mgr->AddToPendingMgrList(&pending_handshake_mgrs_);
414
+ grpc_tcp_server_ref(tcp_server_); // Ref held by ConnectionState.
415
+ return handshake_mgr;
416
+ }
417
+
418
+ void Chttp2ServerListener::OnAccept(void* arg, grpc_endpoint* tcp,
419
+ grpc_pollset* accepting_pollset,
420
+ grpc_tcp_server_acceptor* acceptor) {
421
+ Chttp2ServerListener* self = static_cast<Chttp2ServerListener*>(arg);
422
+ RefCountedPtr<HandshakeManager> handshake_mgr =
423
+ self->CreateHandshakeManager();
424
+ if (handshake_mgr == nullptr) {
209
425
  grpc_endpoint_shutdown(tcp, GRPC_ERROR_NONE);
210
426
  grpc_endpoint_destroy(tcp);
211
427
  gpr_free(acceptor);
212
428
  return;
213
429
  }
214
- auto handshake_mgr = grpc_core::MakeRefCounted<grpc_core::HandshakeManager>();
215
- handshake_mgr->AddToPendingMgrList(&state->pending_handshake_mgrs);
216
- grpc_tcp_server_ref(state->tcp_server);
217
- gpr_mu_unlock(&state->mu);
218
- server_connection_state* connection_state =
219
- static_cast<server_connection_state*>(
220
- gpr_zalloc(sizeof(*connection_state)));
221
- gpr_ref_init(&connection_state->refs, 1);
222
- connection_state->svr_state = state;
223
- connection_state->accepting_pollset = accepting_pollset;
224
- connection_state->acceptor = acceptor;
225
- connection_state->handshake_mgr = handshake_mgr;
226
- connection_state->interested_parties = grpc_pollset_set_create();
227
- grpc_pollset_set_add_pollset(connection_state->interested_parties,
228
- connection_state->accepting_pollset);
229
- grpc_core::HandshakerRegistry::AddHandshakers(
230
- grpc_core::HANDSHAKER_SERVER, state->args,
231
- connection_state->interested_parties,
232
- connection_state->handshake_mgr.get());
233
- const grpc_arg* timeout_arg =
234
- grpc_channel_args_find(state->args, GRPC_ARG_SERVER_HANDSHAKE_TIMEOUT_MS);
235
- connection_state->deadline =
236
- grpc_core::ExecCtx::Get()->Now() +
237
- grpc_channel_arg_get_integer(timeout_arg,
238
- {120 * GPR_MS_PER_SEC, 1, INT_MAX});
239
- connection_state->handshake_mgr->DoHandshake(
240
- tcp, state->args, connection_state->deadline, acceptor, on_handshake_done,
241
- connection_state);
430
+ // Deletes itself when done.
431
+ new ConnectionState(self, accepting_pollset, acceptor,
432
+ std::move(handshake_mgr), self->args_, tcp);
242
433
  }
243
434
 
244
- /* Server callback: start listening on our ports */
245
- static void server_start_listener(grpc_server* /*server*/, void* arg,
246
- grpc_pollset** pollsets,
247
- size_t pollset_count) {
248
- server_state* state = static_cast<server_state*>(arg);
249
- gpr_mu_lock(&state->mu);
250
- state->shutdown = false;
251
- gpr_mu_unlock(&state->mu);
252
- grpc_tcp_server_start(state->tcp_server, pollsets, pollset_count, on_accept,
253
- state);
254
- }
255
-
256
- static void tcp_server_shutdown_complete(void* arg, grpc_error* error) {
257
- server_state* state = static_cast<server_state*>(arg);
435
+ void Chttp2ServerListener::TcpServerShutdownComplete(void* arg,
436
+ grpc_error* error) {
437
+ Chttp2ServerListener* self = static_cast<Chttp2ServerListener*>(arg);
258
438
  /* ensure all threads have unlocked */
259
- gpr_mu_lock(&state->mu);
260
- grpc_closure* destroy_done = state->server_destroy_listener_done;
261
- GPR_ASSERT(state->shutdown);
262
- if (state->pending_handshake_mgrs != nullptr) {
263
- state->pending_handshake_mgrs->ShutdownAllPending(GRPC_ERROR_REF(error));
439
+ grpc_closure* destroy_done = nullptr;
440
+ {
441
+ MutexLock lock(&self->mu_);
442
+ destroy_done = self->on_destroy_done_;
443
+ GPR_ASSERT(self->shutdown_);
444
+ if (self->pending_handshake_mgrs_ != nullptr) {
445
+ self->pending_handshake_mgrs_->ShutdownAllPending(GRPC_ERROR_REF(error));
446
+ }
447
+ self->channelz_listen_socket_.reset();
264
448
  }
265
- state->channelz_listen_socket.reset();
266
- gpr_mu_unlock(&state->mu);
267
449
  // Flush queued work before destroying handshaker factory, since that
268
450
  // may do a synchronous unref.
269
- grpc_core::ExecCtx::Get()->Flush();
451
+ ExecCtx::Get()->Flush();
270
452
  if (destroy_done != nullptr) {
271
- grpc_core::ExecCtx::Run(DEBUG_LOCATION, destroy_done,
272
- GRPC_ERROR_REF(error));
273
- grpc_core::ExecCtx::Get()->Flush();
453
+ ExecCtx::Run(DEBUG_LOCATION, destroy_done, GRPC_ERROR_REF(error));
454
+ ExecCtx::Get()->Flush();
274
455
  }
275
- grpc_channel_args_destroy(state->args);
276
- gpr_mu_destroy(&state->mu);
277
- gpr_free(state);
456
+ delete self;
278
457
  }
279
458
 
280
459
  /* Server callback: destroy the tcp listener (so we don't generate further
281
460
  callbacks) */
282
- static void server_destroy_listener(grpc_server* /*server*/, void* arg,
283
- grpc_closure* destroy_done) {
284
- server_state* state = static_cast<server_state*>(arg);
285
- gpr_mu_lock(&state->mu);
286
- state->shutdown = true;
287
- state->server_destroy_listener_done = destroy_done;
288
- grpc_tcp_server* tcp_server = state->tcp_server;
289
- gpr_mu_unlock(&state->mu);
461
+ void Chttp2ServerListener::Orphan() {
462
+ grpc_tcp_server* tcp_server;
463
+ {
464
+ MutexLock lock(&mu_);
465
+ shutdown_ = true;
466
+ tcp_server = tcp_server_;
467
+ }
290
468
  grpc_tcp_server_shutdown_listeners(tcp_server);
291
469
  grpc_tcp_server_unref(tcp_server);
292
470
  }
293
471
 
294
- static grpc_error* chttp2_server_add_acceptor(grpc_server* server,
295
- const char* name,
296
- grpc_channel_args* args) {
297
- grpc_tcp_server* tcp_server = nullptr;
298
- grpc_error* err = GRPC_ERROR_NONE;
299
- server_state* state = nullptr;
300
- const grpc_arg* arg = nullptr;
301
- grpc_core::TcpServerFdHandler** arg_val = nullptr;
302
- state = static_cast<server_state*>(gpr_zalloc(sizeof(*state)));
303
- GRPC_CLOSURE_INIT(&state->tcp_server_shutdown_complete,
304
- tcp_server_shutdown_complete, state,
305
- grpc_schedule_on_exec_ctx);
306
- err = grpc_tcp_server_create(&state->tcp_server_shutdown_complete, args,
307
- &tcp_server);
308
- if (err != GRPC_ERROR_NONE) {
309
- goto error;
310
- }
311
- state->server = server;
312
- state->tcp_server = tcp_server;
313
- state->args = args;
314
- state->shutdown = true;
315
- gpr_mu_init(&state->mu);
316
- // TODO(yangg) channelz
317
- arg = grpc_channel_args_find(args, name);
318
- GPR_ASSERT(arg->type == GRPC_ARG_POINTER);
319
- arg_val = static_cast<grpc_core::TcpServerFdHandler**>(arg->value.pointer.p);
320
- *arg_val = grpc_tcp_server_create_fd_handler(tcp_server);
321
-
322
- grpc_server_add_listener(server, state, server_start_listener,
323
- server_destroy_listener, /* node */ nullptr);
324
- return err;
325
-
326
- /* Error path: cleanup and return */
327
- error:
328
- GPR_ASSERT(err != GRPC_ERROR_NONE);
329
- if (tcp_server) {
330
- grpc_tcp_server_unref(tcp_server);
331
- } else {
332
- grpc_channel_args_destroy(args);
333
- gpr_free(state);
334
- }
335
- return err;
336
- }
472
+ } // namespace
337
473
 
338
- grpc_error* grpc_chttp2_server_add_port(grpc_server* server, const char* addr,
339
- grpc_channel_args* args,
340
- int* port_num) {
341
- grpc_resolved_addresses* resolved = nullptr;
342
- grpc_tcp_server* tcp_server = nullptr;
343
- size_t i;
344
- size_t count = 0;
345
- int port_temp;
346
- grpc_error* err = GRPC_ERROR_NONE;
347
- server_state* state = nullptr;
348
- grpc_error** errors = nullptr;
349
- size_t naddrs = 0;
350
- const grpc_arg* arg = nullptr;
351
-
352
- *port_num = -1;
474
+ //
475
+ // Chttp2ServerAddPort()
476
+ //
353
477
 
478
+ grpc_error* Chttp2ServerAddPort(grpc_server* server, const char* addr,
479
+ grpc_channel_args* args, int* port_num) {
354
480
  if (strncmp(addr, "external:", 9) == 0) {
355
- return chttp2_server_add_acceptor(server, addr, args);
356
- }
357
-
358
- /* resolve address */
359
- err = grpc_blocking_resolve_address(addr, "https", &resolved);
360
- if (err != GRPC_ERROR_NONE) {
361
- goto error;
362
- }
363
- state = static_cast<server_state*>(gpr_zalloc(sizeof(*state)));
364
- GRPC_CLOSURE_INIT(&state->tcp_server_shutdown_complete,
365
- tcp_server_shutdown_complete, state,
366
- grpc_schedule_on_exec_ctx);
367
- err = grpc_tcp_server_create(&state->tcp_server_shutdown_complete, args,
368
- &tcp_server);
369
- if (err != GRPC_ERROR_NONE) {
370
- goto error;
371
- }
372
-
373
- state->server = server;
374
- state->tcp_server = tcp_server;
375
- state->args = args;
376
- state->shutdown = true;
377
- gpr_mu_init(&state->mu);
378
-
379
- naddrs = resolved->naddrs;
380
- errors = static_cast<grpc_error**>(gpr_malloc(sizeof(*errors) * naddrs));
381
- for (i = 0; i < naddrs; i++) {
382
- errors[i] =
383
- grpc_tcp_server_add_port(tcp_server, &resolved->addrs[i], &port_temp);
384
- if (errors[i] == GRPC_ERROR_NONE) {
385
- if (*port_num == -1) {
386
- *port_num = port_temp;
387
- } else {
388
- GPR_ASSERT(*port_num == port_temp);
389
- }
390
- count++;
391
- }
481
+ return grpc_core::Chttp2ServerListener::CreateWithAcceptor(server, addr,
482
+ args);
392
483
  }
393
- if (count == 0) {
394
- char* msg;
395
- gpr_asprintf(&msg, "No address added out of total %" PRIuPTR " resolved",
396
- naddrs);
397
- err = GRPC_ERROR_CREATE_REFERENCING_FROM_COPIED_STRING(msg, errors, naddrs);
398
- gpr_free(msg);
399
- goto error;
400
- } else if (count != naddrs) {
401
- char* msg;
402
- gpr_asprintf(&msg,
403
- "Only %" PRIuPTR " addresses added out of total %" PRIuPTR
404
- " resolved",
405
- count, naddrs);
406
- err = GRPC_ERROR_CREATE_REFERENCING_FROM_COPIED_STRING(msg, errors, naddrs);
407
- gpr_free(msg);
408
-
409
- const char* warning_message = grpc_error_string(err);
410
- gpr_log(GPR_INFO, "WARNING: %s", warning_message);
411
-
412
- /* we managed to bind some addresses: continue */
413
- }
414
- grpc_resolved_addresses_destroy(resolved);
415
-
416
- arg = grpc_channel_args_find(args, GRPC_ARG_ENABLE_CHANNELZ);
417
- if (grpc_channel_arg_get_bool(arg, GRPC_ENABLE_CHANNELZ_DEFAULT)) {
418
- state->channelz_listen_socket =
419
- grpc_core::MakeRefCounted<grpc_core::channelz::ListenSocketNode>(
420
- addr, absl::StrFormat("chttp2 listener %s", addr));
421
- }
422
-
423
- /* Register with the server only upon success */
424
- grpc_server_add_listener(server, state, server_start_listener,
425
- server_destroy_listener,
426
- state->channelz_listen_socket);
427
- goto done;
428
-
429
- /* Error path: cleanup and return */
430
- error:
431
- GPR_ASSERT(err != GRPC_ERROR_NONE);
432
- if (resolved) {
433
- grpc_resolved_addresses_destroy(resolved);
434
- }
435
- if (tcp_server) {
436
- grpc_tcp_server_unref(tcp_server);
437
- } else {
438
- grpc_channel_args_destroy(args);
439
- gpr_free(state);
440
- }
441
- *port_num = 0;
442
-
443
- done:
444
- if (errors != nullptr) {
445
- for (i = 0; i < naddrs; i++) {
446
- GRPC_ERROR_UNREF(errors[i]);
447
- }
448
- gpr_free(errors);
449
- }
450
- return err;
484
+ return grpc_core::Chttp2ServerListener::Create(server, addr, args, port_num);
451
485
  }
486
+
487
+ } // namespace grpc_core