summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2012-09-14 09:50:17 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-14 13:58:30 +0200
commitfbe8f642b9d0e023ca66c815cf86644106f772ae (patch)
tree33841d00f47a827d47420bf9cab2f4a8b7c42a8c
parent813aa7c2ccff83725ddbc1074599af6f5875b576 (diff)
downloadbarebox-fbe8f642b9d0e023ca66c815cf86644106f772ae.tar.gz
barebox-fbe8f642b9d0e023ca66c815cf86644106f772ae.tar.xz
net: tftp: timeout only after a proper amount of time
Currently, the timeout when waiting for packages is smaller than the timeout communicated to the TFTP server for retransmitting. Make sure we wait at least for two retransmissions before giving up. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--net/tftp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/tftp.c b/net/tftp.c
index ca12638353..053b8f3cd3 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -354,7 +354,8 @@ static int do_tftpb(int argc, char *argv[])
tftp_retries++;
}
- if (tftp_retries > PKT_NUM_RETRIES) {
+ /* Wait for two TIMEOUT periods and add some */
+ if (tftp_retries > 2 * TIMEOUT + 1) {
tftp_err = -ETIMEDOUT;
break;
}