From 5e920157112923417faf901b08098b65d82f7746 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 1 Sep 2010 16:47:42 +0200 Subject: threaded resolver: no more expire 0 calls Curl_expire() set to 0 expires ALL timeouts so it should only be called if we truly and really want to remove all timeouts for the handle. --- lib/hostthre.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'lib/hostthre.c') diff --git a/lib/hostthre.c b/lib/hostthre.c index 8a5f67a17..e8dfa5400 100644 --- a/lib/hostthre.c +++ b/lib/hostthre.c @@ -419,8 +419,6 @@ CURLcode Curl_is_resolved(struct connectdata *conn, if (done) { getaddrinfo_complete(conn); - if (td->poll_interval != 0) - Curl_expire(conn->data, 0); Curl_destroy_thread_data(&conn->async); if(!conn->async.dns) { @@ -431,29 +429,21 @@ CURLcode Curl_is_resolved(struct connectdata *conn, *entry = conn->async.dns; } else { /* poll for name lookup done with exponential backoff up to 250ms */ - int elapsed; - - elapsed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle); - if (elapsed < 0) { + int elapsed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle); + if (elapsed < 0) elapsed = 0; - } - if (td->poll_interval == 0) { + if (td->poll_interval == 0) /* Start at 1ms poll interval */ td->poll_interval = 1; - } else if (elapsed >= td->interval_end) { + 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; - - /* Reset old timer so we can set a new one further in the future */ - Curl_expire(conn->data, 0); - Curl_expire(conn->data, td->poll_interval); } -- cgit v1.2.3