summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Bloom <rbb@apache.org>2000-10-23 10:46:20 +0000
committerRyan Bloom <rbb@apache.org>2000-10-23 10:46:20 +0000
commita90cfa54f1e5ef3ed6ce44cb2d3f7fc173456fea (patch)
tree2aec455a911b8d1ccc2e7f57375e36206844aa52
parent9d5f496143b4b7e2433765077522ecb131ff384b (diff)
downloadhttpd-a90cfa54f1e5ef3ed6ce44cb2d3f7fc173456fea.tar.gz
Make lingering close access the socket directly, instead of relying on
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
-rw-r--r--include/http_connection.h2
-rw-r--r--server/connection.c28
2 files changed, 21 insertions, 9 deletions
diff --git a/include/http_connection.h b/include/http_connection.h
index 3d5fd9b303..7a7c9d962b 100644
--- a/include/http_connection.h
+++ b/include/http_connection.h
@@ -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>
diff --git a/server/connection.c b/server/connection.c
index 33609a7350..9d3553d0e5 100644
--- a/server/connection.c
+++ b/server/connection.c
@@ -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)