From 842f73de58f38bd6e285e08bbd1adb6c17cb62cd Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 29 May 2020 00:08:03 +0200 Subject: 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 --- lib/vtls/schannel.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lib/vtls/schannel.c') diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index a23179eca..1434d9fba 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -1514,7 +1514,7 @@ schannel_connect_common(struct connectdata *conn, int sockindex, connssl->connecting_state ? sockfd : CURL_SOCKET_BAD; what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd, - nonblocking ? 0 : (time_t)timeout_ms); + nonblocking ? 0 : timeout_ms); if(what < 0) { /* fatal error */ failf(data, "select/poll on SSL/TLS socket, errno: %d", SOCKERRNO); @@ -1663,13 +1663,9 @@ schannel_send(struct connectdata *conn, int sockindex, /* send entire message or fail */ while(len > (size_t)written) { - ssize_t this_write; - timediff_t timeout_ms; + ssize_t this_write = 0; int what; - - this_write = 0; - - timeout_ms = Curl_timeleft(conn->data, NULL, FALSE); + timediff_t timeout_ms = Curl_timeleft(conn->data, NULL, FALSE); if(timeout_ms < 0) { /* we already got the timeout */ failf(conn->data, "schannel: timed out sending data " @@ -1678,7 +1674,7 @@ schannel_send(struct connectdata *conn, int sockindex, written = -1; break; } - if(!timeout_ms) + else if(!timeout_ms) timeout_ms = TIMEDIFF_T_MAX; what = SOCKET_WRITABLE(conn->sock[sockindex], timeout_ms); if(what < 0) { -- cgit v1.2.3