Optimized polling in TokenQueue

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7748 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-12-11 22:40:03 +00:00
parent 70009367da
commit a8b08c9957

View File

@ -105,7 +105,7 @@ void TokenQueue::queueRequest(uint32_t token, uint32_t basictype, uint32_t ansty
if (mRequests.size() == 1) if (mRequests.size() == 1)
{ {
/* start the timer */ /* start the timer */
doPoll(0.1); doPoll(0.25);
} }
} }
@ -117,7 +117,7 @@ void TokenQueue::doPoll(float dt)
void TokenQueue::pollRequests() void TokenQueue::pollRequests()
{ {
double pollPeriod = 1.0; // max poll period. double pollPeriod = 0.5; // max poll period.
if (mRequests.empty()) { if (mRequests.empty()) {
return; return;
@ -142,7 +142,7 @@ void TokenQueue::pollRequests()
if (time(NULL) - req.mRequestTs.tv_sec < MAX_REQUEST_AGE) if (time(NULL) - req.mRequestTs.tv_sec < MAX_REQUEST_AGE)
{ {
mRequests.push_back(req); mRequests.push_back(req);
} }
else else
{ {
std::cerr << "TokenQueue::loadRequest(): "; std::cerr << "TokenQueue::loadRequest(): ";