缓存能跑起来了。
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "pangu_logger.h"
|
||||
#include "pattern_replace.h"
|
||||
#include "pangu_web_cache.h"
|
||||
|
||||
#include <tfe_proxy.h>
|
||||
#include <tfe_stream.h>
|
||||
@@ -198,7 +199,7 @@ int pangu_http_init(struct tfe_proxy * proxy)
|
||||
"./pangu_conf/template/HTTP451.html");
|
||||
g_pangu_rt->tpl_451 = ctemplate::Template::GetTemplate(page_path, ctemplate::DO_NOT_STRIP);
|
||||
|
||||
g_pangu_rt->cache = create_web_cache_handle(profile, "CACHE_SERVER", g_pangu_rt->local_logger);
|
||||
g_pangu_rt->cache = create_web_cache_handle(profile, "TANGO_CACHE", g_pangu_rt->local_logger);
|
||||
TFE_LOG_INFO(NULL, "Pangu HTTP init success.");
|
||||
return 0;
|
||||
|
||||
@@ -287,7 +288,7 @@ static struct pangu_http_ctx * pangu_http_ctx_new(unsigned int thread_id)
|
||||
|
||||
static void pangu_http_ctx_free(struct pangu_http_ctx * ctx)
|
||||
{
|
||||
if (!ctx->rep_ctx)
|
||||
if (ctx->rep_ctx)
|
||||
{
|
||||
http_repl_ctx_free(ctx->rep_ctx);
|
||||
ctx->rep_ctx = NULL;
|
||||
@@ -297,26 +298,26 @@ static void pangu_http_ctx_free(struct pangu_http_ctx * ctx)
|
||||
Maat_clean_status(&(ctx->mid));
|
||||
ctx->mid = NULL;
|
||||
|
||||
if(!ctx->sp)
|
||||
if(ctx->sp)
|
||||
{
|
||||
Maat_stream_scan_string_end(&(ctx->sp));
|
||||
}
|
||||
if(!ctx->cache_update_ctx)
|
||||
if(ctx->cache_update_ctx)
|
||||
{
|
||||
web_cache_update_end(ctx->cache_update_ctx);
|
||||
ctx->cache_update_ctx=NULL;
|
||||
}
|
||||
if(!ctx->cached_header)
|
||||
if(ctx->cached_header)
|
||||
{
|
||||
cache_query_free_meta(ctx->cached_header);
|
||||
ctx->cached_header=NULL;
|
||||
}
|
||||
if(!ctx->cached_body)
|
||||
if(ctx->cached_body)
|
||||
{
|
||||
evbuffer_free(ctx->cached_body);
|
||||
ctx->cached_body=NULL;
|
||||
}
|
||||
if(!ctx->f_cache_query)
|
||||
if(ctx->f_cache_query)
|
||||
{
|
||||
future_destroy(ctx->f_cache_query);
|
||||
ctx->f_cache_query=NULL;
|
||||
@@ -811,6 +812,7 @@ void enforce_control_policy(const struct tfe_stream * stream, const struct tfe_h
|
||||
}
|
||||
switch (ctx->action)
|
||||
{
|
||||
case PG_ACTION_NONE:
|
||||
case PG_ACTION_MONIT:
|
||||
//send log on close.
|
||||
break;
|
||||
@@ -829,12 +831,12 @@ void enforce_control_policy(const struct tfe_stream * stream, const struct tfe_h
|
||||
}
|
||||
void cache_query(const struct tfe_http_session * session, unsigned int thread_id, struct pangu_http_ctx * ctx)
|
||||
{
|
||||
ctx->ref_session=session;
|
||||
ctx->f_cache_query=future_create("cache_query", cache_query_on_succ, cache_query_on_fail, ctx);
|
||||
ctx->cache_query_status=async_web_cache_query(g_pangu_rt->cache, thread_id, session->req, ctx->f_cache_query);
|
||||
if(ctx->cache_query_status==WEB_CACHE_QUERING)
|
||||
{
|
||||
tfe_http_session_suspend(session);
|
||||
ctx->ref_session=tfe_http_session_allow_write(session);
|
||||
tfe_http_session_suspend(ctx->ref_session);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user