You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by hu...@apache.org on 2012/08/27 15:57:43 UTC

svn commit: r1377685 - /httpd/httpd/trunk/modules/lua/mod_lua.c

Author: humbedooh
Date: Mon Aug 27 13:57:43 2012
New Revision: 1377685

URL: http://svn.apache.org/viewvc?rev=1377685&view=rev
Log:
Trying to tie up some loose ends:
- Return immediately if the return val of ap_pass_brigade != APR_SUCCESS
- Return a bit earlier when dealing with input filters, so as to not build up a huge backlog.

Modified:
    httpd/httpd/trunk/modules/lua/mod_lua.c

Modified: httpd/httpd/trunk/modules/lua/mod_lua.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/mod_lua.c?rev=1377685&r1=1377684&r2=1377685&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/mod_lua.c (original)
+++ httpd/httpd/trunk/modules/lua/mod_lua.c Mon Aug 27 13:57:43 2012
@@ -390,6 +390,7 @@ static apr_status_t lua_output_filter_ha
     lua_filter_ctx* ctx;
     conn_rec *c = r->connection;
     apr_bucket *pbktIn;
+    apr_status_t rv;
     
     /* Set up the initial filter context and acquire the function.
      * The corresponding Lua function should yield here.
@@ -433,8 +434,11 @@ static apr_status_t lua_output_filter_ha
                 pbktOut = apr_bucket_heap_create(output, olen, NULL,
                                         c->bucket_alloc);
                 APR_BRIGADE_INSERT_TAIL(ctx->tmpBucket, pbktOut);
-                ap_pass_brigade(f->next, ctx->tmpBucket);
+                rv = ap_pass_brigade(f->next, ctx->tmpBucket);
                 apr_brigade_cleanup(ctx->tmpBucket);
+                if (rv != APR_SUCCESS) {
+                    return rv;
+                }
             }
             else {
                 ctx->broken = 1;
@@ -462,7 +466,11 @@ static apr_status_t lua_output_filter_ha
             pbktEOS = apr_bucket_eos_create(c->bucket_alloc);
             APR_BRIGADE_INSERT_TAIL(ctx->tmpBucket, pbktEOS);
             ap_lua_release_state(L, ctx->spec, r);
-            ap_pass_brigade(f->next, ctx->tmpBucket);
+            rv = ap_pass_brigade(f->next, ctx->tmpBucket);
+            apr_brigade_cleanup(ctx->tmpBucket);
+            if (rv != APR_SUCCESS) {
+                return rv;
+            }
         }
     }
     /* Clean up */
@@ -549,6 +557,7 @@ static apr_status_t lua_input_filter_han
                 pbktOut = apr_bucket_heap_create(output, olen, 0, c->bucket_alloc);
                 APR_BRIGADE_INSERT_TAIL(pbbOut, pbktOut);
                 apr_bucket_delete(pbktIn);
+                return APR_SUCCESS;
             }
             else {
                 ctx->broken = 1;