diff options
author | Alexander Polcyn <apolcyn@google.com> | 2017-03-21 19:24:07 -0700 |
---|---|---|
committer | Alexander Polcyn <apolcyn@google.com> | 2017-03-21 19:24:07 -0700 |
commit | 06d4edd28355877e71733a0d246a9b5b4c67452b (patch) | |
tree | 5ac1f997214c11476362f837e9ee824f7ca98c6a | |
parent | 5b881460d24bc930339d1cfd37805a7eadeee5c0 (diff) |
fix setting of time_check_increment in watch conn state loop
-rw-r--r-- | src/ruby/ext/grpc/rb_channel.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index c12ea921c9..acf22dd46b 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -259,9 +259,7 @@ static void *watch_channel_state_without_gvl(void *arg) { grpc_rb_channel *wrapper = stack->wrapper; int last_state = stack->last_state; void *return_value = (void*)0; - gpr_timespec time_check_increment = gpr_time_add( - gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(20, GPR_TIMESPAN)); - + gpr_timespec time_check_increment; gpr_mu_lock(&wrapper->channel_mu); while(wrapper->current_connectivity_state == last_state && @@ -269,6 +267,8 @@ static void *watch_channel_state_without_gvl(void *arg) { !wrapper->safe_to_destroy && !wrapper->abort_watch_connectivity_state && gpr_time_cmp(deadline, gpr_now(GPR_CLOCK_REALTIME)) > 0) { + time_check_increment = gpr_time_add( + gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(20, GPR_TIMESPAN)); gpr_cv_wait(&wrapper->channel_cv, &wrapper->channel_mu, time_check_increment); } if (wrapper->current_connectivity_state != last_state) { |