mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: tftp: timeout only after a proper amount of time
@ 2012-09-14  7:50 Wolfram Sang
  0 siblings, 0 replies; only message in thread
From: Wolfram Sang @ 2012-09-14  7:50 UTC (permalink / raw)
  To: barebox; +Cc: Wolfram Sang

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>
---
 net/tftp.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/tftp.c b/net/tftp.c
index ca12638..053b8f3 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;
 		}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-14  7:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-14  7:50 [PATCH] net: tftp: timeout only after a proper amount of time Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox