You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2001/02/01 18:21:52 UTC
cvs commit: httpd-2.0/server/mpm/prefork prefork.c
trawick 01/02/01 09:21:51
Modified: server connection.c
server/mpm/prefork prefork.c
Log:
handle a TCP connection reset between the time we accept the connection
and when apr_get_sockaddr() does getsockname() or getpeername()
this change will be rolled into the other MPMs later
Revision Changes Path
1.71 +16 -2 httpd-2.0/server/connection.c
Index: connection.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/connection.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- connection.c 2001/01/19 22:32:15 1.70
+++ connection.c 2001/02/01 17:21:46 1.71
@@ -67,6 +67,7 @@
#include "mpm_status.h"
#include "http_config.h"
#include "http_vhost.h"
+#include "http_log.h"
#include "util_filter.h"
#ifdef HAVE_NETINET_IN_H
@@ -270,6 +271,7 @@
apr_socket_t *inout, long id)
{
conn_rec *conn = (conn_rec *) apr_pcalloc(p, sizeof(conn_rec));
+ apr_status_t rv;
/* Got a connection structure, so initialize what fields we can
* (the rest are zeroed out by pcalloc).
@@ -279,9 +281,21 @@
conn->notes = apr_make_table(p, 5);
conn->pool = p;
- apr_get_sockaddr(&conn->local_addr, APR_LOCAL, inout);
+ if ((rv = apr_get_sockaddr(&conn->local_addr, APR_LOCAL, inout))
+ != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_INFO, rv, server,
+ "apr_get_sockaddr(APR_LOCAL)");
+ apr_close_socket(inout);
+ return NULL;
+ }
apr_get_ipaddr(&conn->local_ip, conn->local_addr);
- apr_get_sockaddr(&conn->remote_addr, APR_REMOTE, inout);
+ if ((rv = apr_get_sockaddr(&conn->remote_addr, APR_REMOTE, inout))
+ != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_INFO, rv, server,
+ "apr_get_sockaddr(APR_REMOTE)");
+ apr_close_socket(inout);
+ return NULL;
+ }
apr_get_ipaddr(&conn->remote_ip, conn->remote_addr);
conn->base_server = server;
conn->client_socket = inout;
1.150 +4 -3 httpd-2.0/server/mpm/prefork/prefork.c
Index: prefork.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/prefork/prefork.c,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -r1.149 -r1.150
--- prefork.c 2001/01/31 02:15:12 1.149
+++ prefork.c 2001/02/01 17:21:49 1.150
@@ -1048,9 +1048,10 @@
current_conn = ap_new_connection(ptrans, ap_server_conf, csd,
my_child_num);
-
- ap_process_connection(current_conn);
- ap_lingering_close(current_conn);
+ if (current_conn) {
+ ap_process_connection(current_conn);
+ ap_lingering_close(current_conn);
+ }
}
clean_child_exit(0);
}