Skip to content

Commit

Permalink
removed clean_context()
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoweibin committed Aug 19, 2012
1 parent 5a267ef commit f190542
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions ngx_http_subs_filter_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ static ngx_int_t ngx_http_subs_out_chain_append(ngx_http_request_t *r,
ngx_http_subs_ctx_t *ctx, ngx_buf_t *b);
static ngx_int_t ngx_http_subs_get_chain_buf(ngx_http_request_t *r,
ngx_http_subs_ctx_t *ctx);
static void ngx_http_subs_body_filter_clean_context(ngx_http_request_t *r,
ngx_http_subs_ctx_t *ctx);
static ngx_int_t ngx_http_subs_output(ngx_http_request_t *r,
ngx_http_subs_ctx_t *ctx, ngx_chain_t *in);

Expand Down Expand Up @@ -396,18 +394,14 @@ ngx_http_subs_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
}

/* It doesn't output anything, return */
if ((ctx->last_out == &ctx->out) && (ctx->busy == NULL)) {
if ((ctx->out == NULL) && (ctx->busy == NULL)) {
return NGX_OK;
}

ngx_http_subs_body_filter_clean_context(r, ctx);

return ngx_http_subs_output(r, ctx, in);

failed:

ngx_http_subs_body_filter_clean_context(r, ctx);

ngx_log_error(NGX_LOG_ERR, log, 0,
"[subs_filter] ngx_http_subs_body_filter error.");

Expand All @@ -427,6 +421,8 @@ ngx_http_subs_body_filter_init_context(ngx_http_request_t *r, ngx_chain_t *in)

r->connection->buffered |= NGX_HTTP_SUB_BUFFERED;

ctx->in = NULL;

if (in) {
if (ngx_chain_add_copy(r->pool, &ctx->in, in) != NGX_OK) {
return NGX_ERROR;
Expand Down Expand Up @@ -971,16 +967,6 @@ ngx_http_subs_get_chain_buf(ngx_http_request_t *r,
}


static void
ngx_http_subs_body_filter_clean_context(ngx_http_request_t *r,
ngx_http_subs_ctx_t *ctx)
{
ctx->in = NULL;
ctx->last_out = NULL;
ctx->out_buf = NULL;
}


static ngx_int_t
ngx_http_subs_output(ngx_http_request_t *r, ngx_http_subs_ctx_t *ctx,
ngx_chain_t *in)
Expand Down

0 comments on commit f190542

Please sign in to comment.