mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-13 03:22:34 -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
2 changed files with 42 additions and 3 deletions
|
@ -566,7 +566,7 @@ class StoreHere
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
StoreHere(RsGxsNetService::ClientGrpMap& cgm, RsGxsNetService::ClientMsgMap cmm,
|
StoreHere(RsGxsNetService::ClientGrpMap& cgm, RsGxsNetService::ClientMsgMap& cmm,
|
||||||
RsGxsNetService::ServerMsgMap& smm,
|
RsGxsNetService::ServerMsgMap& smm,
|
||||||
RsGxsServerGrpUpdateItem*& sgm) : mClientGrpMap(cgm), mClientMsgMap(cmm),
|
RsGxsServerGrpUpdateItem*& sgm) : mClientGrpMap(cgm), mClientMsgMap(cmm),
|
||||||
mServerMsgMap(smm), mServerGrpUpdateItem(sgm)
|
mServerMsgMap(smm), mServerGrpUpdateItem(sgm)
|
||||||
|
@ -587,7 +587,7 @@ public:
|
||||||
mServerMsgMap.insert(std::make_pair(msui->grpId, msui));
|
mServerMsgMap.insert(std::make_pair(msui->grpId, msui));
|
||||||
else if((gsui = dynamic_cast<RsGxsServerGrpUpdateItem*>(item)) != NULL)
|
else if((gsui = dynamic_cast<RsGxsServerGrpUpdateItem*>(item)) != NULL)
|
||||||
{
|
{
|
||||||
if(mServerGrpUpdateItem)
|
if(mServerGrpUpdateItem == NULL)
|
||||||
{
|
{
|
||||||
mServerGrpUpdateItem = gsui;
|
mServerGrpUpdateItem = gsui;
|
||||||
}
|
}
|
||||||
|
@ -619,6 +619,7 @@ bool RsGxsNetService::loadList(std::list<RsItem *> &load)
|
||||||
{
|
{
|
||||||
std::for_each(load.begin(), load.end(), StoreHere(mClientGrpUpdateMap, mClientMsgUpdateMap,
|
std::for_each(load.begin(), load.end(), StoreHere(mClientGrpUpdateMap, mClientMsgUpdateMap,
|
||||||
mServerMsgUpdateMap, mGrpServerUpdateItem));
|
mServerMsgUpdateMap, mGrpServerUpdateItem));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,6 +649,9 @@ bool RsGxsNetService::saveList(bool& cleanup, std::list<RsItem*>& save)
|
||||||
std::back_inserter(save), get_second<ServerMsgMap>());
|
std::back_inserter(save), get_second<ServerMsgMap>());
|
||||||
|
|
||||||
save.push_back(mGrpServerUpdateItem);
|
save.push_back(mGrpServerUpdateItem);
|
||||||
|
|
||||||
|
cleanup = false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsSerialiser *RsGxsNetService::setupSerialiser()
|
RsSerialiser *RsGxsNetService::setupSerialiser()
|
||||||
|
@ -916,6 +920,8 @@ void RsGxsNetService::updateServerSyncTS()
|
||||||
mGrpServerUpdateItem = new RsGxsServerGrpUpdateItem(mServType);
|
mGrpServerUpdateItem = new RsGxsServerGrpUpdateItem(mServType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool change = false;
|
||||||
|
|
||||||
for(; mit != gxsMap.end(); mit++)
|
for(; mit != gxsMap.end(); mit++)
|
||||||
{
|
{
|
||||||
const RsGxsGroupId& grpId = mit->first;
|
const RsGxsGroupId& grpId = mit->first;
|
||||||
|
@ -933,15 +939,27 @@ void RsGxsNetService::updateServerSyncTS()
|
||||||
msui = mapIT->second;
|
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
|
// this might be very inefficient with time
|
||||||
if(grpMeta->mRecvTS > mGrpServerUpdateItem->grpUpdateTS)
|
if(grpMeta->mRecvTS > mGrpServerUpdateItem->grpUpdateTS)
|
||||||
|
{
|
||||||
mGrpServerUpdateItem->grpUpdateTS = grpMeta->mRecvTS;
|
mGrpServerUpdateItem->grpUpdateTS = grpMeta->mRecvTS;
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// actual change in config settings, then save configuration
|
||||||
|
if(change)
|
||||||
|
IndicateConfigChanged();
|
||||||
|
|
||||||
freeAndClearContainerResource<std::map<RsGxsGroupId, RsGxsGrpMetaData*>,
|
freeAndClearContainerResource<std::map<RsGxsGroupId, RsGxsGrpMetaData*>,
|
||||||
RsGxsGrpMetaData*>(gxsMap);
|
RsGxsGrpMetaData*>(gxsMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
bool RsGxsNetService::locked_checkTransacTimedOut(NxsTransaction* tr)
|
bool RsGxsNetService::locked_checkTransacTimedOut(NxsTransaction* tr)
|
||||||
{
|
{
|
||||||
|
@ -1229,6 +1247,8 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
|
||||||
item->grpUpdateTS = updateTS;
|
item->grpUpdateTS = updateTS;
|
||||||
item->peerId = peerFrom;
|
item->peerId = peerFrom;
|
||||||
|
|
||||||
|
IndicateConfigChanged();
|
||||||
|
|
||||||
|
|
||||||
}else if(flag & RsNxsTransac::FLAG_TYPE_MSGS)
|
}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->msgUpdateTS[grpId] = nxsTrans->updateTS;
|
||||||
mui->peerId = peerFrom;
|
mui->peerId = peerFrom;
|
||||||
|
|
||||||
|
IndicateConfigChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsNetService::locked_processCompletedOutgoingTrans(NxsTransaction* tr)
|
void RsGxsNetService::locked_processCompletedOutgoingTrans(NxsTransaction* tr)
|
||||||
|
@ -2159,7 +2180,12 @@ bool RsGxsNetService::locked_CanReceiveUpdate(const RsNxsSyncMsg *item)
|
||||||
const RsGxsServerMsgUpdateItem *msui = cit->second;
|
const RsGxsServerMsgUpdateItem *msui = cit->second;
|
||||||
|
|
||||||
if(item->updateTS >= msui->msgUpdateTS && item->updateTS != 0)
|
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 false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2502,6 +2502,19 @@ int RsServer::StartupRetroShare()
|
||||||
mConfigMgr->addConfiguration("bitdht.cfg", mBitDht);
|
mConfigMgr->addConfiguration("bitdht.cfg", mBitDht);
|
||||||
#endif
|
#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) ;
|
mPluginsManager->addConfigurations(mConfigMgr) ;
|
||||||
|
|
||||||
ftserver->addConfiguration(mConfigMgr);
|
ftserver->addConfiguration(mConfigMgr);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue