1
0
mirror of https://github.com/moparisthebest/curl synced 2025-02-28 09:21:50 -05:00

Grant Erickson fixed timeouts for TFTP

This commit is contained in:
Daniel Stenberg 2009-01-13 23:24:06 +00:00
parent a19e02be5e
commit 1225d36188
4 changed files with 44 additions and 7 deletions

38
CHANGES
View File

@ -6,6 +6,44 @@
Changelog
Daniel Stenberg (14 Jan 2009)
- Grant Erickson fixed timeouts for TFTP such that specifying a
connect-timeout, a max-time or both options work correctly and as expected
by passing the correct boolean value to Curl_timeleft via the
'duringconnect' parameter.
With this small change, curl TFTP now behaves as expected (and likely as
originally-designed):
1) For non-existent or unreachable dotted IP addresses:
a) With no options, follows the default curl 300s timeout...
b) With --connect-timeout only, follows that value...
c) With --max-time only, follows that value...
d) With both --connect-timeout and --max-time, follows the smaller value...
and times out with a "curl: (7) Couldn't connect to server" error.
2) For transfers to/from a valid host:
a) With no options, follows default curl 300s timeout for the
first XRQ/DATA/ACK transaction and the default TFTP 3600s
timeout for the remainder of the transfer...
b) With --connect-time only, follows that value for the
first XRQ/DATA/ACK transaction and the default TFTP 3600s
timeout for the remainder of the transfer...
c) With --max-time only, follows that value for the first
XRQ/DATA/ACK transaction and for the remainder of the
transfer...
d) With both --connect-timeout and --max-time, follows the former
for the first XRQ/DATA/ACK transaction and the latter for the
remainder of the transfer...
and times out with a "curl: (28) Timeout was reached" error as
appropriate.
Daniel Stenberg (13 Jan 2009)
- Michael Wallner fixed a NULL pointer deref when calling

View File

@ -47,6 +47,7 @@ This release includes the following bugfixes:
o the configure script can now detect gnutls with pkg-config
o curlbuild.h was adjusted for SunPro compilers
o CURLOPT_COOKIELIST set to "SESS" on an easy handle with no cookies data
o fixed timeouts for TFTP
This release includes the following known bugs:
@ -59,6 +60,7 @@ advice from friends like these:
Markus Koetter, Josef Wolf, Vlad Grachov, Pawel Kierski, Igor Novoseltsev,
Fred Machado, Ken Hirsch, Keshav Krity, Patrick Monnerat, Mark Karpeles,
Anthony Bryan, Peter Korsgaard, Phil Lisiecki, Bas Mevissen, Rob Crittenden,
Emil Romanus, Karl Moerder, Daniel Black, Stefan Teleman, Michael Wallner
Emil Romanus, Karl Moerder, Daniel Black, Stefan Teleman, Michael Wallner,
Grant Erickson
Thanks! (and sorry if I forgot to mention someone)

View File

@ -1,12 +1,8 @@
To be addressed in 7.19.3 (planned release: January 2009)
=========================
210 - [PATCH] TFTP: Fix Connect and Transfer Timeout Behavior
211 - Building and using static libcurl on Windows with VS2008
212 - Updated libcurl VS2008 Guide
213 - bug #2501457 "Timeouts not working with curl_multi_socket_action()" -
most probably subject for addition to docs/KNOWN_BUGS

View File

@ -195,11 +195,12 @@ static CURLcode tftp_set_timeouts(tftp_state_data_t *state)
{
time_t maxtime, timeout;
long timeout_ms;
const bool start = (state->state == TFTP_STATE_START);
time(&state->start_time);
/* Compute drop-dead time */
timeout_ms = Curl_timeleft(state->conn, NULL, TRUE);
timeout_ms = Curl_timeleft(state->conn, NULL, start);
if(timeout_ms < 0) {
/* time-out, bail out, go home */
@ -207,7 +208,7 @@ static CURLcode tftp_set_timeouts(tftp_state_data_t *state)
return CURLE_OPERATION_TIMEDOUT;
}
if(state->state == TFTP_STATE_START) {
if(start) {
maxtime = (time_t)(timeout_ms + 500) / 1000;
state->max_time = state->start_time+maxtime;