diff options
author | Mark D. Roth <roth@google.com> | 2018-02-28 13:00:04 -0800 |
---|---|---|
committer | Mark D. Roth <roth@google.com> | 2018-02-28 13:00:04 -0800 |
commit | 718c8341ca8dcad17d93dc9e20c289c48b7ece34 (patch) | |
tree | 0a1b19d4c150373b860a5c236528030c150f4494 /src/core/ext/filters/client_channel/retry_throttle.cc | |
parent | 0fc97adc9ee41d517ee49ec8e3a8338b793fba7e (diff) |
Retry support.
Diffstat (limited to 'src/core/ext/filters/client_channel/retry_throttle.cc')
-rw-r--r-- | src/core/ext/filters/client_channel/retry_throttle.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/ext/filters/client_channel/retry_throttle.cc b/src/core/ext/filters/client_channel/retry_throttle.cc index 450a332342..45de6667c8 100644 --- a/src/core/ext/filters/client_channel/retry_throttle.cc +++ b/src/core/ext/filters/client_channel/retry_throttle.cc @@ -40,7 +40,7 @@ struct grpc_server_retry_throttle_data { int milli_token_ratio; gpr_atm milli_tokens; // A pointer to the replacement for this grpc_server_retry_throttle_data - // entry. If non-NULL, then this entry is stale and must not be used. + // entry. If non-nullptr, then this entry is stale and must not be used. // We hold a reference to the replacement. gpr_atm replacement; }; @@ -58,6 +58,7 @@ static void get_replacement_throttle_data_if_needed( bool grpc_server_retry_throttle_data_record_failure( grpc_server_retry_throttle_data* throttle_data) { + if (throttle_data == nullptr) return true; // First, check if we are stale and need to be replaced. get_replacement_throttle_data_if_needed(&throttle_data); // We decrement milli_tokens by 1000 (1 token) for each failure. @@ -72,6 +73,7 @@ bool grpc_server_retry_throttle_data_record_failure( void grpc_server_retry_throttle_data_record_success( grpc_server_retry_throttle_data* throttle_data) { + if (throttle_data == nullptr) return; // First, check if we are stale and need to be replaced. get_replacement_throttle_data_if_needed(&throttle_data); // We increment milli_tokens by milli_token_ratio for each success. |