summaryrefslogtreecommitdiff
path: root/platform/src/ssl_service_cache.cpp
diff options
context:
space:
mode:
authorluwenpeng <[email protected]>2019-08-26 15:28:04 +0800
committerluwenpeng <[email protected]>2019-09-03 11:03:03 +0800
commitf9420b16bb7845bd829160f333d3103a2a66316a (patch)
tree8b40d59ad3a12efa589a2d8430db936bce011361 /platform/src/ssl_service_cache.cpp
parent90e6ec4fdc9a2c94b807fbef78a1a4d7c5ebaf2f (diff)
增加从配置文件读取 service_cache_succ_as_app_not_pinning_cnt 配置项的功能
Diffstat (limited to 'platform/src/ssl_service_cache.cpp')
-rw-r--r--platform/src/ssl_service_cache.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/platform/src/ssl_service_cache.cpp b/platform/src/ssl_service_cache.cpp
index f8ae994..3ab0461 100644
--- a/platform/src/ssl_service_cache.cpp
+++ b/platform/src/ssl_service_cache.cpp
@@ -4,10 +4,6 @@
#include <stdlib.h>
#include <string.h>
-#define FAIL_AS_PINNING_COUNT 4
-#define FAIL_TIME_WINDOW 30
-#define FAIL_AS_PROTO_ERR_COUNT 5
-#define SUCC_AS_APP_NOT_PINNING 3
struct ssl_svc_client_st
{
time_t last_update_time;
@@ -399,7 +395,7 @@ void ssl_service_cache_write(struct ssl_service_cache* svc_cache, const struct s
MESA_htable_search_cb(svc_cache->app_st_hash, hash_key, (unsigned int) hash_key_sz, app_st_write_cb, &write_args, &svr_st_cb_ret);
}
}
-struct ssl_service_cache* ssl_service_cache_create(unsigned int slot_size, unsigned int expire_seconds, int fail_as_pinning_cnt, int fail_as_proto_err_cnt, int fail_time_win)
+struct ssl_service_cache* ssl_service_cache_create(unsigned int slot_size, unsigned int expire_seconds, int fail_as_pinning_cnt, int fail_as_proto_err_cnt, int succ_as_app_not_pinning_cnt, int fail_time_win)
{
struct ssl_service_cache * cache = ALLOC(struct ssl_service_cache, 1);
unsigned max_num = slot_size * 4;
@@ -409,7 +405,7 @@ struct ssl_service_cache* ssl_service_cache_create(unsigned int slot_size, unsig
cache->fail_as_cli_pinning_count=fail_as_pinning_cnt;
cache->fail_as_proto_err_count=fail_as_proto_err_cnt;
cache->fail_time_window=fail_time_win;
- cache->succ_as_app_not_pinning_count=SUCC_AS_APP_NOT_PINNING;//TODO: read from profile.
+ cache->succ_as_app_not_pinning_count = succ_as_app_not_pinning_cnt;
void (*free_func[])(void *)={ssl_svc_free_client_st, ssl_svc_free_server_st, ssl_svc_free_app_st};
for(i=0; i<3; i++)
{