mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-27 08:25:53 -04:00
Rename GXS pullFromPeers to pullFromPeers
According to what discussed with Cyril
This commit is contained in:
parent
ebbd8cf938
commit
cd5dad6a75
4 changed files with 24 additions and 19 deletions
|
@ -35,7 +35,7 @@
|
||||||
// |
|
// |
|
||||||
// +----------- sharePublishKeys()
|
// +----------- sharePublishKeys()
|
||||||
// |
|
// |
|
||||||
// +----------- pullFromPeers()
|
// +----------- checkUpdatesFromPeers()
|
||||||
// | |
|
// | |
|
||||||
// | +--if AutoSync--- send global UpdateTS of each peer to itself => the peer knows the last
|
// | +--if AutoSync--- send global UpdateTS of each peer to itself => the peer knows the last
|
||||||
// | | time current peer has received an updated from himself
|
// | | time current peer has received an updated from himself
|
||||||
|
@ -127,14 +127,14 @@
|
||||||
// (Set at server side to be mGrpServerUpdateItem->grpUpdateTS)
|
// (Set at server side to be mGrpServerUpdateItem->grpUpdateTS)
|
||||||
//
|
//
|
||||||
// Only updated in processCompletedIncomingTransaction() from Grp list transaction.
|
// Only updated in processCompletedIncomingTransaction() from Grp list transaction.
|
||||||
// Used in pullFromPeers() sending in RsNxsSyncGrp once to all peers: peer will send data if
|
// Used in checkUpdatesFromPeers() sending in RsNxsSyncGrp once to all peers: peer will send data if
|
||||||
// has something new. All time comparisons are in the friends' clock time.
|
// has something new. All time comparisons are in the friends' clock time.
|
||||||
//
|
//
|
||||||
// mClientMsgUpdateMap: map< RsPeerId, map<grpId,TimeStamp > >
|
// mClientMsgUpdateMap: map< RsPeerId, map<grpId,TimeStamp > >
|
||||||
//
|
//
|
||||||
// Last msg list modification time sent by that peer Id
|
// Last msg list modification time sent by that peer Id
|
||||||
// Updated in processCompletedIncomingTransaction() from Grp list trans.
|
// Updated in processCompletedIncomingTransaction() from Grp list trans.
|
||||||
// Used in pullFromPeers() sending in RsNxsSyncGrp once to all peers.
|
// Used in checkUpdatesFromPeers() sending in RsNxsSyncGrp once to all peers.
|
||||||
// Set at server to be mServerMsgUpdateMap[grpId]->msgUpdateTS
|
// Set at server to be mServerMsgUpdateMap[grpId]->msgUpdateTS
|
||||||
//
|
//
|
||||||
// mGrpServerUpdateItem: TimeStamp Last group local modification timestamp over all groups
|
// mGrpServerUpdateItem: TimeStamp Last group local modification timestamp over all groups
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
//
|
//
|
||||||
// tick() tick()
|
// tick() tick()
|
||||||
// | |
|
// | |
|
||||||
// +---- pullFromPeers +-- recvNxsItemQueue()
|
// +---- checkUpdatesFromPeers() +-- recvNxsItemQueue()
|
||||||
// | |
|
// | |
|
||||||
// +---------------- Send global UpdateTS of each peer to itself => the peer knows +---------> +------ handleRecvSyncGroup( RsNxsSyncGrp*)
|
// +---------------- Send global UpdateTS of each peer to itself => the peer knows +---------> +------ handleRecvSyncGroup( RsNxsSyncGrp*)
|
||||||
// | the last msg sent (stored in mClientGrpUpdateMap[peer_id]), | | - parse all subscribed groups. For each, send a RsNxsSyncGrpItem with publish TS
|
// | the last msg sent (stored in mClientGrpUpdateMap[peer_id]), | | - parse all subscribed groups. For each, send a RsNxsSyncGrpItem with publish TS
|
||||||
|
@ -457,7 +457,7 @@ int RsGxsNetService::tick()
|
||||||
|
|
||||||
if((elapsed) < now)
|
if((elapsed) < now)
|
||||||
{
|
{
|
||||||
pullFromPeers();
|
checkUpdatesFromPeers();
|
||||||
syncGrpStatistics();
|
syncGrpStatistics();
|
||||||
checkDistantSyncState();
|
checkDistantSyncState();
|
||||||
|
|
||||||
|
@ -570,7 +570,8 @@ RsGxsGroupId RsGxsNetService::hashGrpId(const RsGxsGroupId& gid,const RsPeerId&
|
||||||
return RsGxsGroupId( RsDirUtil::sha1sum(tmpmem,SIZE).toByteArray() );
|
return RsGxsGroupId( RsDirUtil::sha1sum(tmpmem,SIZE).toByteArray() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsNetService::pullFromPeers(std::set<RsPeerId> peers)
|
std::error_condition RsGxsNetService::checkUpdatesFromPeers(
|
||||||
|
std::set<RsPeerId> peers )
|
||||||
{
|
{
|
||||||
#ifdef NXS_NET_DEBUG_0
|
#ifdef NXS_NET_DEBUG_0
|
||||||
RS_DBG("this=", (void*)this, ". serviceInfo=", mServiceInfo);
|
RS_DBG("this=", (void*)this, ". serviceInfo=", mServiceInfo);
|
||||||
|
@ -594,8 +595,8 @@ void RsGxsNetService::pullFromPeers(std::set<RsPeerId> peers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Still empty? Then nothing to do
|
// Still empty? Reports there are no available peers
|
||||||
if (peers.empty()) return;
|
if (peers.empty()) return std::errc::network_down;
|
||||||
|
|
||||||
|
|
||||||
RS_STACK_MUTEX(mNxsMutex);
|
RS_STACK_MUTEX(mNxsMutex);
|
||||||
|
@ -624,7 +625,7 @@ void RsGxsNetService::pullFromPeers(std::set<RsPeerId> peers)
|
||||||
generic_sendItem(grp);
|
generic_sendItem(grp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mAllowMsgSync) return;
|
if(!mAllowMsgSync) return std::error_condition();
|
||||||
|
|
||||||
#ifndef GXS_DISABLE_SYNC_MSGS
|
#ifndef GXS_DISABLE_SYNC_MSGS
|
||||||
|
|
||||||
|
@ -742,7 +743,9 @@ void RsGxsNetService::pullFromPeers(std::set<RsPeerId> peers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // ndef GXS_DISABLE_SYNC_MSGS
|
||||||
|
|
||||||
|
return std::error_condition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsNetService::generic_sendItem(rs_owner_ptr<RsItem> si)
|
void RsGxsNetService::generic_sendItem(rs_owner_ptr<RsItem> si)
|
||||||
|
@ -5123,7 +5126,7 @@ std::error_condition RsGxsNetService::requestPull(std::set<RsPeerId> peers)
|
||||||
void RsGxsNetService::handlePullRequest(
|
void RsGxsNetService::handlePullRequest(
|
||||||
std::unique_ptr<RsNxsPullRequestItem> item )
|
std::unique_ptr<RsNxsPullRequestItem> item )
|
||||||
{
|
{
|
||||||
pullFromPeers(std::set<RsPeerId>{item->PeerId()});
|
checkUpdatesFromPeers(std::set<RsPeerId>{item->PeerId()});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsGxsNetService::getGroupServerUpdateTS(const RsGxsGroupId& gid,rstime_t& group_server_update_TS, rstime_t& msg_server_update_TS)
|
bool RsGxsNetService::getGroupServerUpdateTS(const RsGxsGroupId& gid,rstime_t& group_server_update_TS, rstime_t& msg_server_update_TS)
|
||||||
|
|
|
@ -252,7 +252,8 @@ public:
|
||||||
|
|
||||||
|
|
||||||
/// @see RsNetworkExchangeService
|
/// @see RsNetworkExchangeService
|
||||||
void pullFromPeers(std::set<RsPeerId> peers = std::set<RsPeerId>()) override;
|
std::error_condition checkUpdatesFromPeers(
|
||||||
|
std::set<RsPeerId> peers = std::set<RsPeerId>() ) override;
|
||||||
|
|
||||||
/// @see RsNetworkExchangeService
|
/// @see RsNetworkExchangeService
|
||||||
std::error_condition requestPull(
|
std::error_condition requestPull(
|
||||||
|
|
|
@ -327,10 +327,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Pull new stuff from peers
|
* @brief Check if new stuff is available from peers
|
||||||
* @param peers peers to pull from, if empty all available peers are pulled
|
* @param peers peers to check, if empty all available peers are checked
|
||||||
*/
|
*/
|
||||||
virtual void pullFromPeers(
|
virtual std::error_condition checkUpdatesFromPeers(
|
||||||
std::set<RsPeerId> peers = std::set<RsPeerId>() ) = 0;
|
std::set<RsPeerId> peers = std::set<RsPeerId>() ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -907,12 +907,12 @@ bool p3GxsForums::subscribeToForum(const RsGxsGroupId& groupId, bool subscribe )
|
||||||
acknowledgeGrp(token, grp);
|
acknowledgeGrp(token, grp);
|
||||||
|
|
||||||
/* Since subscribe has been requested, the caller is most probably
|
/* Since subscribe has been requested, the caller is most probably
|
||||||
* interested in getting the group messages ASAP so pull from peers without
|
* interested in getting the group messages ASAP so check updates from peers
|
||||||
* waiting GXS sync timer.
|
* without waiting GXS sync timer.
|
||||||
* Do it here as this is meaningful or not depending on the service.
|
* Do it here as this is meaningful or not depending on the service.
|
||||||
* Do it only after the token has been completed otherwise the pull have no
|
* Do it only after the token has been completed otherwise the pull have no
|
||||||
* effect. */
|
* effect. */
|
||||||
if(subscribe) RsGenExchange::netService()->pullFromPeers();
|
if(subscribe) RsGenExchange::netService()->checkUpdatesFromPeers();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1161,7 +1161,8 @@ std::error_condition p3GxsForums::setPostKeepForever(
|
||||||
|
|
||||||
std::error_condition p3GxsForums::requestSynchronization()
|
std::error_condition p3GxsForums::requestSynchronization()
|
||||||
{
|
{
|
||||||
RsGenExchange::netService()->pullFromPeers();
|
auto errc = RsGenExchange::netService()->checkUpdatesFromPeers();
|
||||||
|
if(errc) return errc;
|
||||||
return RsGenExchange::netService()->requestPull();
|
return RsGenExchange::netService()->requestPull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue