Commit d5074f74 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

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.
parent ea0cf7c8
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -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 :
  timeout =
    conn->data->set.connecttimeout ? conn->data->set.connecttimeout :
    conn->data->set.timeout ? conn->data->set.timeout :
            300;   /* default name resolve timeout in seconds */
    CURL_TIMEOUT_RESOLVE; /* default name resolve timeout */
  ticks = GetTickCount();

  status = WaitForSingleObject(td->thread_hnd, 1000UL*timeout);