处理tango cache client在promise_success后还有可能调用promise fail。
This commit is contained in:
@@ -480,7 +480,7 @@ static void cache_query_on_succ(future_result_t * result, void * user)
|
||||
case CACHE_QUERY_RESULT_MISS:
|
||||
ctx->cache_query_status=WEB_CACHE_NOT_HIT;
|
||||
printf("cache query miss: %s\n", ctx->ref_session->req->req_spec.url);
|
||||
ctx->resume_from_cache_query=1;
|
||||
ctx->resume_from_cache_query=1;
|
||||
tfe_http_session_resume(ctx->ref_session);
|
||||
future_destroy(ctx->f_cache_query);
|
||||
ctx->f_cache_query=NULL;
|
||||
@@ -495,9 +495,18 @@ 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;
|
||||
tfe_http_session_resume(ctx->ref_session);
|
||||
ctx->cache_query_status=WEB_CACHE_NOT_HIT;
|
||||
ctx->resume_from_cache_query=1;
|
||||
ctx->resume_from_cache_query=1;
|
||||
if(!ctx->cached_response)
|
||||
{
|
||||
tfe_http_session_resume(ctx->ref_session);
|
||||
}
|
||||
else
|
||||
{
|
||||
tfe_http_half_write_body_end(ctx->cached_response);
|
||||
ctx->cached_response=NULL;
|
||||
}
|
||||
|
||||
printf("cache query failed: %s %s\n", ctx->ref_session->req->req_spec.url, what);
|
||||
}
|
||||
void http_replace(const struct tfe_stream * stream, const struct tfe_http_session * session,
|
||||
|
||||
Reference in New Issue
Block a user