业务层适配HTTP解析层垃圾回收 #63 #83 。HTTP业务层在pangu_http_ctx_free中销毁replace、cache相关的http half结构体。

This commit is contained in:
zhengchao
2018-11-23 18:13:44 +08:00
parent 3970d9de04
commit 6cd2b8186b

View File

@@ -462,8 +462,12 @@ void http_repl_ctx_free(struct replace_ctx* rep_ctx)
evbuffer_free(rep_ctx->http_body); evbuffer_free(rep_ctx->http_body);
rep_ctx->http_body = NULL; rep_ctx->http_body = NULL;
} }
//todo destroy http_half; //On session recycled.
assert(rep_ctx->replacing == NULL); if(rep_ctx->replacing)
{
tfe_http_half_free(rep_ctx->replacing);
rep_ctx->replacing=NULL;
}
FREE(&rep_ctx); FREE(&rep_ctx);
return; return;
} }
@@ -499,13 +503,30 @@ static void pangu_http_ctx_free(struct pangu_http_ctx * ctx)
web_cache_update_end(ctx->cache_update_ctx); web_cache_update_end(ctx->cache_update_ctx);
ctx->cache_update_ctx=NULL; ctx->cache_update_ctx=NULL;
} }
assert(ctx->cached_response==NULL);
//On session recycle
if(ctx->cache_revalidate_req)
{
tfe_http_half_free(ctx->cache_revalidate_req);
ctx->cache_revalidate_req=NULL;
}
if(ctx->cached_response)
{
tfe_http_half_free(ctx->cached_response);
ctx->cached_response=NULL;
}
if(ctx->f_cache_query) if(ctx->f_cache_query)
{ {
future_destroy(ctx->f_cache_query); future_destroy(ctx->f_cache_query);
ctx->f_cache_query=NULL; ctx->f_cache_query=NULL;
} }
if(ctx->f_cache_pending)
{
future_destroy(ctx->f_cache_pending);
ctx->f_cache_pending=NULL;
}
ctx->magic_num=0; ctx->magic_num=0;
FREE(&ctx); FREE(&ctx);
} }