timeouts: change millisecond timeouts to timediff_t from time_t

For millisecond timers we like timediff_t better. Also, time_t can be
unsigned so returning a negative value doesn't work then.

Closes #5479
This commit is contained in:
Daniel Stenberg 2020-05-29 00:08:03 +02:00
parent fc55c723c4
commit 842f73de58
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
15 changed files with 45 additions and 54 deletions

View file

@ -633,8 +633,8 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
while(!*ftpcode && !result) {
/* check and reset timeout value every lap */
time_t timeout = Curl_pp_state_timeout(pp, FALSE);
time_t interval_ms;
timediff_t timeout = Curl_pp_state_timeout(pp, FALSE);
timediff_t interval_ms;
if(timeout <= 0) {
failf(data, "FTP response timeout");
@ -3252,7 +3252,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
* data has been transferred. This happens when doing through NATs etc that
* abandon old silent connections.
*/
long old_time = pp->response_time;
timediff_t old_time = pp->response_time;
pp->response_time = 60*1000; /* give it only a minute for now */
pp->response = Curl_now(); /* timeout relative now */