From 5683d01a31a6d35376b1c10016eed08d21628333 Mon Sep 17 00:00:00 2001 From: zhengchao Date: Wed, 14 Nov 2018 16:00:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=95=B4cache=20key=E7=9A=84?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/business/pangu-http/src/pangu_web_cache.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/plugin/business/pangu-http/src/pangu_web_cache.cpp b/plugin/business/pangu-http/src/pangu_web_cache.cpp index fc0e187..e0ccb48 100644 --- a/plugin/business/pangu-http/src/pangu_web_cache.cpp +++ b/plugin/business/pangu-http/src/pangu_web_cache.cpp @@ -88,7 +88,6 @@ struct cache_bloom double error_rate; char filename[TFE_PATH_MAX]; counting_bloom_t *bloom; - void * ref_logger; }; struct cache_handle { @@ -597,7 +596,6 @@ static void cache_key_bloom_gc_cb(evutil_socket_t fd, short what, void * arg) new_bloom=new_counting_bloom(p_bloom->size, p_bloom->error_rate, p_bloom->filename); free_counting_bloom(p_bloom->bloom); p_bloom->bloom=new_bloom; - TFE_LOG_DEBUG(p_bloom->ref_logger, "Bloom filter %d:%s resets.", p_bloom->thread_id, p_bloom->filename); return; } @@ -633,7 +631,6 @@ struct cache_handle* create_web_cache_handle(const char* profile_path, const cha p_bloom->thread_id=i; p_bloom->size=cache->cache_key_bloom_size; p_bloom->error_rate=0.01; - p_bloom->ref_logger=logger; snprintf(p_bloom->filename, sizeof(p_bloom->filename), "/tmp/pangu_cache_blooms.%02d", i); p_bloom->bloom=new_counting_bloom(p_bloom->size, p_bloom->error_rate, p_bloom->filename); if(p_bloom->bloom==NULL) @@ -650,6 +647,7 @@ struct cache_handle* create_web_cache_handle(const char* profile_path, const cha goto error_out; } } + MESA_load_profile_int_def(profile_path, section, "get_concurrency_max", &temp, 1000*1000); cache->get_concurrency_max=temp; MESA_load_profile_int_def(profile_path, section, "put_concurrency_max", &(temp), 1000*1000); @@ -672,7 +670,7 @@ struct cache_handle* create_web_cache_handle(const char* profile_path, const cha cache->default_cache_policy.pinning_time_sec=0; cache->default_cache_policy.inactive_time_sec=0; cache->default_cache_policy.max_cache_size=0; - cache->default_cache_policy.max_cache_obj_size=1024*1024*1024;//<1GB + cache->default_cache_policy.max_cache_obj_size=1024*1024*1024;//<1GB by default if(cache->cache_policy_enabled) { @@ -682,8 +680,7 @@ struct cache_handle* create_web_cache_handle(const char* profile_path, const cha cache->cache_param_idx=Maat_rule_get_ex_new_index(feather, "PXY_CACHE_COMPILE", cache_param_new, cache_param_free, cache_param_dup, 0, cache); - cache->ref_feather=feather; - TFE_LOG_INFO(logger, "Cache Policy Enabled."); + cache->ref_feather=feather; } cache_stat_init(cache); return cache; @@ -1009,7 +1006,7 @@ enum cache_pending_result web_cache_async_pending(struct cache_handle* handle, u { _mid->cache_key=get_cache_key(request, &(param->key_descr)); } - TFE_LOG_DEBUG(handle->logger, "cache policy %d matched: url=%s alt-key=%s", + TFE_LOG_DEBUG(handle->logger, "cache policy %d matched: url=%s alternative key=%s", cache_policy.config_id, request->req_spec.url, _mid->cache_key!=NULL?_mid->cache_key:"null"); From 4d4d401b2bec18b3a0c6612c9f46536f08ec21a5 Mon Sep 17 00:00:00 2001 From: zhengchao Date: Wed, 14 Nov 2018 16:01:48 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Close=20#80=20=E5=88=9B=E5=BB=BAssl=20upstr?= =?UTF-8?q?eam=E5=8F=91=E7=94=9F=E5=9C=A8KNI=20accept=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=EF=BC=8Cevent=5Fadd=E5=90=8E=E5=8F=88=E9=80=9A=E8=BF=87promise?= =?UTF-8?q?=5Fset=5Fctx=E4=BF=AE=E6=94=B9=E4=BA=86callback=20para=EF=BC=8C?= =?UTF-8?q?=E6=AD=A4=E6=97=B6tfe=20work=20thread=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E4=BA=86peek=20client=20hello=EF=BC=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E5=8F=96=E5=87=BA=E7=A9=BA=E7=9A=84ctx=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cache/src/tango_cache_pending.cpp | 1 + platform/src/ssl_stream.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cache/src/tango_cache_pending.cpp b/cache/src/tango_cache_pending.cpp index ab9b69b..9434bbe 100644 --- a/cache/src/tango_cache_pending.cpp +++ b/cache/src/tango_cache_pending.cpp @@ -150,6 +150,7 @@ time_t read_GMT_time(const char* gmt_string) { time_t expire_rel_time; struct tm expire_gmt_time; + memset(&expire_gmt_time, 0, sizeof(expire_gmt_time)); strptime(gmt_string, "%a, %d %b %Y %H:%M:%S GMT", &expire_gmt_time); expire_rel_time = mktime(&expire_gmt_time); return expire_rel_time; diff --git a/platform/src/ssl_stream.cpp b/platform/src/ssl_stream.cpp index 62e271a..33b18ee 100644 --- a/platform/src/ssl_stream.cpp +++ b/platform/src/ssl_stream.cpp @@ -715,8 +715,8 @@ static void ssl_async_peek_client_hello(struct future * future, evutil_socket_t struct peek_client_hello_ctx * ctx = ALLOC(struct peek_client_hello_ctx, 1); ctx->ev = event_new(evbase, fd, EV_READ, peek_client_hello_cb, p); ctx->logger = logger; - event_add(ctx->ev, NULL); promise_set_ctx(p, (void *) ctx, peek_client_hello_ctx_free_cb); + event_add(ctx->ev, NULL); return; }