whoops, I sent this to the wrong place the first time -------- Original Message -------- Subject: Re: [1.3 PATCH] enhance some trace messages Date: Thu, 16 Jan 2003 09:42:30 -0500 From: Jeff Trawick <[EMAIL PROTECTED]> To: Jim Jagielski <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <p05200f01ba4c6c0f55ce@[209.133.199.10]>
Jim Jagielski wrote: > At 7:47 AM -0500 1/16/03, Jeff Trawick wrote: > > >Roy T. Fielding wrote: > > > > > > > >> Second, > >>change the ap_log_error to the variable args version rather than > >>using a temporary buffer and ap_snprintf. > > > >I'm afraid you've lost me here. What function is there to use in > >place of ap_log_error()? Somehow use ap_pstrcat() and pass the buffer > >it builds to ap_log_error()? > > > > > I think Roy means something like: > > if (!sin_client) > ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, > "setsockopt: (TCP_NODELAY)"); > else > ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, > "setsockopt: (TCP_NODELAY), client %pA probably dropped the connection", > &sin_client->sin_addr); I can certainly understand that :) Here is a new patch along those lines. Index: main/http_main.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.599 diff -u -r1.599 http_main.c --- main/http_main.c 9 Jan 2003 09:24:10 -0000 1.599 +++ main/http_main.c 16 Jan 2003 14:36:38 -0000 @@ -3555,7 +3555,7 @@ } #if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF) -static void sock_disable_nagle(int s) +static void sock_disable_nagle(int s, struct sockaddr_in *sin_client) { /* The Nagle algorithm says that we should delay sending partial * packets in hopes of getting more data. We don't want to do @@ -3573,13 +3573,20 @@ #ifdef NETWARE errno = WSAGetLastError(); #endif - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "setsockopt: (TCP_NODELAY)"); + if (sin_client) { + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, + "setsockopt: (TCP_NODELAY), client %pA probably " + "dropped the connection", &sin_client->sin_addr); + } + else { + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, + "setsockopt: (TCP_NODELAY)"); + } } } #else -#define sock_disable_nagle(s) /* NOOP */ +#define sock_disable_nagle(s, c) /* NOOP */ #endif static int make_sock(pool *p, const struct sockaddr_in *server) @@ -3663,7 +3670,7 @@ } #endif - sock_disable_nagle(s); + sock_disable_nagle(s, NULL); sock_enable_linger(s); /* @@ -4513,11 +4520,14 @@ clen = sizeof(sa_server); if (getsockname(csd, &sa_server, &clen) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname"); + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + "getsockname, client %pA probably dropped the " + "connection", + &((struct sockaddr_in *)&sa_client)->sin_addr); continue; } - sock_disable_nagle(csd); + sock_disable_nagle(csd, (struct sockaddr_in *)&sa_client); (void) ap_update_child_status(my_child_num, SERVER_BUSY_READ, (request_rec *) NULL); @@ -5884,7 +5894,7 @@ memset(&sa_client, '\0', sizeof(sa_client)); } - sock_disable_nagle(csd); + sock_disable_nagle(csd, (struct sockaddr_in *)&sa_client); (void) ap_update_child_status(child_num, SERVER_BUSY_READ, (request_rec *) NULL);