mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-15 04:22:27 -04:00
Reworked ranking process flow
added ranking retrieval in gui removed locks from TokenQueue refactored gxs p3 pointers in p3face header file and gxs services now shutdown correctly using join(led to bad segfaults on shutdown) git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5972 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f8c83779af
commit
3eaf844ec8
13 changed files with 297 additions and 92 deletions
|
@ -98,9 +98,9 @@ void TokenQueue::queueRequest(uint32_t token, uint32_t basictype, uint32_t ansty
|
|||
gettimeofday(&req.mRequestTs, NULL);
|
||||
req.mPollTs = req.mRequestTs;
|
||||
|
||||
mTokenMtx.lock();
|
||||
|
||||
mRequests.push_back(req);
|
||||
mTokenMtx.unlock();
|
||||
|
||||
|
||||
if (mRequests.size() == 1)
|
||||
{
|
||||
|
@ -126,10 +126,10 @@ void TokenQueue::pollRequests()
|
|||
|
||||
TokenRequest req;
|
||||
|
||||
mTokenMtx.lock();
|
||||
|
||||
req = mRequests.front();
|
||||
mRequests.pop_front();
|
||||
mTokenMtx.unlock();
|
||||
|
||||
|
||||
if (checkForRequest(req.mToken))
|
||||
{
|
||||
|
@ -144,9 +144,9 @@ void TokenQueue::pollRequests()
|
|||
/* drop old requests too */
|
||||
if (time(NULL) - req.mRequestTs.tv_sec < MAX_REQUEST_AGE)
|
||||
{
|
||||
mTokenMtx.lock();
|
||||
|
||||
mRequests.push_back(req);
|
||||
mTokenMtx.unlock();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -170,9 +170,9 @@ bool TokenQueue::checkForRequest(uint32_t token)
|
|||
(RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == status) );
|
||||
}
|
||||
|
||||
bool TokenQueue::activeRequestExist(const uint32_t& userType)
|
||||
bool TokenQueue::activeRequestExist(const uint32_t& userType) const
|
||||
{
|
||||
mTokenMtx.lock();
|
||||
|
||||
|
||||
std::list<TokenRequest>::const_iterator lit = mRequests.begin();
|
||||
|
||||
|
@ -182,19 +182,19 @@ bool TokenQueue::activeRequestExist(const uint32_t& userType)
|
|||
|
||||
if(req.mUserType == userType)
|
||||
{
|
||||
mTokenMtx.unlock();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
mTokenMtx.unlock();
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void TokenQueue::activeRequestTokens(const uint32_t& userType, std::list<uint32_t>& tokens)
|
||||
void TokenQueue::activeRequestTokens(const uint32_t& userType, std::list<uint32_t>& tokens) const
|
||||
{
|
||||
mTokenMtx.lock();
|
||||
|
||||
|
||||
std::list<TokenRequest>::const_iterator lit = mRequests.begin();
|
||||
|
||||
|
@ -206,7 +206,7 @@ void TokenQueue::activeRequestTokens(const uint32_t& userType, std::list<uint32_
|
|||
tokens.push_back(req.mToken);
|
||||
}
|
||||
|
||||
mTokenMtx.unlock();
|
||||
|
||||
}
|
||||
|
||||
void TokenQueue::loadRequest(const TokenRequest &req)
|
||||
|
@ -226,7 +226,7 @@ bool TokenQueue::cancelRequest(const uint32_t token)
|
|||
|
||||
std::list<TokenRequest>::iterator it;
|
||||
|
||||
mTokenMtx.lock();
|
||||
|
||||
for(it = mRequests.begin(); it != mRequests.end(); it++)
|
||||
{
|
||||
if (it->mToken == token)
|
||||
|
@ -236,12 +236,12 @@ bool TokenQueue::cancelRequest(const uint32_t token)
|
|||
std::cerr << "TokenQueue::cancelRequest() Cleared Request: " << token;
|
||||
std::cerr << std::endl;
|
||||
|
||||
mTokenMtx.unlock();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
mTokenMtx.unlock();
|
||||
|
||||
|
||||
std::cerr << "TokenQueue::cancelRequest() Failed to Find Request: " << token;
|
||||
std::cerr << std::endl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue