mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-03-21 06:16:29 -04:00
- enabled config saving of sync information
- additional fixes for sync reloading - confirmed sync now working with A B test git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs_finale@6951 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
dab782fbaa
commit
cc7569e396
@ -566,7 +566,7 @@ class StoreHere
|
||||
{
|
||||
public:
|
||||
|
||||
StoreHere(RsGxsNetService::ClientGrpMap& cgm, RsGxsNetService::ClientMsgMap cmm,
|
||||
StoreHere(RsGxsNetService::ClientGrpMap& cgm, RsGxsNetService::ClientMsgMap& cmm,
|
||||
RsGxsNetService::ServerMsgMap& smm,
|
||||
RsGxsServerGrpUpdateItem*& sgm) : mClientGrpMap(cgm), mClientMsgMap(cmm),
|
||||
mServerMsgMap(smm), mServerGrpUpdateItem(sgm)
|
||||
@ -587,7 +587,7 @@ public:
|
||||
mServerMsgMap.insert(std::make_pair(msui->grpId, msui));
|
||||
else if((gsui = dynamic_cast<RsGxsServerGrpUpdateItem*>(item)) != NULL)
|
||||
{
|
||||
if(mServerGrpUpdateItem)
|
||||
if(mServerGrpUpdateItem == NULL)
|
||||
{
|
||||
mServerGrpUpdateItem = gsui;
|
||||
}
|
||||
@ -619,6 +619,7 @@ bool RsGxsNetService::loadList(std::list<RsItem *> &load)
|
||||
{
|
||||
std::for_each(load.begin(), load.end(), StoreHere(mClientGrpUpdateMap, mClientMsgUpdateMap,
|
||||
mServerMsgUpdateMap, mGrpServerUpdateItem));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -648,6 +649,9 @@ bool RsGxsNetService::saveList(bool& cleanup, std::list<RsItem*>& save)
|
||||
std::back_inserter(save), get_second<ServerMsgMap>());
|
||||
|
||||
save.push_back(mGrpServerUpdateItem);
|
||||
|
||||
cleanup = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
RsSerialiser *RsGxsNetService::setupSerialiser()
|
||||
@ -916,6 +920,8 @@ void RsGxsNetService::updateServerSyncTS()
|
||||
mGrpServerUpdateItem = new RsGxsServerGrpUpdateItem(mServType);
|
||||
}
|
||||
|
||||
bool change = false;
|
||||
|
||||
for(; mit != gxsMap.end(); mit++)
|
||||
{
|
||||
const RsGxsGroupId& grpId = mit->first;
|
||||
@ -933,15 +939,27 @@ void RsGxsNetService::updateServerSyncTS()
|
||||
msui = mapIT->second;
|
||||
}
|
||||
|
||||
msui->msgUpdateTS = grpMeta->mLastPost;
|
||||
if(grpMeta->mLastPost > msui->msgUpdateTS )
|
||||
{
|
||||
change = true;
|
||||
msui->msgUpdateTS = grpMeta->mLastPost;
|
||||
}
|
||||
|
||||
// this might be very inefficient with time
|
||||
if(grpMeta->mRecvTS > mGrpServerUpdateItem->grpUpdateTS)
|
||||
{
|
||||
mGrpServerUpdateItem->grpUpdateTS = grpMeta->mRecvTS;
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
|
||||
// actual change in config settings, then save configuration
|
||||
if(change)
|
||||
IndicateConfigChanged();
|
||||
|
||||
freeAndClearContainerResource<std::map<RsGxsGroupId, RsGxsGrpMetaData*>,
|
||||
RsGxsGrpMetaData*>(gxsMap);
|
||||
|
||||
}
|
||||
bool RsGxsNetService::locked_checkTransacTimedOut(NxsTransaction* tr)
|
||||
{
|
||||
@ -1229,6 +1247,8 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
|
||||
item->grpUpdateTS = updateTS;
|
||||
item->peerId = peerFrom;
|
||||
|
||||
IndicateConfigChanged();
|
||||
|
||||
|
||||
}else if(flag & RsNxsTransac::FLAG_TYPE_MSGS)
|
||||
{
|
||||
@ -1310,6 +1330,7 @@ void RsGxsNetService::locked_doMsgUpdateWork(const RsNxsTransac *nxsTrans, const
|
||||
mui->msgUpdateTS[grpId] = nxsTrans->updateTS;
|
||||
mui->peerId = peerFrom;
|
||||
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
|
||||
void RsGxsNetService::locked_processCompletedOutgoingTrans(NxsTransaction* tr)
|
||||
@ -2159,7 +2180,12 @@ bool RsGxsNetService::locked_CanReceiveUpdate(const RsNxsSyncMsg *item)
|
||||
const RsGxsServerMsgUpdateItem *msui = cit->second;
|
||||
|
||||
if(item->updateTS >= msui->msgUpdateTS && item->updateTS != 0)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << "RsGxsNetService::locked_CanReceiveUpdate(): Msgs up to date" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2502,6 +2502,19 @@ int RsServer::StartupRetroShare()
|
||||
mConfigMgr->addConfiguration("bitdht.cfg", mBitDht);
|
||||
#endif
|
||||
|
||||
#ifdef RS_ENABLE_GXS
|
||||
|
||||
mConfigMgr->addConfiguration("identity.cfg", gxsid_ns);
|
||||
mConfigMgr->addConfiguration("gxsforums.cfg", gxsforums_ns);
|
||||
mConfigMgr->addConfiguration("gxschannels.cfg", gxschannels_ns);
|
||||
mConfigMgr->addConfiguration("gxscircles.cfg", gxscircles_ns);
|
||||
mConfigMgr->addConfiguration("posted.cfg", posted_ns);
|
||||
mConfigMgr->addConfiguration("wire.cfg", wire_ns);
|
||||
mConfigMgr->addConfiguration("wiki.cfg", wiki_ns);
|
||||
mConfigMgr->addConfiguration("photo.cfg", photo_ns);
|
||||
|
||||
#endif
|
||||
|
||||
mPluginsManager->addConfigurations(mConfigMgr) ;
|
||||
|
||||
ftserver->addConfiguration(mConfigMgr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user