From commits-return-10159-apmail-apr-commits-archive=apr.apache.org@apr.apache.org Thu Feb 19 10:57:34 2009 Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 18972 invoked from network); 19 Feb 2009 10:57:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Feb 2009 10:57:34 -0000 Received: (qmail 35887 invoked by uid 500); 19 Feb 2009 10:57:34 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 35834 invoked by uid 500); 19 Feb 2009 10:57:33 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 35825 invoked by uid 99); 19 Feb 2009 10:57:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Feb 2009 02:57:33 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Feb 2009 10:57:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id BB0BB238889E; Thu, 19 Feb 2009 10:57:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r745813 - /apr/apr/trunk/file_io/win32/pipe.c Date: Thu, 19 Feb 2009 10:57:12 -0000 To: commits@apr.apache.org From: mturk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090219105712.BB0BB238889E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mturk Date: Thu Feb 19 10:57:12 2009 New Revision: 745813 URL: http://svn.apache.org/viewvc?rev=745813&view=rev Log: On busy systems the accept can be delayed, so use the select and wait untill fully connected Modified: apr/apr/trunk/file_io/win32/pipe.c Modified: apr/apr/trunk/file_io/win32/pipe.c URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/pipe.c?rev=745813&r1=745812&r2=745813&view=diff ============================================================================== --- apr/apr/trunk/file_io/win32/pipe.c (original) +++ apr/apr/trunk/file_io/win32/pipe.c Thu Feb 19 10:57:12 2009 @@ -229,8 +229,9 @@ static apr_status_t create_socket_pipe(SOCKET *rd, SOCKET *wr) { static int id = 0; - + FD_SET rs; SOCKET ls; + struct timeval socktm; struct sockaddr_in pa; struct sockaddr_in la; struct sockaddr_in ca; @@ -290,10 +291,27 @@ goto cleanup; } for (;;) { + int ns; /* Listening socket is nonblocking by now. - * The accept must create the socket - * immediatelly because we connected already. + * The accept should create the socket + * immediatelly because we are connected already. + * However on buys systems this can take a while + * until winsock gets a chance to handle the events. */ + FD_ZERO(&rs); + FD_SET(ls, &rs); + + socktm.tv_sec = 1; + socktm.tv_usec = 0; + if ((ns = select(0, &rs, NULL, NULL, &socktm)) == SOCKET_ERROR) { + /* Accept still not signaled */ + Sleep(100); + continue; + } + if (ns == 0) { + /* No connections in the last second */ + continue; + } if ((*rd = accept(ls, (SOCKADDR *)&ca, &lc)) == INVALID_SOCKET) { rv = apr_get_netos_error(); goto cleanup;