mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-11 02:25:34 -04:00
corrected a bug in chunkmaps that affected file creators being providers at the same time, which could corrupt data. Added some debug info to chunk maps.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3673 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
eb21343685
commit
8369d42600
6 changed files with 114 additions and 12 deletions
|
@ -42,12 +42,21 @@ bool ftFileCreator::getFileData(const std::string& peer_id,uint64_t offset, uint
|
|||
{
|
||||
// Only send the data if we actually have it.
|
||||
//
|
||||
#ifdef FILE_DEBUG
|
||||
std::cerr << "ftFileCreator::getFileData(). Asked for offset=" << offset << ", size=" << chunk_size << std::endl ;
|
||||
#endif
|
||||
bool have_it = false ;
|
||||
{
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
|
||||
have_it = chunkMap.isChunkAvailable(offset, chunk_size) ;
|
||||
}
|
||||
#ifdef FILE_DEBUG
|
||||
if(have_it)
|
||||
std::cerr << "ftFileCreator::getFileData(). Have it" << std::endl ;
|
||||
else
|
||||
std::cerr << "ftFileCreator::getFileData(). Don't have it" << std::endl ;
|
||||
#endif
|
||||
|
||||
if(have_it)
|
||||
return ftFileProvider::getFileData(peer_id,offset, chunk_size, data);
|
||||
|
@ -433,6 +442,13 @@ void ftFileCreator::setAvailabilityMap(const CompressedChunkMap& cmap)
|
|||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
|
||||
chunkMap.setAvailabilityMap(cmap) ;
|
||||
#ifdef FILE_DEBUG
|
||||
std::cerr << "ftFileCreator: setting chunkmap for hash " << hash << ": " ;
|
||||
|
||||
for(uint32_t i=0;i<cmap._map.size();++i)
|
||||
std::cerr << (void*)cmap._map[i] ;
|
||||
std::cerr << std::endl ;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ftFileCreator::getAvailabilityMap(CompressedChunkMap& map)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue