mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-20 23:10:39 -04:00
* Added lots of debugging.
* Partial bug fix for allocate algorithms. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@706 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7b7446c5b5
commit
f243e5f6d3
4 changed files with 125 additions and 15 deletions
|
@ -32,7 +32,7 @@ const uint32_t PQIPEER_DOWNLOAD_TOO_FAST = 8; /* 8 secs */
|
|||
const uint32_t PQIPEER_DOWNLOAD_TOO_SLOW = 12; /* 12 secs */
|
||||
const uint32_t PQIPEER_DOWNLOAD_MIN_DELTA = 5; /* 5 secs */
|
||||
|
||||
const uint32_t TRANSFER_START_MIN = 500; /* 500 byte min limit */
|
||||
const uint32_t TRANSFER_START_MIN = 10000; /* 10000 byte min limit */
|
||||
const uint32_t TRANSFER_START_MAX = 10000; /* 10000 byte max limit */
|
||||
|
||||
ftTransferModule::ftTransferModule(ftFileCreator *fc, ftDataMultiplex *dm)
|
||||
|
@ -73,16 +73,24 @@ bool ftTransferModule::setPeerState(std::string peerId,uint32_t state,uint32_t m
|
|||
it++;
|
||||
}
|
||||
|
||||
if (!found) mFileSources.push_back(*it);
|
||||
if (!found) mFileSources.push_back(peerId);
|
||||
|
||||
std::map<std::string,peerInfo>::iterator mit;
|
||||
mit = mOnlinePeers.find(peerId);
|
||||
if (mit == mOnlinePeers.end())
|
||||
{
|
||||
peerInfo pInfo;
|
||||
pInfo.state = state;
|
||||
pInfo.desiredRate = maxRate;
|
||||
mOnlinePeers[peerId] = pInfo;
|
||||
mit = mOnlinePeers.find(peerId);
|
||||
if (mit == mOnlinePeers.end())
|
||||
{
|
||||
peerInfo pInfo;
|
||||
/* Initialise it properly */
|
||||
pInfo.peerId = peerId;
|
||||
pInfo.state = state;
|
||||
pInfo.offset = 0;
|
||||
pInfo.chunkSize = TRANSFER_START_MIN;
|
||||
pInfo.receivedSize = 0;
|
||||
pInfo.lastTS = 0;
|
||||
pInfo.actualRate = 0;
|
||||
pInfo.desiredRate = maxRate;
|
||||
mOnlinePeers[peerId] = pInfo;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -143,11 +151,18 @@ void ftTransferModule::requestData(std::string peerId, uint64_t offset, uint32_t
|
|||
bool ftTransferModule::getChunk(uint64_t &offset, uint32_t &chunk_size)
|
||||
{
|
||||
std::cerr << "ftTransferModule::getChunk()";
|
||||
std::cerr << " offset: " << offset;
|
||||
std::cerr << " Request: offset: " << offset;
|
||||
std::cerr << " chunk_size: " << chunk_size;
|
||||
std::cerr << std::endl;
|
||||
|
||||
return mFileCreator->getMissingChunk(offset, chunk_size);
|
||||
bool val = mFileCreator->getMissingChunk(offset, chunk_size);
|
||||
|
||||
std::cerr << "ftTransferModule::getChunk()";
|
||||
std::cerr << " Answer: offset: " << offset;
|
||||
std::cerr << " chunk_size: " << chunk_size;
|
||||
std::cerr << std::endl;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
bool ftTransferModule::storeData(uint64_t offset, uint32_t chunk_size,void *data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue