mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-25 17:21:27 -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())
|
if(mIntegrityCheck->isDone())
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mGenMtx) ;
|
|
||||||
|
|
||||||
std::vector<RsGxsGroupId> grpIds;
|
std::vector<RsGxsGroupId> grpIds;
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
|
|
||||||
|
{
|
||||||
|
RS_STACK_MUTEX(mGenMtx) ;
|
||||||
mIntegrityCheck->getDeletedIds(grpIds, msgIds);
|
mIntegrityCheck->getDeletedIds(grpIds, msgIds);
|
||||||
|
}
|
||||||
|
|
||||||
if(!msgIds.empty())
|
if(!msgIds.empty())
|
||||||
{
|
{
|
||||||
@ -319,11 +320,14 @@ void RsGenExchange::tick()
|
|||||||
deleteGroup(token2,grpId);
|
deleteGroup(token2,grpId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
RS_STACK_MUTEX(mGenMtx) ;
|
||||||
delete mIntegrityCheck;
|
delete mIntegrityCheck;
|
||||||
mIntegrityCheck = NULL;
|
mIntegrityCheck = NULL;
|
||||||
mChecking = false;
|
mChecking = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsGenExchange::messagePublicationTest(const RsGxsMsgMetaData& meta)
|
bool RsGenExchange::messagePublicationTest(const RsGxsMsgMetaData& meta)
|
||||||
|
@ -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
|
// compute hash and compare to stored value, if it fails then simply add it
|
||||||
// to list
|
// to list
|
||||||
for( std::map<RsGxsGroupId, RsNxsGrp*>::iterator git = grp.begin();
|
for( std::map<RsGxsGroupId, RsNxsGrp*>::iterator git = grp.begin(); git != grp.end(); ++git )
|
||||||
git != grp.end(); ++git )
|
|
||||||
{
|
{
|
||||||
RsNxsGrp* grp = git->second;
|
RsNxsGrp* grp = git->second;
|
||||||
RsFileHash currHash;
|
RsFileHash currHash;
|
||||||
@ -311,6 +310,7 @@ bool RsGxsIntegrityCheck::check(uint16_t service_type, RsGixs *mgixs, RsGeneralD
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
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);
|
grpsToDel.push_back(grp->grpId);
|
||||||
#ifdef RS_DEEP_CHANNEL_INDEX
|
#ifdef RS_DEEP_CHANNEL_INDEX
|
||||||
if(isGxsChannels)
|
if(isGxsChannels)
|
||||||
@ -321,8 +321,6 @@ bool RsGxsIntegrityCheck::check(uint16_t service_type, RsGixs *mgixs, RsGeneralD
|
|||||||
delete grp;
|
delete grp;
|
||||||
}
|
}
|
||||||
|
|
||||||
mds->removeGroups(grpsToDel);
|
|
||||||
|
|
||||||
// now messages
|
// now messages
|
||||||
GxsMsgResult msgs;
|
GxsMsgResult msgs;
|
||||||
|
|
||||||
@ -378,9 +376,7 @@ bool RsGxsIntegrityCheck::check(uint16_t service_type, RsGixs *mgixs, RsGeneralD
|
|||||||
|
|
||||||
if(msg->metaData == NULL || currHash != msg->metaData->mHash)
|
if(msg->metaData == NULL || currHash != msg->metaData->mHash)
|
||||||
{
|
{
|
||||||
std::cerr << __PRETTY_FUNCTION__ <<" (EE) deleting message data"
|
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;
|
||||||
<< " with wrong hash or null meta data. meta="
|
|
||||||
<< (void*)msg->metaData << std::endl;
|
|
||||||
msgsToDel[msg->grpId].insert(msg->msgId);
|
msgsToDel[msg->grpId].insert(msg->msgId);
|
||||||
#ifdef RS_DEEP_CHANNEL_INDEX
|
#ifdef RS_DEEP_CHANNEL_INDEX
|
||||||
if(isGxsChannels)
|
if(isGxsChannels)
|
||||||
@ -451,8 +447,6 @@ bool RsGxsIntegrityCheck::check(uint16_t service_type, RsGixs *mgixs, RsGeneralD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mds->removeMsgs(msgsToDel);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_GXSUTIL
|
#ifdef DEBUG_GXSUTIL
|
||||||
GXSUTIL_DEBUG() << "At end of pass, this is the list used GXS ids: " << std::endl;
|
GXSUTIL_DEBUG() << "At end of pass, this is the list used GXS ids: " << std::endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user