increased sync period in RsGxsNetService so as to reduce network load. Increased transaction timeout to 30 seconds to avoid wasting too many transactions

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7592 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-10-09 17:20:09 +00:00
parent a82ce123bb
commit 39e8028837

View File

@ -38,8 +38,8 @@
#define GIXS_CUT_OFF 0 #define GIXS_CUT_OFF 0
#define SYNC_PERIOD 12 // in microseconds every 10 seconds (1 second for testing) #define SYNC_PERIOD 60 // every 60 seconds (1 second for testing)
#define TRANSAC_TIMEOUT 10 // 10 seconds #define TRANSAC_TIMEOUT 30 // 30 seconds. Has been increased to avoid epidemic transaction cancelling.
const uint32_t RsGxsNetService::FRAGMENT_SIZE = 150000; const uint32_t RsGxsNetService::FRAGMENT_SIZE = 150000;
@ -1067,12 +1067,10 @@ void RsGxsNetService::processTransactions(){
// first check transaction has not expired // first check transaction has not expired
if(locked_checkTransacTimedOut(tr)) if(locked_checkTransacTimedOut(tr))
{ {
std::cerr << std::dec ;
#ifdef NXS_NET_DEBUG int total_transaction_time = (int)time(NULL) - (tr->mTimeOut - mTransactionTimeOut) ;
std::cerr << "processTransactions() " << std::endl; std::cerr << "Outgoing Transaction has failed, tranN: " << transN << ", Peer: " << mit->first ;
std::cerr << "Transaction has failed, tranN: " << transN << std::endl; std::cerr << ", age: " << total_transaction_time << ", nItems=" << tr->mTransaction->nItems << ". tr->mTimeOut = " << tr->mTimeOut << ", now = " << (uint32_t) time(NULL) << std::endl;
std::cerr << "Transaction has failed, Peer: " << mit->first << std::endl;
#endif
tr->mFlag = NxsTransaction::FLAG_STATE_FAILED; tr->mFlag = NxsTransaction::FLAG_STATE_FAILED;
toRemove.push_back(transN); toRemove.push_back(transN);
@ -1103,6 +1101,11 @@ void RsGxsNetService::processTransactions(){
}else if(flag & NxsTransaction::FLAG_STATE_COMPLETED){ }else if(flag & NxsTransaction::FLAG_STATE_COMPLETED){
#ifdef NXS_NET_DEBUG
int total_transaction_time = (int)time(NULL) - (tr->mTimeOut - mTransactionTimeOut) ;
std::cerr << "RsGxsNetService::processTransactions() outgoing completed " << tr->mTransaction->nItems << " items transaction in " << total_transaction_time << " seconds." << std::endl;
#endif
// move to completed transactions // move to completed transactions
toRemove.push_back(transN); toRemove.push_back(transN);
mComplTransactions.push_back(tr); mComplTransactions.push_back(tr);
@ -1143,10 +1146,10 @@ void RsGxsNetService::processTransactions(){
// first check transaction has not expired // first check transaction has not expired
if(locked_checkTransacTimedOut(tr)) if(locked_checkTransacTimedOut(tr))
{ {
std::cerr << std::dec ;
std::cerr << "processTransactions() " << std::endl; int total_transaction_time = (int)time(NULL) - (tr->mTimeOut - mTransactionTimeOut) ;
std::cerr << "Transaction has failed, tranN: " << transN << std::endl; std::cerr << "Incoming Transaction has failed, tranN: " << transN << ", Peer: " << mit->first ;
std::cerr << "Transaction has failed, Peer: " << mit->first << std::endl; std::cerr << ", age: " << total_transaction_time << ", nItems=" << tr->mTransaction->nItems << ". tr->mTimeOut = " << tr->mTimeOut << ", now = " << (uint32_t) time(NULL) << std::endl;
tr->mFlag = NxsTransaction::FLAG_STATE_FAILED; tr->mFlag = NxsTransaction::FLAG_STATE_FAILED;
toRemove.push_back(transN); toRemove.push_back(transN);
@ -1176,6 +1179,10 @@ void RsGxsNetService::processTransactions(){
// move to completed transactions // move to completed transactions
mComplTransactions.push_back(tr); mComplTransactions.push_back(tr);
#ifdef NXS_NET_DEBUG
int total_transaction_time = (int)time(NULL) - (tr->mTimeOut - mTransactionTimeOut) ;
std::cerr << "RsGxsNetService::processTransactions() incoming completed " << tr->mTransaction->nItems << " items transaction in " << total_transaction_time << " seconds." << std::endl;
#endif
// transaction processing done // transaction processing done
// for this id, add to removal list // for this id, add to removal list