grpc 1.3.4 → 1.4.0

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 (286) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +581 -450
  3. data/include/grpc/census.h +49 -49
  4. data/include/grpc/grpc.h +16 -70
  5. data/include/grpc/grpc_security.h +59 -59
  6. data/include/grpc/grpc_security_constants.h +9 -9
  7. data/include/grpc/impl/codegen/atm.h +1 -1
  8. data/include/grpc/impl/codegen/atm_windows.h +4 -4
  9. data/include/grpc/impl/codegen/byte_buffer_reader.h +2 -2
  10. data/include/grpc/impl/codegen/compression_types.h +4 -5
  11. data/include/grpc/impl/codegen/gpr_slice.h +5 -5
  12. data/include/grpc/impl/codegen/gpr_types.h +6 -7
  13. data/include/grpc/impl/codegen/grpc_types.h +128 -59
  14. data/include/grpc/impl/codegen/port_platform.h +6 -0
  15. data/include/grpc/impl/codegen/propagation_bits.h +2 -2
  16. data/include/grpc/impl/codegen/slice.h +13 -12
  17. data/include/grpc/impl/codegen/status.h +23 -18
  18. data/include/grpc/impl/codegen/sync.h +1 -1
  19. data/include/grpc/load_reporting.h +6 -6
  20. data/include/grpc/slice.h +47 -25
  21. data/include/grpc/slice_buffer.h +18 -14
  22. data/include/grpc/support/alloc.h +7 -7
  23. data/include/grpc/support/cmdline.h +10 -10
  24. data/include/grpc/support/cpu.h +3 -3
  25. data/include/grpc/support/histogram.h +1 -1
  26. data/include/grpc/support/host_port.h +2 -2
  27. data/include/grpc/support/log.h +9 -9
  28. data/include/grpc/support/log_windows.h +1 -1
  29. data/include/grpc/support/string_util.h +3 -3
  30. data/include/grpc/support/subprocess.h +3 -3
  31. data/include/grpc/support/sync.h +31 -31
  32. data/include/grpc/support/thd.h +11 -11
  33. data/include/grpc/support/time.h +12 -12
  34. data/include/grpc/support/tls.h +1 -1
  35. data/include/grpc/support/tls_gcc.h +2 -2
  36. data/include/grpc/support/tls_msvc.h +1 -1
  37. data/include/grpc/support/tls_pthread.h +1 -1
  38. data/include/grpc/support/useful.h +2 -2
  39. data/include/grpc/support/workaround_list.h +46 -0
  40. data/src/core/ext/census/context.c +1 -1
  41. data/src/core/ext/census/intrusive_hash_map.c +319 -0
  42. data/src/core/ext/census/intrusive_hash_map.h +167 -0
  43. data/src/core/ext/census/intrusive_hash_map_internal.h +63 -0
  44. data/src/core/ext/census/resource.c +3 -1
  45. data/src/core/ext/filters/client_channel/channel_connectivity.c +1 -1
  46. data/src/core/ext/filters/client_channel/client_channel.c +173 -103
  47. data/src/core/ext/filters/client_channel/client_channel_plugin.c +3 -2
  48. data/src/core/ext/filters/client_channel/lb_policy.c +2 -1
  49. data/src/core/ext/filters/client_channel/lb_policy.h +8 -7
  50. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +153 -0
  51. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +42 -0
  52. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +405 -102
  53. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +133 -0
  54. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +65 -0
  55. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +90 -51
  56. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +7 -1
  57. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +19 -8
  58. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +63 -34
  59. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +2 -1
  60. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +188 -294
  61. data/src/core/ext/filters/client_channel/lb_policy_factory.c +28 -5
  62. data/src/core/ext/filters/client_channel/lb_policy_factory.h +18 -4
  63. data/src/core/ext/filters/client_channel/parse_address.c +90 -59
  64. data/src/core/ext/filters/client_channel/parse_address.h +17 -8
  65. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +11 -7
  66. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +59 -14
  67. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +6 -0
  68. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +3 -3
  69. data/src/core/ext/filters/client_channel/subchannel.c +20 -17
  70. data/src/core/ext/filters/client_channel/subchannel.h +1 -0
  71. data/src/core/ext/filters/client_channel/subchannel_index.c +11 -1
  72. data/src/core/ext/filters/client_channel/uri_parser.c +36 -22
  73. data/src/core/ext/filters/client_channel/uri_parser.h +1 -1
  74. data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.c +42 -17
  75. data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.h +8 -9
  76. data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.c +19 -11
  77. data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.h +3 -6
  78. data/src/core/ext/filters/http/http_filters_plugin.c +104 -0
  79. data/src/core/{lib/channel/compress_filter.c → ext/filters/http/message_compress/message_compress_filter.c} +124 -23
  80. data/src/core/{lib/channel/compress_filter.h → ext/filters/http/message_compress/message_compress_filter.h} +5 -6
  81. data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.c +4 -6
  82. data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.h +3 -3
  83. data/src/core/ext/filters/load_reporting/load_reporting.c +2 -25
  84. data/src/core/ext/filters/load_reporting/load_reporting_filter.c +26 -1
  85. data/src/core/ext/filters/max_age/max_age_filter.c +14 -14
  86. data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.c +91 -47
  87. data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.h +3 -3
  88. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +223 -0
  89. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +40 -0
  90. data/src/core/ext/filters/workarounds/workaround_utils.c +65 -0
  91. data/src/core/ext/filters/workarounds/workaround_utils.h +52 -0
  92. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +1 -1
  93. data/src/core/ext/transport/chttp2/server/chttp2_server.c +3 -2
  94. data/src/core/ext/transport/chttp2/transport/bin_decoder.c +2 -2
  95. data/src/core/ext/transport/chttp2/transport/bin_encoder.c +3 -3
  96. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +319 -175
  97. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -2
  98. data/src/core/ext/transport/chttp2/transport/frame_data.c +203 -164
  99. data/src/core/ext/transport/chttp2/transport/frame_data.h +8 -14
  100. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +1 -1
  101. data/src/core/ext/transport/chttp2/transport/frame_ping.c +1 -1
  102. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +1 -1
  103. data/src/core/ext/transport/chttp2/transport/frame_settings.c +5 -5
  104. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +1 -1
  105. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +4 -4
  106. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +2 -4
  107. data/src/core/ext/transport/chttp2/transport/hpack_table.c +4 -3
  108. data/src/core/ext/transport/chttp2/transport/internal.h +50 -33
  109. data/src/core/ext/transport/chttp2/transport/parsing.c +10 -11
  110. data/src/core/ext/transport/chttp2/transport/writing.c +32 -13
  111. data/src/core/lib/channel/channel_args.c +30 -9
  112. data/src/core/lib/channel/channel_args.h +5 -1
  113. data/src/core/lib/channel/channel_stack.c +1 -1
  114. data/src/core/lib/channel/channel_stack.h +2 -2
  115. data/src/core/lib/channel/channel_stack_builder.c +13 -1
  116. data/src/core/lib/channel/channel_stack_builder.h +5 -1
  117. data/src/core/lib/channel/connected_channel.c +3 -1
  118. data/src/core/lib/channel/context.h +2 -2
  119. data/src/core/lib/compression/message_compress.c +2 -2
  120. data/src/core/lib/debug/trace.c +13 -6
  121. data/src/core/lib/debug/trace.h +27 -1
  122. data/src/core/lib/http/httpcli.c +1 -1
  123. data/src/core/lib/http/httpcli_security_connector.c +9 -11
  124. data/src/core/lib/http/parser.c +2 -2
  125. data/src/core/lib/http/parser.h +2 -1
  126. data/src/core/lib/iomgr/combiner.c +6 -6
  127. data/src/core/lib/iomgr/combiner.h +2 -1
  128. data/src/core/lib/iomgr/error.c +12 -5
  129. data/src/core/lib/iomgr/error.h +13 -13
  130. data/src/core/lib/iomgr/ev_epoll1_linux.c +984 -0
  131. data/src/core/lib/iomgr/ev_epoll1_linux.h +44 -0
  132. data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +2146 -0
  133. data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.h +43 -0
  134. data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +1337 -0
  135. data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h +43 -0
  136. data/src/core/lib/iomgr/ev_epollex_linux.c +1511 -0
  137. data/src/core/lib/iomgr/ev_epollex_linux.h +43 -0
  138. data/src/core/lib/iomgr/{ev_epoll_linux.c → ev_epollsig_linux.c} +41 -33
  139. data/src/core/lib/iomgr/{ev_epoll_linux.h → ev_epollsig_linux.h} +4 -4
  140. data/src/core/lib/iomgr/ev_poll_posix.c +12 -27
  141. data/src/core/lib/iomgr/ev_poll_posix.h +2 -2
  142. data/src/core/lib/iomgr/ev_posix.c +22 -8
  143. data/src/core/lib/iomgr/ev_posix.h +4 -3
  144. data/src/core/lib/iomgr/ev_windows.c +43 -0
  145. data/src/core/lib/iomgr/exec_ctx.c +5 -0
  146. data/src/core/lib/iomgr/exec_ctx.h +2 -0
  147. data/src/core/lib/iomgr/iomgr.c +4 -0
  148. data/src/core/lib/iomgr/iomgr.h +3 -0
  149. data/src/core/lib/iomgr/is_epollexclusive_available.c +116 -0
  150. data/src/core/lib/iomgr/is_epollexclusive_available.h +41 -0
  151. data/src/core/lib/iomgr/lockfree_event.c +16 -0
  152. data/src/core/lib/iomgr/pollset.h +2 -5
  153. data/src/core/lib/iomgr/pollset_uv.c +1 -1
  154. data/src/core/lib/iomgr/pollset_windows.c +3 -3
  155. data/src/core/lib/iomgr/resource_quota.c +9 -8
  156. data/src/core/lib/iomgr/resource_quota.h +2 -1
  157. data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
  158. data/src/core/lib/iomgr/socket_mutator.h +2 -0
  159. data/src/core/lib/iomgr/sys_epoll_wrapper.h +43 -0
  160. data/src/core/lib/iomgr/tcp_client_posix.c +6 -6
  161. data/src/core/lib/iomgr/tcp_client_uv.c +3 -3
  162. data/src/core/lib/iomgr/tcp_posix.c +7 -7
  163. data/src/core/lib/iomgr/tcp_posix.h +2 -1
  164. data/src/core/lib/iomgr/tcp_server_posix.c +1 -1
  165. data/src/core/lib/iomgr/tcp_uv.c +6 -6
  166. data/src/core/lib/iomgr/tcp_uv.h +2 -1
  167. data/src/core/lib/iomgr/tcp_windows.c +1 -1
  168. data/src/core/lib/iomgr/timer_generic.c +24 -25
  169. data/src/core/lib/iomgr/timer_manager.c +276 -0
  170. data/src/core/lib/iomgr/timer_manager.h +52 -0
  171. data/src/core/lib/iomgr/timer_uv.c +6 -0
  172. data/src/core/lib/iomgr/udp_server.c +42 -9
  173. data/src/core/lib/iomgr/udp_server.h +3 -1
  174. data/src/core/lib/security/credentials/credentials.c +0 -1
  175. data/src/core/lib/security/credentials/fake/fake_credentials.c +23 -0
  176. data/src/core/lib/security/credentials/fake/fake_credentials.h +12 -9
  177. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +1 -1
  178. data/src/core/lib/security/credentials/jwt/jwt_credentials.c +1 -1
  179. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +1 -1
  180. data/src/core/lib/security/credentials/ssl/ssl_credentials.c +24 -53
  181. data/src/core/lib/security/transport/client_auth_filter.c +9 -3
  182. data/src/core/lib/security/transport/secure_endpoint.c +7 -7
  183. data/src/core/lib/security/transport/secure_endpoint.h +1 -1
  184. data/src/core/lib/security/transport/security_connector.c +45 -57
  185. data/src/core/lib/security/transport/security_connector.h +10 -14
  186. data/src/core/lib/security/transport/security_handshaker.c +123 -97
  187. data/src/core/lib/slice/b64.c +1 -1
  188. data/src/core/lib/slice/percent_encoding.c +3 -3
  189. data/src/core/lib/slice/slice.c +66 -33
  190. data/src/core/lib/slice/slice_buffer.c +25 -6
  191. data/src/core/lib/slice/slice_hash_table.c +33 -35
  192. data/src/core/lib/slice/slice_hash_table.h +7 -12
  193. data/src/core/lib/support/atomic.h +45 -0
  194. data/src/core/lib/support/atomic_with_atm.h +70 -0
  195. data/src/core/lib/support/atomic_with_std.h +48 -0
  196. data/src/core/lib/support/avl.c +14 -14
  197. data/src/core/lib/support/cmdline.c +3 -3
  198. data/src/core/lib/support/histogram.c +2 -2
  199. data/src/core/lib/support/host_port.c +1 -1
  200. data/src/core/lib/support/memory.h +74 -0
  201. data/src/core/lib/support/mpscq.c +36 -2
  202. data/src/core/lib/support/mpscq.h +28 -1
  203. data/src/core/lib/support/stack_lockfree.c +3 -36
  204. data/src/core/lib/support/string.c +12 -12
  205. data/src/core/lib/support/string_posix.c +1 -1
  206. data/src/core/lib/support/subprocess_posix.c +2 -2
  207. data/src/core/lib/support/thd_posix.c +1 -1
  208. data/src/core/lib/support/time_posix.c +8 -0
  209. data/src/core/lib/support/tmpfile_posix.c +10 -10
  210. data/src/core/lib/surface/alarm.c +3 -1
  211. data/src/core/lib/surface/api_trace.c +2 -1
  212. data/src/core/lib/surface/api_trace.h +2 -2
  213. data/src/core/lib/surface/byte_buffer_reader.c +1 -1
  214. data/src/core/lib/surface/call.c +65 -22
  215. data/src/core/lib/surface/call.h +4 -2
  216. data/src/core/lib/surface/channel_init.c +2 -19
  217. data/src/core/lib/surface/channel_stack_type.c +18 -0
  218. data/src/core/lib/surface/channel_stack_type.h +2 -0
  219. data/src/core/lib/surface/completion_queue.c +694 -247
  220. data/src/core/lib/surface/completion_queue.h +30 -13
  221. data/src/core/lib/surface/completion_queue_factory.c +24 -9
  222. data/src/core/lib/surface/init.c +1 -52
  223. data/src/core/lib/surface/{lame_client.c → lame_client.cc} +37 -26
  224. data/src/core/lib/surface/server.c +79 -110
  225. data/src/core/lib/surface/server.h +2 -1
  226. data/src/core/lib/surface/version.c +2 -2
  227. data/src/core/lib/transport/bdp_estimator.c +25 -9
  228. data/src/core/lib/transport/bdp_estimator.h +7 -1
  229. data/src/core/lib/transport/byte_stream.c +23 -9
  230. data/src/core/lib/transport/byte_stream.h +15 -6
  231. data/src/core/lib/transport/connectivity_state.c +6 -6
  232. data/src/core/lib/transport/connectivity_state.h +2 -1
  233. data/src/core/lib/transport/service_config.c +6 -13
  234. data/src/core/lib/transport/service_config.h +2 -2
  235. data/src/core/lib/transport/static_metadata.c +403 -389
  236. data/src/core/lib/transport/static_metadata.h +127 -114
  237. data/src/core/plugin_registry/grpc_plugin_registry.c +16 -0
  238. data/src/core/tsi/fake_transport_security.c +5 -4
  239. data/src/core/tsi/ssl_transport_security.c +71 -82
  240. data/src/core/tsi/ssl_transport_security.h +39 -61
  241. data/src/core/tsi/transport_security.c +83 -2
  242. data/src/core/tsi/transport_security.h +27 -2
  243. data/src/core/tsi/transport_security_adapter.c +236 -0
  244. data/src/core/tsi/transport_security_adapter.h +62 -0
  245. data/src/core/tsi/transport_security_interface.h +179 -66
  246. data/src/ruby/ext/grpc/extconf.rb +2 -1
  247. data/src/ruby/ext/grpc/rb_byte_buffer.c +8 -6
  248. data/src/ruby/ext/grpc/rb_call.c +56 -48
  249. data/src/ruby/ext/grpc/rb_call.h +3 -4
  250. data/src/ruby/ext/grpc/rb_call_credentials.c +23 -22
  251. data/src/ruby/ext/grpc/rb_channel.c +2 -3
  252. data/src/ruby/ext/grpc/rb_channel_args.c +11 -9
  253. data/src/ruby/ext/grpc/rb_channel_credentials.c +16 -12
  254. data/src/ruby/ext/grpc/rb_completion_queue.c +7 -9
  255. data/src/ruby/ext/grpc/rb_compression_options.c +7 -6
  256. data/src/ruby/ext/grpc/rb_event_thread.c +10 -12
  257. data/src/ruby/ext/grpc/rb_event_thread.h +1 -2
  258. data/src/ruby/ext/grpc/rb_grpc.c +11 -15
  259. data/src/ruby/ext/grpc/rb_grpc.h +2 -2
  260. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +16 -6
  261. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +25 -10
  262. data/src/ruby/ext/grpc/rb_server.c +26 -28
  263. data/src/ruby/lib/grpc/grpc.rb +1 -1
  264. data/src/ruby/lib/grpc/version.rb +1 -1
  265. data/third_party/cares/config_linux/ares_config.h +36 -2
  266. data/third_party/zlib/adler32.c +14 -7
  267. data/third_party/zlib/compress.c +24 -18
  268. data/third_party/zlib/crc32.c +29 -12
  269. data/third_party/zlib/deflate.c +499 -303
  270. data/third_party/zlib/deflate.h +19 -16
  271. data/third_party/zlib/gzguts.h +16 -7
  272. data/third_party/zlib/gzlib.c +17 -14
  273. data/third_party/zlib/gzread.c +108 -48
  274. data/third_party/zlib/gzwrite.c +210 -122
  275. data/third_party/zlib/infback.c +2 -2
  276. data/third_party/zlib/inffast.c +34 -51
  277. data/third_party/zlib/inflate.c +86 -37
  278. data/third_party/zlib/inflate.h +7 -4
  279. data/third_party/zlib/inftrees.c +12 -14
  280. data/third_party/zlib/trees.c +38 -61
  281. data/third_party/zlib/uncompr.c +66 -32
  282. data/third_party/zlib/zconf.h +32 -9
  283. data/third_party/zlib/zlib.h +298 -154
  284. data/third_party/zlib/zutil.c +25 -24
  285. data/third_party/zlib/zutil.h +35 -17
  286. metadata +63 -30
