1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-30 15:01:14 +03:00

This begins to remove BUFF from the server. The idea is to go very slowly

with this.  To begin with, we store both the socket and the BUFF in the
conn_rec.  Functions are free to use which ever they want, in the end all
of the data goes to the same place.  This modifies all of the MPMs except
Windows.  All of the Unix MPMs are working, but the others need to be
tested.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86651 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan Bloom
2000-10-18 19:12:16 +00:00
parent 1af6430ebf
commit d85bbfb847
11 changed files with 21 additions and 46 deletions

View File

@@ -71,12 +71,13 @@ extern "C" {
* Create a new connection.
* @param p Pool to allocate data structures out of
* @param server The server to create the connection for
* @param inout The BUFF to use for all communication with the client
* @param inout The socket to use for all communication with the client
* @param remaddr The remote address
* @param addr The server's local address
* @param id ID of this connection; unique at any point in time.
*/
conn_rec *ap_new_connection(apr_pool_t *p, server_rec *server, BUFF *inout,
conn_rec *ap_new_connection(apr_pool_t *p, server_rec *server,
apr_socket_t *inout,
const struct sockaddr_in *remaddr,
const struct sockaddr_in *saddr, long id);
@@ -85,11 +86,10 @@ conn_rec *ap_new_connection(apr_pool_t *p, server_rec *server, BUFF *inout,
* wrapper around ap_new_connection
* @param p Pool to allocate data structures out of.
* @param server The server to create the connection for
* @param inout The BUFF to use for all communication with the client
* @param conn_socket The socket we are creating the connection on.
* @param id ID of this connection; unique at any point in time.
*/
conn_rec *ap_new_apr_connection(apr_pool_t *p, server_rec *server, BUFF *inout,
conn_rec *ap_new_apr_connection(apr_pool_t *p, server_rec *server,
apr_socket_t *conn_socket, long id);
/**

View File

@@ -852,6 +852,7 @@ struct conn_rec {
/** Connection to the client */
BUFF *client;
apr_socket_t *client_socket;
/* Who is the client? */

View File

@@ -258,11 +258,14 @@ int ap_process_http_connection(conn_rec *c)
structure, but for now...
*/
conn_rec *ap_new_connection(apr_pool_t *p, server_rec *server, BUFF *inout,
conn_rec *ap_new_connection(apr_pool_t *p, server_rec *server,
apr_socket_t *inout,
const struct sockaddr_in *remaddr,
const struct sockaddr_in *saddr, long id)
{
conn_rec *conn = (conn_rec *) apr_pcalloc(p, sizeof(conn_rec));
BUFF *conn_io = ap_bcreate(p, B_RDWR);
ap_bpush_socket(conn_io, inout);
/* Got a connection structure, so initialize what fields we can
* (the rest are zeroed out by pcalloc).
@@ -276,7 +279,8 @@ conn_rec *ap_new_connection(apr_pool_t *p, server_rec *server, BUFF *inout,
conn->local_ip = apr_pstrdup(conn->pool,
inet_ntoa(conn->local_addr.sin_addr));
conn->base_server = server;
conn->client = inout;
conn->client = conn_io;
conn->client_socket = inout;
conn->remote_addr = *remaddr;
conn->remote_ip = apr_pstrdup(conn->pool,
@@ -289,12 +293,12 @@ conn_rec *ap_new_connection(apr_pool_t *p, server_rec *server, BUFF *inout,
conn_rec *ap_new_apr_connection(apr_pool_t *p, server_rec *server, BUFF *inout,
conn_rec *ap_new_apr_connection(apr_pool_t *p, server_rec *server,
apr_socket_t *conn_socket, long id)
{
struct sockaddr_in *sa_local, *sa_remote;
apr_get_local_name(&sa_local, conn_socket);
apr_get_remote_name(&sa_remote, conn_socket);
return ap_new_connection(p, server, inout, sa_remote, sa_local, id);
return ap_new_connection(p, server, conn_socket, sa_remote, sa_local, id);
}

View File

@@ -305,7 +305,6 @@ int ap_graceful_stop_signalled(void)
static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num)
{
BUFF *conn_io;
conn_rec *current_conn;
long conn_id = my_child_num;
int csd;
@@ -321,10 +320,7 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num)
return;
}
conn_io = ap_bcreate(p, B_RDWR);
ap_bpush_socket(conn_io, sock);
current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
current_conn = ap_new_apr_connection(p, ap_server_conf, sock,
conn_id);
ap_process_connection(current_conn);

View File

@@ -395,7 +395,6 @@ int ap_graceful_stop_signalled(void)
static void process_socket(apr_pool_t *p, apr_socket_t *sock, long conn_id)
{
BUFF *conn_io;
conn_rec *current_conn;
int csd;
apr_status_t rv;
@@ -416,10 +415,7 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, long conn_id)
ap_sock_disable_nagle(sock);
conn_io = ap_bcreate(p, B_RDWR);
ap_bpush_socket(conn_io, sock);
current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
current_conn = ap_new_apr_connection(p, ap_server_conf, sock,
conn_id);
ap_process_connection(current_conn);

View File

@@ -430,7 +430,6 @@ int ap_graceful_stop_signalled(void)
static void process_socket(apr_pool_t *p, apr_socket_t *sock, long conn_id)
{
BUFF *conn_io;
conn_rec *current_conn;
int csd;
apr_status_t rv;
@@ -453,10 +452,8 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, long conn_id)
if (thread_socket_table[thread_num] < 0) {
ap_sock_disable_nagle(sock);
}
conn_io = ap_bcreate(p, B_RDWR);
ap_bpush_socket(conn_io, sock);
current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
current_conn = ap_new_apr_connection(p, ap_server_conf, sock,
conn_id);
ap_process_connection(current_conn);

View File

@@ -295,15 +295,11 @@ int ap_graceful_stop_signalled(void)
static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num, int my_thread_num)
{
BUFF *conn_io;
conn_rec *current_conn;
long conn_id = my_child_num * HARD_THREAD_LIMIT + my_thread_num;
int csd;
conn_io = ap_bcreate(p, B_RDWR);
ap_bpush_socket(conn_io, sock);
current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
current_conn = ap_new_apr_connection(p, ap_server_conf, sock,
conn_id);
ap_process_connection(current_conn);

View File

@@ -392,7 +392,6 @@ int ap_graceful_stop_signalled(void)
static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num, int my_thread_num)
{
BUFF *conn_io;
conn_rec *current_conn;
long conn_id = my_child_num * HARD_THREAD_LIMIT + my_thread_num;
int csd;
@@ -413,10 +412,8 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num,
(void) ap_update_child_status(my_child_num, my_thread_num,
SERVER_BUSY_READ, (request_rec *) NULL);
conn_io = ap_bcreate(p, B_RDWR);
ap_bpush_socket(conn_io, sock);
current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
current_conn = ap_new_apr_connection(p, ap_server_conf, sock,
conn_id);
ap_process_connection(current_conn);

View File

@@ -430,7 +430,6 @@ int ap_graceful_stop_signalled(void)
static void process_socket(apr_pool_t *p, apr_socket_t *sock, long conn_id)
{
BUFF *conn_io;
conn_rec *current_conn;
int csd;
apr_status_t rv;
@@ -453,10 +452,8 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, long conn_id)
if (thread_socket_table[thread_num] < 0) {
ap_sock_disable_nagle(sock);
}
conn_io = ap_bcreate(p, B_RDWR);
ap_bpush_socket(conn_io, sock);
current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
current_conn = ap_new_apr_connection(p, ap_server_conf, sock,
conn_id);
ap_process_connection(current_conn);

View File

@@ -787,7 +787,6 @@ static void child_main(int child_num_arg)
#endif
while (!ap_graceful_stop_signalled()) {
BUFF *conn_io;
/* Prepare to receive a SIGUSR1 due to graceful restart so that
* we can exit cleanly.
@@ -1023,11 +1022,7 @@ static void child_main(int child_num_arg)
(void) ap_update_child_status(my_child_num, SERVER_BUSY_READ,
(request_rec *) NULL);
conn_io = ap_bcreate(ptrans, B_RDWR);
ap_bpush_socket(conn_io, csd);
current_conn = ap_new_apr_connection(ptrans, ap_server_conf, conn_io, csd,
current_conn = ap_new_apr_connection(ptrans, ap_server_conf, csd,
my_child_num);
ap_process_connection(current_conn);

View File

@@ -784,7 +784,6 @@ static void child_main(void *child_num_arg)
signal(SIGTERM, just_die);
while (!ap_stop_signalled()) {
BUFF *conn_io;
int srv;
apr_socket_t *sd;
@@ -969,10 +968,7 @@ static void child_main(void *child_num_arg)
(void) ap_update_child_status(THREAD_GLOBAL(child_num), SERVER_BUSY_READ,
(request_rec *) NULL);
conn_io = ap_bcreate(ptrans, B_RDWR);
ap_bpush_socket(conn_io, csd);
current_conn = ap_new_apr_connection(ptrans, ap_server_conf, conn_io, csd,
current_conn = ap_new_apr_connection(ptrans, ap_server_conf, csd,
THREAD_GLOBAL(child_num));
ap_process_connection(current_conn);