diff options
Diffstat (limited to 'platform/src/key_keeper.cpp')
| -rw-r--r-- | platform/src/key_keeper.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/platform/src/key_keeper.cpp b/platform/src/key_keeper.cpp index 8a982bc..2266bdf 100644 --- a/platform/src/key_keeper.cpp +++ b/platform/src/key_keeper.cpp @@ -419,7 +419,7 @@ static void certstore_rpc_on_succ(void* result, void* user) TFE_LOG_DEBUG(ctx->ref_keeper->logger, "Key keeper cache add key: %s", ctx->key); } } - ctx->ref_keeper->stat.new_issue++; + ATOMIC_INC(&(ctx->ref_keeper->stat.new_issue)); promise_success(p, (void*)kyr); key_keeper_free_keyring((struct keyring*)kyr); } @@ -735,7 +735,7 @@ void key_keeper_async_ask(struct future * f, struct key_keeper * keeper, const c ctx->key_len = len; promise_set_ctx(p, (void*)ctx, key_keeper_promise_free_ctx); long int cb_rtn = 0; - keeper->stat.ask_times++; + ATOMIC_INC(&(keeper->stat.ask_times)); if(!keeper->no_cache) { char *tmp = tfe_strdup((const char *)ctx->key); @@ -821,7 +821,7 @@ void key_keeper_async_ask(struct future * f, struct key_keeper * keeper, const c } } promise_success(p, (void*)kyr); - keeper->stat.new_issue++; + ATOMIC_INC(&(keeper->stat.new_issue)); key_keeper_free_keyring((struct keyring*)kyr); } else @@ -833,14 +833,13 @@ void key_keeper_async_ask(struct future * f, struct key_keeper * keeper, const c } return; } -void key_keeper_statistic(struct key_keeper *keeper, struct key_keeper_stat* result) +void key_keeper_statistic(struct key_keeper *keeper, struct key_keeper_stat *result) { if (!keeper->no_cache) { - // pthread_rwlock_rdlock(&(keeper->rwlock)); - keeper->stat.cached_num=MESA_htable_get_elem_num(keeper->cert_cache); - // pthread_rwlock_unlock(&(keeper->rwlock)); + result->cached_num = MESA_htable_get_elem_num(keeper->cert_cache); } - *result = keeper->stat; - return; + + result->ask_times = ATOMIC_READ(&(keeper->stat.ask_times)); + result->new_issue = ATOMIC_READ(&(keeper->stat.new_issue)); }
\ No newline at end of file |