@@ -34,8 +34,8 @@
34
34
  #ifndef GRPC_RB_H_
35
35
  #define GRPC_RB_H_
36
36
 
37
- #include <sys/time.h>
38
37
  #include <ruby/ruby.h>
38
+ #include <sys/time.h>
39
39
 
40
40
  #include <grpc/support/time.h>
41
41
 
@@ -68,7 +68,7 @@ extern VALUE sym_metadata;
68
68
 
69
69
  /* GRPC_RB_MEMSIZE_UNAVAILABLE is used in rb_data_type_t to indicate that the
70
70
  * number of bytes used by the wrapped struct is not available. */
71
- #define GRPC_RB_MEMSIZE_UNAVAILABLE (size_t (*)(const void*))(NULL)
71
+ #define GRPC_RB_MEMSIZE_UNAVAILABLE (size_t(*)(const void*))(NULL)
72
72
 
73
73
  /* A ruby object alloc func that fails by raising an exception. */
74
74
  VALUE grpc_rb_cannot_alloc(VALUE cls);
@@ -109,9 +109,9 @@ grpc_channel_create_call_type grpc_channel_create_call_import;
109
109
  grpc_channel_ping_type grpc_channel_ping_import;
110
110
  grpc_channel_register_call_type grpc_channel_register_call_import;
