diff --git a/lib/connect.c b/lib/connect.c index be87ed91c65481e7b89630cdecefca3e4085ede4..604bb2a1a55aa921fd206af748d6320a633ddac8 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -124,15 +124,17 @@ singleipconnect(struct connectdata *conn, * transfer/connection. If the value is negative, the timeout time has already * elapsed. * + * The start time is stored in progress.t_startsingle - as set with + * Curl_pgrsTime(..., TIMER_STARTSINGLE); + * * If 'nowp' is non-NULL, it points to the current time. * 'duringconnect' is FALSE if not during a connect, as then of course the * connect timeout is not taken into account! */ -long Curl_timeleft(struct connectdata *conn, +long Curl_timeleft(struct SessionHandle *data, struct timeval *nowp, bool duringconnect) { - struct SessionHandle *data = conn->data; int timeout_set = 0; long timeout_ms = duringconnect?DEFAULT_CONNECT_TIMEOUT:0; struct timeval now; @@ -673,7 +675,7 @@ CURLcode Curl_is_connected(struct connectdata *conn, now = Curl_tvnow(); /* figure out how long time we have left to connect */ - allow = Curl_timeleft(conn, &now, TRUE); + allow = Curl_timeleft(data, &now, TRUE); if(allow < 0) { /* time-out, bail out, go home */ @@ -1040,7 +1042,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */ *connected = FALSE; /* default to not connected */ /* get the timeout left */ - timeout_ms = Curl_timeleft(conn, &before, TRUE); + timeout_ms = Curl_timeleft(data, &before, TRUE); if(timeout_ms < 0) { /* a precaution, no need to continue if time already is up */ diff --git a/lib/connect.h b/lib/connect.h index 6cc403d9f0dc8c24548af4e5179e586b5cdaf016..0720085c2f3e7bf5fdec45331a5aa1f4f22503b2 100644 --- a/lib/connect.h +++ b/lib/connect.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -37,7 +37,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* generic function that returns how much time there's left to run, according to the timeouts set */ -long Curl_timeleft(struct connectdata *conn, +long Curl_timeleft(struct SessionHandle *data, struct timeval *nowp, bool duringconnect); diff --git a/lib/ftp.c b/lib/ftp.c index 8e370c5d2943b993b62e89a2f808289c96a1bb45..518969a98f0545400a1983bc84acbf4cce0c272c 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -322,7 +322,7 @@ static CURLcode AllowServerConnect(struct connectdata *conn) curl_socklen_t size = (curl_socklen_t) sizeof(add); for(;;) { - timeout_ms = Curl_timeleft(conn, NULL, TRUE); + timeout_ms = Curl_timeleft(data, NULL, TRUE); if(timeout_ms < 0) { /* if a timeout was already reached, bail out */ diff --git a/lib/gtls.c b/lib/gtls.c index 845dbbb12fb92a58646db8b2799628268eb83ccd..804f7844657a62ddf80dfec01081ac01f0ea5c49 100644 --- a/lib/gtls.c +++ b/lib/gtls.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -238,7 +238,7 @@ static CURLcode handshake(struct connectdata *conn, for(;;) { /* check allowed time left */ - timeout_ms = Curl_timeleft(conn, NULL, duringconnect); + timeout_ms = Curl_timeleft(data, NULL, duringconnect); if(timeout_ms < 0) { /* no need to continue if time already is up */ diff --git a/lib/hostares.c b/lib/hostares.c index a86ba435b651940bead43304073d24c30e67f6d9..8b1dc06a71be2fa10b17507496cffdc5deddf718 100644 --- a/lib/hostares.c +++ b/lib/hostares.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -224,7 +224,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn, long timeout; struct timeval now = Curl_tvnow(); - timeout = Curl_timeleft(conn, &now, TRUE); + timeout = Curl_timeleft(data, &now, TRUE); if(!timeout) timeout = CURL_TIMEOUT_RESOLVE * 1000; /* default name resolve timeout */ diff --git a/lib/multi.c b/lib/multi.c index 2edd12e623461d5b96fc0d47f8c15f818d3f8797..ecd72bb3204c5fa40db4ab3b0d42705987620857 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -984,7 +984,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* we need to wait for the connect state as only then is the start time stored, but we must not check already completed handles */ - timeout_ms = Curl_timeleft(easy->easy_conn, &now, + timeout_ms = Curl_timeleft(data, &now, (easy->state <= CURLM_STATE_WAITDO)? TRUE:FALSE); diff --git a/lib/nss.c b/lib/nss.c index 7db2d8d766a60dca4c448f8c302b87f10a8f0b83..a5e11e2fcdae14c1b359957ddbb54635e26609a9 100644 --- a/lib/nss.c +++ b/lib/nss.c @@ -1361,7 +1361,7 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex) SSL_SetURL(connssl->handle, conn->host.name); /* check timeout situation */ - time_left = Curl_timeleft(conn, NULL, TRUE); + time_left = Curl_timeleft(data, NULL, TRUE); if(time_left < 0L) { failf(data, "timed out before SSL handshake"); goto error; diff --git a/lib/polarssl.c b/lib/polarssl.c index bed76354a48a08afe88084442a033199766ff3c0..272e1183e57ab202597180a8c2aa6172647404e6 100644 --- a/lib/polarssl.c +++ b/lib/polarssl.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2010, Hoi-Ho Chan, + * Copyright (C) 2010, 2011, Hoi-Ho Chan, * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -229,7 +229,7 @@ Curl_polarssl_connect(struct connectdata *conn, return CURLE_SSL_CONNECT_ERROR; } else { /* wait for data from server... */ - long timeout_ms = Curl_timeleft(conn, NULL, TRUE); + long timeout_ms = Curl_timeleft(data, NULL, TRUE); if(timeout_ms < 0) { failf(data, "SSL connection timeout"); diff --git a/lib/qssl.c b/lib/qssl.c index dd4f911d1b5606773241b1d4b210fd38e55706da..e56a651e5cc05183267d9dff5a2c89383d45eaf3 100644 --- a/lib/qssl.c +++ b/lib/qssl.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -175,7 +175,7 @@ static CURLcode Curl_qsossl_handshake(struct connectdata * conn, int sockindex) h->exitPgm = Curl_qsossl_trap_cert; /* figure out how long time we should wait at maximum */ - timeout_ms = Curl_timeleft(conn, NULL, TRUE); + timeout_ms = Curl_timeleft(data, NULL, TRUE); if(timeout_ms < 0) { /* time-out, bail out, go home */ diff --git a/lib/socks.c b/lib/socks.c index 7b5740be425f707b3e6bc6dba99fcde4c374259a..419d1d796ce3e8541efdc866f6b90328afc6c32c 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -137,7 +137,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name, struct SessionHandle *data = conn->data; /* get timeout */ - timeout = Curl_timeleft(conn, NULL, TRUE); + timeout = Curl_timeleft(data, NULL, TRUE); if(timeout < 0) { /* time-out, bail out, go home */ @@ -399,7 +399,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name, } /* get timeout */ - timeout = Curl_timeleft(conn, NULL, TRUE); + timeout = Curl_timeleft(data, NULL, TRUE); if(timeout < 0) { /* time-out, bail out, go home */ diff --git a/lib/socks_gssapi.c b/lib/socks_gssapi.c index 1ff6f6010952857f5fa34cb282c78d9bb66b8c6b..1decbafd4cb5a79db631ef86bc76726c1dc6213d 100644 --- a/lib/socks_gssapi.c +++ b/lib/socks_gssapi.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2009, Markus Moeller, + * Copyright (C) 2009, 2011, Markus Moeller, * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -139,7 +139,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, char *serviceptr = data->set.str[STRING_SOCKS5_GSSAPI_SERVICE]; /* get timeout */ - timeout = Curl_timeleft(conn, NULL, TRUE); + timeout = Curl_timeleft(data, NULL, TRUE); /* GSSAPI request looks like * +----+------+-----+----------------+ diff --git a/lib/socks_sspi.c b/lib/socks_sspi.c index e9fd551ccbfe476dca1fb416675d58c2eed6f18d..aaf20f5ceb4edd51afc49139fffb18c39351b8e4 100644 --- a/lib/socks_sspi.c +++ b/lib/socks_sspi.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2009, Markus Moeller, + * Copyright (C) 2009, 2011, Markus Moeller, * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -186,7 +186,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, char *service = data->set.str[STRING_SOCKS5_GSSAPI_SERVICE]; /* get timeout */ - timeout = Curl_timeleft(conn, NULL, TRUE); + timeout = Curl_timeleft(data, NULL, TRUE); /* GSSAPI request looks like * +----+------+-----+----------------+ diff --git a/lib/ssh.c b/lib/ssh.c index a0ca4c5218e81f3f8bfb029366dd75f68a5b45d9..73d0478a4b834d18340db904e806cf13f2f8b8b9 100644 --- a/lib/ssh.c +++ b/lib/ssh.c @@ -2457,7 +2457,7 @@ static CURLcode ssh_easy_statemach(struct connectdata *conn, if(Curl_pgrsUpdate(conn)) return CURLE_ABORTED_BY_CALLBACK; - left = Curl_timeleft(conn, NULL, duringconnect); + left = Curl_timeleft(data, NULL, duringconnect); if(left < 0) { failf(data, "Operation timed out\n"); return CURLE_OPERATION_TIMEDOUT; diff --git a/lib/ssluse.c b/lib/ssluse.c index bafc7460af91b8bfec42fab0ca5c0ad25c0f0367..2e434359750171d4e1fe0747a9f8429665744ccb 100644 --- a/lib/ssluse.c +++ b/lib/ssluse.c @@ -2394,7 +2394,7 @@ ossl_connect_common(struct connectdata *conn, if(ssl_connect_1==connssl->connecting_state) { /* Find out how much more time we're allowed */ - timeout_ms = Curl_timeleft(conn, NULL, TRUE); + timeout_ms = Curl_timeleft(data, NULL, TRUE); if(timeout_ms < 0) { /* no need to continue if time already is up */ @@ -2411,7 +2411,7 @@ ossl_connect_common(struct connectdata *conn, ssl_connect_2_writing == connssl->connecting_state) { /* check allowed time left */ - timeout_ms = Curl_timeleft(conn, NULL, TRUE); + timeout_ms = Curl_timeleft(data, NULL, TRUE); if(timeout_ms < 0) { /* no need to continue if time already is up */ diff --git a/lib/tftp.c b/lib/tftp.c index fc741c9412fab6fcfab5fc450c859127b6828c25..ef57fb19d5fd183adbf97833ceb2728c419f83c7 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -218,7 +218,7 @@ static CURLcode tftp_set_timeouts(tftp_state_data_t *state) time(&state->start_time); /* Compute drop-dead time */ - timeout_ms = Curl_timeleft(state->conn, NULL, start); + timeout_ms = Curl_timeleft(state->conn->data, NULL, start); if(timeout_ms < 0) { /* time-out, bail out, go home */ diff --git a/lib/transfer.c b/lib/transfer.c index 1c5815a0512555ce6829ca2846f1b22f0a9e8f62..e84b8b14cbdc4dfce29b26a75f1b86c9f118e929 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -1064,7 +1064,7 @@ CURLcode Curl_readwrite(struct connectdata *conn, return result; if(k->keepon) { - if(0 > Curl_timeleft(conn, &k->now, FALSE)) { + if(0 > Curl_timeleft(data, &k->now, FALSE)) { if(k->size != -1) { failf(data, "Operation timed out after %ld milliseconds with %" FORMAT_OFF_T " out of %" FORMAT_OFF_T " bytes received", @@ -1347,7 +1347,7 @@ Transfer(struct connectdata *conn) to work with, skip the timeout */ timeout_ms = 0; else { - totmp = Curl_timeleft(conn, &k->now, FALSE); + totmp = Curl_timeleft(data, &k->now, FALSE); if(totmp < 0) return CURLE_OPERATION_TIMEDOUT; else if(!totmp) diff --git a/lib/url.c b/lib/url.c index ed310b38b42d1e91421d9fe6113f863788ae072b..6741f18bbd900dd85361603425a5fd8e834e1ea0 100644 --- a/lib/url.c +++ b/lib/url.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -4515,7 +4515,7 @@ static CURLcode resolve_server(struct SessionHandle *data, bool *async) { CURLcode result=CURLE_OK; - long timeout_ms = Curl_timeleft(conn, NULL, TRUE); + long timeout_ms = Curl_timeleft(data, NULL, TRUE); /************************************************************* * Resolve the name of the server or proxy