mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 14:45:12 -04:00
* Added Configurations to new file transfer.
* Enabled config in p3file-startup.cc * Enabled resumeTransfers * Added new RsFileConfigItem to serialiser. * extended ftFiMonitor to use Configuration. * bug fix to add/remove Shared Dirs. * Increased Channel/forum periods to 3/12 months. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@806 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
941e59f6e9
commit
66bf56207d
18 changed files with 768 additions and 111 deletions
|
@ -595,21 +595,43 @@ void FileIndexMonitor::updateCycle()
|
|||
/* interface */
|
||||
void FileIndexMonitor::setSharedDirectories(std::list<std::string> dirs)
|
||||
{
|
||||
fiMutex.lock(); { /* LOCKED DIRS */
|
||||
|
||||
#ifdef FIM_DEBUG
|
||||
std::list<std::string> checkeddirs;
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
#ifdef FIM_DEBUG
|
||||
std::cerr << "FileIndexMonitor::setSharedDirectories() :\n";
|
||||
for(it = dirs.begin(); it != dirs.end(); it++)
|
||||
{
|
||||
std::cerr << "\t" << *it;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
for(it = dirs.begin(); it != dirs.end(); it++)
|
||||
{
|
||||
|
||||
#ifdef FIM_DEBUG
|
||||
std::cerr << "\t" << *it;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
/* check if dir exists before adding in */
|
||||
std::string path = (*it);
|
||||
DIR *dir = opendir(path.c_str());
|
||||
if (!dir)
|
||||
{
|
||||
#ifdef FIM_DEBUG
|
||||
std::cerr << "FileIndexMonitor::setSharedDirectories()";
|
||||
std::cerr << " Ignoring NonExistant SharedDir: " << path << std::endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
checkeddirs.push_back(path);
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
fiMutex.lock(); { /* LOCKED DIRS */
|
||||
|
||||
pendingDirs = true;
|
||||
pendingDirList = dirs;
|
||||
pendingDirList = checkeddirs;
|
||||
|
||||
} fiMutex.unlock(); /* UNLOCKED DIRS */
|
||||
}
|
||||
|
@ -619,12 +641,21 @@ void FileIndexMonitor::getSharedDirectories(std::list<std::string> &dirs)
|
|||
{
|
||||
fiMutex.lock(); { /* LOCKED DIRS */
|
||||
|
||||
/* get actual list (not pending stuff) */
|
||||
std::map<std::string, std::string>::const_iterator it;
|
||||
for(it = directoryMap.begin(); it != directoryMap.end(); it++)
|
||||
/* must provide pendingDirs, as other parts depend on instanteous response */
|
||||
if (pendingDirs)
|
||||
{
|
||||
dirs.push_back(it->second);
|
||||
dirs = pendingDirList;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* get actual list (not pending stuff) */
|
||||
std::map<std::string, std::string>::const_iterator it;
|
||||
for(it = directoryMap.begin(); it != directoryMap.end(); it++)
|
||||
{
|
||||
dirs.push_back(it->second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} fiMutex.unlock(); /* UNLOCKED DIRS */
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ bool updateCache(const CacheData &data); /* we call when we have a new cach
|
|||
virtual void run(); /* overloaded from RsThread */
|
||||
void updateCycle();
|
||||
|
||||
void setSharedDirectories(std::list<std::string> dirs);
|
||||
virtual void setSharedDirectories(std::list<std::string> dirs);
|
||||
void getSharedDirectories(std::list<std::string> &dirs);
|
||||
|
||||
void setPeriod(int insecs);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue