Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 14310 invoked from network); 16 Oct 2003 17:41:36 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 16 Oct 2003 17:41:36 -0000 Received: (qmail 19961 invoked by uid 500); 16 Oct 2003 17:40:57 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 19923 invoked by uid 500); 16 Oct 2003 17:40:56 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 19852 invoked from network); 16 Oct 2003 17:40:56 -0000 Received: from unknown (HELO jaguNET.com) (209.133.199.10) by daedalus.apache.org with SMTP; 16 Oct 2003 17:40:56 -0000 Received: from jagunet.com (localhost [127.0.0.1]) by jaguNET.com (8.12.9/8.12.2) with ESMTP id h9GHewvV000814 for ; Thu, 16 Oct 2003 13:40:59 -0400 (EDT) Date: Thu, 16 Oct 2003 13:40:58 -0400 Mime-Version: 1.0 (Apple Message framework v552) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: [PATCH] Socket Close fixes From: Jim Jagielski To: dev@httpd.apache.org Content-Transfer-Encoding: 7bit Message-Id: X-Mailer: Apple Mail (2.552) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N In response to PR# 22805. The buff.c changes reflect the change to force ap_pclosesocket() on all sockets. Since this function call uses closesocket() universally, this allows the changes to http_main.c. Index: src/main/buff.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/buff.c,v retrieving revision 1.110 diff -u -u -r1.110 buff.c --- src/main/buff.c 3 Feb 2003 17:13:20 -0000 1.110 +++ src/main/buff.c 16 Oct 2003 17:36:46 -0000 @@ -1497,7 +1497,6 @@ rc1 = ap_bflush(fb); else rc1 = 0; -#if defined(WIN32) || defined(NETWARE) || defined(CYGWIN_WINSOCK) if (fb->flags & B_SOCKET) { rc2 = ap_pclosesocket(fb->pool, fb->fd); if (fb->fd_in != fb->fd) { @@ -1506,24 +1505,13 @@ else { rc3 = 0; } - } -#if !defined(NETWARE) && !defined(CYGWIN_WINSOCK) - else if (fb->hFH != INVALID_HANDLE_VALUE) { + } else { +#if defined(WIN32) + if (fb->hFH != INVALID_HANDLE_VALUE) { rc2 = ap_pcloseh(fb->pool, fb->hFH); rc3 = 0; } -#endif else { -#elif defined(BEOS) - if (fb->flags & B_SOCKET) { - rc2 = ap_pclosesocket(fb->pool, fb->fd); - if (fb->fd_in != fb->fd) { - rc3 = ap_pclosesocket(fb->pool, fb->fd_in); - } - else { - rc3 = 0; - } - } else { #endif rc2 = ap_pclosef(fb->pool, fb->fd); if (fb->fd_in != fb->fd) { @@ -1532,7 +1520,8 @@ else { rc3 = 0; } -#if defined(WIN32) || defined (BEOS) || defined(NETWARE) || defined(CYGWIN_WINSOCK) + } +#if defined(WIN32) } #endif Index: src/main/http_main.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.604 diff -u -u -r1.604 http_main.c --- src/main/http_main.c 23 May 2003 15:25:24 -0000 1.604 +++ src/main/http_main.c 16 Oct 2003 17:36:50 -0000 @@ -3703,11 +3703,7 @@ #ifndef _OSD_POSIX ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, "make_sock: for %s, setsockopt: (SO_REUSEADDR)", addr); -#ifdef BEOS closesocket(s); -#else - close(s); -#endif ap_unblock_alarms(); exit(1); #endif /*_OSD_POSIX*/ @@ -3717,11 +3713,7 @@ if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (char *) &one, sizeof(int)) < 0) { ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, "make_sock: for %s, setsockopt: (SO_KEEPALIVE)", addr); -#ifdef BEOS closesocket(s); -#else - close(s); -#endif ap_unblock_alarms(); exit(1); @@ -3776,11 +3768,7 @@ GETUSERMODE(); #endif -#ifdef BEOS closesocket(s); -#else - close(s); -#endif ap_unblock_alarms(); exit(1); } @@ -3792,11 +3780,7 @@ if (listen(s, ap_listenbacklog) == -1) { ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "make_sock: unable to listen for connections on %s", addr); -#ifdef BEOS closesocket(s); -#else - close(s); -#endif ap_unblock_alarms(); exit(1); } @@ -3846,11 +3830,7 @@ "larger than FD_SETSIZE (%u) " "found, you probably need to rebuild Apache with a " "larger FD_SETSIZE", addr, s, FD_SETSIZE); -#ifdef BEOS closesocket(s); -#else - close(s); -#endif exit(1); } #endif