mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-25 09:11:06 -04:00
merging gxs_phase2 branch
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6401 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
1150366913
commit
325fa4f222
116 changed files with 6050 additions and 3596 deletions
|
@ -34,79 +34,9 @@
|
|||
#include "rsnxsobserver.h"
|
||||
#include "pqi/p3linkmgr.h"
|
||||
#include "serialiser/rsnxsitems.h"
|
||||
|
||||
#include "rsgxsnetutils.h"
|
||||
#include "pqi/p3cfgmgr.h"
|
||||
|
||||
|
||||
/*!
|
||||
* This represents a transaction made
|
||||
* with the NxsNetService in all states
|
||||
* of operation until completion
|
||||
*
|
||||
*/
|
||||
class NxsTransaction
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
static const uint8_t FLAG_STATE_STARTING; // when
|
||||
static const uint8_t FLAG_STATE_RECEIVING; // begin receiving items for incoming trans
|
||||
static const uint8_t FLAG_STATE_SENDING; // begin sending items for outgoing trans
|
||||
static const uint8_t FLAG_STATE_COMPLETED;
|
||||
static const uint8_t FLAG_STATE_FAILED;
|
||||
static const uint8_t FLAG_STATE_WAITING_CONFIRM;
|
||||
|
||||
NxsTransaction();
|
||||
~NxsTransaction();
|
||||
|
||||
uint32_t mFlag; // current state of transaction
|
||||
uint32_t mTimeOut;
|
||||
|
||||
/*!
|
||||
* this contains who we
|
||||
* c what peer this transaction involves.
|
||||
* c The type of transaction
|
||||
* c transaction id
|
||||
* c timeout set for this transaction
|
||||
* c and itemCount
|
||||
*/
|
||||
RsNxsTransac* mTransaction;
|
||||
std::list<RsNxsItem*> mItems; // items received or sent
|
||||
};
|
||||
|
||||
/*!
|
||||
* An abstraction of the net manager
|
||||
* for retrieving Rs peers whom you will be synchronising
|
||||
* and also you own Id
|
||||
* Useful for testing also (abstracts away Rs's p3NetMgr)
|
||||
*/
|
||||
class RsNxsNetMgr
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
virtual std::string getOwnId() = 0;
|
||||
virtual void getOnlineList(std::set<std::string>& ssl_peers) = 0;
|
||||
|
||||
};
|
||||
|
||||
class RsNxsNetMgrImpl : public RsNxsNetMgr
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
RsNxsNetMgrImpl(p3LinkMgr* lMgr);
|
||||
|
||||
std::string getOwnId();
|
||||
void getOnlineList(std::set<std::string>& ssl_peers);
|
||||
|
||||
private:
|
||||
|
||||
p3LinkMgr* mLinkMgr;
|
||||
RsMutex mNxsNetMgrMtx;
|
||||
|
||||
};
|
||||
|
||||
#include "rsgixs.h"
|
||||
|
||||
/// keep track of transaction number
|
||||
typedef std::map<uint32_t, NxsTransaction*> TransactionIdMap;
|
||||
|
@ -139,9 +69,11 @@ public:
|
|||
* @param servType service type
|
||||
* @param gds The data service which allows read access to a service/store
|
||||
* @param nxsObs observer will be notified whenever new messages/grps
|
||||
* @param nxsObs observer will be notified whenever new messages/grps
|
||||
* arrive
|
||||
*/
|
||||
RsGxsNetService(uint16_t servType, RsGeneralDataService* gds, RsNxsNetMgr* netMgr, RsNxsObserver* nxsObs = NULL);
|
||||
RsGxsNetService(uint16_t servType, RsGeneralDataService* gds, RsNxsNetMgr* netMgr,
|
||||
RsNxsObserver* nxsObs = NULL, RsGixsReputation* repuations = NULL, RsGcxs* circles = NULL);
|
||||
|
||||
virtual ~RsGxsNetService();
|
||||
|
||||
|
@ -361,7 +293,34 @@ private:
|
|||
/** E: item handlers **/
|
||||
|
||||
|
||||
void runVetting();
|
||||
|
||||
/*!
|
||||
* @param peerId The peer to vet to see if they can receive this groupid
|
||||
* @param grpMeta this is the meta item to determine if it can be sent to given peer
|
||||
* @param toVet groupid/peer to vet are stored here if their circle id is not cached
|
||||
* @return false, if you cannot send to this peer, true otherwise
|
||||
*/
|
||||
bool canSendGrpId(const std::string& sslId, RsGxsGrpMetaData& grpMeta, std::vector<GrpIdCircleVet>& toVet);
|
||||
|
||||
|
||||
bool canSendMsgIds(const std::vector<RsGxsMsgMetaData*>& msgMetas, const RsGxsGrpMetaData&, const std::string& sslId);
|
||||
|
||||
void locked_createTransactionFromPending(MsgRespPending* grpPend);
|
||||
void locked_createTransactionFromPending(GrpRespPending* msgPend);
|
||||
void locked_createTransactionFromPending(GrpCircleIdRequestVetting* grpPend);
|
||||
void locked_createTransactionFromPending(MsgCircleIdsRequestVetting* grpPend);
|
||||
|
||||
void locked_pushMsgTransactionFromList(std::list<RsNxsItem*>& reqList, const std::string& peerId, const uint32_t& transN);
|
||||
void locked_pushGrpTransactionFromList(std::list<RsNxsItem*>& reqList, const std::string& peerId, const uint32_t& transN);
|
||||
void locked_pushGrpRespFromList(std::list<RsNxsItem*>& respList, const std::string& peer, const uint32_t& transN);
|
||||
void locked_pushMsgRespFromList(std::list<RsNxsItem*>& itemL, const std::string& sslId, const uint32_t& transN);
|
||||
void syncWithPeers();
|
||||
void addGroupItemToList(NxsTransaction*& tr,
|
||||
const std::string& grpId, uint32_t& transN,
|
||||
std::list<RsNxsItem*>& reqList);
|
||||
|
||||
bool locked_canReceive(const RsGxsGrpMetaData * const grpMeta, const std::string& peerId);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -457,6 +416,12 @@ private:
|
|||
|
||||
const uint32_t mSYNC_PERIOD;
|
||||
|
||||
RsGcxs* mCircles;
|
||||
RsGixsReputation* mReputations;
|
||||
|
||||
// need to be verfied
|
||||
std::vector<AuthorPending*> mPendingResp;
|
||||
std::vector<GrpCircleVetting*> mPendingCircleVets;
|
||||
};
|
||||
|
||||
#endif // RSGXSNETSERVICE_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue