mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-10 10:05:19 -04:00
Request pull from peers when GXS group is created
This commit is contained in:
parent
a374f1dc6b
commit
a7f1e94cea
3 changed files with 37 additions and 20 deletions
|
@ -41,6 +41,7 @@
|
||||||
#include "rsserver/p3face.h"
|
#include "rsserver/p3face.h"
|
||||||
#include "retroshare/rsevents.h"
|
#include "retroshare/rsevents.h"
|
||||||
#include "util/radix64.h"
|
#include "util/radix64.h"
|
||||||
|
#include "util/cxx17retrocompat.h"
|
||||||
|
|
||||||
#define PUB_GRP_MASK 0x000f
|
#define PUB_GRP_MASK 0x000f
|
||||||
#define RESTR_GRP_MASK 0x00f0
|
#define RESTR_GRP_MASK 0x00f0
|
||||||
|
@ -2723,6 +2724,7 @@ bool RsGenExchange::checkKeys(const RsTlvSecurityKeySet& keySet)
|
||||||
|
|
||||||
void RsGenExchange::publishGrps()
|
void RsGenExchange::publishGrps()
|
||||||
{
|
{
|
||||||
|
bool atLeastOneGroupCreatedSuccessfully = false;
|
||||||
std::list<RsGxsGroupId> groups_to_subscribe;
|
std::list<RsGxsGroupId> groups_to_subscribe;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -2954,6 +2956,8 @@ void RsGenExchange::publishGrps()
|
||||||
|
|
||||||
// add to published to allow acknowledgement
|
// add to published to allow acknowledgement
|
||||||
toNotify.insert(std::make_pair(token, GrpNote(true,ggps.mIsUpdate,grpId)));
|
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.
|
// This is done off-mutex to avoid possible cross deadlocks with the net service.
|
||||||
|
|
||||||
if(mNetService!=NULL)
|
if(mNetService != nullptr)
|
||||||
for(std::list<RsGxsGroupId>::const_iterator it(groups_to_subscribe.begin());it!=groups_to_subscribe.end();++it)
|
{
|
||||||
mNetService->subscribeStatusChanged((*it),true) ;
|
for(auto& grpId : std::as_const(groups_to_subscribe))
|
||||||
|
mNetService->subscribeStatusChanged(grpId, true);
|
||||||
|
|
||||||
|
if(atLeastOneGroupCreatedSuccessfully)
|
||||||
|
mNetService->requestPull();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t RsGenExchange::generatePublicToken()
|
uint32_t RsGenExchange::generatePublicToken()
|
||||||
|
|
|
@ -250,6 +250,14 @@ public:
|
||||||
|
|
||||||
void threadTick() override; /// @see RsTickingThread
|
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:
|
private:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -462,22 +470,6 @@ private:
|
||||||
|
|
||||||
void checkDistantSyncState();
|
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 syncGrpStatistics();
|
||||||
void addGroupItemToList(NxsTransaction*& tr,
|
void addGroupItemToList(NxsTransaction*& tr,
|
||||||
const RsGxsGroupId& grpId, uint32_t& transN,
|
const RsGxsGroupId& grpId, uint32_t& transN,
|
||||||
|
|
|
@ -325,4 +325,20 @@ public:
|
||||||
return RsReputationLevel::NEUTRAL;
|
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…
Add table
Add a link
Reference in a new issue