Return-Path: X-Original-To: apmail-httpd-cvs-archive@www.apache.org Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7357D17F82 for ; Tue, 30 Sep 2014 10:40:05 +0000 (UTC) Received: (qmail 84204 invoked by uid 500); 30 Sep 2014 10:40:05 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 84145 invoked by uid 500); 30 Sep 2014 10:40:05 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 84136 invoked by uid 99); 30 Sep 2014 10:40:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Sep 2014 10:40:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Tue, 30 Sep 2014 10:39:43 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id DA6FE238899C; Tue, 30 Sep 2014 10:39:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1628388 - /httpd/httpd/trunk/support/ab.c Date: Tue, 30 Sep 2014 10:39:41 -0000 To: cvs@httpd.apache.org From: jkaluza@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140930103941.DA6FE238899C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jkaluza Date: Tue Sep 30 10:39:41 2014 New Revision: 1628388 URL: http://svn.apache.org/r1628388 Log: ab: Use only one connection to determine working destination socket address. Modified: httpd/httpd/trunk/support/ab.c Modified: httpd/httpd/trunk/support/ab.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/ab.c?rev=1628388&r1=1628387&r2=1628388&view=diff ============================================================================== --- httpd/httpd/trunk/support/ab.c (original) +++ httpd/httpd/trunk/support/ab.c Tue Sep 30 10:39:41 2014 @@ -343,6 +343,7 @@ apr_time_t start, lasttime, stoptime; char _request[8192]; char *request = _request; apr_size_t reqlen; +int requests_initialized = 0; /* one global throw-away buffer to read stuff into */ char buffer[8192]; @@ -1395,6 +1396,7 @@ static void read_connection(struct conne apr_status_t status; char *part; char respcode[4]; /* 3 digits and null */ + int i; r = sizeof(buffer); #ifdef USE_SSL @@ -1593,6 +1595,16 @@ static void read_connection(struct conne } c->bread += c->cbx - (s + l - c->cbuff) + r - tocopy; totalbread += c->bread; + + /* We have received the header, so we know this destination socket + * address is working, so initialize all remaining requests. */ + if (!requests_initialized) { + for (i = 1; i < concurrency; i++) { + con[i].socknum = i; + start_connect(&con[i]); + } + requests_initialized = 1; + } } } else { @@ -1797,11 +1809,10 @@ static void test(void) apr_signal(SIGINT, output_results); #endif - /* initialise lots of requests */ - for (i = 0; i < concurrency; i++) { - con[i].socknum = i; - start_connect(&con[i]); - } + /* initialise first connection to determine destination socket address + * which should be used for next connections. */ + con[0].socknum = 0; + start_connect(&con[0]); do { apr_int32_t n;