grpc 1.6.7 → 1.7.0.pre1

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 (277) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +579 -77
  3. data/include/grpc/byte_buffer.h +1 -63
  4. data/include/grpc/compression.h +27 -5
  5. data/include/grpc/fork.h +24 -0
  6. data/include/grpc/grpc.h +12 -6
  7. data/include/grpc/grpc_security.h +28 -7
  8. data/include/grpc/impl/codegen/atm.h +1 -0
  9. data/include/grpc/impl/codegen/byte_buffer.h +86 -0
  10. data/include/grpc/impl/codegen/compression_types.h +63 -5
  11. data/include/grpc/impl/codegen/fork.h +48 -0
  12. data/include/grpc/impl/codegen/grpc_types.h +26 -9
  13. data/include/grpc/impl/codegen/port_platform.h +11 -4
  14. data/include/grpc/impl/codegen/slice.h +6 -1
  15. data/include/grpc/impl/codegen/sync.h +3 -1
  16. data/include/grpc/impl/codegen/sync_custom.h +36 -0
  17. data/include/grpc/module.modulemap +75 -3
  18. data/include/grpc/slice.h +1 -5
  19. data/include/grpc/support/sync_custom.h +24 -0
  20. data/src/core/ext/census/base_resources.c +14 -14
  21. data/src/core/ext/census/context.c +7 -5
  22. data/src/core/ext/census/grpc_filter.c +12 -14
  23. data/src/core/ext/census/mlog.c +2 -1
  24. data/src/core/ext/census/resource.c +13 -9
  25. data/src/core/ext/filters/client_channel/channel_connectivity.c +15 -8
  26. data/src/core/ext/filters/client_channel/client_channel.c +418 -439
  27. data/src/core/ext/filters/client_channel/client_channel_factory.c +4 -5
  28. data/src/core/ext/filters/client_channel/client_channel_plugin.c +2 -2
  29. data/src/core/ext/filters/client_channel/http_connect_handshaker.c +7 -5
  30. data/src/core/ext/filters/client_channel/http_proxy.c +17 -21
  31. data/src/core/ext/filters/client_channel/lb_policy.c +1 -1
  32. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +7 -7
  33. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +371 -257
  34. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +7 -5
  35. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +25 -14
  36. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +16 -16
  37. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +33 -28
  38. data/src/core/ext/filters/client_channel/lb_policy_factory.c +10 -8
  39. data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -1
  40. data/src/core/ext/filters/client_channel/proxy_mapper_registry.c +1 -1
  41. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +7 -6
  42. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +62 -28
  43. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +29 -23
  44. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +25 -14
  45. data/src/core/ext/filters/client_channel/retry_throttle.c +9 -6
  46. data/src/core/ext/filters/client_channel/subchannel.c +30 -30
  47. data/src/core/ext/filters/client_channel/subchannel.h +1 -4
  48. data/src/core/ext/filters/client_channel/subchannel_index.c +31 -15
  49. data/src/core/ext/filters/client_channel/subchannel_index.h +7 -0
  50. data/src/core/ext/filters/client_channel/uri_parser.c +4 -3
  51. data/src/core/ext/filters/deadline/deadline_filter.c +78 -39
  52. data/src/core/ext/filters/deadline/deadline_filter.h +7 -1
  53. data/src/core/ext/filters/http/client/http_client_filter.c +14 -14
  54. data/src/core/ext/filters/http/http_filters_plugin.c +1 -1
  55. data/src/core/ext/filters/http/message_compress/message_compress_filter.c +240 -175
  56. data/src/core/ext/filters/http/server/http_server_filter.c +48 -36
  57. data/src/core/ext/filters/load_reporting/{load_reporting_filter.c → server_load_reporting_filter.c} +11 -12
  58. data/src/core/ext/filters/load_reporting/{load_reporting_filter.h → server_load_reporting_filter.h} +6 -5
  59. data/src/core/ext/filters/load_reporting/{load_reporting.c → server_load_reporting_plugin.c} +19 -13
  60. data/src/core/ext/filters/load_reporting/{load_reporting.h → server_load_reporting_plugin.h} +4 -3
  61. data/src/core/ext/filters/max_age/max_age_filter.c +2 -3
  62. data/src/core/ext/filters/message_size/message_size_filter.c +4 -2
  63. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +0 -1
  64. data/src/core/ext/transport/chttp2/client/chttp2_connector.c +5 -5
  65. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +1 -1
  66. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +1 -1
  67. data/src/core/ext/transport/chttp2/server/chttp2_server.c +20 -18
  68. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +1 -0
  69. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +493 -210
  70. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
  71. data/src/core/ext/transport/chttp2/transport/flow_control.c +9 -8
  72. data/src/core/ext/transport/chttp2/transport/frame_data.c +2 -2
  73. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +2 -2
  74. data/src/core/ext/transport/chttp2/transport/frame_ping.c +5 -4
  75. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +1 -1
  76. data/src/core/ext/transport/chttp2/transport/frame_settings.c +10 -9
  77. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +9 -5
  78. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +62 -41
  79. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +52 -8
  80. data/src/core/ext/transport/chttp2/transport/hpack_table.c +2 -2
  81. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +3 -2
  82. data/src/core/ext/transport/chttp2/transport/internal.h +60 -30
  83. data/src/core/ext/transport/chttp2/transport/parsing.c +16 -5
  84. data/src/core/ext/transport/chttp2/transport/stream_lists.c +36 -16
  85. data/src/core/ext/transport/chttp2/transport/stream_map.c +6 -4
  86. data/src/core/ext/transport/chttp2/transport/writing.c +133 -105
  87. data/src/core/ext/transport/inproc/inproc_transport.c +61 -65
  88. data/src/core/lib/channel/channel_args.c +112 -12
  89. data/src/core/lib/channel/channel_args.h +31 -0
  90. data/src/core/lib/channel/channel_stack.c +1 -15
  91. data/src/core/lib/channel/channel_stack.h +3 -10
  92. data/src/core/lib/channel/channel_stack_builder.c +41 -10
  93. data/src/core/lib/channel/channel_stack_builder.h +10 -0
  94. data/src/core/lib/channel/connected_channel.c +94 -23
  95. data/src/core/lib/channel/handshaker.c +8 -6
  96. data/src/core/lib/channel/handshaker_registry.c +1 -1
  97. data/src/core/lib/compression/algorithm_metadata.h +14 -0
  98. data/src/core/lib/compression/compression.c +101 -1
  99. data/src/core/lib/compression/stream_compression.c +32 -146
  100. data/src/core/lib/compression/stream_compression.h +28 -4
  101. data/src/core/lib/compression/stream_compression_gzip.c +228 -0
  102. data/src/core/lib/{iomgr/ev_epoll_thread_pool_linux.h → compression/stream_compression_gzip.h} +5 -7
  103. data/src/core/lib/compression/stream_compression_identity.c +94 -0
  104. data/src/core/lib/{iomgr/ev_epoll_limited_pollers_linux.h → compression/stream_compression_identity.h} +7 -8
  105. data/src/core/lib/debug/stats.c +174 -0
  106. data/src/core/lib/debug/stats.h +61 -0
  107. data/src/core/lib/debug/stats_data.c +687 -0
  108. data/src/core/lib/debug/stats_data.h +470 -0
  109. data/src/core/lib/debug/trace.c +3 -3
  110. data/src/core/lib/debug/trace.h +1 -1
  111. data/src/core/lib/http/format_request.c +1 -1
  112. data/src/core/lib/http/httpcli.c +8 -7
  113. data/src/core/lib/http/httpcli_security_connector.c +2 -1
  114. data/src/core/lib/http/parser.c +4 -3
  115. data/src/core/lib/iomgr/call_combiner.c +202 -0
  116. data/src/core/lib/iomgr/call_combiner.h +121 -0
  117. data/src/core/lib/iomgr/closure.c +18 -4
  118. data/src/core/lib/iomgr/combiner.c +11 -4
  119. data/src/core/lib/iomgr/error.c +26 -24
  120. data/src/core/lib/iomgr/ev_epoll1_linux.c +395 -212
  121. data/src/core/lib/iomgr/ev_epollex_linux.c +141 -128
  122. data/src/core/lib/iomgr/ev_epollsig_linux.c +44 -41
  123. data/src/core/lib/iomgr/ev_poll_posix.c +99 -75
  124. data/src/core/lib/iomgr/ev_posix.c +5 -9
  125. data/src/core/lib/iomgr/ev_posix.h +1 -1
  126. data/src/core/lib/iomgr/exec_ctx.h +6 -1
  127. data/src/core/lib/iomgr/executor.c +142 -36
  128. data/src/core/lib/iomgr/executor.h +6 -1
  129. data/src/core/lib/iomgr/fork_posix.c +88 -0
  130. data/src/core/lib/iomgr/fork_windows.c +39 -0
  131. data/src/core/lib/iomgr/iocp_windows.c +2 -0
  132. data/src/core/lib/iomgr/iomgr.c +2 -8
  133. data/src/core/lib/iomgr/is_epollexclusive_available.c +6 -6
  134. data/src/core/lib/iomgr/load_file.c +2 -1
  135. data/src/core/lib/iomgr/polling_entity.c +9 -9
  136. data/src/core/lib/iomgr/polling_entity.h +7 -1
  137. data/src/core/lib/iomgr/pollset.h +1 -1
  138. data/src/core/lib/iomgr/pollset_uv.c +1 -1
  139. data/src/core/lib/iomgr/pollset_windows.c +3 -3
  140. data/src/core/lib/iomgr/port.h +4 -0
  141. data/src/core/lib/iomgr/resolve_address_posix.c +8 -7
  142. data/src/core/lib/iomgr/resolve_address_windows.c +1 -1
  143. data/src/core/lib/iomgr/resource_quota.c +24 -19
  144. data/src/core/lib/iomgr/socket_factory_posix.c +4 -4
  145. data/src/core/lib/iomgr/socket_mutator.c +4 -4
  146. data/src/core/lib/iomgr/socket_utils_windows.c +0 -4
  147. data/src/core/lib/iomgr/tcp_client_posix.c +5 -4
  148. data/src/core/lib/iomgr/tcp_posix.c +181 -20
  149. data/src/core/lib/iomgr/tcp_server_posix.c +8 -7
  150. data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +1 -1
  151. data/src/core/lib/iomgr/timer.h +4 -0
  152. data/src/core/lib/iomgr/timer_generic.c +138 -3
  153. data/src/core/lib/iomgr/timer_generic.h +3 -0
  154. data/src/core/lib/iomgr/timer_heap.c +4 -4
  155. data/src/core/lib/iomgr/timer_manager.c +2 -2
  156. data/src/core/lib/iomgr/timer_uv.c +2 -0
  157. data/src/core/lib/iomgr/udp_server.c +10 -8
  158. data/src/core/lib/iomgr/unix_sockets_posix.c +4 -2
  159. data/src/core/lib/iomgr/wakeup_fd_cv.c +9 -8
  160. data/src/core/lib/iomgr/wakeup_fd_cv.h +2 -2
  161. data/src/core/lib/json/json.c +1 -1
  162. data/src/core/lib/json/json_string.c +13 -13
  163. data/src/core/lib/profiling/timers.h +18 -8
  164. data/src/core/lib/security/credentials/composite/composite_credentials.c +4 -10
  165. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +2 -1
  166. data/src/core/lib/security/credentials/jwt/jwt_verifier.c +11 -6
  167. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +4 -4
  168. data/src/core/lib/security/credentials/plugin/plugin_credentials.c +132 -50
  169. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
  170. data/src/core/lib/security/transport/client_auth_filter.c +68 -135
  171. data/src/core/lib/security/transport/secure_endpoint.c +110 -90
  172. data/src/core/lib/security/transport/secure_endpoint.h +8 -3
  173. data/src/core/lib/security/transport/security_connector.c +10 -12
  174. data/src/core/lib/security/transport/security_handshaker.c +45 -24
  175. data/src/core/lib/security/transport/server_auth_filter.c +71 -20
  176. data/src/core/lib/slice/b64.c +2 -2
  177. data/src/core/lib/slice/slice.c +16 -14
  178. data/src/core/lib/slice/slice_buffer.c +5 -4
  179. data/src/core/lib/slice/slice_hash_table.c +3 -2
  180. data/src/core/lib/slice/slice_intern.c +8 -5
  181. data/src/core/lib/support/block_annotate.h +22 -0
  182. data/src/core/lib/support/fork.c +62 -0
  183. data/src/core/lib/support/fork.h +35 -0
  184. data/src/core/lib/support/log_linux.c +1 -1
  185. data/src/core/lib/support/string.c +15 -1
  186. data/src/core/lib/support/string.h +3 -0
  187. data/src/core/lib/support/thd_internal.h +6 -0
  188. data/src/core/lib/support/thd_posix.c +56 -0
  189. data/src/core/lib/support/thd_windows.c +2 -0
  190. data/src/core/lib/surface/alarm.c +22 -15
  191. data/src/core/lib/surface/byte_buffer.c +4 -2
  192. data/src/core/lib/surface/call.c +442 -141
  193. data/src/core/lib/surface/call.h +6 -6
  194. data/src/core/lib/surface/call_log_batch.c +1 -1
  195. data/src/core/lib/surface/call_test_only.h +12 -0
  196. data/src/core/lib/surface/channel.c +39 -4
  197. data/src/core/lib/surface/channel_init.c +6 -6
  198. data/src/core/lib/surface/channel_ping.c +2 -2
  199. data/src/core/lib/surface/completion_queue.c +56 -57
  200. data/src/core/lib/surface/init.c +17 -3
  201. data/src/core/lib/surface/init_secure.c +5 -1
  202. data/src/core/lib/surface/lame_client.cc +9 -10
  203. data/src/core/lib/surface/server.c +81 -72
  204. data/src/core/lib/surface/version.c +2 -2
  205. data/src/core/lib/transport/byte_stream.c +1 -0
  206. data/src/core/lib/transport/byte_stream.h +3 -1
  207. data/src/core/lib/transport/connectivity_state.c +2 -1
  208. data/src/core/lib/transport/metadata.c +7 -4
  209. data/src/core/lib/transport/metadata_batch.c +18 -16
  210. data/src/core/lib/transport/metadata_batch.h +1 -0
  211. data/src/core/lib/transport/service_config.c +5 -3
  212. data/src/core/lib/transport/static_metadata.c +395 -614
  213. data/src/core/lib/transport/static_metadata.h +165 -133
  214. data/src/core/lib/transport/status_conversion.c +1 -1
  215. data/src/core/lib/transport/transport.c +20 -20
  216. data/src/core/lib/transport/transport.h +8 -5
  217. data/src/core/lib/transport/transport_impl.h +0 -3
  218. data/src/core/lib/transport/transport_op_string.c +8 -1
  219. data/src/core/plugin_registry/grpc_plugin_registry.c +4 -4
  220. data/src/core/tsi/fake_transport_security.c +133 -2
  221. data/src/core/tsi/fake_transport_security.h +5 -0
  222. data/src/core/tsi/ssl_transport_security.c +105 -8
  223. data/src/core/tsi/ssl_transport_security.h +30 -7
  224. data/src/core/tsi/transport_security.h +8 -2
  225. data/src/core/tsi/transport_security_grpc.c +20 -13
  226. data/src/core/tsi/transport_security_grpc.h +13 -9
  227. data/src/ruby/ext/grpc/rb_call_credentials.c +6 -2
  228. data/src/ruby/ext/grpc/rb_grpc.c +1 -1
  229. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +30 -20
  230. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +50 -35
  231. data/src/ruby/lib/grpc.rb +1 -0
  232. data/src/ruby/lib/grpc/generic/active_call.rb +34 -9
  233. data/src/ruby/lib/grpc/generic/bidi_call.rb +19 -10
  234. data/src/ruby/lib/grpc/generic/client_stub.rb +95 -38
  235. data/src/ruby/lib/grpc/generic/interceptor_registry.rb +53 -0
  236. data/src/ruby/lib/grpc/generic/interceptors.rb +186 -0
  237. data/src/ruby/lib/grpc/generic/rpc_desc.rb +66 -20
  238. data/src/ruby/lib/grpc/generic/rpc_server.rb +15 -3
  239. data/src/ruby/lib/grpc/google_rpc_status_utils.rb +1 -2
  240. data/src/ruby/lib/grpc/version.rb +1 -1
  241. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +1 -0
  242. data/src/ruby/spec/channel_connection_spec.rb +1 -34
  243. data/src/ruby/spec/client_server_spec.rb +188 -82
  244. data/src/ruby/spec/generic/active_call_spec.rb +65 -11
  245. data/src/ruby/spec/generic/client_interceptors_spec.rb +153 -0
  246. data/src/ruby/spec/generic/interceptor_registry_spec.rb +65 -0
  247. data/src/ruby/spec/generic/rpc_desc_spec.rb +38 -0
  248. data/src/ruby/spec/generic/rpc_server_spec.rb +1 -34
  249. data/src/ruby/spec/generic/server_interceptors_spec.rb +218 -0
  250. data/src/ruby/spec/spec_helper.rb +4 -0
  251. data/src/ruby/spec/support/helpers.rb +73 -0
  252. data/src/ruby/spec/support/services.rb +147 -0
  253. data/third_party/cares/ares_build.h +21 -62
  254. data/third_party/cares/cares/ares.h +23 -1
  255. data/third_party/cares/cares/ares__close_sockets.c +2 -2
  256. data/third_party/cares/cares/ares_create_query.c +3 -3
  257. data/third_party/cares/cares/ares_expand_name.c +6 -2
  258. data/third_party/cares/cares/ares_expand_string.c +1 -1
  259. data/third_party/cares/cares/ares_getnameinfo.c +27 -7
  260. data/third_party/cares/cares/ares_init.c +407 -39
  261. data/third_party/cares/cares/ares_library_init.c +10 -0
  262. data/third_party/cares/cares/ares_library_init.h +2 -1
  263. data/third_party/cares/cares/ares_nowarn.c +6 -6
  264. data/third_party/cares/cares/ares_nowarn.h +2 -2
  265. data/third_party/cares/cares/ares_parse_naptr_reply.c +6 -1
  266. data/third_party/cares/cares/ares_private.h +11 -0
  267. data/third_party/cares/cares/ares_process.c +126 -37
  268. data/third_party/cares/cares/ares_version.h +2 -2
  269. data/third_party/cares/cares/ares_writev.c +2 -2
  270. data/third_party/cares/cares/config-win32.h +8 -34
  271. data/third_party/cares/cares/inet_net_pton.c +2 -2
  272. data/third_party/cares/cares/setup_once.h +5 -5
  273. data/third_party/cares/config_darwin/ares_config.h +98 -196
  274. data/third_party/cares/config_linux/ares_config.h +103 -203
  275. metadata +47 -20
  276. data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +0 -1957
  277. data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +0 -1182
