mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed missing peer availability maps in FT dialog
This commit is contained in:
parent
026951ff2c
commit
efa5827fff
@ -446,7 +446,7 @@ public:
|
|||||||
{
|
{
|
||||||
FileChunksInfo fcinfo;
|
FileChunksInfo fcinfo;
|
||||||
if (!rsFiles->FileDownloadChunksDetails(fileInfo.hash, fcinfo))
|
if (!rsFiles->FileDownloadChunksDetails(fileInfo.hash, fcinfo))
|
||||||
return -1;
|
return QVariant();
|
||||||
|
|
||||||
FileProgressInfo pinfo;
|
FileProgressInfo pinfo;
|
||||||
pinfo.cmap = fcinfo.chunks;
|
pinfo.cmap = fcinfo.chunks;
|
||||||
@ -480,34 +480,20 @@ public:
|
|||||||
{
|
{
|
||||||
case COLUMN_PROGRESS:
|
case COLUMN_PROGRESS:
|
||||||
{
|
{
|
||||||
FileProgressInfo peerpinfo ;
|
FileChunksInfo fcinfo;
|
||||||
|
if (!rsFiles->FileDownloadChunksDetails(fileInfo.hash, fcinfo))
|
||||||
if(!rsFiles->FileUploadChunksDetails(fileInfo.hash, fileInfo.peers[source_id].peerId, peerpinfo.cmap) )
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
// Estimate the completion. We need something more accurate, meaning that we need to
|
RsPeerId pid = fileInfo.peers[source_id].peerId;
|
||||||
// transmit the completion info.
|
CompressedChunkMap& cmap(fcinfo.compressed_peer_availability_maps[pid]) ;
|
||||||
//
|
|
||||||
uint32_t chunk_size = 1024*1024 ;
|
|
||||||
uint32_t nb_chunks = (uint32_t)((fileInfo.size + (uint64_t)chunk_size - 1) / (uint64_t)(chunk_size)) ;
|
|
||||||
|
|
||||||
uint32_t filled_chunks = peerpinfo.cmap.filledChunks(nb_chunks) ;
|
FileProgressInfo pinfo;
|
||||||
peerpinfo.type = FileProgressInfo::UPLOAD_LINE ;
|
pinfo.cmap = cmap;
|
||||||
peerpinfo.nb_chunks = peerpinfo.cmap._map.empty()?0:nb_chunks ;
|
pinfo.type = FileProgressInfo::DOWNLOAD_SOURCE;
|
||||||
qlonglong completed ;
|
pinfo.progress = 0.0; // we dont display completion for sources
|
||||||
|
pinfo.nb_chunks = pinfo.cmap._map.empty() ? 0 : fcinfo.chunks.size();
|
||||||
|
|
||||||
if(filled_chunks > 0 && nb_chunks > 0)
|
return QVariant::fromValue(pinfo);
|
||||||
{
|
|
||||||
completed = peerpinfo.cmap.computeProgress(fileInfo.size,chunk_size) ;
|
|
||||||
peerpinfo.progress = completed / (float)fileInfo.size * 100.0f ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = fileInfo.peers[source_id].transfered % chunk_size ; // use the position with respect to last request.
|
|
||||||
peerpinfo.progress = (fileInfo.size>0)?((fileInfo.peers[source_id].transfered % chunk_size)*100.0/fileInfo.size):0 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return QVariant::fromValue(peerpinfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case COLUMN_ID: return QVariant(QString::fromStdString(fileInfo.hash.toStdString()) + QString::fromStdString(fileInfo.peers[source_id].peerId.toStdString()));
|
case COLUMN_ID: return QVariant(QString::fromStdString(fileInfo.hash.toStdString()) + QString::fromStdString(fileInfo.peers[source_id].peerId.toStdString()));
|
||||||
|
Loading…
Reference in New Issue
Block a user