patched fttransfermodule to always fulfill the data suze request, even if the file creator returns small (old pending) chunks, or stops at a chunk boundary. This should improve data flow and hep achievign hight speeds on fast internet connexions

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5505 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-09-02 20:41:25 +00:00
parent 67ea23ae0e
commit 1a8c9d9416

View File

@ -999,9 +999,12 @@ bool ftTransferModule::locked_tickPeerTransfer(peerInfo &info)
uint64_t req_offset = 0;
uint32_t req_size =0 ;
if (locked_getChunk(info.peerId,next_req,req_offset,req_size))
{
if (req_size > 0)
// Loop over multiple calls to the file creator: for some reasons the file creator might not be able to
// give a plain chunk of the requested size (size hint larger than the fixed chunk size, priority given to
// an old pending chunk, etc).
//
while(next_req > 0 && locked_getChunk(info.peerId,next_req,req_offset,req_size))
if(req_size > 0)
{
info.state = PQIPEER_DOWNLOADING;
locked_requestData(info.peerId,req_offset,req_size);
@ -1013,13 +1016,14 @@ bool ftTransferModule::locked_tickPeerTransfer(peerInfo &info)
info.rttActive = true;
info.rttOffset = req_offset + req_size;
}
next_req -= std::min(req_size,next_req) ;
}
else
{
std::cerr << "transfermodule::Waiting for available data";
std::cerr << std::endl;
break ;
}
}
return true;
}