added some safety checks to setting chunk strategy against inconsistent values.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3236 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-06-29 20:51:16 +00:00
parent f7ff141a37
commit c8fc75c75c
3 changed files with 19 additions and 3 deletions

View file

@ -919,6 +919,9 @@ bool ftController::handleAPendingRequest()
req = mPendingRequests.front();
mPendingRequests.pop_front();
}
#ifdef CONTROL_DEBUG
std::cerr << "Requesting pending hash " << req.mHash << std::endl ;
#endif
FileRequest(req.mName, req.mHash, req.mSize, req.mDest, req.mFlags, req.mSrcIds);
@ -942,6 +945,10 @@ bool ftController::handleAPendingRequest()
}
else
{
#ifdef CONTROL_DEBUG
std::cerr << "Hash " << req.mHash << " is in downloads" << std::endl ;
std::cerr << " setting chunk strategy to " << rsft->chunk_strategy << std::endl;
#endif
(fit->second)->mCreator->setAvailabilityMap(rsft->compressed_chunk_map) ;
(fit->second)->mCreator->setChunkStrategy((FileChunksInfo::ChunkStrategy)(rsft->chunk_strategy)) ;
}
@ -949,6 +956,10 @@ bool ftController::handleAPendingRequest()
delete rsft ;
mPendingChunkMaps.erase(it) ;
}
#ifdef CONTROL_DEBUG
else
std::cerr << "No pending chunkmap for hash " << req.mHash << std::endl ;
#endif
}
return true ;