mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-25 09:11:28 -05:00
Merge pull request #2153 from csoler/v0.6-BugFixing_5
fixed bug in mutexes causing a deadlock in gxs integrity check
This commit is contained in:
commit
33c5cc86b6
@ -299,12 +299,13 @@ void RsGenExchange::tick()
|
||||
|
||||
if(mIntegrityCheck->isDone())
|
||||
{
|
||||
RS_STACK_MUTEX(mGenMtx) ;
|
||||
|
||||
std::vector<RsGxsGroupId> grpIds;
|
||||
GxsMsgReq msgIds;
|
||||
|
||||
mIntegrityCheck->getDeletedIds(grpIds, msgIds);
|
||||
{
|
||||
RS_STACK_MUTEX(mGenMtx) ;
|
||||
mIntegrityCheck->getDeletedIds(grpIds, msgIds);
|
||||
}
|
||||
|
||||
if(!msgIds.empty())
|
||||
{
|
||||
@ -319,9 +320,12 @@ void RsGenExchange::tick()
|
||||
deleteGroup(token2,grpId);
|
||||
}
|
||||
|
||||
delete mIntegrityCheck;
|
||||
mIntegrityCheck = NULL;
|
||||
mChecking = false;
|
||||
{
|
||||
RS_STACK_MUTEX(mGenMtx) ;
|
||||
delete mIntegrityCheck;
|
||||
mIntegrityCheck = NULL;
|
||||
mChecking = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -234,8 +234,7 @@ bool RsGxsIntegrityCheck::check(uint16_t service_type, RsGixs *mgixs, RsGeneralD
|
||||
|
||||
// compute hash and compare to stored value, if it fails then simply add it
|
||||
// to list
|
||||
for( std::map<RsGxsGroupId, RsNxsGrp*>::iterator git = grp.begin();
|
||||
git != grp.end(); ++git )
|
||||
for( std::map<RsGxsGroupId, RsNxsGrp*>::iterator git = grp.begin(); git != grp.end(); ++git )
|
||||
{
|
||||
RsNxsGrp* grp = git->second;
|
||||
RsFileHash currHash;
|
||||
@ -311,7 +310,8 @@ bool RsGxsIntegrityCheck::check(uint16_t service_type, RsGixs *mgixs, RsGeneralD
|
||||
}
|
||||
else
|
||||
{
|
||||
grpsToDel.push_back(grp->grpId);
|
||||
std::cerr << __PRETTY_FUNCTION__ <<" (EE) deleting group " << grp->grpId << " with wrong hash or null/corrupted meta data. meta=" << grp->metaData << std::endl;
|
||||
grpsToDel.push_back(grp->grpId);
|
||||
#ifdef RS_DEEP_CHANNEL_INDEX
|
||||
if(isGxsChannels)
|
||||
DeepChannelsIndex::removeChannelFromIndex(grp->grpId);
|
||||
@ -321,8 +321,6 @@ bool RsGxsIntegrityCheck::check(uint16_t service_type, RsGixs *mgixs, RsGeneralD
|
||||
delete grp;
|
||||
}
|
||||
|
||||
mds->removeGroups(grpsToDel);
|
||||
|
||||
// now messages
|
||||
GxsMsgResult msgs;
|
||||
|
||||
@ -378,9 +376,7 @@ bool RsGxsIntegrityCheck::check(uint16_t service_type, RsGixs *mgixs, RsGeneralD
|
||||
|
||||
if(msg->metaData == NULL || currHash != msg->metaData->mHash)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ <<" (EE) deleting message data"
|
||||
<< " with wrong hash or null meta data. meta="
|
||||
<< (void*)msg->metaData << std::endl;
|
||||
std::cerr << __PRETTY_FUNCTION__ <<" (EE) deleting message " << msg->msgId << " in group " << msg->grpId << " with wrong hash or null/corrupted meta data. meta=" << (void*)msg->metaData << std::endl;
|
||||
msgsToDel[msg->grpId].insert(msg->msgId);
|
||||
#ifdef RS_DEEP_CHANNEL_INDEX
|
||||
if(isGxsChannels)
|
||||
@ -451,8 +447,6 @@ bool RsGxsIntegrityCheck::check(uint16_t service_type, RsGixs *mgixs, RsGeneralD
|
||||
}
|
||||
}
|
||||
|
||||
mds->removeMsgs(msgsToDel);
|
||||
|
||||
{
|
||||
#ifdef DEBUG_GXSUTIL
|
||||
GXSUTIL_DEBUG() << "At end of pass, this is the list used GXS ids: " << std::endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user