mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
Optimized filling of shared files (local and remote).
Added cache to RemoteDirModel. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6989 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c9575b6a8a
commit
aff10a352c
4 changed files with 140 additions and 121 deletions
|
@ -1340,7 +1340,7 @@ bool FileIndex::extractData(void *ref,DirDetails& details)
|
|||
FileEntry *file = static_cast<FileEntry *>(ref);
|
||||
DirEntry *dir = (file->hash.empty())?static_cast<DirEntry *>(file):NULL ; // This is a hack to avoid doing a dynamic_cast
|
||||
|
||||
details.children = std::list<DirStub>() ;
|
||||
details.children.clear() ;
|
||||
time_t now = time(NULL) ;
|
||||
|
||||
if (dir!=NULL) /* has children --- fill */
|
||||
|
@ -1351,20 +1351,24 @@ bool FileIndex::extractData(void *ref,DirDetails& details)
|
|||
/* extract all the entries */
|
||||
for(std::map<std::string,DirEntry*>::const_iterator dit(dir->subdirs.begin()); dit != dir->subdirs.end(); ++dit)
|
||||
{
|
||||
DirEntry *dirEntry = dit->second;
|
||||
|
||||
DirStub stub;
|
||||
stub.type = DIR_TYPE_DIR;
|
||||
stub.name = (dit->second) -> name;
|
||||
stub.ref = (dit->second);
|
||||
stub.name = dirEntry -> name;
|
||||
stub.ref = dirEntry;
|
||||
|
||||
details.children.push_back(stub);
|
||||
}
|
||||
|
||||
for(std::map<std::string,FileEntry*>::const_iterator fit(dir->files.begin()); fit != dir->files.end(); ++fit)
|
||||
{
|
||||
FileEntry *fileEntry = fit->second;
|
||||
|
||||
DirStub stub;
|
||||
stub.type = DIR_TYPE_FILE;
|
||||
stub.name = (fit->second) -> name;
|
||||
stub.ref = (fit->second);
|
||||
stub.name = fileEntry -> name;
|
||||
stub.ref = fileEntry;
|
||||
|
||||
details.children.push_back(stub);
|
||||
}
|
||||
|
|
|
@ -247,10 +247,12 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, FileSearch
|
|||
{
|
||||
/*
|
||||
*/
|
||||
FileIndex *fileIndex = pit->second;
|
||||
|
||||
DirStub stub;
|
||||
stub.type = DIR_TYPE_PERSON;
|
||||
stub.name = (pit->second)->root->name;
|
||||
stub.ref = (pit->second)->root;
|
||||
stub.name = fileIndex->root->name;
|
||||
stub.ref = fileIndex->root;
|
||||
|
||||
details.children.push_back(stub);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue