]> granicus.if.org Git - apache/commitdiff
remove churn_output() function and calls to it.
authorDoug MacEachern <dougm@apache.org>
Sat, 1 Dec 2001 02:11:04 +0000 (02:11 +0000)
committerDoug MacEachern <dougm@apache.org>
Sat, 1 Dec 2001 02:11:04 +0000 (02:11 +0000)
when SSL needs to flush (e.g. during SSL_accept()) it will call BIO_flush()
which will trigger a call to bio_bucket_ctrl() -> BIO_bucket_flush().
so we only need to flush the output ourselves if we receive an EOS or
FLUSH bucket.

BIO_bucket_flush() and churn_output() had been turning up near the top
of the profile with gprof.  churn_output() of course has now vanished
and BIO_bucket_flush() has dropped, being called far less than before.

PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92271 13f79535-47bb-0310-9956-ffa450edef68

modules/ssl/ssl_engine_io.c

index 993fe1f6aee196efcca77f379d2c023b051f3b8b..ad2f05271da05b790373c93cabc43899ac90c7b1 100644 (file)
  * malloc-ed buffer, rather than copying into a mem BIO.
  * also allows us to pass the brigade as data is being written
  * rather than buffering up the entire response in the mem BIO.
+ *
+ * when SSL needs to flush (e.g. SSL_accept()), it will call BIO_flush()
+ * which will trigger a call to bio_bucket_ctrl() -> BIO_bucket_flush().
+ * so we only need to flush the output ourselves if we receive an
+ * EOS or FLUSH bucket. this was not possible with the mem BIO where we
+ * had to flush all over the place not really knowing when it was required
+ * to do so.
  */
 
 typedef struct {
@@ -353,16 +360,6 @@ static int ssl_io_hook_write(SSL *ssl, unsigned char *buf, int len)
     return rc;
 }
 
-static apr_status_t churn_output(SSLFilterRec *ctx)
-{
-    if (!ctx->pssl) {
-        /* we've been shutdown */
-        return APR_EOF;
-    }
-
-    return BIO_bucket_flush(ctx->pbioWrite);
-}
-
 static apr_status_t ssl_filter_write(ap_filter_t *f,
                                      const char *data,
                                      apr_size_t len)
@@ -389,8 +386,7 @@ static apr_status_t ssl_filter_write(ap_filter_t *f,
         return APR_EINVAL;
     }
 
-    /* churn the state machine */
-    return churn_output(ctx);
+    return APR_SUCCESS;
 }
 
 #define bio_is_renegotiating(bio) \
@@ -418,9 +414,6 @@ static apr_status_t churn_input(SSLFilterRec *pRec, ap_input_mode_t eMode,
         eMode = AP_MODE_NONBLOCKING;
     }
 
-    /* Flush the output buffers. */
-    churn_output(pRec);
-
     /* We have something in the processed brigade.  Use that first. */
     if (!APR_BRIGADE_EMPTY(ctx->b)) {
         return APR_SUCCESS;
@@ -490,9 +483,6 @@ static apr_status_t churn_input(SSLFilterRec *pRec, ap_input_mode_t eMode,
 
     }
 
-    /* Flush the output buffers. */
-    churn_output(pRec);
-
     /* Note: ssl_engine_kernel.c calls ap_get_brigade when it wants to 
      * renegotiate.  Therefore, we must handle this by reading from
      * the socket and *NOT* reading into ctx->b from the BIO.  This is a 
@@ -516,9 +506,6 @@ static apr_status_t churn_input(SSLFilterRec *pRec, ap_input_mode_t eMode,
         eMode = AP_MODE_NONBLOCKING;
     }
 
-    /* Flush again. */
-    churn_output(pRec);
-
     if (rv != APR_SUCCESS) {
         /* if process connection says HTTP_BAD_REQUEST, we've seen a 
          * HTTP on HTTPS error.
@@ -569,9 +556,6 @@ static apr_status_t churn_input(SSLFilterRec *pRec, ap_input_mode_t eMode,
         pbuf = apr_pmemdup(p, buf, n);
         e = apr_bucket_pool_create(pbuf, n, p);
         APR_BRIGADE_INSERT_TAIL(ctx->b, e);
-
-        /* Flush the output buffers. */
-        churn_output(pRec);
     }
 
     if (n < 0 && errno == EINTR && APR_BRIGADE_EMPTY(ctx->b)) {
@@ -583,7 +567,7 @@ static apr_status_t churn_input(SSLFilterRec *pRec, ap_input_mode_t eMode,
         APR_BRIGADE_INSERT_TAIL(ctx->b, apr_bucket_eos_create());
     }
 
-    return churn_output(pRec);
+    return APR_SUCCESS;
 }
 
 static apr_status_t ssl_io_filter_Output(ap_filter_t *f,
@@ -606,7 +590,7 @@ static apr_status_t ssl_io_filter_Output(ap_filter_t *f,
             apr_bucket_brigade *outbb;
             int done = APR_BUCKET_IS_EOS(bucket);
 
-            if ((ret = churn_output(ctx)) != APR_SUCCESS) {
+            if ((ret = BIO_bucket_flush(ctx->pbioWrite)) != APR_SUCCESS) {
                 return ret;
             }