ares: return error at once if timed out before name resolve starts 68/117568/1 accepted/tizen/common/20170309.175136 accepted/tizen/ivi/20170308.121240 accepted/tizen/mobile/20170308.121208 accepted/tizen/tv/20170308.121224 accepted/tizen/wearable/20170308.121232 submit/tizen/20170308.045955
authorDaniel Stenberg <daniel@haxx.se>
Mon, 6 Mar 2017 08:21:01 +0000 (09:21 +0100)
committerSaurav Babu <saurav.babu@samsung.com>
Mon, 6 Mar 2017 12:02:02 +0000 (17:32 +0530)
Pointed-out-by: Ray Satiro
Bug: https://curl.haxx.se/mail/lib-2017-03/0004.html

Change-Id: I7c38e9dc6f386001692fa3b02f5bba00b59f4f45
Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
lib/asyn-ares.c

index 2aed94f..bc288f5 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, 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
@@ -359,6 +359,11 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
   struct Curl_dns_entry *temp_entry;
 
   timeout = Curl_timeleft(data, &now, TRUE);
+  if(timeout < 0) {
+    /* already expired! */
+    connclose(conn, "Timed out before name resolve started");
+    return CURLE_OPERATION_TIMEDOUT;
+  }
   if(!timeout)
     timeout = CURL_TIMEOUT_RESOLVE * 1000; /* default name resolve timeout */