修正cache_cookied_content开关未生效的bug;在http结束时增加cache日志;

This commit is contained in:
zhengchao
2018-12-22 19:52:49 +06:00
parent a530a4f0ce
commit bba7a4d9b1
3 changed files with 68 additions and 23 deletions

View File

@@ -539,8 +539,8 @@ struct pangu_http_ctx
struct tfe_http_half* cache_revalidate_req;
struct tfe_http_half* cached_response;
size_t cache_result_declared_sz, cache_result_actual_sz;
struct cache_write_context* cache_update_ctx;
struct cache_write_context* cache_write_ctx;
int cache_wirte_result;
int thread_id;
};
@@ -594,10 +594,10 @@ static void pangu_http_ctx_free(struct pangu_http_ctx * ctx)
{
Maat_stream_scan_string_end(&(ctx->sp));
}
if(ctx->cache_update_ctx)
if(ctx->cache_write_ctx)
{
web_cache_write_end(ctx->cache_update_ctx);
ctx->cache_update_ctx=NULL;
web_cache_write_end(ctx->cache_write_ctx);
ctx->cache_write_ctx=NULL;
}
//On session recycle
@@ -1367,16 +1367,16 @@ void cache_write(const struct tfe_http_session * session, enum tfe_http_event ev
if(events & EV_HTTP_RESP_BODY_BEGIN)
{
ctx->cache_update_ctx=web_cache_write_start(g_pangu_rt->cache, thread_id, session, &(ctx->cmid));
ctx->cache_write_ctx=web_cache_write_start(g_pangu_rt->cache, thread_id, session, &(ctx->cmid));
}
if(events & EV_HTTP_RESP_BODY_CONT && ctx->cache_update_ctx!=NULL)
if(events & EV_HTTP_RESP_BODY_CONT && ctx->cache_write_ctx!=NULL)
{
web_cache_write(ctx->cache_update_ctx, body_frag, frag_size);
web_cache_write(ctx->cache_write_ctx, body_frag, frag_size);
}
if(events & EV_HTTP_RESP_BODY_END && ctx->cache_update_ctx!=NULL)
if(events & EV_HTTP_RESP_BODY_END && ctx->cache_write_ctx!=NULL)
{
web_cache_write_end(ctx->cache_update_ctx);
ctx->cache_update_ctx=NULL;
ctx->cache_wirte_result=web_cache_write_end(ctx->cache_write_ctx);
ctx->cache_write_ctx=NULL;
//printf("cache update success: %s\n", ctx->ref_session->req->req_spec.url);
}
@@ -1482,6 +1482,10 @@ void pangu_on_http_end(const struct tfe_stream * stream,
{
ATOMIC_INC(&(g_pangu_rt->stat_val[STAT_ACTION_REPLACE]));
}
TFE_LOG_DEBUG(g_pangu_rt->local_logger, "cache %s %s upload=%d",
session->req->req_spec.url,
cache_pending_result_string(ctx->pending_result),
ctx->cache_wirte_result);
cache_mid_clear(&(ctx->cmid));
pangu_http_ctx_free(ctx);
*pme = NULL;