added cleanup function to test hub

refined group retrieval for RsDataService
also added fix for RsNxsTrasac flag masks
added group data send transaction generation, and fix for request generation

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5298 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-07-14 17:59:54 +00:00
parent 24f6f874f2
commit d3e5ec2836
12 changed files with 489 additions and 147 deletions

View file

@ -31,12 +31,11 @@ public:
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 mTimestamp;
uint32_t mTimeOut;
/*!
* this contains who we
@ -50,11 +49,15 @@ public:
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;
@ -205,6 +208,18 @@ private:
*/
void processCompletedTransactions();
/*!
* Process transaction owned/started by user
* @param tr transaction to process, ownership stays with callee
*/
void processCompletedOutgoingTrans(NxsTransaction* tr);
/*!
* Process transactions started/owned by other peers
* @param tr transaction to process, ownership stays with callee
*/
void processCompletedIncomingTrans(NxsTransaction* tr);
/*!
* Process a transaction item, assumes a general lock
@ -246,22 +261,47 @@ private:
//void notifyListenerMsgs(std::list<RsNxsMsg*>& msgs);
/*!
* Generates new transaction to send msg requests based on list
* of msgs received from peer stored in passed transaction
* @param tr transaction responsible for generating msg request
*/
void genReqMsgTransaction(NxsTransaction* tr);
/*!
* Generates new transaction to send grp requests based on list
* of grps received from peer stored in passed transaction
* @param tr transaction responsible for generating grp request
*/
void genReqGrpTransaction(NxsTransaction* tr);
/*!
* Generates new transaction to send msg data based on list
* of grpids received from peer stored in passed transaction
* @param tr transaction responsible for generating grp request
*/
void genSendMsgsTransaction(NxsTransaction* tr);
/*!
* Generates new transaction to send grp data based on list
* of grps received from peer stored in passed transaction
* @param tr transaction responsible for generating grp request
*/
void genSendGrpsTransaction(NxsTransaction* tr);
/*!
* convenience function to add a transaction to list
* @param tr transaction to add
*/
bool locked_addTransaction(NxsTransaction* tr);
void cleanTransactionItems(NxsTransaction* tr) const;
/*!
* @param tr the transaction to check for timeout
* @return false if transaction has timed out, true otherwise
*/
bool checkTransacTimedOut(NxsTransaction* tr);
/** E: Transaction processing **/
/** S: item handlers **/
@ -316,8 +356,12 @@ private:
RsNxsObserver* mObserver;
RsGeneralDataService* mDataStore;
uint16_t mServType;
// how much time must elapse before a timeout failure
// for an active transaction
uint32_t mTransactionTimeOut;
std::string mOwnId;
RsNxsNetMgr* mNetMgr;