111
111
  grpc_channel_create_registered_call_type grpc_channel_create_registered_call_import;
112
+ grpc_call_arena_alloc_type grpc_call_arena_alloc_import;
112
113
  grpc_call_start_batch_type grpc_call_start_batch_import;
113
114
  grpc_call_get_peer_type grpc_call_get_peer_import;
114
- grpc_call_set_load_reporting_cost_context_type grpc_call_set_load_reporting_cost_context_import;
115
115
  grpc_census_call_set_context_type grpc_census_call_set_context_import;
116
116
  grpc_census_call_get_context_type grpc_census_call_get_context_import;
117
117
  grpc_channel_get_target_type grpc_channel_get_target_import;
@@ -121,13 +121,13 @@ grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import;
121
121
  grpc_channel_destroy_type grpc_channel_destroy_import;
122
122
  grpc_call_cancel_type grpc_call_cancel_import;
123
123
  grpc_call_cancel_with_status_type grpc_call_cancel_with_status_import;
124
- grpc_call_destroy_type grpc_call_destroy_import;
124
+ grpc_call_ref_type grpc_call_ref_import;
125
+ grpc_call_unref_type grpc_call_unref_import;
125
126
  grpc_server_request_call_type grpc_server_request_call_import;
126
127
  grpc_server_register_method_type grpc_server_register_method_import;
