grpc 1.42.0.pre1-arm64-darwin → 1.60.0.pre1-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/grpc_c.64-ucrt.ruby +0 -0
  3. data/src/ruby/bin/math_pb.rb +24 -18
  4. data/src/ruby/ext/grpc/ext-export-truffleruby-with-ruby-abi-version.clang +2 -0
  5. data/src/ruby/ext/grpc/ext-export-truffleruby-with-ruby-abi-version.gcc +7 -0
  6. data/src/ruby/ext/grpc/ext-export-with-ruby-abi-version.clang +2 -0
  7. data/src/ruby/ext/grpc/ext-export-with-ruby-abi-version.gcc +7 -0
  8. data/src/ruby/ext/grpc/ext-export.gcc +1 -1
  9. data/src/ruby/ext/grpc/extconf.rb +174 -27
  10. data/src/ruby/ext/grpc/rb_call.c +63 -39
  11. data/src/ruby/ext/grpc/rb_call_credentials.c +0 -1
  12. data/src/ruby/ext/grpc/rb_channel.c +113 -84
  13. data/src/ruby/ext/grpc/rb_channel.h +1 -0
  14. data/src/ruby/ext/grpc/rb_channel_args.c +19 -2
  15. data/src/ruby/ext/grpc/rb_channel_args.h +4 -0
  16. data/src/ruby/ext/grpc/rb_channel_credentials.c +0 -1
  17. data/src/ruby/ext/grpc/rb_compression_options.c +1 -2
  18. data/src/ruby/ext/grpc/rb_event_thread.c +22 -6
  19. data/src/ruby/ext/grpc/rb_event_thread.h +1 -0
  20. data/src/ruby/ext/grpc/rb_grpc.c +193 -30
  21. data/src/ruby/ext/grpc/rb_grpc.h +8 -2
  22. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +70 -72
  23. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +108 -111
  24. data/src/ruby/ext/grpc/rb_loader.c +6 -2
  25. data/src/ruby/ext/grpc/rb_server.c +69 -49
  26. data/src/ruby/ext/grpc/rb_server_credentials.c +0 -1
  27. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +0 -1
  28. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +0 -1
  29. data/src/ruby/lib/grpc/2.7/grpc_c.bundle +0 -0
  30. data/src/ruby/lib/grpc/3.0/grpc_c.bundle +0 -0
  31. data/src/ruby/lib/grpc/3.1/grpc_c.bundle +0 -0
  32. data/src/ruby/lib/grpc/3.2/grpc_c.bundle +0 -0
  33. data/src/ruby/lib/grpc/errors.rb +1 -1
  34. data/src/ruby/lib/grpc/generic/active_call.rb +16 -15
  35. data/src/ruby/lib/grpc/generic/bidi_call.rb +4 -0
  36. data/src/ruby/lib/grpc/grpc.rb +1 -1
  37. data/src/ruby/lib/grpc/version.rb +1 -1
  38. data/src/ruby/pb/generate_proto_ruby.sh +1 -6
  39. data/src/ruby/pb/grpc/health/v1/health_pb.rb +24 -13
  40. data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +24 -3
  41. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +34 -108
  42. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +27 -3
  43. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +22 -0
  44. data/src/ruby/pb/test/client.rb +16 -0
  45. data/src/ruby/spec/channel_spec.rb +5 -43
  46. data/src/ruby/spec/client_server_spec.rb +20 -8
  47. data/src/ruby/spec/generic/active_call_spec.rb +12 -3
  48. data/src/ruby/spec/generic/client_stub_spec.rb +23 -23
  49. data/src/ruby/spec/generic/rpc_server_spec.rb +3 -3
  50. data/src/ruby/spec/generic/server_interceptors_spec.rb +1 -1
  51. data/src/ruby/spec/user_agent_spec.rb +1 -1
  52. metadata +59 -58
  53. data/src/ruby/lib/grpc/2.4/grpc_c.bundle +0 -0
  54. data/src/ruby/lib/grpc/2.5/grpc_c.bundle +0 -0
  55. data/src/ruby/lib/grpc/2.6/grpc_c.bundle +0 -0
  56. /data/{grpc_c.32.ruby → grpc_c.32-msvcrt.ruby} +0 -0
  57. /data/{grpc_c.64.ruby → grpc_c.64-msvcrt.ruby} +0 -0
@@ -25,22 +25,55 @@
25
25
 
26
26
  #include <windows.h>
27
27
 
28
+ #include <grpc/byte_buffer.h>
28
29
  #include <grpc/compression.h>
29
30
  #include <grpc/grpc.h>
30
31
  #include <grpc/grpc_posix.h>
31
32
  #include <grpc/grpc_security.h>
32
- #include <grpc/impl/codegen/byte_buffer.h>
33
- #include <grpc/impl/codegen/log.h>
34
33
  #include <grpc/slice.h>
35
34
  #include <grpc/slice_buffer.h>
36
35
  #include <grpc/support/alloc.h>
37
36
  #include <grpc/support/cpu.h>
37
+ #include <grpc/support/log.h>
38
38
  #include <grpc/support/log_windows.h>
39
39
  #include <grpc/support/string_util.h>
40
40
  #include <grpc/support/sync.h>
41
41
  #include <grpc/support/thd_id.h>
42
42
  #include <grpc/support/time.h>
43
43
 
