mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 16:15:23 -04:00
Enabled full chunk checking code:
- unchecked chunks are not made available to swarming sources, not saved as done. - force check now uses the simple method to put all chunks in checking mode - force checked files can be cancelled (finally!) - improved display (use red for active chunks, yellow for checking) - cache file are not using chunk checking (assume_availability=true) The code still contains the #ifdef. It should be removed soon if everything works ok. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5235 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c26c1f2163
commit
36198b7e6a
6 changed files with 59 additions and 14 deletions
|
@ -27,6 +27,8 @@
|
|||
* #define DEBUG_FTCHUNK 1
|
||||
*********/
|
||||
|
||||
#define USE_NEW_CHUNK_CHECKING_CODE
|
||||
|
||||
#ifdef DEBUG_FTCHUNK
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
@ -152,7 +154,14 @@ void ChunkMap::dataReceived(const ftChunk::ChunkId& cid)
|
|||
std::cerr << "*** ChunkMap::dataReceived: Chunk is complete. Removing it." << std::endl ;
|
||||
#endif
|
||||
|
||||
_map[n] = FileChunksInfo::CHUNK_CHECKING ;
|
||||
#ifdef USE_NEW_CHUNK_CHECKING_CODE
|
||||
// In this case (cache files, mainly) we rely on the final hash-checking only.
|
||||
//
|
||||
if(_assume_availability)
|
||||
_map[n] = FileChunksInfo::CHUNK_DONE ;
|
||||
else
|
||||
#endif
|
||||
_map[n] = FileChunksInfo::CHUNK_CHECKING ;
|
||||
|
||||
if(n > 0 || _file_size > CHUNKMAP_FIXED_CHUNK_SIZE) // dont' put <1MB files into checking mode. This is useless.
|
||||
_chunks_checking_queue.push_back(n) ;
|
||||
|
@ -616,6 +625,13 @@ void ChunkMap::getAvailabilityMap(CompressedChunkMap& compressed_map) const
|
|||
|
||||
void ChunkMap::forceCheck()
|
||||
{
|
||||
#ifdef USE_NEW_CHUNK_CHECKING_CODE
|
||||
// In this case (cache files, mainly) we rely on the final hash-checking only.
|
||||
//
|
||||
if(_assume_availability)
|
||||
return ;
|
||||
#endif
|
||||
|
||||
for(uint32_t i=0;i<_map.size();++i)
|
||||
{
|
||||
_map[i] = FileChunksInfo::CHUNK_CHECKING ;
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
* #define FT_DEBUG 1
|
||||
*****/
|
||||
|
||||
#define USE_NEW_CHUNK_CHECKING_CODE
|
||||
|
||||
#include "retroshare/rsturtle.h"
|
||||
#include "fttransfermodule.h"
|
||||
|
||||
|
@ -636,6 +638,8 @@ void ftTransferModule::forceCheck()
|
|||
_crcmap_last_asked_time = 0 ;
|
||||
#else
|
||||
mFileCreator->forceCheck() ;
|
||||
mFlag = FT_TM_FLAG_DOWNLOADING ; // Ask for CRC map.
|
||||
mFileStatus.stat = ftFileStatus::PQIFILE_DOWNLOADING;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -777,7 +781,8 @@ bool ftTransferModule::checkCRC()
|
|||
{
|
||||
// We do as if the file is not complete. This way, it finishes properly.
|
||||
//
|
||||
mFlag = FT_TM_FLAG_COMPLETE ; // Transfer is complete.
|
||||
//mFlag = FT_TM_FLAG_COMPLETE ; // Transfer is complete.
|
||||
mFlag = FT_TM_FLAG_DOWNLOADING ;
|
||||
mFileStatus.stat = ftFileStatus::PQIFILE_DOWNLOADING;
|
||||
#ifdef FT_DEBUG
|
||||
std::cerr << "ftTransferModule::checkCRC(): Done. CRC check is ok, file is complete." << std::endl ;
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <string>
|
||||
#include <stdint.h>
|
||||
|
||||
#define USE_NEW_CHUNK_CHECKING_CODE
|
||||
|
||||
typedef std::string RsCertId;
|
||||
typedef std::string RsChanId;
|
||||
typedef std::string RsMsgId;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue