All of lore.kernel.org
 help / color / mirror / Atom feed
From: rockly <rockly703@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net: tftp: Make sure timeout will not effect wrap offset
Date: Sat, 03 Aug 2013 18:09:05 +0800	[thread overview]
Message-ID: <51FCD6C1.4030908@gmail.com> (raw)

Hi:

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>

---

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 */

                 reply	other threads:[~2013-08-03 10:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51FCD6C1.4030908@gmail.com \
    --to=rockly703@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.