grpc 0.13.1-x86-linux → 0.14.1.pre1-x86-linux

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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/grpc_c.32.ruby +0 -0
  3. data/grpc_c.64.ruby +0 -0
  4. data/src/ruby/ext/grpc/extconf.rb +14 -20
  5. data/src/ruby/ext/grpc/rb_byte_buffer.c +2 -3
  6. data/src/ruby/ext/grpc/rb_call.c +37 -4
  7. data/src/ruby/ext/grpc/rb_call_credentials.c +13 -3
  8. data/src/ruby/ext/grpc/rb_channel.c +2 -3
  9. data/src/ruby/ext/grpc/rb_channel_args.c +2 -3
  10. data/src/ruby/ext/grpc/rb_channel_credentials.c +31 -3
  11. data/src/ruby/ext/grpc/rb_completion_queue.c +2 -2
  12. data/src/ruby/ext/grpc/rb_event_thread.c +1 -1
  13. data/src/ruby/ext/grpc/rb_grpc.c +4 -2
  14. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +8 -0
  15. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +14 -2
  16. data/src/ruby/ext/grpc/rb_server.c +2 -3
  17. data/src/ruby/ext/grpc/rb_server_credentials.c +16 -13
  18. data/src/ruby/ext/grpc/rb_signal.c +70 -0
  19. data/src/ruby/ext/grpc/rb_signal.h +39 -0
  20. data/src/ruby/lib/grpc.rb +21 -13
  21. data/src/ruby/lib/grpc/2.0/grpc_c.so +0 -0
  22. data/src/ruby/lib/grpc/2.1/grpc_c.so +0 -0
  23. data/src/ruby/lib/grpc/2.2/grpc_c.so +0 -0
  24. data/src/ruby/lib/grpc/2.3/grpc_c.so +0 -0
  25. data/src/ruby/lib/grpc/core/time_consts.rb +2 -2
  26. data/src/ruby/lib/grpc/errors.rb +2 -2
  27. data/src/ruby/lib/grpc/generic/active_call.rb +10 -3
  28. data/src/ruby/lib/grpc/generic/bidi_call.rb +2 -2
  29. data/src/ruby/lib/grpc/generic/client_stub.rb +10 -7
  30. data/src/ruby/lib/grpc/generic/rpc_desc.rb +2 -2
  31. data/src/ruby/lib/grpc/generic/rpc_server.rb +21 -61
  32. data/src/ruby/lib/grpc/generic/service.rb +5 -15
  33. data/src/ruby/lib/grpc/grpc.rb +3 -3
  34. data/src/ruby/lib/grpc/grpc_c.so +0 -0
  35. data/src/ruby/{bin/interop/interop_client.rb → lib/grpc/signals.rb} +39 -21
  36. data/src/ruby/lib/grpc/version.rb +2 -2
  37. data/src/ruby/pb/generate_proto_ruby.sh +9 -2
  38. data/src/ruby/pb/grpc/health/checker.rb +1 -1
  39. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services.rb +28 -0
  40. data/src/ruby/pb/grpc/testing/metrics.rb +28 -0
  41. data/src/ruby/pb/grpc/testing/metrics_services.rb +27 -0
  42. data/src/ruby/pb/test/client.rb +12 -23
  43. data/src/ruby/pb/test/server.rb +1 -1
  44. data/src/ruby/spec/client_server_spec.rb +1 -1
  45. data/src/ruby/spec/generic/client_stub_spec.rb +18 -17
  46. data/src/ruby/spec/generic/rpc_server_spec.rb +23 -7
  47. data/src/ruby/spec/generic/service_spec.rb +0 -69
  48. data/src/ruby/{bin/interop/interop_server.rb → spec/pb/duplicate/codegen_spec.rb} +41 -20
  49. data/src/ruby/spec/pb/health/checker_spec.rb +1 -1
  50. metadata +27 -15
  51. data/src/ruby/bin/grpc_ruby_interop_client +0 -33
  52. data/src/ruby/bin/grpc_ruby_interop_server +0 -33
