mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-21 12:54:26 -04:00
attempt to fix the crash in DataStore by not calling deleteMsgs directly
This commit is contained in:
parent
39f003f9f9
commit
e726bd1061
2 changed files with 12 additions and 4 deletions
|
@ -354,8 +354,14 @@ void p3GxsTrans::GxsTransIntegrityCleanupThread::run()
|
||||||
|
|
||||||
RS_STACK_MUTEX(mMtx) ;
|
RS_STACK_MUTEX(mMtx) ;
|
||||||
mMsgToDel = msgsToDel ;
|
mMsgToDel = msgsToDel ;
|
||||||
|
mDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool p3GxsTrans::GxsTransIntegrityCleanupThread::isDone()
|
||||||
|
{
|
||||||
|
RS_STACK_MUTEX(mMtx) ;
|
||||||
|
return mDone ;
|
||||||
|
}
|
||||||
void p3GxsTrans::service_tick()
|
void p3GxsTrans::service_tick()
|
||||||
{
|
{
|
||||||
GxsTokenQueue::checkRequests();
|
GxsTokenQueue::checkRequests();
|
||||||
|
@ -381,7 +387,7 @@ void p3GxsTrans::service_tick()
|
||||||
|
|
||||||
// now grab collected messages to delete
|
// now grab collected messages to delete
|
||||||
|
|
||||||
if(mCleanupThread != NULL && !mCleanupThread->isRunning())
|
if(mCleanupThread != NULL && !mCleanupThread->isDone())
|
||||||
{
|
{
|
||||||
GxsMsgReq msgToDel ;
|
GxsMsgReq msgToDel ;
|
||||||
|
|
||||||
|
@ -390,7 +396,8 @@ void p3GxsTrans::service_tick()
|
||||||
if(!msgToDel.empty())
|
if(!msgToDel.empty())
|
||||||
{
|
{
|
||||||
std::cerr << "p3GxsTrans::service_tick(): deleting messages." << std::endl;
|
std::cerr << "p3GxsTrans::service_tick(): deleting messages." << std::endl;
|
||||||
getDataStore()->removeMsgs(msgToDel);
|
uint32_t token ;
|
||||||
|
deleteMsgs(token,msgToDel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ private:
|
||||||
* Two weeks seems fair ATM.
|
* Two weeks seems fair ATM.
|
||||||
*/
|
*/
|
||||||
static const uint32_t GXS_STORAGE_PERIOD = 0x127500;
|
static const uint32_t GXS_STORAGE_PERIOD = 0x127500;
|
||||||
static const uint32_t MAX_DELAY_BETWEEN_CLEANUPS = 1203; // every 20 mins. Could be less.
|
static const uint32_t MAX_DELAY_BETWEEN_CLEANUPS = 1203; // every 20 mins. Could be less.
|
||||||
|
|
||||||
time_t mLastMsgCleanup ;
|
time_t mLastMsgCleanup ;
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ private:
|
||||||
enum CheckState { CheckStart, CheckChecking };
|
enum CheckState { CheckStart, CheckChecking };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GxsTransIntegrityCleanupThread(RsGeneralDataService *const dataService): mDs(dataService),mMtx("GxsTransIntegrityCheck") {}
|
GxsTransIntegrityCleanupThread(RsGeneralDataService *const dataService): mDs(dataService),mMtx("GxsTransIntegrityCheck") { mDone=false;}
|
||||||
|
|
||||||
bool isDone();
|
bool isDone();
|
||||||
void run();
|
void run();
|
||||||
|
@ -296,6 +296,7 @@ private:
|
||||||
RsMutex mMtx ;
|
RsMutex mMtx ;
|
||||||
|
|
||||||
GxsMsgReq mMsgToDel ;
|
GxsMsgReq mMsgToDel ;
|
||||||
|
bool mDone ;
|
||||||
};
|
};
|
||||||
|
|
||||||
GxsTransIntegrityCleanupThread *mCleanupThread ;
|
GxsTransIntegrityCleanupThread *mCleanupThread ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue