Always clean ds queue

Closes #727
This commit is contained in:
UdjinM6 2016-03-08 14:09:22 +03:00 committed by Holger Schinzel
parent 1b41f851bf
commit eeb4e9c11a
2 changed files with 14 additions and 13 deletions

View File

@ -792,6 +792,18 @@ void CDarksendPool::ChargeRandomFees(){
// Check for various timeouts (queue objects, Darksend, etc)
//
void CDarksendPool::CheckTimeout(){
// check Darksend queue objects for timeouts
int c = 0;
vector<CDarksendQueue>::iterator it = vecDarksendQueue.begin();
while(it != vecDarksendQueue.end()){
if((*it).IsExpired()){
LogPrint("darksend", "CDarksendPool::CheckTimeout() : Removing expired queue entry - %d\n", c);
it = vecDarksendQueue.erase(it);
} else ++it;
c++;
}
if(!fEnableDarksend && !fMasterNode) return;
// catching hanging sessions
@ -812,17 +824,6 @@ void CDarksendPool::CheckTimeout(){
}
}
// check Darksend queue objects for timeouts
int c = 0;
vector<CDarksendQueue>::iterator it = vecDarksendQueue.begin();
while(it != vecDarksendQueue.end()){
if((*it).IsExpired()){
LogPrint("darksend", "CDarksendPool::CheckTimeout() : Removing expired queue entry - %d\n", c);
it = vecDarksendQueue.erase(it);
} else ++it;
c++;
}
int addLagTime = 0;
if(!fMasterNode) addLagTime = 10000; //if we're the client, give the server a few extra seconds before resetting.

View File

@ -146,7 +146,7 @@ public:
bool IsExpired()
{
return (GetTime() - addedTime) > DARKSEND_QUEUE_TIMEOUT;// 120 seconds
return (GetTime() - addedTime) > DARKSEND_QUEUE_TIMEOUT;// 30 seconds
}
};
@ -220,7 +220,7 @@ public:
/// Is this Darksend expired?
bool IsExpired()
{
return (GetTime() - time) > DARKSEND_QUEUE_TIMEOUT;// 120 seconds
return (GetTime() - time) > DARKSEND_QUEUE_TIMEOUT;// 30 seconds
}
/// Check if we have a valid Masternode address