127
128
  grpc_server_request_registered_call_type grpc_server_request_registered_call_import;
128
129
  grpc_server_create_type grpc_server_create_import;
129
130
  grpc_server_register_completion_queue_type grpc_server_register_completion_queue_import;
130
- grpc_server_register_non_listening_completion_queue_type grpc_server_register_non_listening_completion_queue_import;
131
131
  grpc_server_add_insecure_http2_port_type grpc_server_add_insecure_http2_port_import;
132
132
  grpc_server_start_type grpc_server_start_import;
133
133
  grpc_server_shutdown_and_notify_type grpc_server_shutdown_and_notify_import;
@@ -180,10 +180,12 @@ grpc_call_set_credentials_type grpc_call_set_credentials_import;
180
180
  grpc_server_credentials_set_auth_metadata_processor_type grpc_server_credentials_set_auth_metadata_processor_import;
181
181
  grpc_slice_ref_type grpc_slice_ref_import;
182
182
  grpc_slice_unref_type grpc_slice_unref_import;
183
+ grpc_slice_copy_type grpc_slice_copy_import;
183
184
  grpc_slice_new_type grpc_slice_new_import;
184
185
  grpc_slice_new_with_user_data_type grpc_slice_new_with_user_data_import;
185
186
  grpc_slice_new_with_len_type grpc_slice_new_with_len_import;
186
187
  grpc_slice_malloc_type grpc_slice_malloc_import;
188
+ grpc_slice_malloc_large_type grpc_slice_malloc_large_import;
187
189
  grpc_slice_intern_type grpc_slice_intern_import;
188
190
  grpc_slice_from_copied_string_type grpc_slice_from_copied_string_import;
189
191
  grpc_slice_from_copied_buffer_type grpc_slice_from_copied_buffer_import;
@@ -192,6 +194,7 @@ grpc_slice_from_static_buffer_type grpc_slice_from_static_buffer_import;
192
194
  grpc_slice_sub_type grpc_slice_sub_import;
193
195
  grpc_slice_sub_no_ref_type grpc_slice_sub_no_ref_import;
194
196
  grpc_slice_split_tail_type grpc_slice_split_tail_import;
197
+ grpc_slice_split_tail_maybe_ref_type grpc_slice_split_tail_maybe_ref_import;
195
198
  grpc_slice_split_head_type grpc_slice_split_head_import;
196
199
  grpc_empty_slice_type grpc_empty_slice_import;
197
200
  grpc_slice_default_hash_impl_type grpc_slice_default_hash_impl_import;
@@ -220,6 +223,7 @@ grpc_slice_buffer_swap_type grpc_slice_buffer_swap_import;
220
223
  grpc_slice_buffer_move_into_type grpc_slice_buffer_move_into_import;
221
224
  grpc_slice_buffer_trim_end_type grpc_slice_buffer_trim_end_import;
222
225
  grpc_slice_buffer_move_first_type grpc_slice_buffer_move_first_import;
226
+ grpc_slice_buffer_move_first_no_ref_type grpc_slice_buffer_move_first_no_ref_import;
223
227
  grpc_slice_buffer_move_first_into_buffer_type grpc_slice_buffer_move_first_into_buffer_import;
224
228
  grpc_slice_buffer_take_first_type grpc_slice_buffer_take_first_import;
225
229
  grpc_slice_buffer_undo_take_first_type grpc_slice_buffer_undo_take_first_import;
@@ -267,6 +271,7 @@ gpr_histogram_get_contents_type gpr_histogram_get_contents_import;
267
271
  gpr_histogram_merge_contents_type gpr_histogram_merge_contents_import;
268
272
  gpr_join_host_port_type gpr_join_host_port_import;
269
273
  gpr_split_host_port_type gpr_split_host_port_import;
274
+ gpr_log_severity_string_type gpr_log_severity_string_import;
270
275
  gpr_log_type gpr_log_import;
271
276
  gpr_log_message_type gpr_log_message_import;
272
277
  gpr_set_log_verbosity_type gpr_set_log_verbosity_import;
