mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
turned some std::list<PeerId> into std::set, as it automatically prevents duplicates
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8138 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f1309a8cbe
commit
c9d5c7b3cb
51 changed files with 269 additions and 266 deletions
|
@ -2089,7 +2089,7 @@ bool ftController::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||
//
|
||||
for(std::list<RsPeerId>::const_iterator it(lst.begin());it!=lst.end();++it)
|
||||
if(!mTurtle->isTurtlePeer(*it))
|
||||
rft->allPeerIds.ids.push_back(*it) ;
|
||||
rft->allPeerIds.ids.insert(*it) ;
|
||||
|
||||
rft->transferred = fit->second->mCreator->getRecvd();
|
||||
fit->second->mCreator->getAvailabilityMap(rft->compressed_chunk_map) ;
|
||||
|
@ -2126,17 +2126,17 @@ bool ftController::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||
|
||||
rft->allPeerIds.ids.clear() ;
|
||||
for(std::list<RsPeerId>::const_iterator it(pit->mSrcIds.begin());it!=pit->mSrcIds.end();++it)
|
||||
rft->allPeerIds.ids.push_back( *it ) ;
|
||||
rft->allPeerIds.ids.insert( *it ) ;
|
||||
}
|
||||
|
||||
// Remove turtle peers from sources, as they are not supposed to survive a reboot of RS, since they are dynamic sources.
|
||||
// Otherwize, such sources are unknown from the turtle router, at restart, and never get removed. We do that in post
|
||||
// process since the rft object may have been created from mPendingChunkMaps
|
||||
//
|
||||
for(std::list<RsPeerId>::iterator sit(rft->allPeerIds.ids.begin());sit!=rft->allPeerIds.ids.end();)
|
||||
for(std::set<RsPeerId>::iterator sit(rft->allPeerIds.ids.begin());sit!=rft->allPeerIds.ids.end();)
|
||||
if(mTurtle->isTurtlePeer(RsPeerId(*sit)))
|
||||
{
|
||||
std::list<RsPeerId>::iterator sittmp(sit) ;
|
||||
std::set<RsPeerId>::iterator sittmp(sit) ;
|
||||
++sittmp ;
|
||||
rft->allPeerIds.ids.erase(sit) ;
|
||||
sit = sittmp ;
|
||||
|
@ -2199,7 +2199,7 @@ bool ftController::loadList(std::list<RsItem *>& load)
|
|||
std::cerr << "ftController::loadList(): requesting " << rsft->file.name << ", " << rsft->file.hash << ", " << rsft->file.filesize << std::endl ;
|
||||
#endif
|
||||
std::list<RsPeerId> src_lst ;
|
||||
for(std::list<RsPeerId>::const_iterator it(rsft->allPeerIds.ids.begin());it!=rsft->allPeerIds.ids.end();++it)
|
||||
for(std::set<RsPeerId>::const_iterator it(rsft->allPeerIds.ids.begin());it!=rsft->allPeerIds.ids.end();++it)
|
||||
src_lst.push_back(*it) ;
|
||||
|
||||
FileRequest(rsft->file.name, rsft->file.hash, rsft->file.filesize, rsft->file.path, TransferRequestFlags(rsft->flags), src_lst, rsft->state);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue