diff options
author | Daniel Stenberg <daniel@haxx.se> | 2008-02-07 22:25:04 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2008-02-07 22:25:04 +0000 |
commit | 1b701c746f66b8fd5bf3017c36254dbde8456df2 (patch) | |
tree | 9ce8d20c20100c4fb9bbec0966928641f9f910b7 /lib/ssluse.c | |
parent | 15bf16852705a585b694cb0d50d21f7edd6b7a88 (diff) | |
download | curl-1b701c746f66b8fd5bf3017c36254dbde8456df2.tar.gz |
- Refactored a lot of timeout code into a few functions in an attempt to make
them all use the same (hopefully correct) logic to make it less error-prone
and easier to introduce library-wide where it should be used.
Diffstat (limited to 'lib/ssluse.c')
-rw-r--r-- | lib/ssluse.c | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/lib/ssluse.c b/lib/ssluse.c index 0083a4153..e8a2e03c9 100644 --- a/lib/ssluse.c +++ b/lib/ssluse.c @@ -1448,40 +1448,17 @@ ossl_connect_step2(struct connectdata *conn, { struct SessionHandle *data = conn->data; int err; - long has_passed; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; DEBUGASSERT(ssl_connect_2 == connssl->connecting_state || ssl_connect_2_reading == connssl->connecting_state || ssl_connect_2_writing == connssl->connecting_state); - /* Find out if any timeout is set. If not, use 300 seconds. - Otherwise, figure out the most strict timeout of the two possible one - and then how much time that has elapsed to know how much time we - allow for the connect call */ - if(data->set.timeout && data->set.connecttimeout) { - /* get the most strict timeout of the ones converted to milliseconds */ - if(data->set.timeout<data->set.connecttimeout) - *timeout_ms = data->set.timeout; - else - *timeout_ms = data->set.connecttimeout; - } - else if(data->set.timeout) - *timeout_ms = data->set.timeout; - else if(data->set.connecttimeout) - *timeout_ms = data->set.connecttimeout; - else - /* no particular time-out has been set */ - *timeout_ms = DEFAULT_CONNECT_TIMEOUT; - - /* Evaluate in milliseconds how much time that has passed */ - has_passed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle); - - /* subtract the passed time */ - *timeout_ms -= has_passed; + /* Find out how much more time we're allowed */ + *timeout_ms = Curl_timeleft(conn, NULL, TRUE); if(*timeout_ms < 0) { - /* a precaution, no need to continue if time already is up */ + /* no need to continue if time already is up */ failf(data, "SSL connection timeout"); return CURLE_OPERATION_TIMEDOUT; } |