@@ -407,9 +412,9 @@ void grpc_rb_load_imports(HMODULE library) {
407
412
  grpc_channel_ping_import = (grpc_channel_ping_type) GetProcAddress(library, "grpc_channel_ping");
408
413
  grpc_channel_register_call_import = (grpc_channel_register_call_type) GetProcAddress(library, "grpc_channel_register_call");
409
414
  grpc_channel_create_registered_call_import = (grpc_channel_create_registered_call_type) GetProcAddress(library, "grpc_channel_create_registered_call");
415
+ grpc_call_arena_alloc_import = (grpc_call_arena_alloc_type) GetProcAddress(library, "grpc_call_arena_alloc");
410
416
  grpc_call_start_batch_import = (grpc_call_start_batch_type) GetProcAddress(library, "grpc_call_start_batch");
411
417
  grpc_call_get_peer_import = (grpc_call_get_peer_type) GetProcAddress(library, "grpc_call_get_peer");
412
- grpc_call_set_load_reporting_cost_context_import = (grpc_call_set_load_reporting_cost_context_type) GetProcAddress(library, "grpc_call_set_load_reporting_cost_context");
413
418
  grpc_census_call_set_context_import = (grpc_census_call_set_context_type) GetProcAddress(library, "grpc_census_call_set_context");
414
419
  grpc_census_call_get_context_import = (grpc_census_call_get_context_type) GetProcAddress(library, "grpc_census_call_get_context");
415
420
  grpc_channel_get_target_import = (grpc_channel_get_target_type) GetProcAddress(library, "grpc_channel_get_target");
@@ -419,13 +424,13 @@ void grpc_rb_load_imports(HMODULE library) {
419
424
  grpc_channel_destroy_import = (grpc_channel_destroy_type) GetProcAddress(library, "grpc_channel_destroy");
420
425
  grpc_call_cancel_import = (grpc_call_cancel_type) GetProcAddress(library, "grpc_call_cancel");
421
426
  grpc_call_cancel_with_status_import = (grpc_call_cancel_with_status_type) GetProcAddress(library, "grpc_call_cancel_with_status");
422
- grpc_call_destroy_import = (grpc_call_destroy_type) GetProcAddress(library, "grpc_call_destroy");
427
+ grpc_call_ref_import = (grpc_call_ref_type) GetProcAddress(library, "grpc_call_ref");
428
+ grpc_call_unref_import = (grpc_call_unref_type) GetProcAddress(library, "grpc_call_unref");
423
429
  grpc_server_request_call_import = (grpc_server_request_call_type) GetProcAddress(library, "grpc_server_request_call");
424
430
  grpc_server_register_method_import = (grpc_server_register_method_type) GetProcAddress(library, "grpc_server_register_method");
425
431
  grpc_server_request_registered_call_import = (grpc_server_request_registered_call_type) GetProcAddress(library, "grpc_server_request_registered_call");
426
432
  grpc_server_create_import = (grpc_server_create_type) GetProcAddress(library, "grpc_server_create");
427
433
  grpc_server_register_completion_queue_import = (grpc_server_register_completion_queue_type) GetProcAddress(library, "grpc_server_register_completion_queue");
428
- grpc_server_register_non_listening_completion_queue_import = (grpc_server_register_non_listening_completion_queue_type) GetProcAddress(library, "grpc_server_register_non_listening_completion_queue");
429
434
  grpc_server_add_insecure_http2_port_import = (grpc_server_add_insecure_http2_port_type) GetProcAddress(library, "grpc_server_add_insecure_http2_port");
430
435
  grpc_server_start_import = (grpc_server_start_type) GetProcAddress(library, "grpc_server_start");
431
436
  grpc_server_shutdown_and_notify_import = (grpc_server_shutdown_and_notify_type) GetProcAddress(library, "grpc_server_shutdown_and_notify");
@@ -478,10 +483,12 @@ void grpc_rb_load_imports(HMODULE library) {
478
483
  grpc_server_credentials_set_auth_metadata_processor_import = (grpc_server_credentials_set_auth_metadata_processor_type) GetProcAddress(library, "grpc_server_credentials_set_auth_metadata_processor");
479
484
  grpc_slice_ref_import = (grpc_slice_ref_type) GetProcAddress(library, "grpc_slice_ref");
480
485
  grpc_slice_unref_import = (grpc_slice_unref_type) GetProcAddress(library, "grpc_slice_unref");
486
+ grpc_slice_copy_import = (grpc_slice_copy_type) GetProcAddress(library, "grpc_slice_copy");
481
487
  grpc_slice_new_import = (grpc_slice_new_type) GetProcAddress(library, "grpc_slice_new");
482
488
  grpc_slice_new_with_user_data_import = (grpc_slice_new_with_user_data_type) GetProcAddress(library, "grpc_slice_new_with_user_data");
483
489
  grpc_slice_new_with_len_import = (grpc_slice_new_with_len_type) GetProcAddress(library, "grpc_slice_new_with_len");
484
490
  grpc_slice_malloc_import = (grpc_slice_malloc_type) GetProcAddress(library, "grpc_slice_malloc");
491
+ grpc_slice_malloc_large_import = (grpc_slice_malloc_large_type) GetProcAddress(library, "grpc_slice_malloc_large");
485
492
  grpc_slice_intern_import = (grpc_slice_intern_type) GetProcAddress(library, "grpc_slice_intern");
486
493
  grpc_slice_from_copied_string_import = (grpc_slice_from_copied_string_type) GetProcAddress(library, "grpc_slice_from_copied_string");
487
494
  grpc_slice_from_copied_buffer_import = (grpc_slice_from_copied_buffer_type) GetProcAddress(library, "grpc_slice_from_copied_buffer");
@@ -490,6 +497,7 @@ void grpc_rb_load_imports(HMODULE library) {
490
497
  grpc_slice_sub_import = (grpc_slice_sub_type) GetProcAddress(library, "grpc_slice_sub");
491
498
  grpc_slice_sub_no_ref_import = (grpc_slice_sub_no_ref_type) GetProcAddress(library, "grpc_slice_sub_no_ref");
492
499
  grpc_slice_split_tail_import = (grpc_slice_split_tail_type) GetProcAddress(library, "grpc_slice_split_tail");
500
+ grpc_slice_split_tail_maybe_ref_import = (grpc_slice_split_tail_maybe_ref_type) GetProcAddress(library, "grpc_slice_split_tail_maybe_ref");
493
501
  grpc_slice_split_head_import = (grpc_slice_split_head_type) GetProcAddress(library, "grpc_slice_split_head");
494
502
  grpc_empty_slice_import = (grpc_empty_slice_type) GetProcAddress(library, "grpc_empty_slice");
495
503
  grpc_slice_default_hash_impl_import = (grpc_slice_default_hash_impl_type) GetProcAddress(library, "grpc_slice_default_hash_impl");
@@ -518,6 +526,7 @@ void grpc_rb_load_imports(HMODULE library) {
518
526
  grpc_slice_buffer_move_into_import = (grpc_slice_buffer_move_into_type) GetProcAddress(library, "grpc_slice_buffer_move_into");
519
527
  grpc_slice_buffer_trim_end_import = (grpc_slice_buffer_trim_end_type) GetProcAddress(library, "grpc_slice_buffer_trim_end");
520
528
  grpc_slice_buffer_move_first_import = (grpc_slice_buffer_move_first_type) GetProcAddress(library, "grpc_slice_buffer_move_first");
529
+ grpc_slice_buffer_move_first_no_ref_import = (grpc_slice_buffer_move_first_no_ref_type) GetProcAddress(library, "grpc_slice_buffer_move_first_no_ref");
521
530
  grpc_slice_buffer_move_first_into_buffer_import = (grpc_slice_buffer_move_first_into_buffer_type) GetProcAddress(library, "grpc_slice_buffer_move_first_into_buffer");
522
531
  grpc_slice_buffer_take_first_import = (grpc_slice_buffer_take_first_type) GetProcAddress(library, "grpc_slice_buffer_take_first");
523
532
  grpc_slice_buffer_undo_take_first_import = (grpc_slice_buffer_undo_take_first_type) GetProcAddress(library, "grpc_slice_buffer_undo_take_first");
@@ -565,6 +574,7 @@ void grpc_rb_load_imports(HMODULE library) {
565
574
  gpr_histogram_merge_contents_import = (gpr_histogram_merge_contents_type) GetProcAddress(library, "gpr_histogram_merge_contents");
566
575
  gpr_join_host_port_import = (gpr_join_host_port_type) GetProcAddress(library, "gpr_join_host_port");
567
576
  gpr_split_host_port_import = (gpr_split_host_port_type) GetProcAddress(library, "gpr_split_host_port");
577
+ gpr_log_severity_string_import = (gpr_log_severity_string_type) GetProcAddress(library, "gpr_log_severity_string");
568
578
  gpr_log_import = (gpr_log_type) GetProcAddress(library, "gpr_log");
569
579
  gpr_log_message_import = (gpr_log_message_type) GetProcAddress(library, "gpr_log_message");
570
580
  gpr_set_log_verbosity_import = (gpr_set_log_verbosity_type) GetProcAddress(library, "gpr_set_log_verbosity");
@@ -233,7 +233,7 @@ extern grpc_completion_queue_create_for_next_type grpc_completion_queue_create_f
233
233
  typedef grpc_completion_queue *(*grpc_completion_queue_create_for_pluck_type)(void *reserved);
234
234
  extern grpc_completion_queue_create_for_pluck_type grpc_completion_queue_create_for_pluck_import;
235
235
  #define grpc_completion_queue_create_for_pluck grpc_completion_queue_create_for_pluck_import
236
- typedef grpc_completion_queue *(*grpc_completion_queue_create_type)(void *reserved);
236
+ typedef grpc_completion_queue *(*grpc_completion_queue_create_type)(const grpc_completion_queue_factory *factory, const grpc_completion_queue_attributes *attributes, void *reserved);
237
237
  extern grpc_completion_queue_create_type grpc_completion_queue_create_import;
238
238
  #define grpc_completion_queue_create grpc_completion_queue_create_import
239
239
  typedef grpc_event(*grpc_completion_queue_next_type)(grpc_completion_queue *cq, gpr_timespec deadline, void *reserved);
@@ -278,15 +278,15 @@ extern grpc_channel_register_call_type grpc_channel_register_call_import;
278
278
  typedef grpc_call *(*grpc_channel_create_registered_call_type)(grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask, grpc_completion_queue *completion_queue, void *registered_call_handle, gpr_timespec deadline, void *reserved);
279
279
  extern grpc_channel_create_registered_call_type grpc_channel_create_registered_call_import;
280
280
  #define grpc_channel_create_registered_call grpc_channel_create_registered_call_import
281
+ typedef void *(*grpc_call_arena_alloc_type)(grpc_call *call, size_t size);
282
+ extern grpc_call_arena_alloc_type grpc_call_arena_alloc_import;
283
+ #define grpc_call_arena_alloc grpc_call_arena_alloc_import
281
284
  typedef grpc_call_error(*grpc_call_start_batch_type)(grpc_call *call, const grpc_op *ops, size_t nops, void *tag, void *reserved);
282
285
  extern grpc_call_start_batch_type grpc_call_start_batch_import;
283
286
  #define grpc_call_start_batch grpc_call_start_batch_import
284
287
  typedef char *(*grpc_call_get_peer_type)(grpc_call *call);
285
288
  extern grpc_call_get_peer_type grpc_call_get_peer_import;
286
289
  #define grpc_call_get_peer grpc_call_get_peer_import
287
- typedef void(*grpc_call_set_load_reporting_cost_context_type)(grpc_call *call, struct grpc_load_reporting_cost_context *context);
288
- extern grpc_call_set_load_reporting_cost_context_type grpc_call_set_load_reporting_cost_context_import;
289
- #define grpc_call_set_load_reporting_cost_context grpc_call_set_load_reporting_cost_context_import
290
290
  typedef void(*grpc_census_call_set_context_type)(grpc_call *call, struct census_context *context);
291
291
  extern grpc_census_call_set_context_type grpc_census_call_set_context_import;
292
292
  #define grpc_census_call_set_context grpc_census_call_set_context_import
@@ -314,9 +314,12 @@ extern grpc_call_cancel_type grpc_call_cancel_import;
314
314
  typedef grpc_call_error(*grpc_call_cancel_with_status_type)(grpc_call *call, grpc_status_code status, const char *description, void *reserved);
315
315
  extern grpc_call_cancel_with_status_type grpc_call_cancel_with_status_import;
316
316
  #define grpc_call_cancel_with_status grpc_call_cancel_with_status_import
317
- typedef void(*grpc_call_destroy_type)(grpc_call *call);
318
- extern grpc_call_destroy_type grpc_call_destroy_import;
319
- #define grpc_call_destroy grpc_call_destroy_import
317
+ typedef void(*grpc_call_ref_type)(grpc_call *call);
318
+ extern grpc_call_ref_type grpc_call_ref_import;
319
+ #define grpc_call_ref grpc_call_ref_import
320
+ typedef void(*grpc_call_unref_type)(grpc_call *call);
321
+ extern grpc_call_unref_type grpc_call_unref_import;
322
+ #define grpc_call_unref grpc_call_unref_import
320
323
  typedef grpc_call_error(*grpc_server_request_call_type)(grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *request_metadata, grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag_new);
321
324
  extern grpc_server_request_call_type grpc_server_request_call_import;
322
325
  #define grpc_server_request_call grpc_server_request_call_import
@@ -332,9 +335,6 @@ extern grpc_server_create_type grpc_server_create_import;
332
335
  typedef void(*grpc_server_register_completion_queue_type)(grpc_server *server, grpc_completion_queue *cq, void *reserved);
333
336
  extern grpc_server_register_completion_queue_type grpc_server_register_completion_queue_import;
334
337
  #define grpc_server_register_completion_queue grpc_server_register_completion_queue_import
335
- typedef void(*grpc_server_register_non_listening_completion_queue_type)(grpc_server *server, grpc_completion_queue *q, void *reserved);
336
- extern grpc_server_register_non_listening_completion_queue_type grpc_server_register_non_listening_completion_queue_import;
337
- #define grpc_server_register_non_listening_completion_queue grpc_server_register_non_listening_completion_queue_import
338
338
  typedef int(*grpc_server_add_insecure_http2_port_type)(grpc_server *server, const char *addr);
339
339
  extern grpc_server_add_insecure_http2_port_type grpc_server_add_insecure_http2_port_import;
340
340
  #define grpc_server_add_insecure_http2_port grpc_server_add_insecure_http2_port_import
@@ -491,6 +491,9 @@ extern grpc_slice_ref_type grpc_slice_ref_import;
491
491
  typedef void(*grpc_slice_unref_type)(grpc_slice s);
492
492
  extern grpc_slice_unref_type grpc_slice_unref_import;
493
493
  #define grpc_slice_unref grpc_slice_unref_import
494
+ typedef grpc_slice(*grpc_slice_copy_type)(grpc_slice s);
495
+ extern grpc_slice_copy_type grpc_slice_copy_import;
496
+ #define grpc_slice_copy grpc_slice_copy_import
494
497
  typedef grpc_slice(*grpc_slice_new_type)(void *p, size_t len, void (*destroy)(void *));
495
498
  extern grpc_slice_new_type grpc_slice_new_import;
496
499
  #define grpc_slice_new grpc_slice_new_import
@@ -503,6 +506,9 @@ extern grpc_slice_new_with_len_type grpc_slice_new_with_len_import;
503
506
  typedef grpc_slice(*grpc_slice_malloc_type)(size_t length);
504
507
  extern grpc_slice_malloc_type grpc_slice_malloc_import;
505
508
  #define grpc_slice_malloc grpc_slice_malloc_import
509
+ typedef grpc_slice(*grpc_slice_malloc_large_type)(size_t length);
510
+ extern grpc_slice_malloc_large_type grpc_slice_malloc_large_import;
511
+ #define grpc_slice_malloc_large grpc_slice_malloc_large_import
506
512
  typedef grpc_slice(*grpc_slice_intern_type)(grpc_slice slice);
507
513
  extern grpc_slice_intern_type grpc_slice_intern_import;
508
514
  #define grpc_slice_intern grpc_slice_intern_import
@@ -527,6 +533,9 @@ extern grpc_slice_sub_no_ref_type grpc_slice_sub_no_ref_import;
527
533
  typedef grpc_slice(*grpc_slice_split_tail_type)(grpc_slice *s, size_t split);
528
534
  extern grpc_slice_split_tail_type grpc_slice_split_tail_import;
529
535
  #define grpc_slice_split_tail grpc_slice_split_tail_import
536
+ typedef grpc_slice(*grpc_slice_split_tail_maybe_ref_type)(grpc_slice *s, size_t split, grpc_slice_ref_whom ref_whom);
537
+ extern grpc_slice_split_tail_maybe_ref_type grpc_slice_split_tail_maybe_ref_import;
538
+ #define grpc_slice_split_tail_maybe_ref grpc_slice_split_tail_maybe_ref_import
530
539
  typedef grpc_slice(*grpc_slice_split_head_type)(grpc_slice *s, size_t split);
531
540
  extern grpc_slice_split_head_type grpc_slice_split_head_import;
532
541
  #define grpc_slice_split_head grpc_slice_split_head_import
@@ -611,6 +620,9 @@ extern grpc_slice_buffer_trim_end_type grpc_slice_buffer_trim_end_import;
611
620
  typedef void(*grpc_slice_buffer_move_first_type)(grpc_slice_buffer *src, size_t n, grpc_slice_buffer *dst);
612
621
  extern grpc_slice_buffer_move_first_type grpc_slice_buffer_move_first_import;
613
622
  #define grpc_slice_buffer_move_first grpc_slice_buffer_move_first_import
623
+ typedef void(*grpc_slice_buffer_move_first_no_ref_type)(grpc_slice_buffer *src, size_t n, grpc_slice_buffer *dst);
624
+ extern grpc_slice_buffer_move_first_no_ref_type grpc_slice_buffer_move_first_no_ref_import;
625
+ #define grpc_slice_buffer_move_first_no_ref grpc_slice_buffer_move_first_no_ref_import
614
626
  typedef void(*grpc_slice_buffer_move_first_into_buffer_type)(grpc_exec_ctx *exec_ctx, grpc_slice_buffer *src, size_t n, void *dst);
615
627
  extern grpc_slice_buffer_move_first_into_buffer_type grpc_slice_buffer_move_first_into_buffer_import;
616
628
  #define grpc_slice_buffer_move_first_into_buffer grpc_slice_buffer_move_first_into_buffer_import
@@ -752,6 +764,9 @@ extern gpr_join_host_port_type gpr_join_host_port_import;
752
764
  typedef int(*gpr_split_host_port_type)(const char *name, char **host, char **port);
753
765
  extern gpr_split_host_port_type gpr_split_host_port_import;
754
766
  #define gpr_split_host_port gpr_split_host_port_import
767
+ typedef const char *(*gpr_log_severity_string_type)(gpr_log_severity severity);
768
+ extern gpr_log_severity_string_type gpr_log_severity_string_import;
769
+ #define gpr_log_severity_string gpr_log_severity_string_import
755
770
  typedef void(*gpr_log_type)(const char *file, int line, gpr_log_severity severity, const char *format, ...) GPR_PRINT_FORMAT_CHECK(4, 5);
756
771
  extern gpr_log_type gpr_log_import;
757
772
  #define gpr_log gpr_log_import
@@ -37,15 +37,15 @@
37
37
  #include "rb_server.h"
38
38
 
39
39
  #include <grpc/grpc.h>
40
- #include <grpc/support/atm.h>
41
40
  #include <grpc/grpc_security.h>
41
+ #include <grpc/support/atm.h>
42
42
  #include <grpc/support/log.h>
43
+ #include "rb_byte_buffer.h"
43
44
  #include "rb_call.h"
44
45
  #include "rb_channel_args.h"
45
46
  #include "rb_completion_queue.h"
46
- #include "rb_server_credentials.h"
47
- #include "rb_byte_buffer.h"
48
47
  #include "rb_grpc.h"
48
+ #include "rb_server_credentials.h"
49
49
 
50
50
  /* grpc_rb_cServer is the ruby class that proxies grpc_server. */
51
51
  static VALUE grpc_rb_cServer = Qnil;
@@ -93,9 +93,8 @@ static void grpc_rb_server_free(void *p) {
93
93
  };
94
94
  svr = (grpc_rb_server *)p;
95
95
 
96
- deadline = gpr_time_add(
97
- gpr_now(GPR_CLOCK_REALTIME),
98
- gpr_time_from_seconds(2, GPR_TIMESPAN));
96
+ deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
97
+ gpr_time_from_seconds(2, GPR_TIMESPAN));
99
98
 
100
99
  destroy_server(svr, deadline);
101
100
 
@@ -104,13 +103,15 @@ static void grpc_rb_server_free(void *p) {
104
103
 
105
104
  static const rb_data_type_t grpc_rb_server_data_type = {
106
105
  "grpc_server",
107
- {GRPC_RB_GC_NOT_MARKED, grpc_rb_server_free, GRPC_RB_MEMSIZE_UNAVAILABLE,
106
+ {GRPC_RB_GC_NOT_MARKED,
107
+ grpc_rb_server_free,
108
+ GRPC_RB_MEMSIZE_UNAVAILABLE,
108
109
  {NULL, NULL}},
109
110
  NULL,
110
111
  NULL,
111
112
  #ifdef RUBY_TYPED_FREE_IMMEDIATELY
112
- /* It is unsafe to specify RUBY_TYPED_FREE_IMMEDIATELY because the free function would block
113
- * and we might want to unlock GVL
113
+ /* It is unsafe to specify RUBY_TYPED_FREE_IMMEDIATELY because the free
114
+ * function would block and we might want to unlock GVL
114
115
  * TODO(yugui) Unlock GVL?
115
116
  */
116
117
  0,
@@ -139,7 +140,7 @@ static VALUE grpc_rb_server_init(VALUE self, VALUE channel_args) {
139
140
 
140
141
  grpc_ruby_once_init();
141
142
 
142
- cq = grpc_completion_queue_create(NULL);
143
+ cq = grpc_completion_queue_create_for_pluck(NULL);
143
144
  TypedData_Get_Struct(self, grpc_rb_server, &grpc_rb_server_data_type,
144
145
  wrapper);
145
146
  grpc_rb_hash_convert_to_channel_args(channel_args, &args);
@@ -167,7 +168,7 @@ typedef struct request_call_stack {
167
168
 
168
169
  /* grpc_request_call_stack_init ensures the request_call_stack is properly
169
170
  * initialized */
170
- static void grpc_request_call_stack_init(request_call_stack* st) {
171
+ static void grpc_request_call_stack_init(request_call_stack *st) {
171
172
  MEMZERO(st, request_call_stack, 1);
172
173
  grpc_metadata_array_init(&st->md_ary);
173
174
  grpc_call_details_init(&st->details);
@@ -175,7 +176,7 @@ static void grpc_request_call_stack_init(request_call_stack* st) {
175
176
 
176
177
  /* grpc_request_call_stack_cleanup ensures the request_call_stack is properly
177
178
  * cleaned up */
178
- static void grpc_request_call_stack_cleanup(request_call_stack* st) {
179
+ static void grpc_request_call_stack_cleanup(request_call_stack *st) {
179
180
  grpc_metadata_array_destroy(&st->md_ary);
180
181
  grpc_call_details_destroy(&st->details);
181
182
  }
@@ -191,8 +192,9 @@ static VALUE grpc_rb_server_request_call(VALUE self) {
191
192
  grpc_call_error err;
192
193
  request_call_stack st;
193
194
  VALUE result;
194
- void *tag = (void*)&st;
195
- grpc_completion_queue *call_queue = grpc_completion_queue_create(NULL);
195
+ void *tag = (void *)&st;
196
+ grpc_completion_queue *call_queue =
197
+ grpc_completion_queue_create_for_pluck(NULL);
196
198
  gpr_timespec deadline;
197
199
 
198
200
  TypedData_Get_Struct(self, grpc_rb_server, &grpc_rb_server_data_type, s);
@@ -203,9 +205,8 @@ static VALUE grpc_rb_server_request_call(VALUE self) {
203
205
  grpc_request_call_stack_init(&st);
204
206
  /* call grpc_server_request_call, then wait for it to complete using
205
207
  * pluck_event */
206
- err = grpc_server_request_call(
207
- s->wrapped, &call, &st.details, &st.md_ary,
208
- call_queue, s->queue, tag);
208
+ err = grpc_server_request_call(s->wrapped, &call, &st.details, &st.md_ary,
209
+ call_queue, s->queue, tag);
209
210
  if (err != GRPC_CALL_OK) {
210
211
  grpc_request_call_stack_cleanup(&st);
211
212
  rb_raise(grpc_rb_eCallError,
@@ -301,8 +302,7 @@ static VALUE grpc_rb_server_add_http2_port(VALUE self, VALUE port,
301
302
  return Qnil;
302
303
  } else if (TYPE(rb_creds) == T_SYMBOL) {
303
304
  if (id_insecure_server != SYM2ID(rb_creds)) {
304
- rb_raise(rb_eTypeError,
305
- "bad creds symbol, want :this_port_is_insecure");
305
+ rb_raise(rb_eTypeError, "bad creds symbol, want :this_port_is_insecure");
306
306
  return Qnil;
307
307
  }
308
308
  recvd_port =
@@ -314,9 +314,8 @@ static VALUE grpc_rb_server_add_http2_port(VALUE self, VALUE port,
314
314
  }
315
315
  } else {
316
316
  creds = grpc_rb_get_wrapped_server_credentials(rb_creds);
317
- recvd_port =
318
- grpc_server_add_secure_http2_port(s->wrapped, StringValueCStr(port),
319
- creds);
317
+ recvd_port = grpc_server_add_secure_http2_port(
318
+ s->wrapped, StringValueCStr(port), creds);
320
319
  if (recvd_port == 0) {
321
320
  rb_raise(rb_eRuntimeError,
322
321
  "could not add secure port %s to server, not sure why",
@@ -335,18 +334,17 @@ void Init_grpc_server() {
335
334
 
336
335
  /* Provides a ruby constructor and support for dup/clone. */
337
336
  rb_define_method(grpc_rb_cServer, "initialize", grpc_rb_server_init, 1);
338
- rb_define_method(grpc_rb_cServer, "initialize_copy",
339
- grpc_rb_cannot_init_copy, 1);
337
+ rb_define_method(grpc_rb_cServer, "initialize_copy", grpc_rb_cannot_init_copy,
338
+ 1);
340
339
 
341
340
  /* Add the server methods. */
342
- rb_define_method(grpc_rb_cServer, "request_call",
343
- grpc_rb_server_request_call, 0);
341
+ rb_define_method(grpc_rb_cServer, "request_call", grpc_rb_server_request_call,
342
+ 0);
344
343
  rb_define_method(grpc_rb_cServer, "start", grpc_rb_server_start, 0);
345
344
  rb_define_method(grpc_rb_cServer, "destroy", grpc_rb_server_destroy, -1);
346
345
  rb_define_alias(grpc_rb_cServer, "close", "destroy");
347
346
  rb_define_method(grpc_rb_cServer, "add_http2_port",
348
- grpc_rb_server_add_http2_port,
349
- 2);
347
+ grpc_rb_server_add_http2_port, 2);
350
348
  id_at = rb_intern("at");
351
349
  id_insecure_server = rb_intern("this_port_is_insecure");
352
350
  }
@@ -34,6 +34,6 @@ begin
34
34
  if File.directory?(distrib_lib_dir)
35
35
  require_relative "#{distrib_lib_dir}/grpc_c"
36
36
  else
37
- require_relative 'grpc_c'
37
+ require 'grpc/grpc_c'
38
38
  end
39
39
  end
@@ -29,5 +29,5 @@
29
29
 
30
30
  # GRPC contains the General RPC module.
31
31
  module GRPC
32
- VERSION = '1.3.4'
32
+ VERSION = '1.4.0'
33
33
  end
@@ -70,8 +70,14 @@
70
70
  /* Define to 1 if bool is an available type. */
71
71
  #define HAVE_BOOL_T 1
72
72
 
73
- /* Define to 1 if you have the clock_gettime function and monotonic timer. */
74
- #define HAVE_CLOCK_GETTIME_MONOTONIC 1
73
+ /* Define HAVE_CLOCK_GETTIME_MONOTONIC to 1 if you have the clock_gettime
74
+ * function and monotonic timer.
75
+ *
76
+ * Note: setting HAVE_CLOCK_GETTIME_MONOTONIC causes use of the clock_gettime
77
+ * function from glibc, don't set it to support glibc < 2.17 */
78
+ #ifndef GPR_BACKWARDS_COMPATIBILITY_MODE
79
+ #define HAVE_CLOCK_GETTIME_MONOTONIC 1
80
+ #endif
75
81
 
76
82
  /* Define to 1 if you have the closesocket function. */
77
83
  /* #undef HAVE_CLOSESOCKET */
@@ -505,6 +511,34 @@
505
511
  # define _DARWIN_USE_64_BIT_INODE 1
506
512
  #endif
507
513
 
514
+ #ifdef GPR_BACKWARDS_COMPATIBILITY_MODE
515
+ /* Redefine the fd_set macros for GLIBC < 2.15 support.
516
+ * This is a backwards compatibility hack. At version 2.15, GLIBC introduces
517
+ * the __fdelt_chk function, and starts using it within its fd_set macros
518
+ * (which c-ares uses). For compatibility with GLIBC < 2.15, we need to redefine
519
+ * the fd_set macros to not use __fdelt_chk. */
520
+ #include <sys/select.h>
521
+ #undef FD_SET
522
+ #undef FD_CLR
523
+ #undef FD_ISSET
524
+ /* 'FD_ZERO' doesn't use __fdelt_chk, no need to redefine. */
525
+
526
+ #ifdef __FDS_BITS
527
+ #define GRPC_CARES_FDS_BITS(set) __FDS_BITS(set)
528
+ #else
529
+ #define GRPC_CARES_FDS_BITS(set) ((set)->fds_bits)
530
+ #endif
531
+
532
+ #define GRPC_CARES_FD_MASK(d) ((long int)(1UL << (d) % NFDBITS))
533
+
534
+ #define FD_SET(d, set) \
535
+ ((void) (GRPC_CARES_FDS_BITS (set)[ (d) / NFDBITS ] |= GRPC_CARES_FD_MASK(d)))
536
+ #define FD_CLR(d, set) \
537
+ ((void) (GRPC_CARES_FDS_BITS (set)[ (d) / NFDBITS ] &= ~GRPC_CARES_FD_MASK(d)))
538
+ #define FD_ISSET(d, set) \
539
+ ((GRPC_CARES_FDS_BITS (set)[ (d) / NFDBITS ] & GRPC_CARES_FD_MASK(d)) != 0)
540
+ #endif /* GPR_BACKWARDS_COMPATIBILITY_MODE */
541
+
508
542
  /* Number of bits in a file offset, on hosts where this is settable. */
509
543
  /* #undef _FILE_OFFSET_BITS */
510
544