Official eMule-Board: Wrap-around Data Block Request - Official eMule-Board

Jump to content


Page 1 of 1

Wrap-around Data Block Request

#1 User is offline   Aw3 

  • eMule Plus
  • PipPipPipPip
  • Group: Member_D
  • Posts: 104
  • Joined: 06-July 04

Posted 15 July 2006 - 06:04 PM

There's a chance of sending file block request where End < Start. This can happen at 4GB boundary when inclusive EndOffset = 0xFFFFFFFF, so the end boundary sent in packet will be 0.
Before eMules never did that, so I propose to keep the same by changing code marked with green into 0xFFFFFFFE.

Quote

void CUpDownClient::SendBlockRequests()
{
...
bool bI64Offsets = false;
POSITION pos = m_PendingBlocks_list.GetHeadPosition();
for (uint32 i = 0; i != 3; i++){
  if (pos){
  Pending_Block_Struct* pending = m_PendingBlocks_list.GetNext(pos);
  ASSERT( pending->block->StartOffset <= pending->block->EndOffset );
  if (pending->block->StartOffset > 0xFFFFFFFF || pending->block->EndOffset > 0xFFFFFFFF){
    bI64Offsets = true;
    if (!SupportsLargeFiles()){
    ASSERT( false );
    SendCancelTransfer();
    SetDownloadState(DS_ERROR);
    }
    break;
  }
  }
}
...
if (bI64Offsets){
...
}
else{
...
  pos = m_PendingBlocks_list.GetHeadPosition();
  for (uint32 i = 0; i != 3; i++){
  if (pos){
    Requested_Block_Struct* block = m_PendingBlocks_list.GetNext(pos)->block;
    uint64 endpos = block->EndOffset+1;
    data.WriteUInt32((uint32)endpos);
  }
  }
}

0

#2 User is offline   Some Support 

  • Last eMule
  • PipPipPipPipPipPipPip
  • Group: Yes
  • Posts: 3628
  • Joined: 27-June 03

Posted 15 July 2006 - 10:50 PM

True, even if extrem rare it could happen and would be a show stopper. Thanks for pointing out.

  • Member Options

Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users