added regular cleaning of inactive chunks and slices, so that they can be treated by a different peer

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2102 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-01-21 12:31:00 +00:00
parent f481dbef59
commit e2b807aad7
6 changed files with 112 additions and 3 deletions

View file

@ -71,6 +71,7 @@ class ChunkDownloadInfo
public:
std::map<ftChunk::ChunkId,uint32_t> _slices ;
uint32_t _remains ;
time_t _last_data_received ;
};
class SourceChunksInfo
@ -139,6 +140,10 @@ class ChunkMap
/// This function is used by the parent ftFileProvider to know whether the chunk can be sent or not.
bool isChunkAvailable(uint64_t offset, uint32_t chunk_size) const ;
/// Remove active chunks that have not received any data for the last 60 seconds, and return
/// the list of slice numbers that should be canceled.
void removeInactiveChunks(std::vector<ftChunk::ChunkId>& to_remove) ;
/// Updates the peer's availablility map
//
void setPeerAvailabilityMap(const std::string& peer_id,const CompressedChunkMap& peer_map) ;