From adb49ad8bb280b586b387ba930c0681afee03923 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 4 Jan 2011 23:07:58 +0100 Subject: Curl_timeleft: s/conn/data in first argument As the function doesn't really use the connectdata struct but only the SessionHanadle struct I modified what argument it wants. --- lib/connect.c | 12 +++++++----- lib/connect.h | 4 ++-- lib/ftp.c | 4 ++-- lib/gtls.c | 4 ++-- lib/hostares.c | 4 ++-- lib/multi.c | 4 ++-- lib/nss.c | 2 +- lib/polarssl.c | 4 ++-- lib/qssl.c | 4 ++-- lib/socks.c | 6 +++--- lib/socks_gssapi.c | 4 ++-- lib/socks_sspi.c | 4 ++-- lib/ssh.c | 2 +- lib/ssluse.c | 4 ++-- lib/tftp.c | 4 ++-- lib/transfer.c | 6 +++--- lib/url.c | 4 ++-- 17 files changed, 39 insertions(+), 37 deletions(-) (limited to 'lib') diff --git a/lib/connect.c b/lib/connect.c index be87ed91c..604bb2a1a 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 6cc403d9f..0720085c2 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 8e370c5d2..518969a98 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 845dbbb12..804f78446 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 a86ba435b..8b1dc06a7 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 2edd12e62..ecd72bb32 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 7db2d8d76..a5e11e2fc 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 bed76354a..272e1183e 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 dd4f911d1..e56a651e5 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 7b5740be4..419d1d796 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 1ff6f6010..1decbafd4 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 e9fd551cc..aaf20f5ce 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 a0ca4c521..73d0478a4 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 bafc7460a..2e4343597 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 fc741c941..ef57fb19d 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 1c5815a05..e84b8b14c 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 ed310b38b..6741f18bb 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 -- cgit v1.2.3