mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-04 12:49:28 -04:00
- implemented post-download hash re-check. For now, if the hash does not match, the download is canceled, but in the near future, per-chunk comparison wil occur
. - corrected a bug that caused file copy error: a closeFile() was missing when the file is complete. Because of delays in fwrite, the file would not be always co mplete, nor exist at all for small files (e.g. cache files), which in the later case caused the copy error. Warning: needs a make clean in libretroshare to recompile. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3261 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
225781aa51
commit
458a8faf70
10 changed files with 329 additions and 117 deletions
|
@ -39,13 +39,14 @@ typedef std::string RsChanId;
|
|||
typedef std::string RsMsgId;
|
||||
typedef std::string RsAuthId;
|
||||
|
||||
const uint32_t FT_STATE_FAILED = 0x0000 ;
|
||||
const uint32_t FT_STATE_OKAY = 0x0001 ;
|
||||
const uint32_t FT_STATE_WAITING = 0x0002 ;
|
||||
const uint32_t FT_STATE_DOWNLOADING = 0x0003 ;
|
||||
const uint32_t FT_STATE_COMPLETE = 0x0004 ;
|
||||
const uint32_t FT_STATE_QUEUED = 0x0005 ;
|
||||
const uint32_t FT_STATE_PAUSED = 0x0006 ;
|
||||
const uint32_t FT_STATE_FAILED = 0x0000 ;
|
||||
const uint32_t FT_STATE_OKAY = 0x0001 ;
|
||||
const uint32_t FT_STATE_WAITING = 0x0002 ;
|
||||
const uint32_t FT_STATE_DOWNLOADING = 0x0003 ;
|
||||
const uint32_t FT_STATE_COMPLETE = 0x0004 ;
|
||||
const uint32_t FT_STATE_QUEUED = 0x0005 ;
|
||||
const uint32_t FT_STATE_PAUSED = 0x0006 ;
|
||||
const uint32_t FT_STATE_CHECKING_HASH = 0x0007 ;
|
||||
|
||||
// These constants are used by RsDiscSpace
|
||||
//
|
||||
|
@ -338,6 +339,23 @@ class CompressedChunkMap
|
|||
std::vector<uint32_t> _map ;
|
||||
};
|
||||
|
||||
class CRC32Map
|
||||
{
|
||||
public:
|
||||
// Build from a file.
|
||||
//
|
||||
CRC32Map(const std::string& fname,uint32_t chunk_size) ;
|
||||
CRC32Map() {}
|
||||
|
||||
// Compares two maps and returns the valid chunks in a compressed chunk map.
|
||||
//
|
||||
friend CompressedChunkMap compare(const CRC32Map& crc1,const CRC32Map& crc2) ;
|
||||
|
||||
bool empty() const { return _map.empty() ; }
|
||||
private:
|
||||
std::vector<uint32_t> _map ;
|
||||
};
|
||||
|
||||
/* class which encapsulates download details */
|
||||
class DwlDetails {
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue