grpc 1.4.0 → 1.4.1

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

Potentially problematic release.


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

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d65cbd6a9b5ec2a965ea36dffe987f6c1f93e90
4
- data.tar.gz: 408b8fe529c968681bed6390b018f56151d6d268
3
+ metadata.gz: e39080ec605040289bb2b93e27ed1797c99d4bf1
4
+ data.tar.gz: 2c93d45be2c465e705deacf118ebbb9bce2f8aa9
5
5
  SHA512:
6
- metadata.gz: 0d0c1e7619a1a282692ea7aeb356ec1b8c682239b484dc80f7f3f5e11f55b0c656a289871f78edca9ce03f197b0cbd9acf39c524bda02aa5b419b77ed82d3392
7
- data.tar.gz: ff039d35db99cd6266b3ddce0d3880905a268dbd5dd34e62e41ec1596007bbc120d606f710efe9b724a0c8c5a1ec3e5890c3bfdf72cda0cd19af8e0919e74af5
6
+ metadata.gz: 4b24f13ba6a723ec29cfbc25e44c8d1114878f369c0c6738794afe4b5e8309a2ba3ead24df133d8b2f9cfca32990d8f2b47886323ea7b38c499fc83eca85fdd7
7
+ data.tar.gz: 020c079ec978700bd7a3931b88b87e58c16117bf11faf4ea813c666a9f7a36892d9c7fca4ee3e18da88bac4ec6f8c69284c22175a6c9380c6f09d9ec7d3c8b8a
data/Makefile CHANGED
@@ -423,8 +423,8 @@ Q = @
423
423
  endif
424
424
 
425
425
  CORE_VERSION = 4.0.0
426
- CPP_VERSION = 1.4.0
427
- CSHARP_VERSION = 1.4.0
426
+ CPP_VERSION = 1.4.1
427
+ CSHARP_VERSION = 1.4.1
428
428
 
429
429
  CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
430
430
  CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
@@ -37,7 +37,7 @@
37
37
  extern bool hm_index_compare(const hm_index *A, const hm_index *B);
38
38
 
39
39
  /* Simple hashing function that takes lower 32 bits. */
40
- static inline uint32_t chunked_vector_hasher(uint64_t key) {
40
+ static __inline uint32_t chunked_vector_hasher(uint64_t key) {
41
41
  return (uint32_t)key;
42
42
  }
43
43
 
@@ -45,8 +45,8 @@ static inline uint32_t chunked_vector_hasher(uint64_t key) {
45
45
  static const size_t VECTOR_CHUNK_SIZE = (1 << 20) / sizeof(void *);
46
46
 
47
47
  /* Helper functions which return buckets from the chunked vector. */
48
- static inline void **get_mutable_bucket(const chunked_vector *buckets,
49
- uint32_t index) {
48
+ static __inline void **get_mutable_bucket(const chunked_vector *buckets,
49
+ uint32_t index) {
50
50
  if (index < VECTOR_CHUNK_SIZE) {
51
51
  return &buckets->first_[index];
52
52
  }
@@ -54,7 +54,8 @@ static inline void **get_mutable_bucket(const chunked_vector *buckets,
54
54
  return &buckets->rest_[rest_index][index % VECTOR_CHUNK_SIZE];
55
55
  }
56
56
 
57
- static inline void *get_bucket(const chunked_vector *buckets, uint32_t index) {
57
+ static __inline void *get_bucket(const chunked_vector *buckets,
58
+ uint32_t index) {
58
59
  if (index < VECTOR_CHUNK_SIZE) {
59
60
  return buckets->first_[index];
60
61
  }
@@ -63,7 +64,7 @@ static inline void *get_bucket(const chunked_vector *buckets, uint32_t index) {
63
64
  }
64
65
 
65
66
  /* Helper function. */
66
- static inline size_t RestSize(const chunked_vector *vec) {
67
+ static __inline size_t RestSize(const chunked_vector *vec) {
67
68
  return (vec->size_ <= VECTOR_CHUNK_SIZE)
68
69
  ? 0
69
70
  : (vec->size_ - VECTOR_CHUNK_SIZE - 1) / VECTOR_CHUNK_SIZE + 1;
@@ -222,9 +223,9 @@ hm_item *intrusive_hash_map_erase(intrusive_hash_map *hash_map, uint64_t key) {
222
223
  * array_size-1. Returns true if it is a new hm_item and false if the hm_item
223
224
  * already existed.
224
225
  */
225
- static inline bool intrusive_hash_map_internal_insert(chunked_vector *buckets,
226
- uint32_t hash_mask,
227
- hm_item *item) {
226
+ static __inline bool intrusive_hash_map_internal_insert(chunked_vector *buckets,
227
+ uint32_t hash_mask,
228
+ hm_item *item) {
228
229
  const uint64_t key = item->key;
229
230
  uint32_t index = chunked_vector_hasher(key) & hash_mask;
230
231
  hm_item **slot = (hm_item **)get_mutable_bucket(buckets, index);
@@ -101,7 +101,7 @@ typedef struct hm_index {
101
101
 
102
102
  /* Returns true if two hm_indices point to the same object within the hash map
103
103
  * and false otherwise. */
104
- inline bool hm_index_compare(const hm_index *A, const hm_index *B) {
104
+ __inline bool hm_index_compare(const hm_index *A, const hm_index *B) {
105
105
  return (A->item == B->item && A->bucket_index == B->bucket_index);
106
106
  }
107
107
 
@@ -138,6 +138,8 @@ struct round_robin_lb_policy {
138
138
  size_t num_ready;
139
139
  /** how many subchannels are in state TRANSIENT_FAILURE */
140
140
  size_t num_transient_failures;
141
+ /** how many subchannels are in state SHUTDOWN */
142
+ size_t num_shutdown;
141
143
  /** how many subchannels are in state IDLE */
142
144
  size_t num_idle;
143
145
 
@@ -381,6 +383,8 @@ static void update_state_counters_locked(subchannel_data *sd) {
381
383
  ++p->num_ready;
382
384
  } else if (sd->curr_connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
383
385
  ++p->num_transient_failures;
386
+ } else if (sd->curr_connectivity_state == GRPC_CHANNEL_SHUTDOWN) {
387
+ ++p->num_shutdown;
384
388
  } else if (sd->curr_connectivity_state == GRPC_CHANNEL_IDLE) {
385
389
  ++p->num_idle;
386
390
  }
@@ -401,7 +405,7 @@ static grpc_connectivity_state update_lb_connectivity_status_locked(
401
405
  * CHECK: sd->curr_connectivity_state == CONNECTING.
402
406
  *
403
407
  * 3) RULE: ALL subchannels are SHUTDOWN => policy is SHUTDOWN.
404
- * CHECK: p->num_subchannels = 0.
408
+ * CHECK: p->num_shutdown == p->num_subchannels.
405
409
  *
406
410
  * 4) RULE: ALL subchannels are TRANSIENT_FAILURE => policy is
407
411
  * TRANSIENT_FAILURE.
@@ -411,34 +415,35 @@ static grpc_connectivity_state update_lb_connectivity_status_locked(
411
415
  * CHECK: p->num_idle == p->num_subchannels.
412
416
  */
413
417
  round_robin_lb_policy *p = sd->policy;
418
+ grpc_connectivity_state new_state = sd->curr_connectivity_state;
414
419
  if (p->num_ready > 0) { /* 1) READY */
415
420
  grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_READY,
416
421
  GRPC_ERROR_NONE, "rr_ready");
417
- return GRPC_CHANNEL_READY;
422
+ new_state = GRPC_CHANNEL_READY;
418
423
  } else if (sd->curr_connectivity_state ==
419
424
  GRPC_CHANNEL_CONNECTING) { /* 2) CONNECTING */
420
425
  grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
421
426
  GRPC_CHANNEL_CONNECTING, GRPC_ERROR_NONE,
422
427
  "rr_connecting");
423
- return GRPC_CHANNEL_CONNECTING;
424
- } else if (p->num_subchannels == 0) { /* 3) SHUTDOWN */
428
+ new_state = GRPC_CHANNEL_CONNECTING;
429
+ } else if (p->num_shutdown == p->num_subchannels) { /* 3) SHUTDOWN */
425
430
  grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
426
431
  GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error),
427
432
  "rr_shutdown");
428
- return GRPC_CHANNEL_SHUTDOWN;
433
+ new_state = GRPC_CHANNEL_SHUTDOWN;
429
434
  } else if (p->num_transient_failures ==
430
435
  p->num_subchannels) { /* 4) TRANSIENT_FAILURE */
431
436
  grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
432
437
  GRPC_CHANNEL_TRANSIENT_FAILURE,
433
438
  GRPC_ERROR_REF(error), "rr_transient_failure");
434
- return GRPC_CHANNEL_TRANSIENT_FAILURE;
439
+ new_state = GRPC_CHANNEL_TRANSIENT_FAILURE;
435
440
  } else if (p->num_idle == p->num_subchannels) { /* 5) IDLE */
436
441
  grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_IDLE,
437
442
  GRPC_ERROR_NONE, "rr_idle");
438
- return GRPC_CHANNEL_IDLE;
443
+ new_state = GRPC_CHANNEL_IDLE;
439
444
  }
440
- /* no change */
441
- return sd->curr_connectivity_state;
445
+ GRPC_ERROR_UNREF(error);
446
+ return new_state;
442
447
  }
443
448
 
444
449
  static void rr_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg,
@@ -80,6 +80,7 @@ typedef struct {
80
80
  } grpc_tcp;
81
81
 
82
82
  static void tcp_free(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) {
83
+ grpc_slice_unref_internal(exec_ctx, tcp->read_slice);
83
84
  grpc_resource_user_unref(exec_ctx, tcp->resource_user);
84
85
  gpr_free(tcp);
85
86
  }
@@ -125,13 +126,17 @@ static void uv_close_callback(uv_handle_t *handle) {
125
126
  grpc_exec_ctx_finish(&exec_ctx);
126
127
  }
127
128
 
129
+ static grpc_slice alloc_read_slice(grpc_exec_ctx *exec_ctx,
130
+ grpc_resource_user *resource_user) {
131
+ return grpc_resource_user_slice_malloc(exec_ctx, resource_user,
132
+ GRPC_TCP_DEFAULT_READ_SLICE_SIZE);
133
+ }
134
+
128
135
  static void alloc_uv_buf(uv_handle_t *handle, size_t suggested_size,
129
136
  uv_buf_t *buf) {
130
137
  grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
131
138
  grpc_tcp *tcp = handle->data;
132
139
  (void)suggested_size;
133
- tcp->read_slice = grpc_resource_user_slice_malloc(
134
- &exec_ctx, tcp->resource_user, GRPC_TCP_DEFAULT_READ_SLICE_SIZE);
135
140
  buf->base = (char *)GRPC_SLICE_START_PTR(tcp->read_slice);
136
141
  buf->len = GRPC_SLICE_LENGTH(tcp->read_slice);
137
142
  grpc_exec_ctx_finish(&exec_ctx);
@@ -158,6 +163,7 @@ static void read_callback(uv_stream_t *stream, ssize_t nread,
158
163
  // Successful read
159
164
  sub = grpc_slice_sub_no_ref(tcp->read_slice, 0, (size_t)nread);
160
165
  grpc_slice_buffer_add(tcp->read_slices, sub);
166
+ tcp->read_slice = alloc_read_slice(&exec_ctx, tcp->resource_user);
161
167
  error = GRPC_ERROR_NONE;
162
168
  if (GRPC_TRACER_ON(grpc_tcp_trace)) {
163
169
  size_t i;
@@ -347,6 +353,7 @@ grpc_endpoint *grpc_tcp_create(uv_tcp_t *handle,
347
353
  grpc_resource_quota *resource_quota,
348
354
  char *peer_string) {
349
355
  grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp));
356
+ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
350
357
 
351
358
  if (GRPC_TRACER_ON(grpc_tcp_trace)) {
352
359
  gpr_log(GPR_DEBUG, "Creating TCP endpoint %p", tcp);
@@ -363,6 +370,7 @@ grpc_endpoint *grpc_tcp_create(uv_tcp_t *handle,
363
370
  tcp->peer_string = gpr_strdup(peer_string);
364
371
  tcp->shutting_down = false;
365
372
  tcp->resource_user = grpc_resource_user_create(resource_quota, peer_string);
373
+ tcp->read_slice = alloc_read_slice(&exec_ctx, tcp->resource_user);
366
374
  /* Tell network status tracking code about the new endpoint */
367
375
  grpc_network_status_register_endpoint(&tcp->base);
368
376
 
@@ -370,6 +378,7 @@ grpc_endpoint *grpc_tcp_create(uv_tcp_t *handle,
370
378
  uv_unref((uv_handle_t *)handle);
371
379
  #endif
372
380
 
381
+ grpc_exec_ctx_finish(&exec_ctx);
373
382
  return &tcp->base;
374
383
  }
375
384
 
@@ -29,5 +29,5 @@
29
29
 
30
30
  # GRPC contains the General RPC module.
31
31
  module GRPC
32
- VERSION = '1.4.0'
32
+ VERSION = '1.4.1'
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - gRPC Authors
8
8
  autorequire:
9
9
  bindir: src/ruby/bin
10
10
  cert_chain: []
11
- date: 2017-06-21 00:00:00.000000000 Z
11
+ date: 2017-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf