Improved CRC32Map checking in several ways:

- servers now compute the map in a separate thread
- CRC32Maps are kept in cache for 30 mins
- CRC32Maps requests cannot be used to overflood a server anymore since their number is limited.
- Transfer modules now send keep alive packets to maintain tunnels when asking for a CRC32Map



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4661 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-11-03 23:18:00 +00:00
parent a9cb864717
commit d43a131c04
7 changed files with 197 additions and 32 deletions

View file

@ -53,12 +53,6 @@ class ftFileProvider
//
virtual void getAvailabilityMap(CompressedChunkMap& cmap) ;
// Provides a complete per-chunk CRC32 map to client who want to check their data.
// This is derived in ftFileCreator, but returns false, because we can't ensure that unchecked chunks
// will provide a CRC32 that is faithful to the original hash.
//
virtual bool getCRC32Map(CRC32Map& crc_map) ;
// a ftFileProvider feeds a distant peer. To display what the peers already has, we need to store/read this info.
void getClientMap(const std::string& peer_id,CompressedChunkMap& cmap,bool& map_is_too_old) ;
void setClientMap(const std::string& peer_id,const CompressedChunkMap& cmap) ;
@ -66,6 +60,10 @@ class ftFileProvider
// Removes inactive peers from the client list. Returns true if all peers have been removed.
//
bool purgeOldPeers(time_t now,uint32_t max_duration) ;
const std::string& fileHash() const { return hash ; }
const std::string& fileName() const { return file_name ; }
uint64_t fileSize() const { return mSize ; }
protected:
virtual int initializeFileAttrs(); /* does for both */