for each channel msg post download request is now only called once.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4136 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2011-04-08 21:58:03 +00:00
parent 05ed2bec88
commit bff095198c

View File

@ -740,18 +740,26 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std
return true;
}
// check if msg has done download already
// return if msg has d download already
chanStatMap::iterator cit = mMsgReadStatus.find(grpId);
statMap MsgMap;
statMap::iterator mit1, mit2;
std::list<RsChannelReadStatus*>::iterator lit = mReadStatus.begin();
if(cit != mMsgReadStatus.end()){
mit1 = cit->second.find(msgId);
for(;lit != mReadStatus.end();lit++){
if(mit1 != cit->second.end()){
if((*lit)->channelId == grpId)
break;
}
if(lit != mReadStatus.end()){
if(( mit1=(*lit)->msgReadStatus.find(msgId)) != (*lit)->msgReadStatus.end()){
if(mit1->second & CHANNEL_MSG_STATUS_DOWLOADED)
return false;
}else{
// create an entry for msg id
(*lit)->msgReadStatus[msgId] = ~CHANNEL_MSG_STATUS_MASK;
}
}
@ -850,13 +858,15 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std
localpath, flags, srcIds);
}
if(cit != mMsgReadStatus.end()){
if(lit != mReadStatus.end()){
if(mit1 != cit->second.end())
mit1->second |= (CHANNEL_MSG_STATUS_MASK &
(*lit)->msgReadStatus[msgId] |= (CHANNEL_MSG_STATUS_MASK &
CHANNEL_MSG_STATUS_DOWLOADED);
}
IndicateConfigChanged();
return true;
}