diff options
| author | luwenpeng <[email protected]> | 2024-11-13 14:09:03 +0800 |
|---|---|---|
| committer | luwenpeng <[email protected]> | 2024-11-13 17:17:13 +0800 |
| commit | 3d99178958d99a2ee6a7c94c58ae8f7479ea1e2a (patch) | |
| tree | ea880387c3d13d34a7e0e73f9a7ff48521a42b0e /platform/src/ssl_service_cache.cpp | |
| parent | aa98cf915e965203479dec7ab7d231edd8301384 (diff) | |
TSG-23378 TFE移除平台层的FieldStat2,为适配AArch64做准备
Diffstat (limited to 'platform/src/ssl_service_cache.cpp')
| -rw-r--r-- | platform/src/ssl_service_cache.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/platform/src/ssl_service_cache.cpp b/platform/src/ssl_service_cache.cpp index fccabfa..0f0d3c5 100644 --- a/platform/src/ssl_service_cache.cpp +++ b/platform/src/ssl_service_cache.cpp @@ -43,16 +43,16 @@ static void ssl_svc_free_client_st(void * data) struct ssl_service_cache* svc_cache=p->ref_svc_cache; if(p->is_mutual_auth) { - svc_cache->stat.mutual_auth_cli_cnt--; + ATOMIC_DEC(&(svc_cache->stat.mutual_auth_cli_cnt)); } if(p->suspect_pinning_count>=svc_cache->fail_as_cli_pinning_count) { - svc_cache->stat.pinning_cli_cnt--; + ATOMIC_DEC(&(svc_cache->stat.pinning_cli_cnt)); } if (p->protocol_error_count >= svc_cache->fail_as_proto_err_count) { - svc_cache->stat.proto_err_cli_cnt--; + ATOMIC_DEC(&(svc_cache->stat.proto_err_cli_cnt)); } free(p); @@ -64,11 +64,11 @@ static void ssl_svc_free_server_st(void * data) struct ssl_service_cache* svc_cache=p->ref_svc_cache; if(p->is_ct) { - svc_cache->stat.ct_srv_cnt--; + ATOMIC_DEC(&(svc_cache->stat.ct_srv_cnt)); } if(p->is_ev) { - svc_cache->stat.ev_srv_cnt--; + ATOMIC_DEC(&(svc_cache->stat.ev_srv_cnt)); } free(p); return; @@ -79,7 +79,7 @@ static void ssl_svc_free_app_st(void *data) struct ssl_service_cache *svc_cache = p->ref_svc_cache; if (p->down_ssl_success_cnt > svc_cache->succ_as_app_not_pinning_count) { - svc_cache->stat.app_not_pinning_cnt--; + ATOMIC_DEC(&(svc_cache->stat.app_not_pinning_cnt)); } free(p); } @@ -189,7 +189,7 @@ static long cli_st_write_cb(void * data, const uchar * key, uint size, void * us } if(cli_st->suspect_pinning_count==cache->fail_as_cli_pinning_count) { - cache->stat.pinning_cli_cnt++; + ATOMIC_INC(&(cache->stat.pinning_cli_cnt)); } } else if(status->cli_pinning_status==PINNING_ST_PINNING) @@ -201,12 +201,12 @@ static long cli_st_write_cb(void * data, const uchar * key, uint size, void * us cli_st->protocol_error_count++; if(cli_st->protocol_error_count==cache->fail_as_proto_err_count) { - cache->stat.proto_err_cli_cnt++; + ATOMIC_INC(&(cache->stat.proto_err_cli_cnt)); } } if(status->is_mutual_auth==1&&cli_st->is_mutual_auth==0) { - cache->stat.mutual_auth_cli_cnt++; + ATOMIC_INC(&(cache->stat.mutual_auth_cli_cnt)); cli_st->is_mutual_auth=1; } cli_st->last_update_time=now; @@ -243,7 +243,7 @@ static long srv_st_write_cb(void * data, const uchar * key, uint size, void * us if(status->is_ev==1&&srv_st->is_ev==0) { srv_st->is_ev=1; - cache->stat.ev_srv_cnt++; + ATOMIC_INC(&(cache->stat.ev_srv_cnt)); } if(status->is_ev!=srv_st->is_ev) { @@ -252,7 +252,7 @@ static long srv_st_write_cb(void * data, const uchar * key, uint size, void * us if(status->is_ct==1&&srv_st->is_ct==0) { srv_st->is_ct=1; - cache->stat.ct_srv_cnt++; + ATOMIC_INC(&(cache->stat.ct_srv_cnt)); } if(status->is_ct!=srv_st->is_ct) { @@ -297,7 +297,7 @@ static long app_st_write_cb(void *data, const uchar *key, uint size, void *user_ } if (app_st->down_ssl_success_cnt > cache->succ_as_app_not_pinning_count) { - cache->stat.app_not_pinning_cnt++; + ATOMIC_INC(&(cache->stat.app_not_pinning_cnt)); } return 1; } @@ -462,8 +462,13 @@ void ssl_service_cache_destroy(struct ssl_service_cache* cache) free(cache); return; } -void ssl_service_cache_stat(struct ssl_service_cache* svc_cache, struct ssl_service_cache_statistics* result) +void ssl_service_cache_stat(struct ssl_service_cache *svc_cache, struct ssl_service_cache_statistics *result) { - *result=svc_cache->stat; - return; + result->pinning_cli_cnt = ATOMIC_READ(&(svc_cache->stat.pinning_cli_cnt)); + result->mutual_auth_cli_cnt = ATOMIC_READ(&(svc_cache->stat.mutual_auth_cli_cnt)); + result->proto_err_cli_cnt = ATOMIC_READ(&(svc_cache->stat.proto_err_cli_cnt)); + result->ev_srv_cnt = ATOMIC_READ(&(svc_cache->stat.ev_srv_cnt)); + result->ct_srv_cnt = ATOMIC_READ(&(svc_cache->stat.ct_srv_cnt)); + result->app_not_pinning_cnt = ATOMIC_READ(&(svc_cache->stat.app_not_pinning_cnt)); + result->trusted_cert_cnt = ATOMIC_READ(&(svc_cache->stat.trusted_cert_cnt)); }
\ No newline at end of file |