@@ -166,7 +166,7 @@ extern grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_im
166
166
  typedef int(*grpc_compression_algorithm_name_type)(grpc_compression_algorithm algorithm, char **name);
167
167
  extern grpc_compression_algorithm_name_type grpc_compression_algorithm_name_import;
168
168
  #define grpc_compression_algorithm_name grpc_compression_algorithm_name_import
169
- typedef grpc_compression_algorithm(*grpc_compression_algorithm_for_level_type)(grpc_compression_level level);
169
+ typedef grpc_compression_algorithm(*grpc_compression_algorithm_for_level_type)(grpc_compression_level level, uint32_t accepted_encodings);
170
170
  extern grpc_compression_algorithm_for_level_type grpc_compression_algorithm_for_level_import;
171
171
  #define grpc_compression_algorithm_for_level grpc_compression_algorithm_for_level_import
172
172
  typedef void(*grpc_compression_options_init_type)(grpc_compression_options *opts);
@@ -283,7 +283,7 @@ extern grpc_call_destroy_type grpc_call_destroy_import;
283
283
  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);
284
284
  extern grpc_server_request_call_type grpc_server_request_call_import;
285
285
  #define grpc_server_request_call grpc_server_request_call_import
286
- typedef void *(*grpc_server_register_method_type)(grpc_server *server, const char *method, const char *host);
286
+ typedef void *(*grpc_server_register_method_type)(grpc_server *server, const char *method, const char *host, grpc_server_register_method_payload_handling payload_handling, uint32_t flags);
287
287
  extern grpc_server_register_method_type grpc_server_register_method_import;
288
288
  #define grpc_server_register_method grpc_server_register_method_import
289
289
  typedef grpc_call_error(*grpc_server_request_registered_call_type)(grpc_server *server, void *registered_method, grpc_call **call, gpr_timespec *deadline, grpc_metadata_array *request_metadata, grpc_byte_buffer **optional_payload, grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag_new);
@@ -322,6 +322,9 @@ extern grpc_header_nonbin_value_is_legal_type grpc_header_nonbin_value_is_legal_
322
322
  typedef int(*grpc_is_binary_header_type)(const char *key, size_t length);
323
323
  extern grpc_is_binary_header_type grpc_is_binary_header_import;
324
324
  #define grpc_is_binary_header grpc_is_binary_header_import
325
+ typedef const char *(*grpc_call_error_to_string_type)(grpc_call_error error);
326
+ extern grpc_call_error_to_string_type grpc_call_error_to_string_import;
327
+ #define grpc_call_error_to_string grpc_call_error_to_string_import
325
328
  typedef const grpc_auth_property *(*grpc_auth_property_iterator_next_type)(grpc_auth_property_iterator *it);
326
329
  extern grpc_auth_property_iterator_next_type grpc_auth_property_iterator_next_import;
327
330
  #define grpc_auth_property_iterator_next grpc_auth_property_iterator_next_import
@@ -406,6 +409,9 @@ extern grpc_server_credentials_release_type grpc_server_credentials_release_impo
406
409
  typedef grpc_server_credentials *(*grpc_ssl_server_credentials_create_type)(const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs, size_t num_key_cert_pairs, int force_client_auth, void *reserved);
407
410
  extern grpc_ssl_server_credentials_create_type grpc_ssl_server_credentials_create_import;
408
411
  #define grpc_ssl_server_credentials_create grpc_ssl_server_credentials_create_import
412
+ typedef grpc_server_credentials *(*grpc_ssl_server_credentials_create_ex_type)(const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs, size_t num_key_cert_pairs, grpc_ssl_client_certificate_request_type client_certificate_request, void *reserved);
413
+ extern grpc_ssl_server_credentials_create_ex_type grpc_ssl_server_credentials_create_ex_import;
414
+ #define grpc_ssl_server_credentials_create_ex grpc_ssl_server_credentials_create_ex_import
409
415
  typedef int(*grpc_server_add_secure_http2_port_type)(grpc_server *server, const char *addr, grpc_server_credentials *creds);
410
416
  extern grpc_server_add_secure_http2_port_type grpc_server_add_secure_http2_port_import;
411
417
  #define grpc_server_add_secure_http2_port grpc_server_add_secure_http2_port_import
@@ -472,6 +478,12 @@ extern gpr_log_type gpr_log_import;
472
478
  typedef void(*gpr_log_message_type)(const char *file, int line, gpr_log_severity severity, const char *message);
473
479
  extern gpr_log_message_type gpr_log_message_import;
474
480
  #define gpr_log_message gpr_log_message_import
481
+ typedef void(*gpr_set_log_verbosity_type)(gpr_log_severity min_severity_to_print);
482
+ extern gpr_set_log_verbosity_type gpr_set_log_verbosity_import;
483
+ #define gpr_set_log_verbosity gpr_set_log_verbosity_import
484
+ typedef void(*gpr_log_verbosity_init_type)();
485
+ extern gpr_log_verbosity_init_type gpr_log_verbosity_init_import;
486
+ #define gpr_log_verbosity_init gpr_log_verbosity_init_import
475
487
  typedef void(*gpr_set_log_function_type)(gpr_log_func func);
476
488
  extern gpr_set_log_function_type gpr_set_log_function_import;
477
489
  #define gpr_set_log_function gpr_set_log_function_import
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  *
3
- * Copyright 2015-2016, Google Inc.
3
+ * Copyright 2015, Google Inc.
4
4
  * All rights reserved.
5
5
  *
6
6
  * Redistribution and use in source and binary forms, with or without
@@ -32,11 +32,10 @@
32
32
  */
33
33
 
34
34
  #include <ruby/ruby.h>
35
+
35
36
  #include "rb_grpc_imports.generated.h"
36
37
  #include "rb_server.h"
37
38
 
38
- #include <ruby/ruby.h>
39
-
40
39
  #include <grpc/grpc.h>
41
40
  #include <grpc/grpc_security.h>
42
41
  #include "rb_call.h"
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  *
3
- * Copyright 2015-2016, Google Inc.
3
+ * Copyright 2015, Google Inc.
4
4
  * All rights reserved.
5
5
  *
6
6
  * Redistribution and use in source and binary forms, with or without
@@ -32,11 +32,10 @@
32
32
  */
33
33
 
34
34
  #include <ruby/ruby.h>
35
+
35
36
  #include "rb_grpc_imports.generated.h"
36
37
  #include "rb_server_credentials.h"
37
38
 
38
- #include <ruby/ruby.h>
39
-
40
39
  #include <grpc/grpc.h>
41
40
  #include <grpc/grpc_security.h>
42
41
 
@@ -90,9 +89,12 @@ static void grpc_rb_server_credentials_mark(void *p) {
90
89
 
91
90
  static const rb_data_type_t grpc_rb_server_credentials_data_type = {
92
91
  "grpc_server_credentials",
93
- {grpc_rb_server_credentials_mark, grpc_rb_server_credentials_free,
94
- GRPC_RB_MEMSIZE_UNAVAILABLE, {NULL, NULL}},
95
- NULL, NULL,
92
+ {grpc_rb_server_credentials_mark,
93
+ grpc_rb_server_credentials_free,
94
+ GRPC_RB_MEMSIZE_UNAVAILABLE,
95
+ {NULL, NULL}},
96
+ NULL,
97
+ NULL,
96
98
  #ifdef RUBY_TYPED_FREE_IMMEDIATELY
97
99
  RUBY_TYPED_FREE_IMMEDIATELY
98
100
  #endif
@@ -219,7 +221,9 @@ static VALUE grpc_rb_server_credentials_init(VALUE self, VALUE pem_root_certs,
219
221
  }
220
222
  }
221
223
 
222
- auth_client = TYPE(force_client_auth) == T_TRUE;
224
+ auth_client = TYPE(force_client_auth) == T_TRUE
225
+ ? GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
226
+ : GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE;
223
227
  key_cert_pairs = ALLOC_N(grpc_ssl_pem_key_cert_pair, num_key_certs);
224
228
  for (i = 0; i < num_key_certs; i++) {
225
229
  key_cert = rb_ary_entry(pem_key_certs, i);
@@ -233,13 +237,12 @@ static VALUE grpc_rb_server_credentials_init(VALUE self, VALUE pem_root_certs,
233
237
  &grpc_rb_server_credentials_data_type, wrapper);
234
238
 
235
239
  if (pem_root_certs == Qnil) {
236
- creds = grpc_ssl_server_credentials_create(NULL, key_cert_pairs,
237
- num_key_certs,
238
- auth_client, NULL);
240
+ creds = grpc_ssl_server_credentials_create_ex(
241
+ NULL, key_cert_pairs, num_key_certs, auth_client, NULL);
239
242
  } else {
240
- creds = grpc_ssl_server_credentials_create(RSTRING_PTR(pem_root_certs),
241
- key_cert_pairs, num_key_certs,
242
- auth_client, NULL);
243
+ creds = grpc_ssl_server_credentials_create_ex(RSTRING_PTR(pem_root_certs),
244
+ key_cert_pairs, num_key_certs,
245
+ auth_client, NULL);
243
246
  }
244
247
  xfree(key_cert_pairs);
245
248
  if (creds == NULL) {
@@ -0,0 +1,70 @@
1
+ /*
2
+ *
3
+ * Copyright 2016, Google Inc.
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are
8
+ * met:
9
+ *
10
+ * * Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * * Redistributions in binary form must reproduce the above
13
+ * copyright notice, this list of conditions and the following disclaimer
14
+ * in the documentation and/or other materials provided with the
15
+ * distribution.
16
+ * * Neither the name of Google Inc. nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ */
33
+
34
+ #include <ruby/ruby.h>
35
+ #include <signal.h>
36
+ #include <stdbool.h>
37
+
38
+ #include <grpc/support/log.h>
39
+
40
+ #include "rb_grpc.h"
41
+
42
+ static void (*old_sigint_handler)(int);
43
+ static void (*old_sigterm_handler)(int);
44
+
45
+ static volatile bool signal_received = false;
46
+
47
+ /* This has to be handled at the C level instead of Ruby, because Ruby signal
48
+ * handlers are constrained to run in the main interpreter thread. If that main
49
+ * thread is blocked on grpc_completion_queue_pluck, the signal handlers will
50
+ * never run */
51
+ static void handle_signal(int signum) {
52
+ signal_received = true;
53
+ if (signum == SIGINT) {
54
+ old_sigint_handler(signum);
55
+ } else if (signum == SIGTERM) {
56
+ old_sigterm_handler(signum);
57
+ }
58
+ }
59
+
60
+ static VALUE grpc_rb_signal_received(VALUE self) {
61
+ (void)self;
62
+ return signal_received ? Qtrue : Qfalse;
63
+ }
64
+
65
+ void Init_grpc_signals() {
66
+ old_sigint_handler = signal(SIGINT, handle_signal);
67
+ old_sigterm_handler = signal(SIGTERM, handle_signal);
68
+ rb_define_singleton_method(grpc_rb_mGrpcCore, "signal_received?",
69
+ grpc_rb_signal_received, 0);
70
+ }
@@ -0,0 +1,39 @@
1
+ /*
2
+ *
3
+ * Copyright 2016, Google Inc.
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are
8
+ * met:
9
+ *
10
+ * * Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * * Redistributions in binary form must reproduce the above
13
+ * copyright notice, this list of conditions and the following disclaimer
14
+ * in the documentation and/or other materials provided with the
15
+ * distribution.
16
+ * * Neither the name of Google Inc. nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ */
33
+
34
+ #ifndef GRPC_RB_SIGNAL_H_
35
+ #define GRPC_RB_SIGNAL_H_
36
+
37
+ void Init_grpc_signals();
38
+
39
+ #endif /* GRPC_RB_SIGNAL_H_ */
@@ -1,4 +1,4 @@
1
- # Copyright 2015-2016, Google Inc.
1
+ # Copyright 2015, Google Inc.
2
2
  # All rights reserved.
3
3
  #
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -28,17 +28,25 @@
28
28
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
30
  ssl_roots_path = File.expand_path('../../../../etc/roots.pem', __FILE__)
31
- unless ENV['GRPC_DEFAULT_SSL_ROOTS_FILE_PATH']
32
- ENV['GRPC_DEFAULT_SSL_ROOTS_FILE_PATH'] = ssl_roots_path
31
+
32
+ require_relative 'grpc/errors'
33
+ require_relative 'grpc/grpc'
34
+ require_relative 'grpc/logconfig'
35
+ require_relative 'grpc/notifier'
36
+ require_relative 'grpc/signals'
37
+ require_relative 'grpc/version'
38
+ require_relative 'grpc/core/time_consts'
39
+ require_relative 'grpc/generic/active_call'
40
+ require_relative 'grpc/generic/client_stub'
41
+ require_relative 'grpc/generic/service'
42
+ require_relative 'grpc/generic/rpc_server'
43
+
44
+ begin
45
+ file = File.open(ssl_roots_path)
46
+ roots = file.read
47
+ GRPC::Core::ChannelCredentials.set_default_roots_pem roots
48
+ ensure
49
+ file.close
33
50
  end
34
51
 
35
- require 'grpc/errors'
36
- require 'grpc/grpc'
37
- require 'grpc/logconfig'
38
- require 'grpc/notifier'
39
- require 'grpc/version'
40
- require 'grpc/core/time_consts'
41
- require 'grpc/generic/active_call'
42
- require 'grpc/generic/client_stub'
43
- require 'grpc/generic/service'
44
- require 'grpc/generic/rpc_server'
52
+ GRPC::Signals.wait_for_signals
@@ -1,4 +1,4 @@
1
- # Copyright 2015-2016, Google Inc.
1
+ # Copyright 2015, Google Inc.
2
2
  # All rights reserved.
3
3
  #
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
27
27
  # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
28
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
- require 'grpc/grpc'
30
+ require_relative '../grpc'
31
31
 
32
32
  # GRPC contains the General RPC module.
33
33
  module GRPC
@@ -1,4 +1,4 @@
1
- # Copyright 2015-2016, Google Inc.
1
+ # Copyright 2015, Google Inc.
2
2
  # All rights reserved.
3
3
  #
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
27
27
  # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
28
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
- require 'grpc/grpc'
30
+ require_relative './grpc'
31
31
 
32
32
  # GRPC contains the General RPC module.
33
33
  module GRPC
@@ -28,7 +28,9 @@
28
28
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
30
  require 'forwardable'
31
- require 'grpc/generic/bidi_call'
31
+ require 'weakref'
32
+ require_relative 'bidi_call'
33
+ require_relative '../signals'
32
34
 
33
35
  class Struct
34
36
  # BatchResult is the struct returned by calls to call#start_batch.
@@ -59,7 +61,8 @@ module GRPC
59
61
  include Core::CallOps
60
62
  extend Forwardable
61
63
  attr_reader(:deadline)
62
- def_delegators :@call, :cancel, :metadata, :write_flag, :write_flag=
64
+ def_delegators :@call, :cancel, :metadata, :write_flag, :write_flag=,
65
+ :peer, :peer_cert
63
66
 
64
67
  # client_invoke begins a client invocation.
65
68
  #
@@ -120,6 +123,10 @@ module GRPC
120
123
  @unmarshal = unmarshal
121
124
  @metadata_tag = metadata_tag
122
125
  @op_notifier = nil
126
+ weak_self = WeakRef.new(self)
127
+ remove_handler = GRPC::Signals.register_handler(&weak_self
128
+ .method(:cancel))
129
+ ObjectSpace.define_finalizer(self, remove_handler)
123
130
  end
124
131
 
125
132
  # output_metadata are provides access to hash that can be used to
@@ -472,7 +479,7 @@ module GRPC
472
479
  # SingleReqView limits access to an ActiveCall's methods for use in server
473
480
  # handlers that receive just one request.
474
481
  SingleReqView = view_class(:cancelled, :deadline, :metadata,
475
- :output_metadata)
482
+ :output_metadata, :peer, :peer_cert)
476
483
 
477
484
  # MultiReqView limits access to an ActiveCall's methods for use in
478
485
  # server client_streamer handlers.
@@ -1,4 +1,4 @@
1
- # Copyright 2015-2016, Google Inc.
1
+ # Copyright 2015, Google Inc.
2
2
  # All rights reserved.
3
3
  #
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,7 @@
28
28
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
30
  require 'forwardable'
31
- require 'grpc/grpc'
31
+ require_relative '../grpc'
32
32
 
33
33
  # GRPC contains the General RPC module.
34
34
  module GRPC
@@ -1,4 +1,4 @@
1
- # Copyright 2015-2016, Google Inc.
1
+ # Copyright 2015, Google Inc.
2
2
  # All rights reserved.
3
3
  #
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,8 +27,8 @@
27
27
  # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
28
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
- require 'grpc/generic/active_call'
31
- require 'grpc/version'
30
+ require_relative 'active_call'
31
+ require_relative '../version'
32
32
 
33
33
  # GRPC contains the General RPC module.
34
34
  module GRPC
@@ -85,7 +85,8 @@ module GRPC
85
85
  # when present, this is the default timeout used for calls
86
86
  #
87
87
  # @param host [String] the host the stub connects to
88
- # @param q [Core::CompletionQueue] used to wait for events
88
+ # @param q [Core::CompletionQueue] used to wait for events - now deprecated
89
+ # since each new active call gets its own separately
89
90
  # @param creds [Core::ChannelCredentials|Symbol] the channel credentials, or
90
91
  # :this_channel_is_insecure
91
92
  # @param channel_override [Core::Channel] a pre-created channel
@@ -97,7 +98,6 @@ module GRPC
97
98
  propagate_mask: nil,
98
99
  **kw)
99
100
  fail(TypeError, '!CompletionQueue') unless q.is_a?(Core::CompletionQueue)
100
- @queue = q
101
101
  @ch = ClientStub.setup_channel(channel_override, host, creds, **kw)
102
102
  alt_host = kw[Core::Channel::SSL_TARGET]
103
103
  @host = alt_host.nil? ? host : alt_host
@@ -458,14 +458,17 @@ module GRPC
458
458
  if deadline.nil?
459
459
  deadline = from_relative_time(timeout.nil? ? @timeout : timeout)
460
460
  end
461
- call = @ch.create_call(@queue,
461
+ # Provide each new client call with its own completion queue
462
+ call_queue = Core::CompletionQueue.new
463
+ call = @ch.create_call(call_queue,
462
464
  parent, # parent call
463
465
  @propagate_mask, # propagation options
464
466
  method,
465
467
  nil, # host use nil,
466
468
  deadline)
467
469
  call.set_credentials! credentials unless credentials.nil?
468
- ActiveCall.new(call, @queue, marshal, unmarshal, deadline, started: false)
470
+ ActiveCall.new(call, call_queue, marshal, unmarshal, deadline,
471
+ started: false)
469
472
  end
470
473
  end
471
474
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2015-2016, Google Inc.
1
+ # Copyright 2015, Google Inc.
2
2
  # All rights reserved.
3
3
  #
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
27
27
  # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
28
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
- require 'grpc/grpc'
30
+ require_relative '../grpc'
31
31
 
32
32
  # GRPC contains the General RPC module.
33
33
  module GRPC