Merging bugfixes from trunk.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.4.x@1303 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2009-06-16 21:19:11 +00:00
parent 4854a91822
commit f28b9d3bf5
2 changed files with 70 additions and 45 deletions

View file

@ -134,10 +134,14 @@ void ftController::run()
std::cerr << std::endl;
#endif
if (it->second.mTransfer) {
if (it->second.mTransfer)
{
#ifdef CONTROL_DEBUG
std::cerr << "\tTicking mTransfer: " << (void*)it->second.mTransfer;
std::cerr << std::endl;
#endif
(it->second.mTransfer)->tick();
//check if a cache file is downloaded, if the case, timeout the transfer after TIMOUT_CACHE_FILE_TRANSFER
if ((it->second).mFlags & RS_FILE_HINTS_CACHE) {
#ifdef CONTROL_DEBUG
@ -906,6 +910,7 @@ bool ftController::setDownloadDirectory(std::string path)
std::cerr << "ftController::setDownloadDirectory() Okay!";
std::cerr << std::endl;
#endif
IndicateConfigChanged();
return true;
}
@ -920,6 +925,24 @@ bool ftController::setPartialsDirectory(std::string path)
{
/* check it is not a subdir of download / shared directories (BAD) - TODO */
{
RsStackMutex stack(ctrlMutex);
if (!path.find(mDownloadPath)) {
return false;
}
if (rsFiles) {
std::list<std::string>::iterator it;
std::list<std::string> dirs;
rsFiles->getSharedDirectories(dirs);
for (it = dirs.begin(); it != dirs.end(); it++) {
if (!path.find(*it)) {
return false;
}
}
}
}
/* check if it exists */
@ -937,6 +960,7 @@ bool ftController::setPartialsDirectory(std::string path)
(it->second).mCreator->changePartialDirectory(mPartialPath);
}
#endif
IndicateConfigChanged();
return true;
}
@ -1332,7 +1356,7 @@ bool ftController::loadConfigMap(std::map<std::string, std::string> &configMap)
if (configMap.end() != (mit = configMap.find(partial_dir_ss)))
{
//setPartialsDirectory(mit->second);
setPartialsDirectory(mit->second);
}
return true;

View file

@ -437,6 +437,7 @@ bool ftExtraList::loadList(std::list<RsItem *> load)
/* to old */
cleanupEntry(fi->file.path, fi->flags);
delete (*it);
continue ;
}
/* add into system */