Optimized p3HistoryMgr::cleanOldMessages.

There is no need to check the messages when mMaxStorageDurationSeconds is set to 0.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6779 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-09-29 13:31:15 +00:00
parent 4e259fecfd
commit 571099d56b

View file

@ -156,9 +156,11 @@ void p3HistoryMgr::cleanOldMessages()
bool changed = false ; bool changed = false ;
for(std::map<std::string, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.begin(); mit != mMessages.end();) for(std::map<std::string, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.begin(); mit != mMessages.end();)
{
if (mMaxStorageDurationSeconds > 0)
{ {
for(std::map<uint32_t, RsHistoryMsgItem*>::iterator lit = mit->second.begin();lit!=mit->second.end();) for(std::map<uint32_t, RsHistoryMsgItem*>::iterator lit = mit->second.begin();lit!=mit->second.end();)
if(mMaxStorageDurationSeconds > 0 && lit->second->recvTime + mMaxStorageDurationSeconds < now) if(lit->second->recvTime + mMaxStorageDurationSeconds < now)
{ {
std::map<uint32_t, RsHistoryMsgItem*>::iterator lit2 = lit ; std::map<uint32_t, RsHistoryMsgItem*>::iterator lit2 = lit ;
++lit2 ; ++lit2 ;
@ -173,6 +175,7 @@ void p3HistoryMgr::cleanOldMessages()
} }
else else
++lit ; ++lit ;
}
if(mit->second.empty()) if(mit->second.empty())
{ {