mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-11 02:25:34 -04:00
- corrected 1 bug in serialisation of CRC32Maps for peer transfer
- corrected 1 bug (missing hashing thread deletion on failure) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3321 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
38be555332
commit
1069ed0c58
3 changed files with 30 additions and 18 deletions
|
@ -499,20 +499,38 @@ bool ftFileCreator::crossCheckChunkMap(const CRC32Map& ref,uint32_t& bad_chunks,
|
|||
uint32_t len = 0 ;
|
||||
|
||||
for(uint32_t i=0;i<nb_chunks;++i)
|
||||
{
|
||||
printf(" Chunk %05d/%05d:",i,nb_chunks) ;
|
||||
if(map[i])
|
||||
{
|
||||
if(fseek(fd,(uint64_t)i * (uint64_t)chunk_size,SEEK_SET)==0 && (len = fread(buff,1,chunk_size,fd)) > 0)
|
||||
{
|
||||
if( RsDirUtil::rs_CRC32(buff,len) != ref[i])
|
||||
uint32_t crc = RsDirUtil::rs_CRC32(buff,len) ;
|
||||
|
||||
printf(" crc: %08x, ref: %08x : ",crc,ref[i]) ;
|
||||
|
||||
if(crc != ref[i])
|
||||
{
|
||||
printf(" CRC ERROR!!\n") ;
|
||||
++bad_chunks ;
|
||||
++incomplete_chunks ;
|
||||
map.reset(i) ;
|
||||
}
|
||||
else
|
||||
printf(" matched\n") ;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(" cannot fseek!\n") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(" incomplete.\n") ;
|
||||
++incomplete_chunks ;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] buff ;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue