[PATCH] net: tftpput: reset timeout_count when an ACK is received

Jerome Forissier jerome.forissier at linaro.org
Fri Nov 29 15:47:32 CET 2024


timeout_count is never reset once a tftpput transfer has started. If for
whatever reason timeouts occur frequently, but the server keeps replying
nonetheless, the transfer may be needlessly aborted.

Reset timer_count on reception of an ACK to avoid this situation.

Signed-off-by: Jerome Forissier <jerome.forissier at linaro.org>
---
 net/tftp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/tftp.c b/net/tftp.c
index 704b20b4ff8..8d54a83d9c2 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -478,6 +478,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	case TFTP_ACK:
 #ifdef CONFIG_CMD_TFTPPUT
 		if (tftp_put_active) {
+			timeout_count = 0;
 			if (tftp_put_final_block_sent) {
 				tftp_complete();
 			} else {
-- 
2.43.0



More information about the U-Boot mailing list