diff -ur -x .svn -x *.patch -x *.orig current/docs/libcurl/curl_multi_fdset.3 csapuntz/docs/libcurl/curl_multi_fdset.3
--- current/docs/libcurl/curl_multi_fdset.3	Wed Apr 29 14:58:46 2009
+++ csapuntz/docs/libcurl/curl_multi_fdset.3	Sun Sep  6 15:46:53 2009
@@ -25,6 +25,10 @@
 this function returns. Otherwise it will contain the higher descriptor number
 libcurl set.
 
+The function may return a \fImax_fd\fP of -1 even when there are operations
+still running. This means the curl library would like the caller to sleep
+before calling back.
+
 You should also be aware that when doing select(), you should consider using a
 rather small (single-digit number of seconds) timeout and call
 \fIcurl_multi_perform\fP regularly - even if no activity has been seen on the
diff -ur -x .svn -x *.patch -x *.orig current/lib/hostthre.c csapuntz/lib/hostthre.c
--- current/lib/hostthre.c	Sun Sep  6 07:25:08 2009
+++ csapuntz/lib/hostthre.c	Sun Sep  6 15:42:22 2009
@@ -104,7 +104,9 @@
   HANDLE thread_hnd;
   unsigned thread_id;
   DWORD  thread_status;
-  curl_socket_t dummy_sock;   /* dummy for Curl_resolv_fdset() */
+  unsigned int poll_interval;
+  unsigned int interval_end;
+
   HANDLE mutex_waiting;  /* marks that we are still waiting for a resolve */
   HANDLE event_resolved; /* marks that the thread obtained the information */
   HANDLE event_thread_started; /* marks that the thread has initialized and
@@ -347,7 +349,6 @@
 
   if(async->os_specific) {
     struct thread_data *td = (struct thread_data*) async->os_specific;
-    curl_socket_t sock = td->dummy_sock;
 
     if(td->mutex_terminate && td->event_terminate) {
       /* Signaling resolver thread to terminate */
@@ -367,9 +368,6 @@
     if(td->event_thread_started)
       CloseHandle(td->event_thread_started);
 
-    if(sock != CURL_SOCKET_BAD)
-      sclose(sock);
-
     /* destroy the synchronization objects */
     if(td->mutex_waiting)
       CloseHandle(td->mutex_waiting);
@@ -417,7 +415,6 @@
   conn->async.status = 0;
   conn->async.dns = NULL;
   conn->async.os_specific = (void*) td;
-  td->dummy_sock = CURL_SOCKET_BAD;
 
   /* Create the mutex used to inform the resolver thread that we're
    * still waiting, and take initial ownership.
@@ -499,11 +496,7 @@
      * most probably it works now - ignoring this "minor" error
      */
   }
-  /* This socket is only to keep Curl_resolv_fdset() and select() happy;
-   * should never become signalled for read/write since it's unbound but
-   * Windows needs atleast 1 socket in select().
-   */
-  td->dummy_sock = socket(AF_INET, SOCK_DGRAM, 0);
+
   return TRUE;
 }
 
@@ -630,6 +623,32 @@
       return CURLE_COULDNT_RESOLVE_HOST;
     }
     *entry = conn->async.dns;
+  } else {
+    /* poll for name lookup done with exponential backoff up to 250ms */
+    struct thread_data *td = (struct thread_data*) conn->async.os_specific;
+    if (td) {
+      int elapsed;
+
+      elapsed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle);
+      if (elapsed < 0) {
+        elapsed = 0;
+      }
+
+      if (td->poll_interval == 0) {
+        /* Start at 1ms poll interval */
+        td->poll_interval = 1;
+      } else if (elapsed >= td->interval_end) {
+        /* Back-off exponentially if last interval expired  */
+        td->poll_interval *= 2;
+      }
+
+      if (td->poll_interval > 250)
+        td->poll_interval = 250;
+
+      td->interval_end = elapsed + td->poll_interval;
+
+      Curl_expire(conn->data, td->poll_interval);
+    }
   }
   return CURLE_OK;
 }
@@ -638,17 +657,6 @@
                         curl_socket_t *socks,
                         int numsocks)
 {
-  const struct thread_data *td =
-    (const struct thread_data *) conn->async.os_specific;
-
-  if(td && td->dummy_sock != CURL_SOCKET_BAD) {
-    if(numsocks) {
-      /* return one socket waiting for writable, even though this is just
-         a dummy */
-      socks[0] = td->dummy_sock;
-      return GETSOCK_WRITESOCK(0);
-    }
-  }
   return 0;
 }
 

