summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c')
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c
index fedf1cde46..6960e322a5 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c
@@ -154,6 +154,7 @@ Mtftp4RrqSaveBlock (
UINT16 Block;
UINT64 Start;
UINT32 DataLen;
+ UINT64 BlockCounter;
BOOLEAN Completed;
Completed = FALSE;
@@ -174,10 +175,10 @@ Mtftp4RrqSaveBlock (
// Remove this block number from the file hole. If Mtftp4RemoveBlockNum
// returns EFI_NOT_FOUND, the block has been saved, don't save it again.
// Note that : For bigger files, allowing the block counter to roll over
- // to accept transfers of unlimited size. So TotalBlock is memorised as
+ // to accept transfers of unlimited size. So BlockCounter is memorised as
// continuous block counter.
//
- Status = Mtftp4RemoveBlockNum (&Instance->Blocks, Block, Completed, &Instance->TotalBlock);
+ Status = Mtftp4RemoveBlockNum (&Instance->Blocks, Block, Completed, &BlockCounter);
if (Status == EFI_NOT_FOUND) {
return EFI_SUCCESS;
@@ -200,7 +201,7 @@ Mtftp4RrqSaveBlock (
}
if (Token->Buffer != NULL) {
- Start = MultU64x32 (Instance->TotalBlock - 1, Instance->BlkSize);
+ Start = MultU64x32 (BlockCounter - 1, Instance->BlkSize);
if (Start + DataLen <= Token->BufferSize) {
CopyMem ((UINT8 *) Token->Buffer + Start, Packet->Data.Data, DataLen);
@@ -271,9 +272,9 @@ Mtftp4RrqHandleData (
ASSERT (Expected >= 0);
//
- // If we are active and received an unexpected packet, transmit
+ // If we are active (Master) and received an unexpected packet, transmit
// the ACK for the block we received, then restart receiving the
- // expected one. If we are passive, save the block.
+ // expected one. If we are passive (Slave), save the block.
//
if (Instance->Master && (Expected != BlockNum)) {
//
@@ -289,6 +290,11 @@ Mtftp4RrqHandleData (
}
//
+ // Record the total received and saved block number.
+ //
+ Instance->TotalBlock ++;
+
+ //
// Reset the passive client's timer whenever it received a
// valid data packet.
//