44
+ typedef grpc_byte_buffer*(*grpc_raw_byte_buffer_create_type)(grpc_slice* slices, size_t nslices);
45
+ extern grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
46
+ #define grpc_raw_byte_buffer_create grpc_raw_byte_buffer_create_import
47
+ typedef grpc_byte_buffer*(*grpc_raw_compressed_byte_buffer_create_type)(grpc_slice* slices, size_t nslices, grpc_compression_algorithm compression);
48
+ extern grpc_raw_compressed_byte_buffer_create_type grpc_raw_compressed_byte_buffer_create_import;
49
+ #define grpc_raw_compressed_byte_buffer_create grpc_raw_compressed_byte_buffer_create_import
50
+ typedef grpc_byte_buffer*(*grpc_byte_buffer_copy_type)(grpc_byte_buffer* bb);
51
+ extern grpc_byte_buffer_copy_type grpc_byte_buffer_copy_import;
52
+ #define grpc_byte_buffer_copy grpc_byte_buffer_copy_import
53
+ typedef size_t(*grpc_byte_buffer_length_type)(grpc_byte_buffer* bb);
54
+ extern grpc_byte_buffer_length_type grpc_byte_buffer_length_import;
55
+ #define grpc_byte_buffer_length grpc_byte_buffer_length_import
56
+ typedef void(*grpc_byte_buffer_destroy_type)(grpc_byte_buffer* bb);
57
+ extern grpc_byte_buffer_destroy_type grpc_byte_buffer_destroy_import;
58
+ #define grpc_byte_buffer_destroy grpc_byte_buffer_destroy_import
59
+ typedef int(*grpc_byte_buffer_reader_init_type)(grpc_byte_buffer_reader* reader, grpc_byte_buffer* buffer);
60
+ extern grpc_byte_buffer_reader_init_type grpc_byte_buffer_reader_init_import;
61
+ #define grpc_byte_buffer_reader_init grpc_byte_buffer_reader_init_import
62
+ typedef void(*grpc_byte_buffer_reader_destroy_type)(grpc_byte_buffer_reader* reader);
63
+ extern grpc_byte_buffer_reader_destroy_type grpc_byte_buffer_reader_destroy_import;
64
+ #define grpc_byte_buffer_reader_destroy grpc_byte_buffer_reader_destroy_import
65
+ typedef int(*grpc_byte_buffer_reader_next_type)(grpc_byte_buffer_reader* reader, grpc_slice* slice);
66
+ extern grpc_byte_buffer_reader_next_type grpc_byte_buffer_reader_next_import;
67
+ #define grpc_byte_buffer_reader_next grpc_byte_buffer_reader_next_import
68
+ typedef int(*grpc_byte_buffer_reader_peek_type)(grpc_byte_buffer_reader* reader, grpc_slice** slice);
69
+ extern grpc_byte_buffer_reader_peek_type grpc_byte_buffer_reader_peek_import;
70
+ #define grpc_byte_buffer_reader_peek grpc_byte_buffer_reader_peek_import
71
+ typedef grpc_slice(*grpc_byte_buffer_reader_readall_type)(grpc_byte_buffer_reader* reader);
72
+ extern grpc_byte_buffer_reader_readall_type grpc_byte_buffer_reader_readall_import;
73
+ #define grpc_byte_buffer_reader_readall grpc_byte_buffer_reader_readall_import
74
+ typedef grpc_byte_buffer*(*grpc_raw_byte_buffer_from_reader_type)(grpc_byte_buffer_reader* reader);
75
+ extern grpc_raw_byte_buffer_from_reader_type grpc_raw_byte_buffer_from_reader_import;
76
+ #define grpc_raw_byte_buffer_from_reader grpc_raw_byte_buffer_from_reader_import
44
77
  typedef int(*grpc_compression_algorithm_is_message_type)(grpc_compression_algorithm algorithm);
45
78
  extern grpc_compression_algorithm_is_message_type grpc_compression_algorithm_is_message_import;
46
79
  #define grpc_compression_algorithm_is_message grpc_compression_algorithm_is_message_import
@@ -80,9 +113,6 @@ extern grpc_call_details_init_type grpc_call_details_init_import;
80
113
  typedef void(*grpc_call_details_destroy_type)(grpc_call_details* details);
81
114
  extern grpc_call_details_destroy_type grpc_call_details_destroy_import;
82
115
  #define grpc_call_details_destroy grpc_call_details_destroy_import
83
- typedef void(*grpc_register_plugin_type)(void (*init)(void), void (*destroy)(void));
84
- extern grpc_register_plugin_type grpc_register_plugin_import;
85
- #define grpc_register_plugin grpc_register_plugin_import
86
116
  typedef void(*grpc_init_type)(void);
87
117
  extern grpc_init_type grpc_init_import;
88
118
  #define grpc_init grpc_init_import
@@ -179,9 +209,15 @@ extern grpc_channel_get_info_type grpc_channel_get_info_import;
179
209
  typedef void(*grpc_channel_reset_connect_backoff_type)(grpc_channel* channel);
180
210
  extern grpc_channel_reset_connect_backoff_type grpc_channel_reset_connect_backoff_import;
181
211
  #define grpc_channel_reset_connect_backoff grpc_channel_reset_connect_backoff_import
182
- typedef grpc_channel*(*grpc_insecure_channel_create_type)(const char* target, const grpc_channel_args* args, void* reserved);
183
- extern grpc_insecure_channel_create_type grpc_insecure_channel_create_import;
184
- #define grpc_insecure_channel_create grpc_insecure_channel_create_import
212
+ typedef void(*grpc_channel_credentials_release_type)(grpc_channel_credentials* creds);
213
+ extern grpc_channel_credentials_release_type grpc_channel_credentials_release_import;
214
+ #define grpc_channel_credentials_release grpc_channel_credentials_release_import
215
+ typedef void(*grpc_server_credentials_release_type)(grpc_server_credentials* creds);
216
+ extern grpc_server_credentials_release_type grpc_server_credentials_release_import;
217
+ #define grpc_server_credentials_release grpc_server_credentials_release_import
218
+ typedef grpc_channel*(*grpc_channel_create_type)(const char* target, grpc_channel_credentials* creds, const grpc_channel_args* args);
219
+ extern grpc_channel_create_type grpc_channel_create_import;
220
+ #define grpc_channel_create grpc_channel_create_import
185
221
  typedef grpc_channel*(*grpc_lame_client_channel_create_type)(const char* target, grpc_status_code error_code, const char* error_message);
186
222
  extern grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import;
187
223
  #define grpc_lame_client_channel_create grpc_lame_client_channel_create_import
@@ -227,9 +263,9 @@ extern grpc_server_config_fetcher_destroy_type grpc_server_config_fetcher_destro
227
263
  typedef void(*grpc_server_set_config_fetcher_type)(grpc_server* server, grpc_server_config_fetcher* config_fetcher);
228
264
  extern grpc_server_set_config_fetcher_type grpc_server_set_config_fetcher_import;
229
265
  #define grpc_server_set_config_fetcher grpc_server_set_config_fetcher_import
230
- typedef int(*grpc_server_add_insecure_http2_port_type)(grpc_server* server, const char* addr);
231
- extern grpc_server_add_insecure_http2_port_type grpc_server_add_insecure_http2_port_import;
232
- #define grpc_server_add_insecure_http2_port grpc_server_add_insecure_http2_port_import
266
+ typedef int(*grpc_server_add_http2_port_type)(grpc_server* server, const char* addr, grpc_server_credentials* creds);
267
+ extern grpc_server_add_http2_port_type grpc_server_add_http2_port_import;
268
+ #define grpc_server_add_http2_port grpc_server_add_http2_port_import
233
269
  typedef void(*grpc_server_start_type)(grpc_server* server);
234
270
  extern grpc_server_start_type grpc_server_start_import;
235
271
  #define grpc_server_start grpc_server_start_import
@@ -272,7 +308,7 @@ extern grpc_resource_quota_resize_type grpc_resource_quota_resize_import;
272
308
  typedef void(*grpc_resource_quota_set_max_threads_type)(grpc_resource_quota* resource_quota, int new_max_threads);
273
309
  extern grpc_resource_quota_set_max_threads_type grpc_resource_quota_set_max_threads_import;
274
310
  #define grpc_resource_quota_set_max_threads grpc_resource_quota_set_max_threads_import
275
- typedef grpc_slice(*grpc_dump_xds_configs_type)();
311
+ typedef grpc_slice(*grpc_dump_xds_configs_type)(void);
276
312
  extern grpc_dump_xds_configs_type grpc_dump_xds_configs_import;
277
313
  #define grpc_dump_xds_configs grpc_dump_xds_configs_import
278
314
  typedef const grpc_arg_pointer_vtable*(*grpc_resource_quota_arg_vtable_type)(void);
@@ -302,12 +338,12 @@ extern grpc_channelz_get_socket_type grpc_channelz_get_socket_import;
302
338
  typedef const grpc_arg_pointer_vtable*(*grpc_authorization_policy_provider_arg_vtable_type)(void);
303
339
  extern grpc_authorization_policy_provider_arg_vtable_type grpc_authorization_policy_provider_arg_vtable_import;
304
340
  #define grpc_authorization_policy_provider_arg_vtable grpc_authorization_policy_provider_arg_vtable_import
305
- typedef grpc_channel*(*grpc_insecure_channel_create_from_fd_type)(const char* target, int fd, const grpc_channel_args* args);
306
- extern grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import;
307
- #define grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd_import
308
- typedef void(*grpc_server_add_insecure_channel_from_fd_type)(grpc_server* server, void* reserved, int fd);
309
- extern grpc_server_add_insecure_channel_from_fd_type grpc_server_add_insecure_channel_from_fd_import;
310
- #define grpc_server_add_insecure_channel_from_fd grpc_server_add_insecure_channel_from_fd_import
341
+ typedef grpc_channel*(*grpc_channel_create_from_fd_type)(const char* target, int fd, grpc_channel_credentials* creds, const grpc_channel_args* args);
342
+ extern grpc_channel_create_from_fd_type grpc_channel_create_from_fd_import;
343
+ #define grpc_channel_create_from_fd grpc_channel_create_from_fd_import
344
+ typedef void(*grpc_server_add_channel_from_fd_type)(grpc_server* server, int fd, grpc_server_credentials* creds);
345
+ extern grpc_server_add_channel_from_fd_type grpc_server_add_channel_from_fd_import;
346
+ #define grpc_server_add_channel_from_fd grpc_server_add_channel_from_fd_import
311
347
  typedef const grpc_auth_property*(*grpc_auth_property_iterator_next_type)(grpc_auth_property_iterator* it);
312
348
  extern grpc_auth_property_iterator_next_type grpc_auth_property_iterator_next_import;
313
349
  #define grpc_auth_property_iterator_next grpc_auth_property_iterator_next_import
@@ -353,9 +389,6 @@ extern grpc_ssl_session_cache_create_channel_arg_type grpc_ssl_session_cache_cre
353
389
  typedef void(*grpc_call_credentials_release_type)(grpc_call_credentials* creds);
354
390
  extern grpc_call_credentials_release_type grpc_call_credentials_release_import;
355
391
  #define grpc_call_credentials_release grpc_call_credentials_release_import
356
- typedef void(*grpc_channel_credentials_release_type)(grpc_channel_credentials* creds);
357
- extern grpc_channel_credentials_release_type grpc_channel_credentials_release_import;
358
- #define grpc_channel_credentials_release grpc_channel_credentials_release_import
359
392
  typedef grpc_channel_credentials*(*grpc_google_default_credentials_create_type)(grpc_call_credentials* call_credentials);
360
393
  extern grpc_google_default_credentials_create_type grpc_google_default_credentials_create_import;
361
394
  #define grpc_google_default_credentials_create grpc_google_default_credentials_create_import
@@ -407,12 +440,6 @@ extern grpc_auth_metadata_context_reset_type grpc_auth_metadata_context_reset_im
407
440
  typedef grpc_call_credentials*(*grpc_metadata_credentials_create_from_plugin_type)(grpc_metadata_credentials_plugin plugin, grpc_security_level min_security_level, void* reserved);
408
441
  extern grpc_metadata_credentials_create_from_plugin_type grpc_metadata_credentials_create_from_plugin_import;
409
442
  #define grpc_metadata_credentials_create_from_plugin grpc_metadata_credentials_create_from_plugin_import
410
- typedef grpc_channel*(*grpc_secure_channel_create_type)(grpc_channel_credentials* creds, const char* target, const grpc_channel_args* args, void* reserved);
411
- extern grpc_secure_channel_create_type grpc_secure_channel_create_import;
412
- #define grpc_secure_channel_create grpc_secure_channel_create_import
413
- typedef void(*grpc_server_credentials_release_type)(grpc_server_credentials* creds);
414
- extern grpc_server_credentials_release_type grpc_server_credentials_release_import;
415
- #define grpc_server_credentials_release grpc_server_credentials_release_import
416
443
  typedef grpc_ssl_server_certificate_config*(*grpc_ssl_server_certificate_config_create_type)(const char* pem_root_certs, const grpc_ssl_pem_key_cert_pair* pem_key_cert_pairs, size_t num_key_cert_pairs);
417
444
  extern grpc_ssl_server_certificate_config_create_type grpc_ssl_server_certificate_config_create_import;
418
445
  #define grpc_ssl_server_certificate_config_create grpc_ssl_server_certificate_config_create_import
@@ -437,9 +464,6 @@ extern grpc_ssl_server_credentials_options_destroy_type grpc_ssl_server_credenti
437
464
  typedef grpc_server_credentials*(*grpc_ssl_server_credentials_create_with_options_type)(grpc_ssl_server_credentials_options* options);
438
465
  extern grpc_ssl_server_credentials_create_with_options_type grpc_ssl_server_credentials_create_with_options_import;
439
466
  #define grpc_ssl_server_credentials_create_with_options grpc_ssl_server_credentials_create_with_options_import
440
- typedef int(*grpc_server_add_secure_http2_port_type)(grpc_server* server, const char* addr, grpc_server_credentials* creds);
441
- extern grpc_server_add_secure_http2_port_type grpc_server_add_secure_http2_port_import;
442
- #define grpc_server_add_secure_http2_port grpc_server_add_secure_http2_port_import
443
467
  typedef grpc_call_error(*grpc_call_set_credentials_type)(grpc_call* call, grpc_call_credentials* creds);
444
468
  extern grpc_call_set_credentials_type grpc_call_set_credentials_import;
445
469
  #define grpc_call_set_credentials grpc_call_set_credentials_import
@@ -491,12 +515,12 @@ extern grpc_tls_certificate_provider_release_type grpc_tls_certificate_provider_
491
515
  typedef grpc_tls_credentials_options*(*grpc_tls_credentials_options_create_type)(void);
492
516
  extern grpc_tls_credentials_options_create_type grpc_tls_credentials_options_create_import;
493
517
  #define grpc_tls_credentials_options_create grpc_tls_credentials_options_create_import
494
- typedef void(*grpc_tls_credentials_options_set_cert_request_type_type)(grpc_tls_credentials_options* options, grpc_ssl_client_certificate_request_type type);
495
- extern grpc_tls_credentials_options_set_cert_request_type_type grpc_tls_credentials_options_set_cert_request_type_import;
496
- #define grpc_tls_credentials_options_set_cert_request_type grpc_tls_credentials_options_set_cert_request_type_import
497
- typedef void(*grpc_tls_credentials_options_set_server_verification_option_type)(grpc_tls_credentials_options* options, grpc_tls_server_verification_option server_verification_option);
498
- extern grpc_tls_credentials_options_set_server_verification_option_type grpc_tls_credentials_options_set_server_verification_option_import;
499
- #define grpc_tls_credentials_options_set_server_verification_option grpc_tls_credentials_options_set_server_verification_option_import
518
+ typedef grpc_tls_credentials_options*(*grpc_tls_credentials_options_copy_type)(grpc_tls_credentials_options* options);
519
+ extern grpc_tls_credentials_options_copy_type grpc_tls_credentials_options_copy_import;
520
+ #define grpc_tls_credentials_options_copy grpc_tls_credentials_options_copy_import
521
+ typedef void(*grpc_tls_credentials_options_destroy_type)(grpc_tls_credentials_options* options);
522
+ extern grpc_tls_credentials_options_destroy_type grpc_tls_credentials_options_destroy_import;
523
+ #define grpc_tls_credentials_options_destroy grpc_tls_credentials_options_destroy_import
500
524
  typedef void(*grpc_tls_credentials_options_set_certificate_provider_type)(grpc_tls_credentials_options* options, grpc_tls_certificate_provider* provider);
501
525
  extern grpc_tls_credentials_options_set_certificate_provider_type grpc_tls_credentials_options_set_certificate_provider_import;
502
526
  #define grpc_tls_credentials_options_set_certificate_provider grpc_tls_credentials_options_set_certificate_provider_import
@@ -512,15 +536,27 @@ extern grpc_tls_credentials_options_watch_identity_key_cert_pairs_type grpc_tls_
512
536
  typedef void(*grpc_tls_credentials_options_set_identity_cert_name_type)(grpc_tls_credentials_options* options, const char* identity_cert_name);
513
537
  extern grpc_tls_credentials_options_set_identity_cert_name_type grpc_tls_credentials_options_set_identity_cert_name_import;
514
538
  #define grpc_tls_credentials_options_set_identity_cert_name grpc_tls_credentials_options_set_identity_cert_name_import
515
- typedef void(*grpc_tls_credentials_options_set_server_authorization_check_config_type)(grpc_tls_credentials_options* options, grpc_tls_server_authorization_check_config* config);
516
- extern grpc_tls_credentials_options_set_server_authorization_check_config_type grpc_tls_credentials_options_set_server_authorization_check_config_import;
517
- #define grpc_tls_credentials_options_set_server_authorization_check_config grpc_tls_credentials_options_set_server_authorization_check_config_import
518
- typedef grpc_tls_server_authorization_check_config*(*grpc_tls_server_authorization_check_config_create_type)(const void* config_user_data, int (*schedule)(void* config_user_data, grpc_tls_server_authorization_check_arg* arg), void (*cancel)(void* config_user_data, grpc_tls_server_authorization_check_arg* arg), void (*destruct)(void* config_user_data));
519
- extern grpc_tls_server_authorization_check_config_create_type grpc_tls_server_authorization_check_config_create_import;
520
- #define grpc_tls_server_authorization_check_config_create grpc_tls_server_authorization_check_config_create_import
521
- typedef void(*grpc_tls_server_authorization_check_config_release_type)(grpc_tls_server_authorization_check_config* config);
522
- extern grpc_tls_server_authorization_check_config_release_type grpc_tls_server_authorization_check_config_release_import;
523
- #define grpc_tls_server_authorization_check_config_release grpc_tls_server_authorization_check_config_release_import
539
+ typedef void(*grpc_tls_credentials_options_set_cert_request_type_type)(grpc_tls_credentials_options* options, grpc_ssl_client_certificate_request_type type);
540
+ extern grpc_tls_credentials_options_set_cert_request_type_type grpc_tls_credentials_options_set_cert_request_type_import;
541
+ #define grpc_tls_credentials_options_set_cert_request_type grpc_tls_credentials_options_set_cert_request_type_import
542
+ typedef void(*grpc_tls_credentials_options_set_crl_directory_type)(grpc_tls_credentials_options* options, const char* crl_directory);
543
+ extern grpc_tls_credentials_options_set_crl_directory_type grpc_tls_credentials_options_set_crl_directory_import;
544
+ #define grpc_tls_credentials_options_set_crl_directory grpc_tls_credentials_options_set_crl_directory_import
545
+ typedef void(*grpc_tls_credentials_options_set_verify_server_cert_type)(grpc_tls_credentials_options* options, int verify_server_cert);
546
+ extern grpc_tls_credentials_options_set_verify_server_cert_type grpc_tls_credentials_options_set_verify_server_cert_import;
547
+ #define grpc_tls_credentials_options_set_verify_server_cert grpc_tls_credentials_options_set_verify_server_cert_import
548
+ typedef void(*grpc_tls_credentials_options_set_send_client_ca_list_type)(grpc_tls_credentials_options* options, bool send_client_ca_list);
549
+ extern grpc_tls_credentials_options_set_send_client_ca_list_type grpc_tls_credentials_options_set_send_client_ca_list_import;
550
+ #define grpc_tls_credentials_options_set_send_client_ca_list grpc_tls_credentials_options_set_send_client_ca_list_import
551
+ typedef void(*grpc_tls_credentials_options_set_check_call_host_type)(grpc_tls_credentials_options* options, int check_call_host);
552
+ extern grpc_tls_credentials_options_set_check_call_host_type grpc_tls_credentials_options_set_check_call_host_import;
553
+ #define grpc_tls_credentials_options_set_check_call_host grpc_tls_credentials_options_set_check_call_host_import
554
+ typedef grpc_channel_credentials*(*grpc_insecure_credentials_create_type)();
555
+ extern grpc_insecure_credentials_create_type grpc_insecure_credentials_create_import;
556
+ #define grpc_insecure_credentials_create grpc_insecure_credentials_create_import
557
+ typedef grpc_server_credentials*(*grpc_insecure_server_credentials_create_type)();
558
+ extern grpc_insecure_server_credentials_create_type grpc_insecure_server_credentials_create_import;
559
+ #define grpc_insecure_server_credentials_create grpc_insecure_server_credentials_create_import
524
560
  typedef grpc_channel_credentials*(*grpc_xds_credentials_create_type)(grpc_channel_credentials* fallback_credentials);
525
561
  extern grpc_xds_credentials_create_type grpc_xds_credentials_create_import;
526
562
  #define grpc_xds_credentials_create grpc_xds_credentials_create_import
@@ -536,60 +572,9 @@ extern grpc_authorization_policy_provider_file_watcher_create_type grpc_authoriz
536
572
  typedef void(*grpc_authorization_policy_provider_release_type)(grpc_authorization_policy_provider* provider);
537
573
  extern grpc_authorization_policy_provider_release_type grpc_authorization_policy_provider_release_import;
538
574
  #define grpc_authorization_policy_provider_release grpc_authorization_policy_provider_release_import
539
- typedef grpc_byte_buffer*(*grpc_raw_byte_buffer_create_type)(grpc_slice* slices, size_t nslices);
540
- extern grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
541
- #define grpc_raw_byte_buffer_create grpc_raw_byte_buffer_create_import
542
- typedef grpc_byte_buffer*(*grpc_raw_compressed_byte_buffer_create_type)(grpc_slice* slices, size_t nslices, grpc_compression_algorithm compression);
543
- extern grpc_raw_compressed_byte_buffer_create_type grpc_raw_compressed_byte_buffer_create_import;
544
- #define grpc_raw_compressed_byte_buffer_create grpc_raw_compressed_byte_buffer_create_import
545
- typedef grpc_byte_buffer*(*grpc_byte_buffer_copy_type)(grpc_byte_buffer* bb);
546
- extern grpc_byte_buffer_copy_type grpc_byte_buffer_copy_import;
547
- #define grpc_byte_buffer_copy grpc_byte_buffer_copy_import
548
- typedef size_t(*grpc_byte_buffer_length_type)(grpc_byte_buffer* bb);
549
- extern grpc_byte_buffer_length_type grpc_byte_buffer_length_import;
550
- #define grpc_byte_buffer_length grpc_byte_buffer_length_import
551
- typedef void(*grpc_byte_buffer_destroy_type)(grpc_byte_buffer* bb);
552
- extern grpc_byte_buffer_destroy_type grpc_byte_buffer_destroy_import;
553
- #define grpc_byte_buffer_destroy grpc_byte_buffer_destroy_import
554
- typedef int(*grpc_byte_buffer_reader_init_type)(grpc_byte_buffer_reader* reader, grpc_byte_buffer* buffer);
555
- extern grpc_byte_buffer_reader_init_type grpc_byte_buffer_reader_init_import;
556
- #define grpc_byte_buffer_reader_init grpc_byte_buffer_reader_init_import
557
- typedef void(*grpc_byte_buffer_reader_destroy_type)(grpc_byte_buffer_reader* reader);
558
- extern grpc_byte_buffer_reader_destroy_type grpc_byte_buffer_reader_destroy_import;
559
- #define grpc_byte_buffer_reader_destroy grpc_byte_buffer_reader_destroy_import
560
- typedef int(*grpc_byte_buffer_reader_next_type)(grpc_byte_buffer_reader* reader, grpc_slice* slice);
561
- extern grpc_byte_buffer_reader_next_type grpc_byte_buffer_reader_next_import;
562
- #define grpc_byte_buffer_reader_next grpc_byte_buffer_reader_next_import
563
- typedef int(*grpc_byte_buffer_reader_peek_type)(grpc_byte_buffer_reader* reader, grpc_slice** slice);
564
- extern grpc_byte_buffer_reader_peek_type grpc_byte_buffer_reader_peek_import;
565
- #define grpc_byte_buffer_reader_peek grpc_byte_buffer_reader_peek_import
566
- typedef grpc_slice(*grpc_byte_buffer_reader_readall_type)(grpc_byte_buffer_reader* reader);
567
- extern grpc_byte_buffer_reader_readall_type grpc_byte_buffer_reader_readall_import;
568
- #define grpc_byte_buffer_reader_readall grpc_byte_buffer_reader_readall_import
569
- typedef grpc_byte_buffer*(*grpc_raw_byte_buffer_from_reader_type)(grpc_byte_buffer_reader* reader);
570
- extern grpc_raw_byte_buffer_from_reader_type grpc_raw_byte_buffer_from_reader_import;
571
- #define grpc_raw_byte_buffer_from_reader grpc_raw_byte_buffer_from_reader_import
572
- typedef const char*(*gpr_log_severity_string_type)(gpr_log_severity severity);
573
- extern gpr_log_severity_string_type gpr_log_severity_string_import;
574
- #define gpr_log_severity_string gpr_log_severity_string_import
575
- typedef void(*gpr_log_type)(const char* file, int line, gpr_log_severity severity, const char* format, ...) GPR_PRINT_FORMAT_CHECK(4, 5);
576
- extern gpr_log_type gpr_log_import;
577
- #define gpr_log gpr_log_import
578
- typedef int(*gpr_should_log_type)(gpr_log_severity severity);
579
- extern gpr_should_log_type gpr_should_log_import;
580
- #define gpr_should_log gpr_should_log_import
581
- typedef void(*gpr_log_message_type)(const char* file, int line, gpr_log_severity severity, const char* message);
582
- extern gpr_log_message_type gpr_log_message_import;
583
- #define gpr_log_message gpr_log_message_import
584
- typedef void(*gpr_set_log_verbosity_type)(gpr_log_severity min_severity_to_print);
585
- extern gpr_set_log_verbosity_type gpr_set_log_verbosity_import;
586
- #define gpr_set_log_verbosity gpr_set_log_verbosity_import
587
- typedef void(*gpr_log_verbosity_init_type)(void);
588
- extern gpr_log_verbosity_init_type gpr_log_verbosity_init_import;
589
- #define gpr_log_verbosity_init gpr_log_verbosity_init_import
590
- typedef void(*gpr_set_log_function_type)(gpr_log_func func);
591
- extern gpr_set_log_function_type gpr_set_log_function_import;
592
- #define gpr_set_log_function gpr_set_log_function_import
575
+ typedef void(*grpc_tls_credentials_options_set_tls_session_key_log_file_path_type)(grpc_tls_credentials_options* options, const char* path);
576
+ extern grpc_tls_credentials_options_set_tls_session_key_log_file_path_type grpc_tls_credentials_options_set_tls_session_key_log_file_path_import;
577
+ #define grpc_tls_credentials_options_set_tls_session_key_log_file_path grpc_tls_credentials_options_set_tls_session_key_log_file_path_import
593
578
  typedef grpc_slice(*grpc_slice_ref_type)(grpc_slice s);
