mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fix for trigger statement, and readjusted algo to use self gen-exchange generated time stamps
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs_finale@6907 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
24839ee237
commit
1cdf329bb1
@ -253,7 +253,7 @@ void RsDataService::initialise(){
|
||||
" UPDATE OF " + KEY_RECV_TS + " ON " + MSG_TABLE_NAME +
|
||||
std::string(" BEGIN ") +
|
||||
" UPDATE " + GRP_TABLE_NAME + " SET " + KEY_GRP_LAST_POST + "= new."
|
||||
+ KEY_RECV_TS + ";"
|
||||
+ KEY_RECV_TS + " WHERE " + KEY_GRP_ID + "=old." + KEY_GRP_ID + ";"
|
||||
+ std::string("END;"));
|
||||
}
|
||||
|
||||
|
@ -868,6 +868,7 @@ void RsGxsNetService::run(){
|
||||
|
||||
|
||||
double timeDelta = 0.2;
|
||||
int updateCounter = 0;
|
||||
|
||||
while(isRunning()){
|
||||
|
||||
@ -877,7 +878,13 @@ void RsGxsNetService::run(){
|
||||
Sleep((int) (timeDelta * 1000));
|
||||
#endif
|
||||
|
||||
if(updateCounter == 3)
|
||||
{
|
||||
updateServerSyncTS();
|
||||
updateCounter = 0;
|
||||
}
|
||||
else
|
||||
updateCounter++;
|
||||
|
||||
// process active transactions
|
||||
processTransactions();
|
||||
@ -1729,12 +1736,15 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t updateTS = 0;
|
||||
if(mGrpServerUpdateItem)
|
||||
updateTS = mGrpServerUpdateItem->grpUpdateTS;
|
||||
|
||||
RsNxsTransac* ntr = new RsNxsTransac(mServType);
|
||||
ntr->transactionNumber = transN;
|
||||
ntr->transactFlag = RsNxsTransac::FLAG_BEGIN_P1 |
|
||||
RsNxsTransac::FLAG_TYPE_GRPS;
|
||||
ntr->updateTS = time(NULL);
|
||||
ntr->updateTS = updateTS;
|
||||
ntr->nItems = grps.size();
|
||||
ntr->PeerId(tr->mTransaction->PeerId());
|
||||
|
||||
@ -1850,12 +1860,17 @@ void RsGxsNetService::locked_genSendMsgsTransaction(NxsTransaction* tr)
|
||||
return;
|
||||
}
|
||||
|
||||
std::string grpId = "";
|
||||
|
||||
for(;lit != tr->mItems.end(); lit++)
|
||||
{
|
||||
RsNxsSyncMsgItem* item = dynamic_cast<RsNxsSyncMsgItem*>(*lit);
|
||||
if (item)
|
||||
{
|
||||
msgIds[item->grpId].push_back(item->msgId);
|
||||
|
||||
if(grpId.empty())
|
||||
grpId = item->grpId;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1912,11 +1927,18 @@ void RsGxsNetService::locked_genSendMsgsTransaction(NxsTransaction* tr)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t updateTS = 0;
|
||||
|
||||
ServerMsgMap::const_iterator cit = mServerMsgUpdateMap.find(grpId);
|
||||
|
||||
if(cit != mServerMsgUpdateMap.end())
|
||||
updateTS = cit->second->msgUpdateTS;
|
||||
|
||||
RsNxsTransac* ntr = new RsNxsTransac(mServType);
|
||||
ntr->transactionNumber = transN;
|
||||
ntr->transactFlag = RsNxsTransac::FLAG_BEGIN_P1 |
|
||||
RsNxsTransac::FLAG_TYPE_MSGS;
|
||||
ntr->updateTS = time(NULL);
|
||||
ntr->updateTS = updateTS;
|
||||
ntr->nItems = msgSize;
|
||||
ntr->PeerId(peerId);
|
||||
|
||||
@ -2003,8 +2025,10 @@ void RsGxsNetService::handleRecvSyncGroup(RsNxsSyncGrp* item)
|
||||
if(mGrpServerUpdateItem)
|
||||
{
|
||||
if(item->updateTS >= mGrpServerUpdateItem->grpUpdateTS && item->updateTS != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
std::map<std::string, RsGxsGrpMetaData*> grp;
|
||||
mDataStore->retrieveGxsGrpMetaData(grp);
|
||||
|
Loading…
Reference in New Issue
Block a user