]> granicus.if.org Git - apache/commitdiff
Make lingering close access the socket directly, instead of relying on
authorRyan Bloom <rbb@apache.org>
Mon, 23 Oct 2000 10:46:20 +0000 (10:46 +0000)
committerRyan Bloom <rbb@apache.org>
Mon, 23 Oct 2000 10:46:20 +0000 (10:46 +0000)
BUFF.  This has been tested, but all we can determine is that it doesn't
fail, not that it works.  This needs to be tested much better.

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

include/http_connection.h
server/connection.c

index 3d5fd9b3031122ecfe7c26dbbd3dcd5ac1c73ab2..7a7c9d962b1d6249ee81fa160722f65fca3f3861 100644 (file)
@@ -115,6 +115,8 @@ int ap_pre_http_connection(conn_rec *);
  */
 int ap_process_http_connection(conn_rec *);
 
+AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c);
+
 /**
  * This function is responsible for the following cases:
  * <PRE>
index 33609a7350cc068f382820d530a254dc61701cb8..9d3553d0e55e922482e148cc9b1480df790dd8be 100644 (file)
@@ -130,6 +130,17 @@ static void sock_enable_linger(int s)
 #define sock_enable_linger(s)  /* NOOP */
 #endif /* USE_SO_LINGER */
 
+AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c)
+{
+    ap_bucket_brigade *bb;
+    ap_bucket *b;
+
+    bb = ap_brigade_create(c->pool);
+    b = ap_bucket_create_flush();
+    AP_BRIGADE_INSERT_TAIL(bb, b);
+    ap_pass_brigade(c->output_filters, bb);
+}
+
 /* we now proceed to read from the client until we get EOF, or until
  * MAX_SECS_TO_LINGER has passed.  the reasons for doing this are
  * documented in a draft:
@@ -150,7 +161,8 @@ void ap_lingering_close(conn_rec *c)
     int timeout;
 
 #ifdef NO_LINGCLOSE
-    ap_bclose(c->client);      /* just close it */
+    ap_flush_conn(c);  /* just close it */
+    apr_close_socket(c->client_socket);
     return;
 #endif
 
@@ -159,24 +171,22 @@ void ap_lingering_close(conn_rec *c)
      * client has ACKed our FIN and/or has stopped sending us data.
      */
 
-    if (c->aborted || !(c->client)) {
-       ap_bclose(c->client);
+    if (c->aborted) {
+        ap_flush_conn(c);
+        apr_close_socket(c->client_socket);
         return;
     }
 
     /* Send any leftover data to the client, but never try to again */
 
-    if (ap_bflush(c->client) != APR_SUCCESS) {
-        ap_bclose(c->client);
-        return;
-    }
+    ap_flush_conn(c);
 
     /* Shut down the socket for write, which will send a FIN
      * to the peer.
      */
     
     if (apr_shutdown(c->client_socket, 1) != APR_SUCCESS || c->aborted) {
-        ap_bclose(c->client);
+        apr_close_socket(c->client_socket);
         return;
     }
 
@@ -200,7 +210,7 @@ void ap_lingering_close(conn_rec *c)
         timeout = (MAX_SECS_TO_LINGER - timeout) * APR_USEC_PER_SEC;
     }
 
-    ap_bclose(c->client);
+    apr_close_socket(c->client_socket);
 }
 
 AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c)