mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 07:59:35 -05:00
fixed bug responsible for sending wrong checksums on windows systems
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5029 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b68e660a1c
commit
456177ef11
@ -489,12 +489,12 @@ bool ftDataMultiplex::doWork()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ftDataMultiplex::recvSingleChunkCrc(const std::string& /*peerId*/, const std::string& hash,uint32_t chunk_number,const Sha1CheckSum& crc)
|
bool ftDataMultiplex::recvSingleChunkCrc(const std::string& peerId, const std::string& hash,uint32_t chunk_number,const Sha1CheckSum& crc)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
|
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
|
||||||
|
|
||||||
//#ifdef MPLEX_DEBUG
|
//#ifdef MPLEX_DEBUG
|
||||||
std::cerr << "ftDataMultiplex::recvSingleChunkCrc() Received crc of file " << hash << ", chunk " << chunk_number << ", crc=" << crc.toStdString() << std::endl;
|
std::cerr << "ftDataMultiplex::recvSingleChunkCrc() Received crc of file " << hash << ", from peer id " << peerId << ", chunk " << chunk_number << ", crc=" << crc.toStdString() << std::endl;
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
std::map<std::string, ftClient>::iterator it = mClients.find(hash);
|
std::map<std::string, ftClient>::iterator it = mClients.find(hash);
|
||||||
@ -757,7 +757,7 @@ bool ftDataMultiplex::computeAndSendCRC32Map(const std::string& peerId, const st
|
|||||||
|
|
||||||
std::cerr << "Computing CRC32Map for file " << filename << ", hash=" << hash << ", size=" << filesize << std::endl;
|
std::cerr << "Computing CRC32Map for file " << filename << ", hash=" << hash << ", size=" << filesize << std::endl;
|
||||||
|
|
||||||
FILE *fd = fopen(filename.c_str(),"r") ;
|
FILE *fd = RsDirUtil::rs_fopen(filename.c_str(),"rb") ;
|
||||||
|
|
||||||
if(fd == NULL)
|
if(fd == NULL)
|
||||||
{
|
{
|
||||||
@ -899,7 +899,7 @@ bool ftDataMultiplex::handleRecvChunkCrcRequest(const std::string& peerId, const
|
|||||||
std::cerr << "Computing Sha1 for chunk " << chunk_number<< " of file " << filename << ", hash=" << hash << ", size=" << filesize << std::endl;
|
std::cerr << "Computing Sha1 for chunk " << chunk_number<< " of file " << filename << ", hash=" << hash << ", size=" << filesize << std::endl;
|
||||||
|
|
||||||
unsigned char *buf = new unsigned char[ChunkMap::CHUNKMAP_FIXED_CHUNK_SIZE] ;
|
unsigned char *buf = new unsigned char[ChunkMap::CHUNKMAP_FIXED_CHUNK_SIZE] ;
|
||||||
FILE *fd = fopen(filename.c_str(),"r") ;
|
FILE *fd = RsDirUtil::rs_fopen(filename.c_str(),"rb") ;
|
||||||
|
|
||||||
if(fd == NULL)
|
if(fd == NULL)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ int main(int argc,char *argv[])
|
|||||||
return -1 ;
|
return -1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *f = fopen(argv[1],"r") ;
|
FILE *f = RsDirUtil::rs_fopen(argv[1],"r") ;
|
||||||
|
|
||||||
if(f == NULL)
|
if(f == NULL)
|
||||||
{
|
{
|
||||||
@ -75,6 +75,19 @@ int main(int argc,char *argv[])
|
|||||||
Sha1CheckSum H(hash) ;
|
Sha1CheckSum H(hash) ;
|
||||||
std::cerr << "Hashed transformed: " << H.toStdString() << std::endl;
|
std::cerr << "Hashed transformed: " << H.toStdString() << std::endl;
|
||||||
|
|
||||||
|
std::cerr << "Computing all chunk hashes:" << std::endl;
|
||||||
|
|
||||||
|
fseek(f,0,SEEK_SET) ;
|
||||||
|
int n=0 ;
|
||||||
|
|
||||||
|
while(len = fread(buf,1,SIZE,f))
|
||||||
|
{
|
||||||
|
Sha1CheckSum sum = RsDirUtil::sha1sum(buf,len) ;
|
||||||
|
std::cerr << "Chunk " << n << ": " << sum.toStdString() << std::endl;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f) ;
|
||||||
return 0 ;
|
return 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user