aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-01-05 16:38:18 +0100
committerDaniel Stenberg <daniel@haxx.se>2014-01-12 00:11:53 +0100
commit3b183df9cc781b329ca409ded1ea336530624715 (patch)
treecd335d59f73dd0ec90682ab39b0438a8959bec1e
parent7cd45b297ec2d09af92cd6defccd54c7e9ac5a3d (diff)
multi: remove MULTI_TIMEOUT_INACCURACY
With the recently added timeout "reminder" functionality, there's no reason left for us to execute timeout code before the time is ripe. Simplifies the handling too. This will make the *TIMEOUT and *CONNECTTIMEOUT options more accurate again, which probably is most important when the *_MS versions are used. In multi_socket, make sure to update 'now' after having handled activity on a socket.
-rw-r--r--lib/connect.c3
-rw-r--r--lib/multi.c26
-rw-r--r--lib/multiif.h12
-rw-r--r--lib/transfer.c10
4 files changed, 8 insertions, 43 deletions
diff --git a/lib/connect.c b/lib/connect.c
index f04cce7e3..0816af2d4 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -1104,8 +1104,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
conn->tempaddr[1] = NULL;
conn->tempsock[0] = CURL_SOCKET_BAD;
conn->tempsock[1] = CURL_SOCKET_BAD;
- Curl_expire(conn->data,
- HAPPY_EYEBALLS_TIMEOUT + (MULTI_TIMEOUT_INACCURACY/1000));
+ Curl_expire(conn->data, HAPPY_EYEBALLS_TIMEOUT);
/* Max time for the next connection attempt */
conn->timeoutms_per_addr =
diff --git a/lib/multi.c b/lib/multi.c
index 3af460da4..cab303049 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -2231,6 +2231,8 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
data = NULL; /* set data to NULL again to avoid calling
multi_runsingle() in case there's no need to */
+ now = Curl_tvnow(); /* get a newer time since the multi_runsingle() loop
+ may have taken some time */
}
}
else {
@@ -2241,30 +2243,6 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
memset(&multi->timer_lastcall, 0, sizeof(multi->timer_lastcall));
}
- /* Compensate for bad precision timers that might've triggered too early.
-
- This precaution was added in commit 2c72732ebf3da5e as a result of bad
- resolution in the windows function use(d).
-
- The problematic case here is when using the multi_socket API and libcurl
- has told the application about a timeout, and that timeout is what fires
- off a bit early. As we don't have any IDs associated with the timeout we
- can't tell which timeout that fired off but we only have the times to use
- to check what to do. If it fires off too early, we don't run the correct
- actions and we don't tell the application again about the same timeout as
- was already first in the queue...
-
- Originally we made the timeouts run 40 milliseconds early on all systems,
- but now we have an #ifdef setup to provide a decent precaution inaccuracy
- margin.
- */
-
- now.tv_usec += MULTI_TIMEOUT_INACCURACY;
- if(now.tv_usec >= 1000000) {
- now.tv_sec++;
- now.tv_usec -= 1000000;
- }
-
/*
* The loop following here will go on as long as there are expire-times left
* to process in the splay and 'data' will be re-assigned for every expired
diff --git a/lib/multiif.h b/lib/multiif.h
index 15163da98..1cbd31009 100644
--- a/lib/multiif.h
+++ b/lib/multiif.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -22,16 +22,6 @@
*
***************************************************************************/
-/* See multi_socket() for the explanation of this constant. Counted in number
- of microseconds. */
-#ifdef WIN32
-#define MULTI_TIMEOUT_INACCURACY 40000
-#else
-#define MULTI_TIMEOUT_INACCURACY 3000
-#endif
-
-#define MULTI_TIMEOUT_INACCURACY_MS (MULTI_TIMEOUT_INACCURACY / 1000)
-
/*
* Prototypes for library-wide functions provided by multi.c
*/
diff --git a/lib/transfer.c b/lib/transfer.c
index 7861174a7..3408a8414 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -1320,11 +1320,10 @@ CURLcode Curl_pretransfer(struct SessionHandle *data)
Curl_pgrsStartNow(data);
if(data->set.timeout)
- Curl_expire(data, data->set.timeout + MULTI_TIMEOUT_INACCURACY_MS);
+ Curl_expire(data, data->set.timeout);
if(data->set.connecttimeout)
- Curl_expire(data, data->set.connecttimeout +
- MULTI_TIMEOUT_INACCURACY_MS);
+ Curl_expire(data, data->set.connecttimeout);
/* In case the handle is re-used and an authentication method was picked
in the session we need to make sure we only use the one(s) we now
@@ -1970,8 +1969,7 @@ Curl_setup_transfer(
/* Set a timeout for the multi interface. Add the inaccuracy margin so
that we don't fire slightly too early and get denied to run. */
- Curl_expire(data, CURL_TIMEOUT_EXPECT_100 +
- MULTI_TIMEOUT_INACCURACY / 1000);
+ Curl_expire(data, CURL_TIMEOUT_EXPECT_100);
}
else {
if(data->state.expect100header)