small bug fixes about CRC32 verification when the file is actually complete.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4662 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-11-04 21:29:51 +00:00
parent d43a131c04
commit fa690de1d6
3 changed files with 6 additions and 4 deletions

View File

@ -352,7 +352,7 @@ void ChunkMap::setPeerAvailabilityMap(const std::string& peer_id,const Compresse
uint32_t ChunkMap::sizeOfChunk(uint32_t cid) const uint32_t ChunkMap::sizeOfChunk(uint32_t cid) const
{ {
if(cid == _map.size()-1) if(cid == _map.size()-1)
return _file_size - (_map.size()-1)*_chunk_size ; return _file_size - cid*_chunk_size ;
else else
return _chunk_size ; return _chunk_size ;
} }

View File

@ -653,8 +653,7 @@ bool ftFileCreator::crossCheckChunkMap(const CRC32Map& ref,uint32_t& bad_chunks,
delete[] buff ; delete[] buff ;
if(bad_chunks > 0) chunkMap.setAvailabilityMap(map) ;
chunkMap.setAvailabilityMap(map) ;
} }
closeFile() ; closeFile() ;
return true ; return true ;

View File

@ -744,7 +744,10 @@ bool ftTransferModule::checkCRC()
} }
else else
{ {
mFlag = FT_TM_FLAG_COMPLETE ; // We do as if the file is not complete. This way, it finishes properly.
//
mFlag = FT_TM_FLAG_DOWNLOADING ;
mFileStatus.stat = ftFileStatus::PQIFILE_DOWNLOADING;
#ifdef FT_DEBUG #ifdef FT_DEBUG
std::cerr << "ftTransferModule::checkCRC(): Done. CRC check is ok, file is complete." << std::endl ; std::cerr << "ftTransferModule::checkCRC(): Done. CRC check is ok, file is complete." << std::endl ;
#endif #endif