Merge branch 'develop-tfe3a' of git.mesalab.cn:tango/tfe into develop-tfe3a

This commit is contained in:
zhengchao
2018-11-20 19:43:14 +08:00
7 changed files with 66 additions and 39 deletions

View File

@@ -439,7 +439,6 @@ struct pangu_http_ctx
size_t datalen, unsigned int thread_id, struct pangu_http_ctx* ctx);
enum cache_pending_result pending_result;
enum cache_query_status cache_query_status;
struct future *f_cache_pending, *f_cache_query;
struct tfe_http_session * ref_session;
struct tfe_http_half* cache_revalidate_req;
@@ -1084,16 +1083,16 @@ static void cache_query_on_succ(future_result_t * result, void * user)
break;
case CACHE_QUERY_RESULT_END:
assert(ctx->cached_response!=NULL);
ctx->cache_query_status=WEB_CACHE_HIT;
tfe_http_half_write_body_end(ctx->cached_response);
//ownership has been transferred to http session, set to NULL.
//ownership has been transferred to http session, set to NULL.
ctx->pending_result=PENDING_RESULT_HIT;
ctx->cached_response=NULL;
assert(ctx->cache_result_actual_sz==ctx->cache_result_declared_sz);
future_destroy(ctx->f_cache_query);
ctx->f_cache_query=NULL;
break;
case CACHE_QUERY_RESULT_MISS:
ctx->cache_query_status=WEB_CACHE_MISS;
ctx->pending_result=PENDING_RESULT_MISS;
ctx->resumed_cb=dummy_resume;
tfe_http_session_resume(ctx->ref_session);
future_destroy(ctx->f_cache_query);
@@ -1109,7 +1108,6 @@ static void cache_query_on_fail(enum e_future_error err, const char * what, void
struct pangu_http_ctx * ctx = (struct pangu_http_ctx *)user;
future_destroy(ctx->f_cache_query);
ctx->f_cache_query=NULL;
ctx->cache_query_status=WEB_CACHE_MISS;
if(!ctx->cached_response)
{
tfe_http_session_resume(ctx->ref_session);
@@ -1120,7 +1118,7 @@ static void cache_query_on_fail(enum e_future_error err, const char * what, void
tfe_http_half_write_body_end(ctx->cached_response);
ctx->cached_response=NULL;
}
ctx->pending_result=PENDING_RESULT_MISS;
printf("cache query failed: %s %s\n", ctx->ref_session->req->req_spec.url, what);
}
static void cache_pending_on_succ(future_result_t * result, void * user)
@@ -1345,7 +1343,7 @@ void pangu_on_http_data(const struct tfe_stream * stream, const struct tfe_http_
}
}
if(tfe_http_in_response(events)&& ctx->pending_result==PENDING_RESULT_MISS)
if(tfe_http_in_response(events) && ctx->pending_result==PENDING_RESULT_MISS)
{
cache_update(session, events, body_frag, frag_size, thread_id, ctx);
}