diff options
| author | zhengchao <[email protected]> | 2018-08-31 19:59:22 +0800 |
|---|---|---|
| committer | zhengchao <[email protected]> | 2018-08-31 19:59:22 +0800 |
| commit | baa409ecc8d557066f871be47d1a0d08763c6aa2 (patch) | |
| tree | 898c53ed715b2ddaa197a8b4d3eccf59dea1899b /platform/src/ssl_sess_cache.cpp | |
| parent | fd216a51deb8444a08d672b1ab55f0a71eb7761b (diff) | |
ssl stream增加统计
Diffstat (limited to 'platform/src/ssl_sess_cache.cpp')
| -rw-r--r-- | platform/src/ssl_sess_cache.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/platform/src/ssl_sess_cache.cpp b/platform/src/ssl_sess_cache.cpp index 9f6687f..9af4130 100644 --- a/platform/src/ssl_sess_cache.cpp +++ b/platform/src/ssl_sess_cache.cpp @@ -2,6 +2,7 @@ #include <ssl_sess_cache.h> #include <ssl_utils.h> +#include <tfe_utils.h> #include <MESA/MESA_htable.h> #include <MESA/field_stat2.h> @@ -189,9 +190,7 @@ void up_session_set(struct sess_cache * cache, struct sockaddr * addr, socklen_t struct asn1_sess * asn1 = NULL; asn1 = ssl_sess_serialize(sess); - struct sess_set_args set_args; - set_args.hash = cache->hash; - set_args.new_sess = asn1; + struct sess_set_args set_args{.hash = cache->hash, .new_sess = asn1}; no_use = MESA_htable_search_cb(cache->hash, key, key_size, sess_cache_set_cb, &set_args, &cb_ret); if (cb_ret == SESS_CACHE_UPDATE_OLD) { @@ -217,12 +216,12 @@ SSL_SESSION * up_session_get(struct sess_cache * cache, struct sockaddr * addr, key = NULL; if (cb_ret == 1) { - cache->hit_cnt++; + ATOMIC_INC(&(cache->hit_cnt)); return sess; } else { - cache->miss_cnt++; + ATOMIC_INC(&(cache->miss_cnt)); return NULL; } } @@ -263,12 +262,12 @@ SSL_SESSION * down_session_get(struct sess_cache * cache, const unsigned char * no_use = MESA_htable_search_cb(cache->hash, id, (unsigned int) idlen, sess_cache_get_cb, &sess, &cb_ret); if (cb_ret == 1) { - cache->hit_cnt++; + ATOMIC_INC(&(cache->hit_cnt)); return sess; } else { - cache->miss_cnt++; + ATOMIC_INC(&(cache->miss_cnt)); return NULL; } } @@ -281,7 +280,7 @@ void down_session_del(struct sess_cache * cache, const SSL_SESSION * sess) int ret = MESA_htable_del(cache->hash, id, len, NULL); if (ret != MESA_HTABLE_RET_OK) { - cache->del_err++; + ATOMIC_INC(&(cache->del_err)); } return; } |
