aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-03-31 12:55:24 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-03-31 12:55:24 +0000
commitd5074f74bbc8b27ca962afeba059d9d70a7edc80 (patch)
treeeea586a67ef992676352975b4b49c07e47dd3dce
parentea0cf7c87b88810e4de39b5fd6c68dfc20909251 (diff)
The asynch name resolve methods now all use CURL_TIMEOUT_RESOLVE for
the specific time to wait for a resolve. The definition is at the top of this source file.
-rw-r--r--lib/hostip.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/hostip.c b/lib/hostip.c
index 0ce07be81..2cd4e110e 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -88,6 +88,9 @@
#define ARES_SUCCESS CURLE_OK
#endif
+#define CURL_TIMEOUT_RESOLVE 300 /* when using asynch methods, we allow this
+ many seconds for a name resolve */
+
/* These two symbols are for the global DNS cache */
static curl_hash hostname_cache;
static int host_cache_initialized;
@@ -570,8 +573,8 @@ CURLcode Curl_is_resolved(struct connectdata *conn,
diff = Curl_tvdiff(Curl_tvnow(),
data->progress.t_startsingle)/1000;
- if(diff > 180) {
- /* Waited >180 seconds, this is a name resolve timeout! */
+ if(diff > CURL_TIMEOUT_RESOLVE) {
+ /* Waited many seconds, this is a name resolve timeout! */
failf(data, "Name resolve timeout after %ld seconds", diff);
return CURLE_OPERATION_TIMEDOUT;
}
@@ -614,7 +617,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
CURLcode rc=CURLE_OK;
struct SessionHandle *data = conn->data;
struct timeval now = Curl_tvnow();
- long timeout = 300; /* default name resolve timeout in seconds */
+ long timeout = CURL_TIMEOUT_RESOLVE; /* default name resolve timeout */
/* now, see if there's a connect timeout or a regular timeout to
use instead of the default one */
@@ -1431,9 +1434,10 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
/* now, see if there's a connect timeout or a regular timeout to
use instead of the default one */
- timeout = conn->data->set.connecttimeout ? conn->data->set.connecttimeout :
- conn->data->set.timeout ? conn->data->set.timeout :
- 300; /* default name resolve timeout in seconds */
+ timeout =
+ conn->data->set.connecttimeout ? conn->data->set.connecttimeout :
+ conn->data->set.timeout ? conn->data->set.timeout :
+ CURL_TIMEOUT_RESOLVE; /* default name resolve timeout */
ticks = GetTickCount();
status = WaitForSingleObject(td->thread_hnd, 1000UL*timeout);