fixed bug in cache file exchange

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IdCleaning@7148 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-02-23 15:52:41 +00:00
parent 160a893017
commit 1843ad74c6
5 changed files with 13 additions and 7 deletions

View file

@ -1052,7 +1052,7 @@ bool CacheStrapper::loadList(std::list<RsItem *>& load)
std::list<std::string> cacheDirs;
std::list<std::string>::iterator dit;
#ifdef CS_DEBUG
std::list<std::string>::iterator fit;
std::set<std::string>::iterator fit;
#endif
std::map<uint16_t, CachePair>::iterator cit;
for(cit = caches.begin(); cit != caches.end(); cit++)

View file

@ -1107,7 +1107,7 @@ time_t FileIndexMonitor::locked_saveFileIndexes(bool update_cache)
#ifdef FIM_DEBUG
std::cerr << "FileIndexMonitor::updateCycle(): got list of all friends." << std::endl ;
for(std::list<std::string>::const_iterator it(all_friend_ids.begin());it!=all_friend_ids.end();++it)
for(std::list<RsPeerId>::const_iterator it(all_friend_ids.begin());it!=all_friend_ids.end();++it)
std::cerr << " " << *it << std::endl;
#endif
@ -1171,7 +1171,7 @@ time_t FileIndexMonitor::locked_saveFileIndexes(bool update_cache)
std::cerr << "Sending file list: " << std::endl;
std::cerr << " filename : " << tmpname_browsable << std::endl;
std::cerr << " to peers : " << std::endl;
for(std::set<std::string>::const_iterator itt(it->second.begin());itt!= it->second.end();++itt)
for(std::set<RsPeerId>::const_iterator itt(it->second.begin());itt!= it->second.end();++itt)
std::cerr << " " << *itt << std::endl;
std::cerr << " forbidden : " << std::endl;
for(std::set<std::string>::const_iterator itt(it->first.begin());itt!= it->first.end();++itt)

View file

@ -821,6 +821,11 @@ int FileIndex::loadIndex(const std::string& filename, const RsFileHash& expected
}
std::string s((char *)uncompressed_data,uncompressed_data_size) ;
std::cerr << " file = " << filename << std::endl;
std::cerr << " uncompressed size = " << uncompressed_data_size << std::endl;
std::cerr << " compressed size = " << size << std::endl;
std::cerr << " hash = " << tmpout << std::endl;
delete[] compressed_data ;
free(uncompressed_data) ;
@ -1048,6 +1053,7 @@ int FileIndex::saveIndex(const std::string& filename, RsFileHash &fileHash, uint
fileHash = RsDirUtil::sha1sum((unsigned char *)compressed_data,compressed_data_size).toStdString() ;
std::cerr << " file = " << filename << std::endl;
std::cerr << " old size = " << s.length() << std::endl;
std::cerr << " new size = " << compressed_data_size << std::endl;
std::cerr << " hash = " << fileHash << std::endl;

View file

@ -1913,7 +1913,7 @@ void ftController::statusChange(const std::list<pqipeer> &plist)
}
/* Cache Interface */
bool ftController::RequestCacheFile(RsPeerId id, std::string path, const RsFileHash& hash, uint64_t size)
bool ftController::RequestCacheFile(const RsPeerId& id, std::string path, const RsFileHash& hash, uint64_t size)
{
#ifdef CONTROL_DEBUG
std::cerr << "ftController::RequestCacheFile(" << id << ",";
@ -1952,7 +1952,7 @@ bool ftController::RequestCacheFile(RsPeerId id, std::string path, const RsFileH
}
bool ftController::CancelCacheFile(RsPeerId id, std::string path, const RsFileHash& hash, uint64_t size)
bool ftController::CancelCacheFile(const RsPeerId& id, std::string path, const RsFileHash& hash, uint64_t size)
{
std::cerr << "ftController::CancelCacheFile(" << id << ",";
std::cerr << path << "," << hash << "," << size << ")";

View file

@ -193,8 +193,8 @@ class ftController: public CacheTransfer, public RsThread, public pqiMonitor, pu
protected:
virtual bool RequestCacheFile(RsPeerId id, std::string path, const RsFileHash& hash, uint64_t size);
virtual bool CancelCacheFile(RsPeerId id, std::string path, const RsFileHash& hash, uint64_t size);
virtual bool RequestCacheFile(const RsPeerId& id, std::string path, const RsFileHash& hash, uint64_t size);
virtual bool CancelCacheFile(const RsPeerId& id, std::string path, const RsFileHash& hash, uint64_t size);
void cleanCacheDownloads() ;
void searchForDirectSources() ;