diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/connect.c | 6 | ||||
-rw-r--r-- | lib/connect.h | 2 | ||||
-rw-r--r-- | lib/setopt.c | 6 | ||||
-rw-r--r-- | lib/url.c | 1 | ||||
-rw-r--r-- | lib/urldata.h | 1 |
5 files changed, 12 insertions, 4 deletions
diff --git a/lib/connect.c b/lib/connect.c index c3add43cc..1a27ae135 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -783,7 +783,8 @@ CURLcode Curl_is_connected(struct connectdata *conn, /* should we try another protocol family? */ if(i == 0 && conn->tempaddr[1] == NULL && - Curl_timediff(now, conn->connecttime) >= HAPPY_EYEBALLS_TIMEOUT) { + (Curl_timediff(now, conn->connecttime) >= + data->set.happy_eyeballs_timeout)) { trynextip(conn, sockindex, 1); } } @@ -1206,7 +1207,8 @@ 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); + Curl_expire(conn->data, data->set.happy_eyeballs_timeout, + EXPIRE_HAPPY_EYEBALLS); return CURLE_OK; } diff --git a/lib/connect.h b/lib/connect.h index 4c038874e..193dc6397 100644 --- a/lib/connect.h +++ b/lib/connect.h @@ -41,8 +41,6 @@ timediff_t Curl_timeleft(struct Curl_easy *data, bool duringconnect); #define DEFAULT_CONNECT_TIMEOUT 300000 /* milliseconds == five minutes */ -#define HAPPY_EYEBALLS_TIMEOUT 200 /* milliseconds to wait between - IPv4/IPv6 connection attempts */ /* * Used to extract socket and connectdata struct for the most recent diff --git a/lib/setopt.c b/lib/setopt.c index 69f98a64d..f03e6d5fa 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -2533,6 +2533,12 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, case CURLOPT_SSH_COMPRESSION: data->set.ssh_compression = (0 != va_arg(param, long))?TRUE:FALSE; break; + case CURLOPT_HAPPY_EYEBALLS_TIMEOUT: + arg = va_arg(param, long); + if(arg < 0) + return CURLE_BAD_FUNCTION_ARGUMENT; + data->set.happy_eyeballs_timeout = arg; + break; default: /* unknown tag and its companion, just ignore: */ result = CURLE_UNKNOWN_OPTION; @@ -527,6 +527,7 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data) set->expect_100_timeout = 1000L; /* Wait for a second by default. */ set->sep_headers = TRUE; /* separated header lists by default */ set->buffer_size = READBUFFER_SIZE; + set->happy_eyeballs_timeout = CURL_HET_DEFAULT; Curl_http2_init_userset(set); return result; diff --git a/lib/urldata.h b/lib/urldata.h index 6c594fe8d..35014c232 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -1520,6 +1520,7 @@ struct UserDefined { long timeout; /* in milliseconds, 0 means no timeout */ long connecttimeout; /* in milliseconds, 0 means no timeout */ long accepttimeout; /* in milliseconds, 0 means no timeout */ + long happy_eyeballs_timeout; /* in milliseconds, 0 is a valid value */ long server_response_timeout; /* in milliseconds, 0 means no timeout */ long tftp_blksize; /* in bytes, 0 means use default */ bool tftp_no_options; /* do not send TFTP options requests */ |