@@ -0,0 +1,48 @@
1
+ /*
2
+ *
3
+ * Copyright 2017 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ #ifndef GRPC_IMPL_CODEGEN_FORK_H
20
+ #define GRPC_IMPL_CODEGEN_FORK_H
21
+
22
+ /**
23
+ * gRPC applications should call this before calling fork(). There should be no
24
+ * active gRPC function calls between calling grpc_prefork() and
25
+ * grpc_postfork_parent()/grpc_postfork_child().
26
+ *
27
+ *
28
+ * Typical use:
29
+ * grpc_prefork();
30
+ * int pid = fork();
31
+ * if (pid) {
32
+ * grpc_postfork_parent();
33
+ * // Parent process..
34
+ * } else {
35
+ * grpc_postfork_child();
36
+ * // Child process...
37
+ * }
38
+ */
39
+
40
+ void grpc_prefork();
41
+
42
+ void grpc_postfork_parent();
43
+
44
+ void grpc_postfork_child();
45
+
46
+ void grpc_fork_handlers_auto_register();
47
+
48
+ #endif /* GRPC_IMPL_CODEGEN_FORK_H */
@@ -188,9 +188,14 @@ typedef struct {
188
188
  #define GRPC_ARG_HTTP2_MAX_FRAME_SIZE "grpc.http2.max_frame_size"
189
189
  /** Should BDP probing be performed? */
190
190
  #define GRPC_ARG_HTTP2_BDP_PROBE "grpc.http2.bdp_probe"
191
- /** Minimum time (in milliseconds) between successive ping frames being sent */
192
- #define GRPC_ARG_HTTP2_MIN_TIME_BETWEEN_PINGS_MS \
191
+ /** Minimum time between sending successive ping frames without receiving any
192
+ data frame, Int valued, milliseconds. */
193
+ #define GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS \
193
194
  "grpc.http2.min_time_between_pings_ms"
195
+ /** Minimum allowed time between receiving successive ping frames without
196
+ sending any data frame. Int valued, milliseconds */
197
+ #define GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS \
198
+ "grpc.http2.min_ping_interval_without_data_ms"
194
199
  /** Channel arg to override the http2 :scheme header */
195
200
  #define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme"
196
201
  /** How many pings can we send before needing to send a data frame or header
@@ -202,10 +207,6 @@ typedef struct {
202
207
  closing the transport? (0 indicates that the server can bear an infinite
203
208
  number of misbehaving pings) */
204
209
  #define GRPC_ARG_HTTP2_MAX_PING_STRIKES "grpc.http2.max_ping_strikes"
205
- /** Minimum allowed time between two pings without sending any data frame. Int
206
- valued, seconds */
207
- #define GRPC_ARG_HTTP2_MIN_PING_INTERVAL_WITHOUT_DATA_MS \
208
- "grpc.http2.min_ping_interval_without_data_ms"
209
210
  /** How much data are we willing to queue up per stream if
210
211
  GRPC_WRITE_BUFFER_HINT is set? This is an upper bound */
211
212
  #define GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE "grpc.http2.write_buffer_size"
@@ -287,7 +288,11 @@ typedef struct {
287
288
  "grpc.experimental.tcp_max_read_chunk_size"
288
289
  /* Timeout in milliseconds to use for calls to the grpclb load balancer.
289
290
  If 0 or unset, the balancer calls will have no deadline. */
290
- #define GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS "grpc.grpclb_timeout_ms"
291
+ #define GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS "grpc.grpclb_call_timeout_ms"
292
+ /* Timeout in milliseconds to wait for the serverlist from the grpclb load
293
+ balancer before using fallback backend addresses from the resolver.
294
+ If 0, fallback will never be used. */
295
+ #define GRPC_ARG_GRPCLB_FALLBACK_TIMEOUT_MS "grpc.grpclb_fallback_timeout_ms"
291
296
  /** If non-zero, grpc server's cronet compression workaround will be enabled */
292
297
  #define GRPC_ARG_WORKAROUND_CRONET_COMPRESSION \
293
298
  "grpc.workaround.cronet_compression"
@@ -355,8 +360,11 @@ typedef enum grpc_call_error {
355
360
  /** Force compression to be disabled for a particular write
356
361
  (start_write/add_metadata). Illegal on invoke/accept. */
357
362
  #define GRPC_WRITE_NO_COMPRESS (0x00000002u)
363
+ /** Force this message to be written to the socket before completing it */
364
+ #define GRPC_WRITE_THROUGH (0x00000004u)
358
365
  /** Mask of all valid flags. */
359
- #define GRPC_WRITE_USED_MASK (GRPC_WRITE_BUFFER_HINT | GRPC_WRITE_NO_COMPRESS)
366
+ #define GRPC_WRITE_USED_MASK \
367
+ (GRPC_WRITE_BUFFER_HINT | GRPC_WRITE_NO_COMPRESS | GRPC_WRITE_THROUGH)
360
368
 
361
369
  /** Initial metadata flags */
362
370
  /** Signal that the call is idempotent */
@@ -377,7 +385,7 @@ typedef enum grpc_call_error {
377
385
  GRPC_INITIAL_METADATA_WAIT_FOR_READY | \
378
386
  GRPC_INITIAL_METADATA_CACHEABLE_REQUEST | \
379
387
  GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET | \
380
- GRPC_INITIAL_METADATA_CORKED)
388
+ GRPC_INITIAL_METADATA_CORKED | GRPC_WRITE_THROUGH)
381
389
 
382
390
  /** A single metadata element */
383
391
  typedef struct grpc_metadata {
@@ -505,8 +513,17 @@ typedef struct grpc_op {
505
513
  uint8_t is_set;
506
514
  grpc_compression_level level;
507
515
  } maybe_compression_level;
516
+ struct grpc_op_send_initial_metadata_maybe_stream_compression_level {
517
+ uint8_t is_set;
518
+ grpc_stream_compression_level level;
519
+ } maybe_stream_compression_level;
508
520
  } send_initial_metadata;
509
521
  struct grpc_op_send_message {
522
+ /** This op takes ownership of the slices in send_message. After
523
+ * a call completes, the contents of send_message are not guaranteed
524
+ * and likely empty. The original owner should still call
525
+ * grpc_byte_buffer_destroy() on this object however.
526
+ */
510
527
  struct grpc_byte_buffer *send_message;
511
528
  } send_message;
512
529
  struct grpc_op_send_status_from_server {
@@ -291,10 +291,6 @@
291
291
  #endif
292
292
 
293
293
  #ifdef _MSC_VER
294
- #ifdef _PYTHON_MSVC
295
- // The Python 3.5 Windows runtime is missing InetNtop
296
- #define GPR_WIN_INET_NTOP
297
- #endif // _PYTHON_MSVC
298
294
  #if _MSC_VER < 1700
299
295
  typedef __int8 int8_t;
300
296
  typedef __int16 int16_t;
@@ -408,4 +404,15 @@ typedef unsigned __int64 uint64_t;
408
404
  #define CENSUSAPI GRPCAPI
409
405
  #endif
410
406
 
407
+ #ifndef GPR_ATTRIBUTE_NO_TSAN /* (1) */
408
+ #if defined(__has_feature)
409
+ #if __has_feature(thread_sanitizer)
410
+ #define GPR_ATTRIBUTE_NO_TSAN __attribute__((no_sanitize("thread")))
411
+ #endif /* __has_feature(thread_sanitizer) */
412
+ #endif /* defined(__has_feature) */
413
+ #ifndef GPR_ATTRIBUTE_NO_TSAN /* (2) */
414
+ #define GPR_ATTRIBUTE_NO_TSAN
415
+ #endif /* GPR_ATTRIBUTE_NO_TSAN (2) */
416
+ #endif /* GPR_ATTRIBUTE_NO_TSAN (1) */
417
+
411
418
  #endif /* GRPC_IMPL_CODEGEN_PORT_PLATFORM_H */
@@ -62,7 +62,12 @@ typedef struct grpc_slice_refcount {
62
62
  struct grpc_slice_refcount *sub_refcount;
63
63
  } grpc_slice_refcount;
64
64
 
65
- #define GRPC_SLICE_INLINED_SIZE (sizeof(size_t) + sizeof(uint8_t *) - 1)
65
+ /* Inlined half of grpc_slice is allowed to expand the size of the overall type
66
+ by this many bytes */
67
+ #define GRPC_SLICE_INLINE_EXTRA_SIZE sizeof(void *)
68
+
69
+ #define GRPC_SLICE_INLINED_SIZE \
70
+ (sizeof(size_t) + sizeof(uint8_t *) - 1 + GRPC_SLICE_INLINE_EXTRA_SIZE)
66
71
 
67
72
  /** A grpc_slice s, if initialized, represents the byte range
68
73
  s.bytes[0..s.length-1].
@@ -49,7 +49,9 @@ extern "C" {
49
49
  #include <grpc/impl/codegen/sync_posix.h>
50
50
  #elif defined(GPR_WINDOWS)
51
51
  #include <grpc/impl/codegen/sync_windows.h>
52
- #elif !defined(GPR_CUSTOM_SYNC)
52
+ #elif defined(GPR_CUSTOM_SYNC)
53
+ #include <grpc/impl/codegen/sync_custom.h>
54
+ #else
53
55
  #error Unable to determine platform for sync
54
56
  #endif
55
57
 
@@ -0,0 +1,36 @@
1
+ /*
2
+ *
3
+ * Copyright 2017 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ #ifndef GRPC_IMPL_CODEGEN_SYNC_CUSTOM_H
20
+ #define GRPC_IMPL_CODEGEN_SYNC_CUSTOM_H
21
+
22
+ #include <grpc/impl/codegen/sync_generic.h>
23
+
24
+ /* Users defining GPR_CUSTOM_SYNC need to define the following macros. */
25
+
26
+ #ifdef GPR_CUSTOM_SYNC
27
+
28
+ typedef GPR_CUSTOM_MU_TYPE gpr_mu;
29
+ typedef GPR_CUSTOM_CV_TYPE gpr_cv;
30
+ typedef GPR_CUSTOM_ONCE_TYPE gpr_once;
31
+
32
+ #define GPR_ONCE_INIT GPR_CUSTOM_ONCE_INIT
33
+
34
+ #endif
35
+
36
+ #endif /* GRPC_IMPL_CODEGEN_SYNC_CUSTOM_H */
@@ -1,12 +1,84 @@
1
+
1
2
  framework module grpc {
2
3
  umbrella header "grpc.h"
3
4
 
4
- header "byte_buffer_reader.h"
5
- header "grpc_security.h"
6
- header "grpc_security_constants.h"
7
5
  header "support/alloc.h"
6
+ header "support/atm.h"
7
+ header "support/avl.h"
8
+ header "support/cmdline.h"
9
+ header "support/cpu.h"
10
+ header "support/histogram.h"
11
+ header "support/host_port.h"
12
+ header "support/log.h"
13
+ header "support/log_windows.h"
8
14
  header "support/port_platform.h"
9
15
  header "support/string_util.h"
16
+ header "support/subprocess.h"
17
+ header "support/sync.h"
18
+ header "support/sync_generic.h"
19
+ header "support/thd.h"
20
+ header "support/time.h"
21
+ header "support/tls.h"
22
+ header "support/useful.h"
23
+ header "impl/codegen/atm.h"
24
+ header "impl/codegen/fork.h"
25
+ header "impl/codegen/gpr_slice.h"
26
+ header "impl/codegen/gpr_types.h"
27
+ header "impl/codegen/port_platform.h"
28
+ header "impl/codegen/sync.h"
29
+ header "impl/codegen/sync_generic.h"
30
+ header "impl/codegen/byte_buffer.h"
31
+ header "impl/codegen/byte_buffer_reader.h"
32
+ header "impl/codegen/compression_types.h"
33
+ header "impl/codegen/connectivity_state.h"
34
+ header "impl/codegen/exec_ctx_fwd.h"
35
+ header "impl/codegen/grpc_types.h"
36
+ header "impl/codegen/propagation_bits.h"
37
+ header "impl/codegen/slice.h"
38
+ header "impl/codegen/status.h"
39
+ header "impl/codegen/atm.h"
40
+ header "impl/codegen/fork.h"
41
+ header "impl/codegen/gpr_slice.h"
42
+ header "impl/codegen/gpr_types.h"
43
+ header "impl/codegen/port_platform.h"
44
+ header "impl/codegen/sync.h"
45
+ header "impl/codegen/sync_generic.h"
46
+ header "grpc_security.h"
47
+ header "byte_buffer.h"
48
+ header "byte_buffer_reader.h"
49
+ header "compression.h"
50
+ header "fork.h"
51
+ header "grpc.h"
52
+ header "grpc_posix.h"
53
+ header "grpc_security_constants.h"
54
+ header "load_reporting.h"
55
+ header "slice.h"
56
+ header "slice_buffer.h"
57
+ header "status.h"
58
+ header "support/workaround_list.h"
59
+ header "census.h"
60
+
61
+ textual header "support/atm_gcc_atomic.h"
62
+ textual header "support/atm_gcc_sync.h"
63
+ textual header "support/atm_windows.h"
64
+ textual header "support/sync_custom.h"
65
+ textual header "support/sync_posix.h"
66
+ textual header "support/sync_windows.h"
67
+ textual header "support/tls_gcc.h"
68
+ textual header "support/tls_msvc.h"
69
+ textual header "support/tls_pthread.h"
70
+ textual header "impl/codegen/atm_gcc_atomic.h"
71
+ textual header "impl/codegen/atm_gcc_sync.h"
72
+ textual header "impl/codegen/atm_windows.h"
73
+ textual header "impl/codegen/sync_custom.h"
74
+ textual header "impl/codegen/sync_posix.h"
75
+ textual header "impl/codegen/sync_windows.h"
76
+ textual header "impl/codegen/atm_gcc_atomic.h"
77
+ textual header "impl/codegen/atm_gcc_sync.h"
78
+ textual header "impl/codegen/atm_windows.h"
79
+ textual header "impl/codegen/sync_custom.h"
80
+ textual header "impl/codegen/sync_posix.h"
81
+ textual header "impl/codegen/sync_windows.h"
10
82
 
11
83
  export *
12
84
  module * { export * }
@@ -65,11 +65,7 @@ GPRAPI grpc_slice grpc_slice_new_with_len(void *p, size_t len,
65
65
  GPRAPI grpc_slice grpc_slice_malloc(size_t length);
66
66
  GPRAPI grpc_slice grpc_slice_malloc_large(size_t length);
67
67
 
68
- #define GRPC_SLICE_MALLOC(len) \
69
- ((len) <= GRPC_SLICE_INLINED_SIZE \
70
- ? (grpc_slice){.refcount = NULL, \
71
- .data.inlined = {.length = (uint8_t)(len)}} \
72
- : grpc_slice_malloc_large((len)))
68
+ #define GRPC_SLICE_MALLOC(len) grpc_slice_malloc(len)
73
69
 
74
70
  /** Intern a slice:
75
71
 
@@ -0,0 +1,24 @@
1
+ /*
2
+ *
3
+ * Copyright 2017 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ #ifndef GRPC_SUPPORT_SYNC_CUSTOM_H
20
+ #define GRPC_SUPPORT_SYNC_CUSTOM_H
21
+
22
+ #include <grpc/impl/codegen/sync_custom.h>
23
+
24
+ #endif /* GRPC_SUPPORT_SYNC_CUSTOM_H */
@@ -37,20 +37,20 @@
37
37
  void define_base_resources() {
38
38
  google_census_Resource_BasicUnit numerator =
39
39
  google_census_Resource_BasicUnit_SECS;
40
- resource r = {"client_rpc_latency", // name
41
- "Client RPC latency in seconds", // description
42
- 0, // prefix
43
- 1, // n_numerators
44
- &numerator, // numerators
45
- 0, // n_denominators
46
- NULL}; // denominators
40
+ resource r = {(char *)"client_rpc_latency", // name
41
+ (char *)"Client RPC latency in seconds", // description
42
+ 0, // prefix
43
+ 1, // n_numerators
44
+ &numerator, // numerators
45
+ 0, // n_denominators
46
+ NULL}; // denominators
47
47
  define_resource(&r);
48
- r = (resource){"server_rpc_latency", // name
49
- "Server RPC latency in seconds", // description
50
- 0, // prefix
51
- 1, // n_numerators
52
- &numerator, // numerators
53
- 0, // n_denominators
54
- NULL}; // denominators
48
+ r = (resource){(char *)"server_rpc_latency", // name
49
+ (char *)"Server RPC latency in seconds", // description
50
+ 0, // prefix
51
+ 1, // n_numerators
52
+ &numerator, // numerators
53
+ 0, // n_denominators
54
+ NULL}; // denominators
55
55
  define_resource(&r);
56
56
  }
@@ -141,7 +141,7 @@ static char *decode_tag(struct raw_tag *tag, char *header, int offset) {
141
141
  // Make a copy (in 'to') of an existing tag_set.
142
142
  static void tag_set_copy(struct tag_set *to, const struct tag_set *from) {
143
143
  memcpy(to, from, sizeof(struct tag_set));
144
- to->kvm = gpr_malloc(to->kvm_size);
144
+ to->kvm = (char *)gpr_malloc(to->kvm_size);
145
145
  memcpy(to->kvm, from->kvm, from->kvm_used);
146
146
  }
147
147
 
@@ -184,7 +184,7 @@ static bool tag_set_add_tag(struct tag_set *tags, const census_tag *tag,
184
184
  if (tags->kvm_used + tag_size > tags->kvm_size) {
185
185
  // allocate new memory if needed
186
186
  tags->kvm_size += 2 * CENSUS_MAX_TAG_KV_LEN + TAG_HEADER_SIZE;
187
- char *new_kvm = gpr_malloc(tags->kvm_size);
187
+ char *new_kvm = (char *)gpr_malloc(tags->kvm_size);
188
188
  if (tags->kvm_used > 0) memcpy(new_kvm, tags->kvm, tags->kvm_used);
189
189
  gpr_free(tags->kvm);
190
190
  tags->kvm = new_kvm;
@@ -274,7 +274,8 @@ static void tag_set_flatten(struct tag_set *tags) {
274
274
  census_context *census_context_create(const census_context *base,
275
275
  const census_tag *tags, int ntags,
276
276
  census_context_status const **status) {
277
- census_context *context = gpr_malloc(sizeof(census_context));
277
+ census_context *context =
278
+ (census_context *)gpr_malloc(sizeof(census_context));
278
279
  // If we are given a base, copy it into our new tag set. Otherwise set it
279
280
  // to zero/NULL everything.
280
281
  if (base == NULL) {
@@ -459,7 +460,7 @@ static void tag_set_decode(struct tag_set *tags, const char *buffer,
459
460
  }
460
461
  tags->kvm_used = size - header_size;
461
462
  tags->kvm_size = tags->kvm_used + CENSUS_MAX_TAG_KV_LEN;
462
- tags->kvm = gpr_malloc(tags->kvm_size);
463
+ tags->kvm = (char *)gpr_malloc(tags->kvm_size);
463
464
  if (tag_header_size != TAG_HEADER_SIZE) {
464
465
  // something new in the tag information. I don't understand it, so
465
466
  // don't copy it over.
@@ -481,7 +482,8 @@ static void tag_set_decode(struct tag_set *tags, const char *buffer,
481
482
  }
482
483
 
483
484
  census_context *census_context_decode(const char *buffer, size_t size) {
484
- census_context *context = gpr_malloc(sizeof(census_context));
485
+ census_context *context =
486
+ (census_context *)gpr_malloc(sizeof(census_context));
485
487
  memset(&context->tags[LOCAL_TAGS], 0, sizeof(struct tag_set));
486
488
  if (buffer == NULL) {
487
489
  memset(&context->tags[PROPAGATED_TAGS], 0, sizeof(struct tag_set));
@@ -60,8 +60,8 @@ static void extract_and_annotate_method_tag(grpc_metadata_batch *md,
60
60
 
61
61
  static void client_mutate_op(grpc_call_element *elem,
62
62
  grpc_transport_stream_op_batch *op) {
63
- call_data *calld = elem->call_data;
64
- channel_data *chand = elem->channel_data;
63
+ call_data *calld = (call_data *)elem->call_data;
64
+ channel_data *chand = (channel_data *)elem->channel_data;
65
65
  if (op->send_initial_metadata) {
66
66
  extract_and_annotate_method_tag(
67
67
  op->payload->send_initial_metadata.send_initial_metadata, calld, chand);
@@ -78,9 +78,9 @@ static void client_start_transport_op(grpc_exec_ctx *exec_ctx,
78
78
  static void server_on_done_recv(grpc_exec_ctx *exec_ctx, void *ptr,
79
79
  grpc_error *error) {
80
80
  GPR_TIMER_BEGIN("census-server:server_on_done_recv", 0);
81
- grpc_call_element *elem = ptr;
82
- call_data *calld = elem->call_data;
83
- channel_data *chand = elem->channel_data;
81
+ grpc_call_element *elem = (grpc_call_element *)ptr;
82
+ call_data *calld = (call_data *)elem->call_data;
83
+ channel_data *chand = (channel_data *)elem->channel_data;
84
84
  if (error == GRPC_ERROR_NONE) {
85
85
  extract_and_annotate_method_tag(calld->recv_initial_metadata, calld, chand);
86
86
  }
@@ -90,7 +90,7 @@ static void server_on_done_recv(grpc_exec_ctx *exec_ctx, void *ptr,
90
90
 
91
91
  static void server_mutate_op(grpc_call_element *elem,
92
92
  grpc_transport_stream_op_batch *op) {
93
- call_data *calld = elem->call_data;
93
+ call_data *calld = (call_data *)elem->call_data;
94
94
  if (op->recv_initial_metadata) {
95
95
  /* substitute our callback for the op callback */
96
96
  calld->recv_initial_metadata =
@@ -117,7 +117,7 @@ static void server_start_transport_op(grpc_exec_ctx *exec_ctx,
117
117
  static grpc_error *client_init_call_elem(grpc_exec_ctx *exec_ctx,
118
118
  grpc_call_element *elem,
119
119
  const grpc_call_element_args *args) {
120
- call_data *d = elem->call_data;
120
+ call_data *d = (call_data *)elem->call_data;
121
121
  GPR_ASSERT(d != NULL);
122
122
  memset(d, 0, sizeof(*d));
123
123
  d->start_ts = args->start_time;
@@ -128,7 +128,7 @@ static void client_destroy_call_elem(grpc_exec_ctx *exec_ctx,
128
128
  grpc_call_element *elem,
129
129
  const grpc_call_final_info *final_info,
130
130
  grpc_closure *ignored) {
131
- call_data *d = elem->call_data;
131
+ call_data *d = (call_data *)elem->call_data;
132
132
  GPR_ASSERT(d != NULL);
133
133
  /* TODO(hongyu): record rpc client stats and census_rpc_end_op here */
134
134
  }
@@ -136,7 +136,7 @@ static void client_destroy_call_elem(grpc_exec_ctx *exec_ctx,
136
136
  static grpc_error *server_init_call_elem(grpc_exec_ctx *exec_ctx,
137
137
  grpc_call_element *elem,
138
138
  const grpc_call_element_args *args) {
139
- call_data *d = elem->call_data;
139
+ call_data *d = (call_data *)elem->call_data;
140
140
  GPR_ASSERT(d != NULL);
141
141
  memset(d, 0, sizeof(*d));
142
142
  d->start_ts = args->start_time;
@@ -150,7 +150,7 @@ static void server_destroy_call_elem(grpc_exec_ctx *exec_ctx,
150
150
  grpc_call_element *elem,
151
151
  const grpc_call_final_info *final_info,
152
152
  grpc_closure *ignored) {
153
- call_data *d = elem->call_data;
153
+ call_data *d = (call_data *)elem->call_data;
154
154
  GPR_ASSERT(d != NULL);
155
155
  /* TODO(hongyu): record rpc server stats and census_tracing_end_op here */
156
156
  }
@@ -158,14 +158,14 @@ static void server_destroy_call_elem(grpc_exec_ctx *exec_ctx,
158
158
  static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx,
159
159
  grpc_channel_element *elem,
160
160
  grpc_channel_element_args *args) {
161
- channel_data *chand = elem->channel_data;
161
+ channel_data *chand = (channel_data *)elem->channel_data;
162
162
  GPR_ASSERT(chand != NULL);
163
163
  return GRPC_ERROR_NONE;
164
164
  }
165
165
 
166
166
  static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
167
167
  grpc_channel_element *elem) {
168
- channel_data *chand = elem->channel_data;
168
+ channel_data *chand = (channel_data *)elem->channel_data;
169
169
  GPR_ASSERT(chand != NULL);
170
170
  }
171
171
 
@@ -179,7 +179,6 @@ const grpc_channel_filter grpc_client_census_filter = {
179
179
  sizeof(channel_data),
180
180
  init_channel_elem,
181
181
  destroy_channel_elem,
182
- grpc_call_next_get_peer,
183
182
  grpc_channel_next_get_info,
184
183
  "census-client"};
185
184
 
@@ -193,6 +192,5 @@ const grpc_channel_filter grpc_server_census_filter = {
193
192
  sizeof(channel_data),
194
193
  init_channel_elem,
195
194
  destroy_channel_elem,
196
- grpc_call_next_get_peer,
197
195
  grpc_channel_next_get_info,
198
196
  "census-server"};