- 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:
csoler 2010-07-06 05:04:11 +00:00
parent 225781aa51
commit 458a8faf70
10 changed files with 329 additions and 117 deletions

View file

@ -106,6 +106,7 @@ public:
PQIFILE_NOT_ONLINE,
PQIFILE_DOWNLOADING,
PQIFILE_COMPLETE,
PQIFILE_CHECKING,
PQIFILE_FAIL,
PQIFILE_FAIL_CANCEL,
PQIFILE_FAIL_NOT_AVAIL,
@ -138,7 +139,9 @@ public:
bool getPeerState(std::string peerId,uint32_t &state,uint32_t &tfRate);
uint32_t getDataRate(std::string peerId);
bool cancelTransfer();
bool cancelFileTransferUpward();
bool completeFileTransfer();
bool isCheckingHash() ;
//interface to multiplex module
bool recvFileData(std::string peerId, uint64_t offset,
@ -164,6 +167,8 @@ private:
bool locked_recvPeerData(peerInfo &info, uint64_t offset,
uint32_t chunk_size, void *data);
bool checkFile() ;
bool checkCRC() ;
/* These have independent Mutexes / are const locally (no Mutex protection)*/
ftFileCreator *mFileCreator;
@ -178,10 +183,12 @@ private:
std::list<std::string> mOnlinePeers;
std::map<std::string,peerInfo> mFileSources;
uint16_t mFlag; //2:file canceled, 1:transfer complete, 0: not complete
uint16_t mFlag; //2:file canceled, 1:transfer complete, 0: not complete, 3: checking hash, 4: checking chunks
double desiredRate;
double actualRate;
CRC32Map _crc32map ;
ftFileStatus mFileStatus; //used for pause/resume file transfer
};