Hi,
while looking for backport candidates to synch 2.4.x and trunk, I came
accross this one.
I don't see where it "avoids a double apr_time_now() call on the first
succeeding read".
Because of the 'continue' after the 'timeup' computation, I think that
the previous code already had only one apr_time_now call on the first
succeeding read.
So, if you agree, I propose to revert it as there is no win.
Best regards,
CJ
Le 28/02/2014 11:22, [email protected] a écrit :
Author: ylavic
Date: Fri Feb 28 10:22:26 2014
New Revision: 1572905
URL: http://svn.apache.org/r1572905
Log:
core: avoid a double apr_time_now() call on the first succeeding read.
Modified:
httpd/httpd/trunk/server/connection.c
Modified: httpd/httpd/trunk/server/connection.c
URL:
http://svn.apache.org/viewvc/httpd/httpd/trunk/server/connection.c?rev=1572905&r1=1572904&r2=1572905&view=diff
==============================================================================
--- httpd/httpd/trunk/server/connection.c (original)
+++ httpd/httpd/trunk/server/connection.c Fri Feb 28 10:22:26 2014
@@ -141,7 +141,7 @@ AP_DECLARE(void) ap_lingering_close(conn
{
char dummybuf[512];
apr_size_t nbytes;
- apr_time_t timeup = 0;
+ apr_time_t now, timeup = 0;
apr_socket_t *csd = ap_get_conn_socket(c);
if (ap_start_lingering_close(c)) {
@@ -165,6 +165,7 @@ AP_DECLARE(void) ap_lingering_close(conn
if (apr_socket_recv(csd, dummybuf, &nbytes) || nbytes == 0)
break;
+ now = apr_time_now();
if (timeup == 0) {
/*
* First time through;
@@ -175,14 +176,14 @@ AP_DECLARE(void) ap_lingering_close(conn
* DoS attacks.
*/
if (apr_table_get(c->notes, "short-lingering-close")) {
- timeup = apr_time_now() + apr_time_from_sec(SECONDS_TO_LINGER);
+ timeup = now + apr_time_from_sec(SECONDS_TO_LINGER);
}
else {
- timeup = apr_time_now() +
apr_time_from_sec(MAX_SECS_TO_LINGER);
+ timeup = now + apr_time_from_sec(MAX_SECS_TO_LINGER);
}
continue;
}
- } while (apr_time_now() < timeup);
+ } while (now < timeup);
apr_socket_close(csd);
return;