summaryrefslogtreecommitdiff
path: root/net/tftp.c
diff options
context:
space:
mode:
authorrockly <rockly703@gmail.com>2013-08-03 18:09:05 +0800
committerJoe Hershberger <joe.hershberger@ni.com>2013-11-22 14:39:31 -0600
commitf754f5dc6fe4b6cfbd28a9a6d9d08059d9312101 (patch)
tree13a44100a337a2bafab5cb916d24227dab7dfdf5 /net/tftp.c
parentc2e5e802ecb7ab668ce9911b210ed68c804b349f (diff)
downloadu-boot-imx-f754f5dc6fe4b6cfbd28a9a6d9d08059d9312101.zip
u-boot-imx-f754f5dc6fe4b6cfbd28a9a6d9d08059d9312101.tar.gz
u-boot-imx-f754f5dc6fe4b6cfbd28a9a6d9d08059d9312101.tar.bz2
net: tftp: Make sure timeout will not effect wrap offset
When the block 0 store to the memory of client and timeout at this moment. Because of no ACK packet, the server will send block 0 again, if this client reconnect to the server at this time, TftpBlockWrapOffset will become larger than it should be. Signed-off-by: Rockly <rocklygnome@gmail.com> Patch: 264417
Diffstat (limited to 'net/tftp.c')
-rw-r--r--net/tftp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/tftp.c b/net/tftp.c
index 6d333d5..2e06808 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -281,7 +281,7 @@ static void update_block_number(void)
* number of 0 this means that there was a wrap
* around of the (16 bit) counter.
*/
- if (TftpBlock == 0) {
+ if (TftpBlock == 0 && TftpLastBlock != 0) {
TftpBlockWrap++;
TftpBlockWrapOffset += TftpBlkSize * TFTP_SEQUENCE_SIZE;
TftpTimeoutCount = 0; /* we've done well, reset thhe timeout */