mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 17:09:34 -05:00
Request pull from peers when GXS group is created
This commit is contained in:
parent
a374f1dc6b
commit
a7f1e94cea
@ -41,6 +41,7 @@
|
||||
#include "rsserver/p3face.h"
|
||||
#include "retroshare/rsevents.h"
|
||||
#include "util/radix64.h"
|
||||
#include "util/cxx17retrocompat.h"
|
||||
|
||||
#define PUB_GRP_MASK 0x000f
|
||||
#define RESTR_GRP_MASK 0x00f0
|
||||
@ -2723,7 +2724,8 @@ bool RsGenExchange::checkKeys(const RsTlvSecurityKeySet& keySet)
|
||||
|
||||
void RsGenExchange::publishGrps()
|
||||
{
|
||||
std::list<RsGxsGroupId> groups_to_subscribe ;
|
||||
bool atLeastOneGroupCreatedSuccessfully = false;
|
||||
std::list<RsGxsGroupId> groups_to_subscribe;
|
||||
|
||||
{
|
||||
RS_STACK_MUTEX(mGenMtx) ;
|
||||
@ -2954,6 +2956,8 @@ void RsGenExchange::publishGrps()
|
||||
|
||||
// add to published to allow acknowledgement
|
||||
toNotify.insert(std::make_pair(token, GrpNote(true,ggps.mIsUpdate,grpId)));
|
||||
|
||||
atLeastOneGroupCreatedSuccessfully = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2972,9 +2976,14 @@ void RsGenExchange::publishGrps()
|
||||
|
||||
// This is done off-mutex to avoid possible cross deadlocks with the net service.
|
||||
|
||||
if(mNetService!=NULL)
|
||||
for(std::list<RsGxsGroupId>::const_iterator it(groups_to_subscribe.begin());it!=groups_to_subscribe.end();++it)
|
||||
mNetService->subscribeStatusChanged((*it),true) ;
|
||||
if(mNetService != nullptr)
|
||||
{
|
||||
for(auto& grpId : std::as_const(groups_to_subscribe))
|
||||
mNetService->subscribeStatusChanged(grpId, true);
|
||||
|
||||
if(atLeastOneGroupCreatedSuccessfully)
|
||||
mNetService->requestPull();
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t RsGenExchange::generatePublicToken()
|
||||
|
@ -250,6 +250,14 @@ public:
|
||||
|
||||
void threadTick() override; /// @see RsTickingThread
|
||||
|
||||
|
||||
/// @see RsNetworkExchangeService
|
||||
void pullFromPeers(std::set<RsPeerId> peers = std::set<RsPeerId>()) override;
|
||||
|
||||
/// @see RsNetworkExchangeService
|
||||
std::error_condition requestPull(
|
||||
std::set<RsPeerId> peers = std::set<RsPeerId>() ) override;
|
||||
|
||||
private:
|
||||
|
||||
/*!
|
||||
@ -462,22 +470,6 @@ private:
|
||||
|
||||
void checkDistantSyncState();
|
||||
|
||||
/**
|
||||
* @brief Pull new stuff from peers
|
||||
* @param peers peers to pull from, if empty all available peers are pulled
|
||||
*/
|
||||
void pullFromPeers(std::set<RsPeerId> peers = std::set<RsPeerId>());
|
||||
|
||||
/**
|
||||
* @brief request online peers to pull updates from our node ASAP
|
||||
* @param peers peers to which request pull from, if empty all available
|
||||
* peers are requested to pull
|
||||
* @return success or error details
|
||||
* TODO: should this be exposed via RsNetworkExchangeService?
|
||||
*/
|
||||
std::error_condition requestPull(
|
||||
std::set<RsPeerId> peers = std::set<RsPeerId>() );
|
||||
|
||||
void syncGrpStatistics();
|
||||
void addGroupItemToList(NxsTransaction*& tr,
|
||||
const RsGxsGroupId& grpId, uint32_t& transN,
|
||||
|
@ -325,4 +325,20 @@ public:
|
||||
return RsReputationLevel::NEUTRAL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pull new stuff from peers
|
||||
* @param peers peers to pull from, if empty all available peers are pulled
|
||||
*/
|
||||
virtual void pullFromPeers(
|
||||
std::set<RsPeerId> peers = std::set<RsPeerId>() ) = 0;
|
||||
|
||||
/**
|
||||
* @brief request online peers to pull updates from our node ASAP
|
||||
* @param peers peers to which request pull from, if empty all available
|
||||
* peers are requested to pull
|
||||
* @return success or error details
|
||||
*/
|
||||
virtual std::error_condition requestPull(
|
||||
std::set<RsPeerId> peers = std::set<RsPeerId>() ) = 0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user