594
579
  extern grpc_slice_ref_type grpc_slice_ref_import;
595
580
  #define grpc_slice_ref grpc_slice_ref_import
@@ -614,9 +599,6 @@ extern grpc_slice_malloc_type grpc_slice_malloc_import;
614
599
  typedef grpc_slice(*grpc_slice_malloc_large_type)(size_t length);
615
600
  extern grpc_slice_malloc_large_type grpc_slice_malloc_large_import;
616
601
  #define grpc_slice_malloc_large grpc_slice_malloc_large_import
617
- typedef grpc_slice(*grpc_slice_intern_type)(grpc_slice slice);
618
- extern grpc_slice_intern_type grpc_slice_intern_import;
619
- #define grpc_slice_intern grpc_slice_intern_import
620
602
  typedef grpc_slice(*grpc_slice_from_copied_string_type)(const char* source);
621
603
  extern grpc_slice_from_copied_string_type grpc_slice_from_copied_string_import;
622
604
  #define grpc_slice_from_copied_string grpc_slice_from_copied_string_import
@@ -647,12 +629,6 @@ extern grpc_slice_split_head_type grpc_slice_split_head_import;
647
629
  typedef grpc_slice(*grpc_empty_slice_type)(void);
648
630
  extern grpc_empty_slice_type grpc_empty_slice_import;
649
631
  #define grpc_empty_slice grpc_empty_slice_import
650
- typedef uint32_t(*grpc_slice_default_hash_impl_type)(grpc_slice s);
651
- extern grpc_slice_default_hash_impl_type grpc_slice_default_hash_impl_import;
652
- #define grpc_slice_default_hash_impl grpc_slice_default_hash_impl_import
653
- typedef int(*grpc_slice_default_eq_impl_type)(grpc_slice a, grpc_slice b);
654
- extern grpc_slice_default_eq_impl_type grpc_slice_default_eq_impl_import;
655
- #define grpc_slice_default_eq_impl grpc_slice_default_eq_impl_import
656
632
  typedef int(*grpc_slice_eq_type)(grpc_slice a, grpc_slice b);
657
633
  extern grpc_slice_eq_type grpc_slice_eq_import;
658
634
  #define grpc_slice_eq grpc_slice_eq_import
@@ -674,9 +650,6 @@ extern grpc_slice_chr_type grpc_slice_chr_import;
674
650
  typedef int(*grpc_slice_slice_type)(grpc_slice haystack, grpc_slice needle);
675
651
  extern grpc_slice_slice_type grpc_slice_slice_import;
676
652
  #define grpc_slice_slice grpc_slice_slice_import
677
- typedef uint32_t(*grpc_slice_hash_type)(grpc_slice s);
678
- extern grpc_slice_hash_type grpc_slice_hash_import;
679
- #define grpc_slice_hash grpc_slice_hash_import
680
653
  typedef int(*grpc_slice_is_equivalent_type)(grpc_slice a, grpc_slice b);
681
654
  extern grpc_slice_is_equivalent_type grpc_slice_is_equivalent_import;
682
655
  #define grpc_slice_is_equivalent grpc_slice_is_equivalent_import
@@ -758,6 +731,30 @@ extern gpr_cpu_num_cores_type gpr_cpu_num_cores_import;
758
731
  typedef unsigned(*gpr_cpu_current_cpu_type)(void);
759
732
  extern gpr_cpu_current_cpu_type gpr_cpu_current_cpu_import;
760
733
  #define gpr_cpu_current_cpu gpr_cpu_current_cpu_import
734
+ typedef const char*(*gpr_log_severity_string_type)(gpr_log_severity severity);
735
+ extern gpr_log_severity_string_type gpr_log_severity_string_import;
736
+ #define gpr_log_severity_string gpr_log_severity_string_import
737
+ typedef void(*gpr_log_type)(const char* file, int line, gpr_log_severity severity, const char* format, ...) GPR_PRINT_FORMAT_CHECK(4, 5);
738
+ extern gpr_log_type gpr_log_import;
739
+ #define gpr_log gpr_log_import
740
+ typedef int(*gpr_should_log_type)(gpr_log_severity severity);
741
+ extern gpr_should_log_type gpr_should_log_import;
742
+ #define gpr_should_log gpr_should_log_import
743
+ typedef void(*gpr_log_message_type)(const char* file, int line, gpr_log_severity severity, const char* message);
744
+ extern gpr_log_message_type gpr_log_message_import;
745
+ #define gpr_log_message gpr_log_message_import
746
+ typedef void(*gpr_set_log_verbosity_type)(gpr_log_severity min_severity_to_print);
747
+ extern gpr_set_log_verbosity_type gpr_set_log_verbosity_import;
748
+ #define gpr_set_log_verbosity gpr_set_log_verbosity_import
749
+ typedef void(*gpr_log_verbosity_init_type)(void);
750
+ extern gpr_log_verbosity_init_type gpr_log_verbosity_init_import;
751
+ #define gpr_log_verbosity_init gpr_log_verbosity_init_import
752
+ typedef void(*gpr_set_log_function_type)(gpr_log_func func);
753
+ extern gpr_set_log_function_type gpr_set_log_function_import;
754
+ #define gpr_set_log_function gpr_set_log_function_import
755
+ typedef void(*gpr_assertion_failed_type)(const char* filename, int line, const char* message);
756
+ extern gpr_assertion_failed_type gpr_assertion_failed_import;
757
+ #define gpr_assertion_failed gpr_assertion_failed_import
761
758
  typedef char*(*gpr_format_message_type)(int messageid);
762
759
  extern gpr_format_message_type gpr_format_message_import;
763
760
  #define gpr_format_message gpr_format_message_import
@@ -23,9 +23,13 @@
23
23
 
24
24
  int grpc_rb_load_core() {
25
25
  #if GPR_ARCH_64
26
- TCHAR fname[] = _T("grpc_c.64.ruby");
26
+ #if GRPC_RUBY_WINDOWS_UCRT
27
+ TCHAR fname[] = _T("grpc_c.64-ucrt.ruby");
27
28
  #else
28
- TCHAR fname[] = _T("grpc_c.32.ruby");
29
+ TCHAR fname[] = _T("grpc_c.64-msvcrt.ruby");
30
+ #endif
31
+ #else
32
+ TCHAR fname[] = _T("grpc_c.32-msvcrt.ruby");
29
33
  #endif
30
34
  HMODULE module = GetModuleHandle(_T("grpc_c.so"));
31
35
  TCHAR path[2048 + 32] = _T("");
@@ -106,10 +106,7 @@ static void grpc_rb_server_free_internal(void* p) {
106
106
  }
107
107
 
108
108
  /* Destroys server instances. */
109
- static void grpc_rb_server_free(void* p) {
110
- grpc_rb_server_free_internal(p);
111
- grpc_ruby_shutdown();
112
- }
109
+ static void grpc_rb_server_free(void* p) { grpc_rb_server_free_internal(p); }
113
110
 
114
111
  static const rb_data_type_t grpc_rb_server_data_type = {
115
112
  "grpc_server",
@@ -155,10 +152,7 @@ static VALUE grpc_rb_server_init(VALUE self, VALUE channel_args) {
155
152
  wrapper);
156
153
  grpc_rb_hash_convert_to_channel_args(channel_args, &args);
157
154
  srv = grpc_server_create(&args, NULL);
158
-
159
- if (args.args != NULL) {
160
- xfree(args.args); /* Allocated by grpc_rb_hash_convert_to_channel_args */
161
- }
155
+ grpc_rb_channel_args_destroy(&args);
162
156
  if (srv == NULL) {
163
157
  rb_raise(rb_eRuntimeError, "could not create a gRPC server, not sure why");
164
158
  }
@@ -191,65 +185,88 @@ static void grpc_request_call_stack_cleanup(request_call_stack* st) {
191
185
  grpc_call_details_destroy(&st->details);
192
186
  }
193
187
 
194
- /* call-seq:
195
- server.request_call
188
+ struct server_request_call_args {
189
+ grpc_rb_server* server;
190
+ grpc_completion_queue* call_queue;
191
+ request_call_stack st;
192
+ };
193
+
194
+ static VALUE grpc_rb_server_request_call_try(VALUE value_args) {
195
+ grpc_rb_fork_unsafe_begin();
196
+ struct server_request_call_args* args =
197
+ (struct server_request_call_args*)value_args;
196
198
 
197
- Requests notification of a new call on a server. */
198
- static VALUE grpc_rb_server_request_call(VALUE self) {
199
- grpc_rb_server* s = NULL;
200
199
  grpc_call* call = NULL;
201
- grpc_event ev;
202
- grpc_call_error err;
203
- request_call_stack st;
204
- VALUE result;
205
- void* tag = (void*)&st;
206
- grpc_completion_queue* call_queue =
207
- grpc_completion_queue_create_for_pluck(NULL);
208
- gpr_timespec deadline;
200
+ void* tag = (void*)&args->st;
201
+
202
+ args->call_queue = grpc_completion_queue_create_for_pluck(NULL);
203
+ grpc_request_call_stack_init(&args->st);
209
204
 
210
- TypedData_Get_Struct(self, grpc_rb_server, &grpc_rb_server_data_type, s);
211
- if (s->wrapped == NULL) {
212
- rb_raise(rb_eRuntimeError, "destroyed!");
213
- return Qnil;
214
- }
215
- grpc_request_call_stack_init(&st);
216
205
  /* call grpc_server_request_call, then wait for it to complete using
217
206
  * pluck_event */
218
- err = grpc_server_request_call(s->wrapped, &call, &st.details, &st.md_ary,
219
- call_queue, s->queue, tag);
207
+ grpc_call_error err = grpc_server_request_call(
208
+ args->server->wrapped, &call, &args->st.details, &args->st.md_ary,
209
+ args->call_queue, args->server->queue, tag);
220
210
  if (err != GRPC_CALL_OK) {
221
- grpc_request_call_stack_cleanup(&st);
222
211
  rb_raise(grpc_rb_eCallError,
223
212
  "grpc_server_request_call failed: %s (code=%d)",
224
213
  grpc_call_error_detail_of(err), err);
225
- return Qnil;
226
214
  }
227
215
 
228
- ev = rb_completion_queue_pluck(s->queue, tag,
229
- gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
216
+ grpc_event ev = rb_completion_queue_pluck(
217
+ args->server->queue, tag, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
230
218
  if (!ev.success) {
231
- grpc_request_call_stack_cleanup(&st);
232
219
  rb_raise(grpc_rb_eCallError, "request_call completion failed");
233
- return Qnil;
234
220
  }
235
221
 
236
222
  /* build the NewServerRpc struct result */
237
- deadline = gpr_convert_clock_type(st.details.deadline, GPR_CLOCK_REALTIME);
238
- result = rb_struct_new(
239
- grpc_rb_sNewServerRpc, grpc_rb_slice_to_ruby_string(st.details.method),
240
- grpc_rb_slice_to_ruby_string(st.details.host),
241
- rb_funcall(rb_cTime, id_at, 2, INT2NUM(deadline.tv_sec),
242
- INT2NUM(deadline.tv_nsec / 1000)),
243
- grpc_rb_md_ary_to_h(&st.md_ary), grpc_rb_wrap_call(call, call_queue),
244
- NULL);
245
- grpc_request_call_stack_cleanup(&st);
223
+ gpr_timespec deadline =
224
+ gpr_convert_clock_type(args->st.details.deadline, GPR_CLOCK_REALTIME);
225
+ VALUE result =
226
+ rb_struct_new(grpc_rb_sNewServerRpc,
227
+ grpc_rb_slice_to_ruby_string(args->st.details.method),
228
+ grpc_rb_slice_to_ruby_string(args->st.details.host),
229
+ rb_funcall(rb_cTime, id_at, 2, INT2NUM(deadline.tv_sec),
230
+ INT2NUM(deadline.tv_nsec / 1000)),
231
+ grpc_rb_md_ary_to_h(&args->st.md_ary),
232
+ grpc_rb_wrap_call(call, args->call_queue), NULL);
233
+ args->call_queue = NULL;
246
234
  return result;
247
235
  }
248
236
 
237
+ static VALUE grpc_rb_server_request_call_ensure(VALUE value_args) {
238
+ grpc_rb_fork_unsafe_end();
239
+ struct server_request_call_args* args =
240
+ (struct server_request_call_args*)value_args;
241
+
242
+ if (args->call_queue) {
243
+ grpc_rb_completion_queue_destroy(args->call_queue);
244
+ }
245
+
246
+ grpc_request_call_stack_cleanup(&args->st);
247
+
248
+ return Qnil;
249
+ }
250
+
251
+ /* call-seq:
252
+ server.request_call
253
+
254
+ Requests notification of a new call on a server. */
255
+ static VALUE grpc_rb_server_request_call(VALUE self) {
256
+ grpc_rb_server* s;
257
+ TypedData_Get_Struct(self, grpc_rb_server, &grpc_rb_server_data_type, s);
258
+ grpc_ruby_fork_guard();
259
+ if (s->wrapped == NULL) {
260
+ rb_raise(rb_eRuntimeError, "destroyed!");
261
+ }
262
+ struct server_request_call_args args = {.server = s, .call_queue = NULL};
263
+ return rb_ensure(grpc_rb_server_request_call_try, (VALUE)&args,
264
+ grpc_rb_server_request_call_ensure, (VALUE)&args);
265
+ }
266
+
249
267
  static VALUE grpc_rb_server_start(VALUE self) {
250
268
  grpc_rb_server* s = NULL;
251
269
  TypedData_Get_Struct(self, grpc_rb_server, &grpc_rb_server_data_type, s);
252
-
253
270
  grpc_ruby_fork_guard();
254
271
  if (s->wrapped == NULL) {
255
272
  rb_raise(rb_eRuntimeError, "destroyed!");
@@ -320,8 +337,11 @@ static VALUE grpc_rb_server_add_http2_port(VALUE self, VALUE port,
320
337
  rb_raise(rb_eTypeError, "bad creds symbol, want :this_port_is_insecure");
321
338
  return Qnil;
322
339
  }
323
- recvd_port =
324
- grpc_server_add_insecure_http2_port(s->wrapped, StringValueCStr(port));
340
+ grpc_server_credentials* insecure_creds =
341
+ grpc_insecure_server_credentials_create();
342
+ recvd_port = grpc_server_add_http2_port(s->wrapped, StringValueCStr(port),
343
+ insecure_creds);
344
+ grpc_server_credentials_release(insecure_creds);
325
345
  if (recvd_port == 0) {
326
346
  rb_raise(rb_eRuntimeError,
327
347
  "could not add port %s to server, not sure why",
@@ -340,8 +360,8 @@ static VALUE grpc_rb_server_add_http2_port(VALUE self, VALUE port,
340
360
  "failed to create server because credentials parameter has an "
341
361
  "invalid type, want ServerCredentials or XdsServerCredentials");
342
362
  }
343
- recvd_port = grpc_server_add_secure_http2_port(
344
- s->wrapped, StringValueCStr(port), creds);
363
+ recvd_port =
364
+ grpc_server_add_http2_port(s->wrapped, StringValueCStr(port), creds);
345
365
  if (recvd_port == 0) {
346
366
  rb_raise(rb_eRuntimeError,
347
367
  "could not add secure port %s to server, not sure why",
@@ -62,7 +62,6 @@ static void grpc_rb_server_credentials_free_internal(void* p) {
62
62
  /* Destroys the server credentials instances. */
63
63
  static void grpc_rb_server_credentials_free(void* p) {
64
64
  grpc_rb_server_credentials_free_internal(p);
65
- grpc_ruby_shutdown();
66
65
  }
67
66
 
68
67
  /* Protects the mark object from GC */
@@ -62,7 +62,6 @@ static void grpc_rb_xds_channel_credentials_free_internal(void* p) {
62
62
  /* Destroys the credentials instances. */
63
63
  static void grpc_rb_xds_channel_credentials_free(void* p) {
64
64
  grpc_rb_xds_channel_credentials_free_internal(p);
65
- grpc_ruby_shutdown();
66
65
  }
67
66
 
68
67
  /* Protects the mark object from GC */
@@ -63,7 +63,6 @@ static void grpc_rb_xds_server_credentials_free_internal(void* p) {
63
63
  /* Destroys the server credentials instances. */
64
64
  static void grpc_rb_xds_server_credentials_free(void* p) {
65
65
  grpc_rb_xds_server_credentials_free_internal(p);
66
- grpc_ruby_shutdown();
67
66
  }
68
67
 
69
68
  /* Protects the mark object from GC */
Binary file
Binary file
Binary file
Binary file
@@ -43,7 +43,7 @@ module GRPC
43
43
  debug_error_string = nil)
44
44
  exception_message = "#{code}:#{details}"
45
45
  if debug_error_string
46
- exception_message += ". debug_error_string:#{debug_error_string}"
46
+ exception_message += ". debug_error_string:{#{debug_error_string}}"
47
47
  end
48
48
  super(exception_message)
49
49
  @code = code
@@ -164,7 +164,13 @@ module GRPC
164
164
  end
165
165
 
166
166
  def receive_and_check_status
167
- batch_result = @call.run_batch(RECV_STATUS_ON_CLIENT => nil)
167
+ ops = { RECV_STATUS_ON_CLIENT => nil }
168
+ ops[RECV_INITIAL_METADATA] = nil unless @metadata_received
169
+ batch_result = @call.run_batch(ops)
170
+ unless @metadata_received
171
+ @call.metadata = batch_result.metadata
172
+ @metadata_received = true
173
+ end
168
174
  set_input_stream_done
169
175
  attach_status_results_and_complete_call(batch_result)
170
176
  end
@@ -226,17 +232,16 @@ module GRPC
226
232
  def server_unary_response(req, trailing_metadata: {},
227
233
  code: Core::StatusCodes::OK, details: 'OK')
228
234
  ops = {}
235
+ ops[SEND_MESSAGE] = @marshal.call(req)
236
+ ops[SEND_STATUS_FROM_SERVER] = Struct::Status.new(
237
+ code, details, trailing_metadata)
238
+ ops[RECV_CLOSE_ON_SERVER] = nil
239
+
229
240
  @send_initial_md_mutex.synchronize do
230
241
  ops[SEND_INITIAL_METADATA] = @metadata_to_send unless @metadata_sent
231
242
  @metadata_sent = true
232
243
  end
233
244
 
234
- payload = @marshal.call(req)
235
- ops[SEND_MESSAGE] = payload
236
- ops[SEND_STATUS_FROM_SERVER] = Struct::Status.new(
237
- code, details, trailing_metadata)
238
- ops[RECV_CLOSE_ON_SERVER] = nil
239
-
240
245
  @call.run_batch(ops)
241
246
  set_output_stream_done
242
247
  end
@@ -256,6 +261,9 @@ module GRPC
256
261
  @metadata_received = true
257
262
  end
258
263
  get_message_from_batch_result(batch_result)
264
+ rescue GRPC::Core::CallError => e
265
+ GRPC.logger.info("remote_read: #{e}")
266
+ nil
259
267
  end
260
268
 
261
269
  def get_message_from_batch_result(recv_message_batch_result)
@@ -322,14 +330,7 @@ module GRPC
322
330
  def each_remote_read_then_finish
323
331
  return enum_for(:each_remote_read_then_finish) unless block_given?
324
332
  loop do
325
- resp =
326
- begin
327
- remote_read
328
- rescue GRPC::Core::CallError => e
329
- GRPC.logger.warn("In each_remote_read_then_finish: #{e}")
330
- nil
331
- end
332
-
333
+ resp = remote_read
333
334
  break if resp.nil? # the last response was received
334
335
  yield resp
335
336
  end