mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -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
@ -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;
|
||||
|
@ -649,9 +649,14 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo, const std::map<s
|
||||
pinfo.progress = (fileInfo.size == 0) ? 0 : (completed * 100.0 / fileInfo.size);
|
||||
pinfo.nb_chunks = pinfo.cmap._map.empty() ? 0 : fcinfo.chunks.size();
|
||||
|
||||
for (uint32_t i = 0; i < fcinfo.active_chunks.size(); ++i) {
|
||||
pinfo.chunks_in_progress.push_back(fcinfo.active_chunks[i].first);
|
||||
}
|
||||
for (uint32_t i = 0; i < fcinfo.chunks.size(); ++i)
|
||||
switch(fcinfo.chunks[i])
|
||||
{
|
||||
case FileChunksInfo::CHUNK_CHECKING: pinfo.chunks_in_checking.push_back(i);
|
||||
break ;
|
||||
case FileChunksInfo::CHUNK_ACTIVE: pinfo.chunks_in_progress.push_back(i);
|
||||
break ;
|
||||
}
|
||||
|
||||
QString tooltip;
|
||||
|
||||
|
@ -225,16 +225,32 @@ void xProgressBar::paint()
|
||||
i += j ;
|
||||
}
|
||||
|
||||
QColor gradColor_a1, gradColor_a2 ;
|
||||
gradColor_a1.setRgb(223, 134, 6);
|
||||
gradColor_a2.setRgb(248, 170, 59);
|
||||
linearGrad.setColorAt(0.00, gradColor_a1);
|
||||
linearGrad.setColorAt(0.16, gradColor_a2);
|
||||
linearGrad.setColorAt(1.00, gradColor_a1);
|
||||
painter->setBrush(linearGrad);
|
||||
{
|
||||
QColor gradColor_a1, gradColor_a2 ;
|
||||
gradColor_a1.setRgb(170, 20, 9);
|
||||
gradColor_a2.setRgb(223, 121,123);
|
||||
linearGrad.setColorAt(0.00, gradColor_a1);
|
||||
linearGrad.setColorAt(0.16, gradColor_a2);
|
||||
linearGrad.setColorAt(1.00, gradColor_a1);
|
||||
painter->setBrush(linearGrad);
|
||||
|
||||
for(uint32_t i=0;i<_pinfo.chunks_in_progress.size();++i)
|
||||
painter->drawRect(rect.x() + hSpan+(int)rint(_pinfo.chunks_in_progress[i]*width/(float)ss), rect.y() + vSpan, (int)ceil(1.0f*width/(float)ss), rect.height() - 1 - vSpan * 2);
|
||||
for(uint32_t i=0;i<_pinfo.chunks_in_progress.size();++i)
|
||||
painter->drawRect(rect.x() + hSpan+(int)rint(_pinfo.chunks_in_progress[i]*width/(float)ss), rect.y() + vSpan, (int)ceil(1.0f*width/(float)ss), rect.height() - 1 - vSpan * 2);
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
QColor gradColor_a1, gradColor_a2 ;
|
||||
gradColor_a1.setRgb(186, 143, 0);
|
||||
gradColor_a2.setRgb(223, 196, 61);
|
||||
linearGrad.setColorAt(0.00, gradColor_a1);
|
||||
linearGrad.setColorAt(0.16, gradColor_a2);
|
||||
linearGrad.setColorAt(1.00, gradColor_a1);
|
||||
painter->setBrush(linearGrad);
|
||||
|
||||
for(uint32_t i=0;i<_pinfo.chunks_in_checking.size();++i)
|
||||
painter->drawRect(rect.x() + hSpan+(int)rint(_pinfo.chunks_in_checking[i]*width/(float)ss), rect.y() + vSpan, (int)ceil(1.0f*width/(float)ss), rect.height() - 1 - vSpan * 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -47,6 +47,7 @@ class FileProgressInfo
|
||||
uint32_t nb_chunks ;
|
||||
|
||||
std::vector<uint32_t> chunks_in_progress ;
|
||||
std::vector<uint32_t> chunks_in_checking ;
|
||||
|
||||
bool operator<(const FileProgressInfo &other) const;
|
||||
bool operator>(const FileProgressInfo &other) const;
|
||||
|
Loading…
Reference in New Issue
Block a user