suppressed bug due to asking again to publish a groupkey that had been deleted before.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3976 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-01-23 14:06:56 +00:00
parent 42e32b9514
commit ee5417e46a

View File

@ -525,19 +525,22 @@ bool p3GroupDistrib::loadGroupKey(RsDistribGrpKey *newKey)
#endif #endif
// if this is an in-date full publish key then keep to see if group arrives later // if this is an in-date full publish key then keep to see if group arrives later
if(((time_t)(newKey->key.startTS + mStorePeriod) > time(NULL)) && (newKey->key.keyFlags & RSTLV_KEY_TYPE_FULL)){ if(((time_t)(newKey->key.startTS + mStorePeriod) > time(NULL)) && (newKey->key.keyFlags & RSTLV_KEY_TYPE_FULL))
{
// make sure key does not exist // make sure key does not exist
if(mRecvdPubKeys.find(gid) == mRecvdPubKeys.end()){ if(mRecvdPubKeys.find(gid) == mRecvdPubKeys.end()){
mRecvdPubKeys.insert(std::pair<std::string, RsDistribGrpKey*>(gid, newKey)); mRecvdPubKeys.insert(std::pair<std::string, RsDistribGrpKey*>(gid, newKey));
return true; return true;
}else{ }
else
{
#ifdef DISTRIB_DEBUG #ifdef DISTRIB_DEBUG
std::cerr << "p3GroupDistrib::loadGroupKey() Key already received; discarding"; std::cerr << "p3GroupDistrib::loadGroupKey() Key already received; discarding";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
delete newKey; delete newKey;
return false ;
} }
} }
@ -548,11 +551,8 @@ bool p3GroupDistrib::loadGroupKey(RsDistribGrpKey *newKey)
#endif #endif
delete newKey; delete newKey;
return false ;
} }
return false;
} }
@ -604,7 +604,9 @@ bool p3GroupDistrib::loadGroupKey(RsDistribGrpKey *newKey)
return updateOk; return updateOk;
} }
delete newKey; if(!updateOk)
delete newKey;
return updateOk; return updateOk;
} }
@ -726,7 +728,7 @@ void p3GroupDistrib::loadMsg(RsDistribSignedMsg *newMsg, const std::string &src,
(git->second).msgs[msg->msgId] = msg; (git->second).msgs[msg->msgId] = msg;
// update the time stamp of group for last post // update the time stamp of group for last post
if((git->second.lastPost < msg->timestamp)) if((git->second.lastPost < (time_t)msg->timestamp))
git->second.lastPost = msg->timestamp; git->second.lastPost = msg->timestamp;
/* now update parents TS */ /* now update parents TS */
@ -1308,13 +1310,22 @@ bool p3GroupDistrib::subscribeToGroup(const std::string &grpId, bool subscrib
bool p3GroupDistrib::attemptPublishKeysRecvd() bool p3GroupDistrib::attemptPublishKeysRecvd()
{ {
std::map<std::string, RsDistribGrpKey*>::iterator mit = mRecvdPubKeys.begin();
std::map<std::string, RsDistribGrpKey*>::iterator mit; for(;mit != mRecvdPubKeys.end();)
mit = mRecvdPubKeys.begin(); {
bool ok = loadGroupKey(mit->second);
for(; mit != mRecvdPubKeys.end(); mit++){ if(!ok)
loadGroupKey(mit->second); {
} std::map<std::string, RsDistribGrpKey*>::iterator tmp(mit);
++mit ;
mRecvdPubKeys.erase(tmp) ;
}
else
++mit ;
}
return true; return true;
} }