diff options
author | Anders Bakken <agbakken@gmail.com> | 2017-09-28 08:20:04 -0700 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-09-29 08:51:59 +0200 |
commit | 49d75a4c15393d66e9f3e0ce289a610da4d6e5a9 (patch) | |
tree | 1f8ac13f83a587acf1b2d481db511b5014391693 /lib | |
parent | c66d94d6da50b20a8bc218683bc88b54ac15d6c2 (diff) |
connect: fix race condition with happy eyeballs timeout
The timer should be started after conn->connecttime is set. Otherwise
the timer could expire without this condition being true:
/* should we try another protocol family? */
if(i == 0 && conn->tempaddr[1] == NULL &&
curlx_tvdiff(now, conn->connecttime) >= HAPPY_EYEBALLS_TIMEOUT) {
Ref: #1928
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/connect.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/connect.c b/lib/connect.c index 42559f979..b7d10af55 100755 --- a/lib/connect.c +++ b/lib/connect.c @@ -1161,7 +1161,6 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */ conn->tempaddr[1] = NULL; conn->tempsock[0] = CURL_SOCKET_BAD; conn->tempsock[1] = CURL_SOCKET_BAD; - Curl_expire(conn->data, HAPPY_EYEBALLS_TIMEOUT, EXPIRE_HAPPY_EYEBALLS); /* Max time for the next connection attempt */ conn->timeoutms_per_addr = @@ -1182,6 +1181,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */ } data->info.numconnects++; /* to track the number of connections made */ + Curl_expire(conn->data, HAPPY_EYEBALLS_TIMEOUT, EXPIRE_HAPPY_EYEBALLS); return CURLE_OK; } |