aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2018-08-22 12:14:45 -0700
committerGravatar GitHub <noreply@github.com>2018-08-22 12:14:45 -0700
commit5b0e7537abd543505e546aad7a78d88d560c7a1d (patch)
treed4ac6a4e47acbf09fe80a3a88b2a94cfcc4591d9 /src/core/ext
parentf10596f0f3d6ab2dfe67b86d259a8d3effb73a99 (diff)
parentadd72762a7a7fb8e72a95bf5e573f2e909371ce5 (diff)
Merge pull request #16398 from markdroth/round_robin_size_t_fix
Fix round_robin to avoid negative size_t value.
Diffstat (limited to 'src/core/ext')
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
index c730b3bd2b..4195c1e9d1 100644
--- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
@@ -139,7 +139,8 @@ class RoundRobin : public LoadBalancingPolicy {
grpc_client_channel_factory* client_channel_factory,
const grpc_channel_args& args)
: SubchannelList(policy, tracer, addresses, combiner,
- client_channel_factory, args) {
+ client_channel_factory, args),
+ last_ready_index_(num_subchannels() - 1) {
// Need to maintain a ref to the LB policy as long as we maintain
// any references to subchannels, since the subchannels'
// pollset_sets will include the LB policy's pollset_set.
@@ -180,7 +181,7 @@ class RoundRobin : public LoadBalancingPolicy {
size_t num_connecting_ = 0;
size_t num_transient_failure_ = 0;
grpc_error* last_transient_failure_error_ = GRPC_ERROR_NONE;
- size_t last_ready_index_ = -1; // Index into list of last pick.
+ size_t last_ready_index_; // Index into list of last pick.
};
// Helper class to ensure that any function that modifies the child refs