[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 21/116: Curl_timeleft: change return type to timedi
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 21/116: Curl_timeleft: change return type to timediff_t |
Date: |
Tue, 05 Dec 2017 14:50:51 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 0d85eed3dfbbce18303900385d17f84d939cef00
Author: Daniel Stenberg <address@hidden>
AuthorDate: Thu Oct 26 15:24:50 2017 +0200
Curl_timeleft: change return type to timediff_t
returning 'time_t' is problematic when that type is unsigned and we
return values less than zero to signal "already expired", used in
several places in the code.
Closes #2021
---
lib/asyn-ares.c | 2 +-
lib/connect.c | 10 +++++-----
lib/connect.h | 7 ++++---
lib/ftp.c | 6 +++---
lib/multi.c | 2 +-
lib/socks.c | 4 ++--
lib/ssh.c | 2 +-
lib/tftp.c | 2 +-
lib/url.c | 2 +-
9 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c
index dd7dc4028..38ede999c 100644
--- a/lib/asyn-ares.c
+++ b/lib/asyn-ares.c
@@ -354,7 +354,7 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- long timeout;
+ timediff_t timeout;
struct curltime now = Curl_now();
struct Curl_dns_entry *temp_entry;
diff --git a/lib/connect.c b/lib/connect.c
index 5f545f230..787026942 100755
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -179,12 +179,12 @@ singleipconnect(struct connectdata *conn,
*
* @unittest: 1303
*/
-time_t Curl_timeleft(struct Curl_easy *data,
- struct curltime *nowp,
- bool duringconnect)
+timediff_t Curl_timeleft(struct Curl_easy *data,
+ struct curltime *nowp,
+ bool duringconnect)
{
int timeout_set = 0;
- time_t timeout_ms = duringconnect?DEFAULT_CONNECT_TIMEOUT:0;
+ timediff_t timeout_ms = duringconnect?DEFAULT_CONNECT_TIMEOUT:0;
struct curltime now;
/* if a timeout is set, use the most restrictive one */
@@ -1148,7 +1148,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /*
context */
struct curltime before = Curl_now();
CURLcode result = CURLE_COULDNT_CONNECT;
- time_t timeout_ms = Curl_timeleft(data, &before, TRUE);
+ timediff_t 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 3f05c3978..397448636 100644
--- a/lib/connect.h
+++ b/lib/connect.h
@@ -25,6 +25,7 @@
#include "nonblock.h" /* for curlx_nonblock(), formerly Curl_nonblock() */
#include "sockaddr.h"
+#include "timeval.h"
CURLcode Curl_is_connected(struct connectdata *conn,
int sockindex,
@@ -35,9 +36,9 @@ CURLcode Curl_connecthost(struct connectdata *conn,
/* generic function that returns how much time there's left to run, according
to the timeouts set */
-time_t Curl_timeleft(struct Curl_easy *data,
- struct curltime *nowp,
- bool duringconnect);
+timediff_t Curl_timeleft(struct Curl_easy *data,
+ struct curltime *nowp,
+ bool duringconnect);
#define DEFAULT_CONNECT_TIMEOUT 300000 /* milliseconds == five minutes */
#define HAPPY_EYEBALLS_TIMEOUT 200 /* milliseconds to wait between
diff --git a/lib/ftp.c b/lib/ftp.c
index 5c7df2b4c..8042edf48 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -333,10 +333,10 @@ static CURLcode AcceptServerConnect(struct connectdata
*conn)
* Curl_pgrsTime(..., TIMER_STARTACCEPT);
*
*/
-static time_t ftp_timeleft_accept(struct Curl_easy *data)
+static timediff_t ftp_timeleft_accept(struct Curl_easy *data)
{
- time_t timeout_ms = DEFAULT_ACCEPT_TIMEOUT;
- time_t other;
+ timediff_t timeout_ms = DEFAULT_ACCEPT_TIMEOUT;
+ timediff_t other;
struct curltime now;
if(data->set.accepttimeout > 0)
diff --git a/lib/multi.c b/lib/multi.c
index 658a18b15..262f192ca 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -1318,7 +1318,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
struct SingleRequest *k;
time_t timeout_ms;
time_t recv_timeout_ms;
- time_t send_timeout_ms;
+ timediff_t send_timeout_ms;
int control;
if(!GOOD_EASY_HANDLE(data))
diff --git a/lib/socks.c b/lib/socks.c
index e64cb98d4..ac4270eac 100644
--- a/lib/socks.c
+++ b/lib/socks.c
@@ -57,7 +57,7 @@ int Curl_blockread_all(struct connectdata *conn, /*
connection data */
ssize_t nread;
ssize_t allread = 0;
int result;
- time_t timeleft;
+ timediff_t timeleft;
*n = 0;
for(;;) {
timeleft = Curl_timeleft(conn->data, NULL, TRUE);
@@ -382,7 +382,7 @@ CURLcode Curl_SOCKS5(const char *proxy_user,
CURLcode code;
curl_socket_t sock = conn->sock[sockindex];
struct Curl_easy *data = conn->data;
- time_t timeout;
+ timediff_t timeout;
bool socks5_resolve_local =
(conn->socks_proxy.proxytype == CURLPROXY_SOCKS5) ? TRUE : FALSE;
const size_t hostname_len = strlen(hostname);
diff --git a/lib/ssh.c b/lib/ssh.c
index e225ed297..c4a369997 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -2833,7 +2833,7 @@ static CURLcode ssh_block_statemach(struct connectdata
*conn,
while((sshc->state != SSH_STOP) && !result) {
bool block;
- time_t left = 1000;
+ timediff_t left = 1000;
struct curltime now = Curl_now();
result = ssh_statemach_act(conn, &block);
diff --git a/lib/tftp.c b/lib/tftp.c
index a47c24162..20dc60040 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -200,7 +200,7 @@ const struct Curl_handler Curl_handler_tftp = {
static CURLcode tftp_set_timeouts(tftp_state_data_t *state)
{
time_t maxtime, timeout;
- time_t timeout_ms;
+ timediff_t timeout_ms;
bool start = (state->state == TFTP_STATE_START) ? TRUE : FALSE;
time(&state->start_time);
diff --git a/lib/url.c b/lib/url.c
index 03ee0855a..5a11e423b 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -6323,7 +6323,7 @@ static CURLcode resolve_server(struct Curl_easy *data,
bool *async)
{
CURLcode result = CURLE_OK;
- time_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
+ timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
/*************************************************************
* Resolve the name of the server or proxy
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 05/116: libtest: Add required test libraries for lib1552 and lib1553, (continued)
- [GNUnet-SVN] [gnurl] 05/116: libtest: Add required test libraries for lib1552 and lib1553, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 03/116: curl_mime_filedata.3: fix typos, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 04/116: libcurl-tutorial.3: fix typo, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 02/116: RELEASE-NOTES: clean slate towards 7.57.0, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 01/116: travis: exit if any steps fail, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 12/116: curl_fnmatch: return error on illegal wildcard pattern, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 10/116: multi: allow table handle sizes to be overridden, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 22/116: ROADMAP.md: spelling fixes, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 13/116: timeval: make timediff_t also work on 32bit windows, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 08/116: ftplistparser: follow-up cleanup to remove PL_ERROR(), gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 21/116: Curl_timeleft: change return type to timediff_t,
gnunet <=
- [GNUnet-SVN] [gnurl] 06/116: timediff: return timediff_t from the time diff functions, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 16/116: curl_setup.h: oops, shorten the too long line, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 18/116: resolvers: only include anything if needed, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 35/116: curlx: the timeval functions are no longer provided as curlx_*, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 17/116: HELP-US: rename the subtitle too since the label is changed, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 30/116: cli tool: in -F option arg, comma is a delimiter for files only, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 45/116: url: fix CURLOPT_DNS_CACHE_TIMEOUT arg value check to allow -1, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 15/116: curl_setup: Improve detection of CURL_WINDOWS_APP, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 42/116: CURLOPT_MAXREDIRS: allow -1 as a value, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 19/116: setopt: fix CURLOPT_SSH_AUTH_TYPES option read, gnunet, 2017/12/05