aboutsummaryrefslogtreecommitdiff
path: root/lib/gtls.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-02-07 22:25:04 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-02-07 22:25:04 +0000
commit1b701c746f66b8fd5bf3017c36254dbde8456df2 (patch)
tree9ce8d20c20100c4fb9bbec0966928641f9f910b7 /lib/gtls.c
parent15bf16852705a585b694cb0d50d21f7edd6b7a88 (diff)
- 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/gtls.c')
-rw-r--r--lib/gtls.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/lib/gtls.c b/lib/gtls.c
index 49b0fc739..d317d2bb0 100644
--- a/lib/gtls.c
+++ b/lib/gtls.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -154,23 +154,7 @@ static CURLcode handshake(struct connectdata *conn,
rc = gnutls_handshake(session);
if((rc == GNUTLS_E_AGAIN) || (rc == GNUTLS_E_INTERRUPTED)) {
- long timeout_ms = DEFAULT_CONNECT_TIMEOUT;
- long has_passed;
-
- if(duringconnect && data->set.connecttimeout)
- timeout_ms = data->set.connecttimeout;
-
- if(data->set.timeout) {
- /* get the strictest timeout of the ones converted to milliseconds */
- if(data->set.timeout < timeout_ms)
- timeout_ms = data->set.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;
+ long timeout_ms = Curl_connecttimeleft(conn, NULL, duringconnect);
if(timeout_ms < 0) {
/* a precaution, no need to continue if time already is up */