mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
RsTokenService use enum for request status
This commit is contained in:
parent
ec95b6d054
commit
b4d2ce82c1
@ -71,12 +71,12 @@ void ChannelsHandler::handleListChannels(Request& /*req*/, Response& resp)
|
||||
tChannels.requestGroupInfo(token, RS_DEPRECATED_TOKREQ_ANSTYPE, opts);
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
while((tChannels.requestStatus(token) != RsTokenService::COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
std::list<RsGroupMetaData> grps;
|
||||
if( tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE
|
||||
if( tChannels.requestStatus(token) == RsTokenService::COMPLETE
|
||||
&& mChannels.getGroupSummary(token, grps) )
|
||||
{
|
||||
for( RsGroupMetaData& grp : grps )
|
||||
@ -136,12 +136,12 @@ void ChannelsHandler::handleGetChannelInfo(Request& req, Response& resp)
|
||||
opts, groupIds );
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
while((tChannels.requestStatus(token) != RsTokenService::COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
std::vector<RsGxsChannelGroup> grps;
|
||||
if( tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE
|
||||
if( tChannels.requestStatus(token) == RsTokenService::COMPLETE
|
||||
&& mChannels.getGroupData(token, grps) )
|
||||
{
|
||||
for( RsGxsChannelGroup& grp : grps )
|
||||
@ -210,14 +210,14 @@ void ChannelsHandler::handleGetChannelContent(Request& req, Response& resp)
|
||||
}
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((mChannels.getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(mChannels.getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
while((mChannels.getTokenService()->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
&&(mChannels.getTokenService()->requestStatus(token) != RsTokenService::FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
std::vector<RsGxsChannelPost> posts;
|
||||
std::vector<RsGxsComment> comments;
|
||||
if( mChannels.getTokenService()->requestStatus(token) ==
|
||||
RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE &&
|
||||
RsTokenService::COMPLETE &&
|
||||
mChannels.getPostData(token, posts, comments) )
|
||||
{
|
||||
for( std::vector<RsGxsChannelPost>::iterator vit = posts.begin();
|
||||
@ -286,11 +286,11 @@ void ChannelsHandler::handleToggleSubscription(Request& req, Response& resp)
|
||||
RsTokenService& tChannels = *mChannels.getTokenService();
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
while((tChannels.requestStatus(token) != RsTokenService::COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
if(tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if(tChannels.requestStatus(token) == RsTokenService::COMPLETE)
|
||||
resp.setOk();
|
||||
else resp.setFail("Unknown GXS error!");
|
||||
}
|
||||
@ -353,11 +353,11 @@ void ChannelsHandler::handleCreateChannel(Request& req, Response& resp)
|
||||
RsTokenService& tChannels = *mChannels.getTokenService();
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
while((tChannels.requestStatus(token) != RsTokenService::COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
if(tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if(tChannels.requestStatus(token) == RsTokenService::COMPLETE)
|
||||
resp.setOk();
|
||||
else resp.setFail("Unknown GXS error!");
|
||||
}
|
||||
@ -436,11 +436,11 @@ void ChannelsHandler::handleTogglePostRead(Request& req, Response& resp)
|
||||
RsTokenService& tChannels = *mChannels.getTokenService();
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
while((tChannels.requestStatus(token) != RsTokenService::COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
if(tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if(tChannels.requestStatus(token) == RsTokenService::COMPLETE)
|
||||
resp.setOk();
|
||||
else resp.setFail("Unknown GXS error!");
|
||||
}
|
||||
@ -522,11 +522,11 @@ void ChannelsHandler::handleCreatePost(Request &req, Response &resp)
|
||||
RsTokenService& tChannels = *mChannels.getTokenService();
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
while((tChannels.requestStatus(token) != RsTokenService::COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
if(tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if(tChannels.requestStatus(token) == RsTokenService::COMPLETE)
|
||||
resp.setOk();
|
||||
else resp.setFail("Unknown GXS error!");
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ void ForumHandler::handleWildcard(Request &req, Response &resp)
|
||||
mRsGxsForums->getTokenService()->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds);
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
while((mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
&&(mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::FAILED)
|
||||
&&((time(NULL) < (start+10)))
|
||||
)
|
||||
{
|
||||
@ -50,7 +50,7 @@ void ForumHandler::handleWildcard(Request &req, Response &resp)
|
||||
#endif
|
||||
}
|
||||
|
||||
if(mRsGxsForums->getTokenService()->requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if(mRsGxsForums->getTokenService()->requestStatus(token) == RsTokenService::COMPLETE)
|
||||
{
|
||||
std::vector<RsGxsForumMsg> grps;
|
||||
ok &= mRsGxsForums->getMsgData(token, grps);
|
||||
@ -86,8 +86,8 @@ void ForumHandler::handleWildcard(Request &req, Response &resp)
|
||||
mRsGxsForums->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts);
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
while((mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
&&(mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::FAILED)
|
||||
&&((time(NULL) < (start+10)))
|
||||
)
|
||||
{
|
||||
@ -97,7 +97,7 @@ void ForumHandler::handleWildcard(Request &req, Response &resp)
|
||||
usleep(500*1000) ;
|
||||
#endif
|
||||
}
|
||||
if(mRsGxsForums->getTokenService()->requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if(mRsGxsForums->getTokenService()->requestStatus(token) == RsTokenService::COMPLETE)
|
||||
{
|
||||
std::vector<RsGxsForumGroup> grps;
|
||||
ok &= mRsGxsForums->getGroupData(token, grps);
|
||||
|
@ -21,11 +21,11 @@ bool GxsResponseTask::doWork(Request &req, Response &resp)
|
||||
for(std::vector<uint32_t>::iterator vit = mWaitingTokens.begin(); vit != mWaitingTokens.end(); ++vit)
|
||||
{
|
||||
uint8_t status = mTokenService->requestStatus(*vit);
|
||||
if(status != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if(status != RsTokenService::COMPLETE)
|
||||
{
|
||||
ready = false;
|
||||
}
|
||||
if(status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
if(status == RsTokenService::FAILED)
|
||||
{
|
||||
std::cerr << "GxsResponseTask::doWork() Error: token failed. aborting." << std::endl;
|
||||
resp.setFail("GxsResponseTask::doWork() Error: token failed.");
|
||||
|
@ -220,15 +220,15 @@ void IdentityHandler::handleWildcard(Request & /*req*/, Response &resp)
|
||||
|
||||
time_t timeout = time(NULL)+10;
|
||||
uint8_t rStatus = mRsIdentity->getTokenService()->requestStatus(token);
|
||||
while( rStatus != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE &&
|
||||
rStatus != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED &&
|
||||
while( rStatus != RsTokenService::COMPLETE &&
|
||||
rStatus != RsTokenService::FAILED &&
|
||||
time(NULL) < timeout )
|
||||
{
|
||||
usleep(50*1000);
|
||||
rStatus = mRsIdentity->getTokenService()->requestStatus(token);
|
||||
}
|
||||
|
||||
if(rStatus == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if(rStatus == RsTokenService::COMPLETE)
|
||||
{
|
||||
std::vector<RsGxsIdGroup> grps;
|
||||
ok &= mRsIdentity->getGroupData(token, grps);
|
||||
@ -277,15 +277,15 @@ void IdentityHandler::handleNotOwnIdsRequest(Request & /*req*/, Response &resp)
|
||||
|
||||
time_t timeout = time(NULL)+10;
|
||||
uint8_t rStatus = mRsIdentity->getTokenService()->requestStatus(token);
|
||||
while( rStatus != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE &&
|
||||
rStatus != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED &&
|
||||
while( rStatus != RsTokenService::COMPLETE &&
|
||||
rStatus != RsTokenService::FAILED &&
|
||||
time(NULL) < timeout )
|
||||
{
|
||||
usleep(50*1000);
|
||||
rStatus = mRsIdentity->getTokenService()->requestStatus(token);
|
||||
}
|
||||
|
||||
if(rStatus == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if(rStatus == RsTokenService::COMPLETE)
|
||||
{
|
||||
std::vector<RsGxsIdGroup> grps;
|
||||
ok &= mRsIdentity->getGroupData(token, grps);
|
||||
@ -327,8 +327,8 @@ void IdentityHandler::handleOwnIdsRequest(Request & /*req*/, Response &resp)
|
||||
mRsIdentity->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts);
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
&&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::FAILED)
|
||||
&&((time(NULL) < (start+10)))
|
||||
)
|
||||
{
|
||||
@ -339,7 +339,7 @@ void IdentityHandler::handleOwnIdsRequest(Request & /*req*/, Response &resp)
|
||||
#endif
|
||||
}
|
||||
|
||||
if(mRsIdentity->getTokenService()->requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if(mRsIdentity->getTokenService()->requestStatus(token) == RsTokenService::COMPLETE)
|
||||
{
|
||||
std::vector<RsGxsIdGroup> grps;
|
||||
ok &= mRsIdentity->getGroupData(token, grps);
|
||||
@ -410,8 +410,8 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp)
|
||||
mRsIdentity->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds);
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
&&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::FAILED)
|
||||
&&((time(NULL) < (start+10)))
|
||||
)
|
||||
{
|
||||
@ -545,8 +545,8 @@ void IdentityHandler::handleSetAvatar(Request& req, Response& resp)
|
||||
mRsIdentity->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds);
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
&&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::FAILED)
|
||||
&&((time(NULL) < (start+10)))
|
||||
)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ void GxsTokenQueue::checkRequests()
|
||||
uint32_t token = it->mToken;
|
||||
uint32_t status = mGenExchange->getTokenService()->requestStatus(token);
|
||||
|
||||
if (status == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if (status == RsTokenService::COMPLETE)
|
||||
{
|
||||
toload.push_back(*it);
|
||||
it = mQueue.erase(it);
|
||||
@ -71,7 +71,7 @@ void GxsTokenQueue::checkRequests()
|
||||
#endif
|
||||
++it;
|
||||
}
|
||||
else if (status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
else if (status == RsTokenService::FAILED)
|
||||
{
|
||||
// maybe we should do alternative callback?
|
||||
std::cerr << "GxsTokenQueue::checkRequests() ERROR Request Failed: " << token;
|
||||
|
@ -1987,7 +1987,7 @@ void RsGenExchange::processMsgMetaChanges()
|
||||
|
||||
if(ok)
|
||||
{
|
||||
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
|
||||
mDataAccess->updatePublicRequestStatus(token, RsTokenService::COMPLETE);
|
||||
if (changed)
|
||||
{
|
||||
msgIds[m.msgId.first].insert(m.msgId.second);
|
||||
@ -1995,7 +1995,7 @@ void RsGenExchange::processMsgMetaChanges()
|
||||
}
|
||||
else
|
||||
{
|
||||
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
|
||||
mDataAccess->updatePublicRequestStatus(token, RsTokenService::FAILED);
|
||||
}
|
||||
|
||||
{
|
||||
@ -2041,11 +2041,11 @@ void RsGenExchange::processGrpMetaChanges()
|
||||
|
||||
if(ok)
|
||||
{
|
||||
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
|
||||
mDataAccess->updatePublicRequestStatus(token, RsTokenService::COMPLETE);
|
||||
grpChanged.push_back(g.grpId);
|
||||
}else
|
||||
{
|
||||
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
|
||||
mDataAccess->updatePublicRequestStatus(token, RsTokenService::FAILED);
|
||||
}
|
||||
|
||||
{
|
||||
@ -2278,7 +2278,7 @@ void RsGenExchange::publishMsgs()
|
||||
|
||||
// add to published to allow acknowledgement
|
||||
mMsgNotify.insert(std::make_pair(mit->first, std::make_pair(grpId, msgId)));
|
||||
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
|
||||
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::COMPLETE);
|
||||
|
||||
}
|
||||
else
|
||||
@ -2288,7 +2288,7 @@ void RsGenExchange::publishMsgs()
|
||||
|
||||
if(!tryLater)
|
||||
mDataAccess->updatePublicRequestStatus(mit->first,
|
||||
RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
|
||||
RsTokenService::FAILED);
|
||||
|
||||
std::cerr << "RsGenExchange::publishMsgs() failed to publish msg " << std::endl;
|
||||
}
|
||||
@ -2365,7 +2365,7 @@ void RsGenExchange::processGroupUpdatePublish()
|
||||
if(mit == grpMeta.end() || mit->second == NULL)
|
||||
{
|
||||
std::cerr << "Error! could not find meta of old group to update!" << std::endl;
|
||||
mDataAccess->updatePublicRequestStatus(gup.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
|
||||
mDataAccess->updatePublicRequestStatus(gup.mToken, RsTokenService::FAILED);
|
||||
delete gup.grpItem;
|
||||
continue;
|
||||
}
|
||||
@ -2393,7 +2393,7 @@ void RsGenExchange::processGroupUpdatePublish()
|
||||
std::cerr << "(EE) publish group fails because RS cannot find the private publish and author keys" << std::endl;
|
||||
|
||||
delete gup.grpItem;
|
||||
mDataAccess->updatePublicRequestStatus(gup.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
|
||||
mDataAccess->updatePublicRequestStatus(gup.mToken, RsTokenService::FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2435,8 +2435,8 @@ void RsGenExchange::processGroupDelete()
|
||||
for(; mit != toNotify.end(); ++mit)
|
||||
{
|
||||
GrpNote& note = mit->second;
|
||||
uint8_t status = note.first ? RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE
|
||||
: RsTokenService::GXS_REQUEST_V2_STATUS_FAILED;
|
||||
uint8_t status = note.first ? RsTokenService::COMPLETE
|
||||
: RsTokenService::FAILED;
|
||||
|
||||
mGrpNotify.insert(std::make_pair(mit->first, note.second));
|
||||
mDataAccess->updatePublicRequestStatus(mit->first, status);
|
||||
@ -2744,8 +2744,8 @@ void RsGenExchange::publishGrps()
|
||||
for(; mit != toNotify.end(); ++mit)
|
||||
{
|
||||
GrpNote& note = mit->second;
|
||||
uint8_t status = note.first ? RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE
|
||||
: RsTokenService::GXS_REQUEST_V2_STATUS_FAILED;
|
||||
uint8_t status = note.first ? RsTokenService::COMPLETE
|
||||
: RsTokenService::FAILED;
|
||||
|
||||
mGrpNotify.insert(std::make_pair(mit->first, note.second));
|
||||
mDataAccess->updatePublicRequestStatus(mit->first, status);
|
||||
|
@ -29,14 +29,6 @@
|
||||
#include "rsgxsdataaccess.h"
|
||||
#include "retroshare/rsgxsflags.h"
|
||||
|
||||
// TODO CLEANUP: This should be an enum defined in rstokenservice.h
|
||||
const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_FAILED = 0;
|
||||
const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_PENDING = 1;
|
||||
const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_PARTIAL = 2;
|
||||
const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE = 4;
|
||||
const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_DONE = 5; // ONCE ALL DATA RETRIEVED.
|
||||
const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_CANCELLED = 6;
|
||||
|
||||
/***********
|
||||
* #define DATA_DEBUG 1
|
||||
**********/
|
||||
@ -316,7 +308,7 @@ void RsGxsDataAccess::storeRequest(GxsRequest* req)
|
||||
{
|
||||
RsStackMutex stack(mDataMutex); /****** LOCKED *****/
|
||||
|
||||
req->status = GXS_REQUEST_V2_STATUS_PENDING;
|
||||
req->status = PENDING;
|
||||
req->reqTime = time(NULL);
|
||||
mRequests[req->token] = req;
|
||||
|
||||
@ -339,7 +331,7 @@ uint32_t RsGxsDataAccess::requestStatus(uint32_t token)
|
||||
}
|
||||
|
||||
if (!checkRequestStatus(token, status, reqtype, anstype, ts))
|
||||
return RsTokenService::GXS_REQUEST_V2_STATUS_FAILED;
|
||||
return RsTokenService::FAILED;
|
||||
|
||||
return status;
|
||||
}
|
||||
@ -354,7 +346,7 @@ bool RsGxsDataAccess::cancelRequest(const uint32_t& token)
|
||||
return false;
|
||||
}
|
||||
|
||||
req->status = GXS_REQUEST_V2_STATUS_CANCELLED;
|
||||
req->status = CANCELLED;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -390,7 +382,7 @@ bool RsGxsDataAccess::getGroupSummary(const uint32_t& token, std::list<const RsG
|
||||
<< "group summary" << std::endl;
|
||||
return false;
|
||||
}
|
||||
else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
else if(req->status == COMPLETE)
|
||||
{
|
||||
GroupMetaReq* gmreq = dynamic_cast<GroupMetaReq*>(req);
|
||||
|
||||
@ -398,7 +390,7 @@ bool RsGxsDataAccess::getGroupSummary(const uint32_t& token, std::list<const RsG
|
||||
{
|
||||
groupInfo = gmreq->mGroupMetaData;
|
||||
gmreq->mGroupMetaData.clear();
|
||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||
locked_updateRequestStatus(token, DONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -429,7 +421,7 @@ bool RsGxsDataAccess::getGroupData(const uint32_t& token, std::list<RsNxsGrp*>&
|
||||
<< "data" << std::endl;
|
||||
return false;
|
||||
}
|
||||
else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
else if(req->status == COMPLETE)
|
||||
{
|
||||
GroupDataReq* gmreq = dynamic_cast<GroupDataReq*>(req);
|
||||
GroupSerializedDataReq* gsreq = dynamic_cast<GroupSerializedDataReq*>(req);
|
||||
@ -439,13 +431,13 @@ bool RsGxsDataAccess::getGroupData(const uint32_t& token, std::list<RsNxsGrp*>&
|
||||
grpData.swap(gsreq->mGroupData);
|
||||
gsreq->mGroupData.clear();
|
||||
|
||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||
locked_updateRequestStatus(token, DONE);
|
||||
}
|
||||
else if(gmreq)
|
||||
{
|
||||
grpData.swap(gmreq->mGroupData);
|
||||
gmreq->mGroupData.clear();
|
||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||
locked_updateRequestStatus(token, DONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -474,7 +466,7 @@ bool RsGxsDataAccess::getMsgData(const uint32_t& token, NxsMsgDataResult& msgDat
|
||||
|
||||
std::cerr << "RsGxsDataAccess::getMsgData() Unable to retrieve group data" << std::endl;
|
||||
return false;
|
||||
}else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){
|
||||
}else if(req->status == COMPLETE){
|
||||
|
||||
MsgDataReq* mdreq = dynamic_cast<MsgDataReq*>(req);
|
||||
|
||||
@ -482,7 +474,7 @@ bool RsGxsDataAccess::getMsgData(const uint32_t& token, NxsMsgDataResult& msgDat
|
||||
{
|
||||
msgData.swap(mdreq->mMsgData);
|
||||
mdreq->mMsgData.clear();
|
||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||
locked_updateRequestStatus(token, DONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -508,7 +500,7 @@ bool RsGxsDataAccess::getMsgRelatedData(const uint32_t &token, NxsMsgRelatedData
|
||||
|
||||
std::cerr << "RsGxsDataAccess::getMsgRelatedData() Unable to retrieve group data" << std::endl;
|
||||
return false;
|
||||
}else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){
|
||||
}else if(req->status == COMPLETE){
|
||||
|
||||
MsgRelatedInfoReq* mrireq = dynamic_cast<MsgRelatedInfoReq*>(req);
|
||||
|
||||
@ -519,7 +511,7 @@ bool RsGxsDataAccess::getMsgRelatedData(const uint32_t &token, NxsMsgRelatedData
|
||||
{
|
||||
msgData.swap(mrireq->mMsgDataResult);
|
||||
mrireq->mMsgDataResult.clear();
|
||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||
locked_updateRequestStatus(token, DONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -545,7 +537,7 @@ bool RsGxsDataAccess::getMsgSummary(const uint32_t& token, GxsMsgMetaResult& msg
|
||||
|
||||
std::cerr << "RsGxsDataAccess::getMsgSummary() Unable to retrieve group data" << std::endl;
|
||||
return false;
|
||||
}else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){
|
||||
}else if(req->status == COMPLETE){
|
||||
|
||||
MsgMetaReq* mmreq = dynamic_cast<MsgMetaReq*>(req);
|
||||
|
||||
@ -553,7 +545,7 @@ bool RsGxsDataAccess::getMsgSummary(const uint32_t& token, GxsMsgMetaResult& msg
|
||||
{
|
||||
msgInfo.swap(mmreq->mMsgMetaData);
|
||||
mmreq->mMsgMetaData.clear();
|
||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||
locked_updateRequestStatus(token, DONE);
|
||||
|
||||
}
|
||||
else
|
||||
@ -582,7 +574,7 @@ bool RsGxsDataAccess::getMsgRelatedSummary(const uint32_t &token, MsgRelatedMeta
|
||||
|
||||
std::cerr << "RsGxsDataAccess::getMsgRelatedSummary() Unable to retrieve message summary" << std::endl;
|
||||
return false;
|
||||
}else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){
|
||||
}else if(req->status == COMPLETE){
|
||||
|
||||
if(req->Options.mReqType != GXS_REQUEST_TYPE_MSG_RELATED_META)
|
||||
return false;
|
||||
@ -593,7 +585,7 @@ bool RsGxsDataAccess::getMsgRelatedSummary(const uint32_t &token, MsgRelatedMeta
|
||||
{
|
||||
msgMeta.swap(mrireq->mMsgMetaResult);
|
||||
mrireq->mMsgMetaResult.clear();
|
||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||
locked_updateRequestStatus(token, DONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -621,7 +613,7 @@ bool RsGxsDataAccess::getMsgRelatedList(const uint32_t &token, MsgRelatedIdResul
|
||||
|
||||
std::cerr << "RsGxsDataAccess::getMsgRelatedList() Unable to retrieve message data" << std::endl;
|
||||
return false;
|
||||
}else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){
|
||||
}else if(req->status == COMPLETE){
|
||||
|
||||
if(req->Options.mReqType != GXS_REQUEST_TYPE_MSG_RELATED_IDS)
|
||||
return false;
|
||||
@ -632,7 +624,7 @@ bool RsGxsDataAccess::getMsgRelatedList(const uint32_t &token, MsgRelatedIdResul
|
||||
{
|
||||
msgIds.swap(mrireq->mMsgIdResult);
|
||||
mrireq->mMsgIdResult.clear();
|
||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||
locked_updateRequestStatus(token, DONE);
|
||||
}
|
||||
else{
|
||||
std::cerr << "RsGxsDataAccess::getMsgRelatedList() Req found, failed caste" << std::endl;
|
||||
@ -658,7 +650,7 @@ bool RsGxsDataAccess::getMsgList(const uint32_t& token, GxsMsgIdResult& msgIds)
|
||||
|
||||
std::cerr << "RsGxsDataAccess::getMsgList() Unable to retrieve msg Ids" << std::endl;
|
||||
return false;
|
||||
}else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){
|
||||
}else if(req->status == COMPLETE){
|
||||
|
||||
MsgIdReq* mireq = dynamic_cast<MsgIdReq*>(req);
|
||||
|
||||
@ -666,7 +658,7 @@ bool RsGxsDataAccess::getMsgList(const uint32_t& token, GxsMsgIdResult& msgIds)
|
||||
{
|
||||
msgIds.swap(mireq->mMsgIdResult);
|
||||
mireq->mMsgIdResult.clear();
|
||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||
locked_updateRequestStatus(token, DONE);
|
||||
}
|
||||
else{
|
||||
std::cerr << "RsGxsDataAccess::getMsgList() Req found, failed caste" << std::endl;
|
||||
@ -691,7 +683,7 @@ bool RsGxsDataAccess::getGroupList(const uint32_t& token, std::list<RsGxsGroupId
|
||||
std::cerr << "RsGxsDataAccess::getGroupList() Unable to retrieve group Ids,"
|
||||
"\nRequest does not exist" << std::endl;
|
||||
return false;
|
||||
}else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){
|
||||
}else if(req->status == COMPLETE){
|
||||
|
||||
GroupIdReq* gireq = dynamic_cast<GroupIdReq*>(req);
|
||||
|
||||
@ -699,7 +691,7 @@ bool RsGxsDataAccess::getGroupList(const uint32_t& token, std::list<RsGxsGroupId
|
||||
{
|
||||
groupIds.swap(gireq->mGroupIdResult);
|
||||
gireq->mGroupIdResult.clear();
|
||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||
locked_updateRequestStatus(token, DONE);
|
||||
|
||||
}else{
|
||||
std::cerr << "RsGxsDataAccess::getGroupList() Req found, failed caste" << std::endl;
|
||||
@ -741,21 +733,21 @@ void RsGxsDataAccess::processRequests()
|
||||
|
||||
switch (req->status)
|
||||
{
|
||||
case GXS_REQUEST_V2_STATUS_PENDING:
|
||||
case PENDING:
|
||||
// process request later
|
||||
break;
|
||||
case GXS_REQUEST_V2_STATUS_PARTIAL:
|
||||
case PARTIAL:
|
||||
// should not happen
|
||||
req->status = GXS_REQUEST_V2_STATUS_COMPLETE;
|
||||
req->status = COMPLETE;
|
||||
break;
|
||||
case GXS_REQUEST_V2_STATUS_DONE:
|
||||
case DONE:
|
||||
#ifdef DATA_DEBUG
|
||||
std::cerr << "RsGxsDataAccess::processrequests() Clearing Done Request Token: " << req->token;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
toClear.push_back(req->token);
|
||||
break;
|
||||
case GXS_REQUEST_V2_STATUS_CANCELLED:
|
||||
case CANCELLED:
|
||||
#ifdef DATA_DEBUG
|
||||
std::cerr << "RsGxsDataAccess::processrequests() Clearing Cancelled Request Token: " << req->token;
|
||||
std::cerr << std::endl;
|
||||
@ -793,10 +785,10 @@ void RsGxsDataAccess::processRequests()
|
||||
for (it = mRequests.begin(); it != mRequests.end(); ++it)
|
||||
{
|
||||
GxsRequest* reqCheck = it->second;
|
||||
if (reqCheck->status == GXS_REQUEST_V2_STATUS_PENDING)
|
||||
if (reqCheck->status == PENDING)
|
||||
{
|
||||
req = reqCheck;
|
||||
req->status = GXS_REQUEST_V2_STATUS_PARTIAL;
|
||||
req->status = PARTIAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -876,9 +868,9 @@ void RsGxsDataAccess::processRequests()
|
||||
|
||||
{
|
||||
RsStackMutex stack(mDataMutex); /******* LOCKED *******/
|
||||
if (req->status == GXS_REQUEST_V2_STATUS_PARTIAL)
|
||||
if (req->status == PARTIAL)
|
||||
{
|
||||
req->status = ok ? GXS_REQUEST_V2_STATUS_COMPLETE : GXS_REQUEST_V2_STATUS_FAILED;
|
||||
req->status = ok ? COMPLETE : FAILED;
|
||||
}
|
||||
} // END OF MUTEX.
|
||||
}
|
||||
@ -894,14 +886,14 @@ bool RsGxsDataAccess::getGroupStatistic(const uint32_t &token, GxsGroupStatistic
|
||||
|
||||
std::cerr << "RsGxsDataAccess::getGroupStatistic() Unable to retrieve grp stats" << std::endl;
|
||||
return false;
|
||||
}else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){
|
||||
}else if(req->status == COMPLETE){
|
||||
|
||||
GroupStatisticRequest* gsreq = dynamic_cast<GroupStatisticRequest*>(req);
|
||||
|
||||
if(gsreq)
|
||||
{
|
||||
grpStatistic = gsreq->mGroupStatistic;
|
||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||
locked_updateRequestStatus(token, DONE);
|
||||
}
|
||||
else{
|
||||
std::cerr << "RsGxsDataAccess::getGroupStatistic() Req found, failed caste" << std::endl;
|
||||
@ -925,14 +917,14 @@ bool RsGxsDataAccess::getServiceStatistic(const uint32_t &token, GxsServiceStati
|
||||
|
||||
std::cerr << "RsGxsDataAccess::getServiceStatistic() Unable to retrieve service stats" << std::endl;
|
||||
return false;
|
||||
}else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){
|
||||
}else if(req->status == COMPLETE){
|
||||
|
||||
ServiceStatisticRequest* ssreq = dynamic_cast<ServiceStatisticRequest*>(req);
|
||||
|
||||
if(ssreq)
|
||||
{
|
||||
servStatistic = ssreq->mServiceStatistic;
|
||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||
locked_updateRequestStatus(token, DONE);
|
||||
}
|
||||
else{
|
||||
std::cerr << "RsGxsDataAccess::getServiceStatistic() Req found, failed caste" << std::endl;
|
||||
@ -1777,7 +1769,7 @@ bool RsGxsDataAccess::checkRequestStatus(const uint32_t& token,
|
||||
|
||||
GxsRequest* req = locked_retrieveRequest(token);
|
||||
|
||||
if (req == NULL || req->status == GXS_REQUEST_V2_STATUS_CANCELLED)
|
||||
if (req == NULL || req->status == CANCELLED)
|
||||
return false;
|
||||
|
||||
anstype = req->ansType;
|
||||
@ -1852,7 +1844,7 @@ uint32_t RsGxsDataAccess::generatePublicToken()
|
||||
|
||||
{
|
||||
RsStackMutex stack(mDataMutex);
|
||||
mPublicToken[token] = RsTokenService::GXS_REQUEST_V2_STATUS_PENDING;
|
||||
mPublicToken[token] = RsTokenService::PENDING;
|
||||
}
|
||||
|
||||
return token;
|
||||
|
@ -123,18 +123,19 @@ class RsTokenService
|
||||
|
||||
public:
|
||||
|
||||
// TODO CLEANUP: This should be an enum
|
||||
static const uint8_t GXS_REQUEST_V2_STATUS_FAILED;
|
||||
static const uint8_t GXS_REQUEST_V2_STATUS_PENDING;
|
||||
static const uint8_t GXS_REQUEST_V2_STATUS_PARTIAL;
|
||||
static const uint8_t GXS_REQUEST_V2_STATUS_COMPLETE;
|
||||
static const uint8_t GXS_REQUEST_V2_STATUS_DONE; // ONCE ALL DATA RETRIEVED.
|
||||
static const uint8_t GXS_REQUEST_V2_STATUS_CANCELLED;
|
||||
enum GxsRequestStatus : uint8_t
|
||||
{
|
||||
FAILED,
|
||||
PENDING,
|
||||
PARTIAL,
|
||||
COMPLETE,
|
||||
DONE, /// Once all data has been retrived
|
||||
CANCELLED
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
RsTokenService() { return; }
|
||||
virtual ~RsTokenService() { return; }
|
||||
RsTokenService() {}
|
||||
virtual ~RsTokenService() {}
|
||||
|
||||
/* Data Requests */
|
||||
|
||||
|
@ -1315,14 +1315,14 @@ void p3GxsChannels::dummy_tick()
|
||||
#endif
|
||||
|
||||
uint32_t status = RsGenExchange::getTokenService()->requestStatus(mGenToken);
|
||||
if (status != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if (status != RsTokenService::COMPLETE)
|
||||
{
|
||||
#ifdef GXSCHANNELS_DEBUG
|
||||
std::cerr << "p3GxsChannels::dummy_tick() Status: " << status;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if (status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
if (status == RsTokenService::FAILED)
|
||||
{
|
||||
#ifdef GXSCHANNELS_DEBUG
|
||||
std::cerr << "p3GxsChannels::dummy_tick() generateDummyMsgs() FAILED";
|
||||
|
@ -1656,8 +1656,8 @@ void p3GxsCircles::checkDummyIdData()
|
||||
|
||||
// check the token.
|
||||
uint32_t status = rsIdentity->getTokenService()->requestStatus(mDummyIdToken);
|
||||
if ( (RsTokenService::GXS_REQUEST_V2_STATUS_FAILED == status) ||
|
||||
(RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == status) )
|
||||
if ( (RsTokenService::FAILED == status) ||
|
||||
(RsTokenService::COMPLETE == status) )
|
||||
{
|
||||
std::vector<RsGxsIdGroup> ids;
|
||||
if (!rsIdentity->getGroupData(mDummyIdToken, ids))
|
||||
|
@ -572,7 +572,7 @@ void p3GxsCommentService::load_PendingVoteParent(const uint32_t &token)
|
||||
std::cerr << std::endl;
|
||||
|
||||
pit->second.mStatus = VoteHolder::VOTE_ERROR;
|
||||
uint32_t status = RsTokenService::GXS_REQUEST_V2_STATUS_FAILED;
|
||||
uint32_t status = RsTokenService::FAILED;
|
||||
mExchange->updatePublicRequestStatus(pit->second.mReqToken, status);
|
||||
continue;
|
||||
}
|
||||
|
@ -489,12 +489,12 @@ void p3GxsForums::dummy_tick()
|
||||
std::cerr << std::endl;
|
||||
|
||||
uint32_t status = RsGenExchange::getTokenService()->requestStatus(mGenToken);
|
||||
if (status != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if (status != RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << "p3GxsForums::dummy_tick() Status: " << status;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
if (status == RsTokenService::FAILED)
|
||||
{
|
||||
std::cerr << "p3GxsForums::dummy_tick() generateDummyMsgs() FAILED";
|
||||
std::cerr << std::endl;
|
||||
|
@ -1536,7 +1536,7 @@ bool p3IdService::opinion_handlerequest(uint32_t token)
|
||||
std::cerr << "p3IdService::opinion_handlerequest() ERROR getGroupMeta()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
updatePublicRequestStatus(req.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
|
||||
updatePublicRequestStatus(req.mToken, RsTokenService::FAILED);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1546,7 +1546,7 @@ bool p3IdService::opinion_handlerequest(uint32_t token)
|
||||
std::cerr << std::endl;
|
||||
|
||||
// error.
|
||||
updatePublicRequestStatus(req.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
|
||||
updatePublicRequestStatus(req.mToken, RsTokenService::FAILED);
|
||||
return false;
|
||||
}
|
||||
RsGroupMetaData &meta = *(groups.begin());
|
||||
@ -1557,7 +1557,7 @@ bool p3IdService::opinion_handlerequest(uint32_t token)
|
||||
std::cerr << std::endl;
|
||||
|
||||
// error.
|
||||
updatePublicRequestStatus(req.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
|
||||
updatePublicRequestStatus(req.mToken, RsTokenService::FAILED);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1592,7 +1592,7 @@ bool p3IdService::opinion_handlerequest(uint32_t token)
|
||||
setGroupServiceString(dummyToken, meta.mGroupId, serviceString);
|
||||
cache_update_if_cached(RsGxsId(meta.mGroupId), serviceString);
|
||||
|
||||
updatePublicRequestStatus(req.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
|
||||
updatePublicRequestStatus(req.mToken, RsTokenService::COMPLETE);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -538,7 +538,7 @@ void p3Wiki::dummyTick()
|
||||
|
||||
uint32_t status = RsGenExchange::getTokenService()->requestStatus(mAboutToken);
|
||||
|
||||
if (status == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if (status == RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << "p3Wiki::dummyTick() AboutActive, Lines: " << mAboutLines;
|
||||
std::cerr << std::endl;
|
||||
@ -605,7 +605,7 @@ void p3Wiki::dummyTick()
|
||||
|
||||
uint32_t status = RsGenExchange::getTokenService()->requestStatus(mImprovToken);
|
||||
|
||||
if (status == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if (status == RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << "p3Wiki::dummyTick() ImprovActive, Lines: " << mImprovLines;
|
||||
std::cerr << std::endl;
|
||||
@ -673,7 +673,7 @@ void p3Wiki::dummyTick()
|
||||
|
||||
uint32_t status = RsGenExchange::getTokenService()->requestStatus(mMarkdownToken);
|
||||
|
||||
if (status == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
if (status == RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << "p3Wiki::dummyTick() MarkdownActive, Lines: " << mMarkdownLines;
|
||||
std::cerr << std::endl;
|
||||
|
@ -2229,11 +2229,11 @@ bool p3FeedReader::waitForToken(uint32_t token)
|
||||
|
||||
while (!mStopped) {
|
||||
uint32_t status = service->requestStatus(token);
|
||||
if (status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) {
|
||||
if (status == RsTokenService::FAILED) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (status == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) {
|
||||
if (status == RsTokenService::COMPLETE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -112,11 +112,11 @@ void GxsForumsFillThread::run()
|
||||
service->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds);
|
||||
|
||||
/* wait for the answer */
|
||||
uint32_t requestStatus = RsTokenService::GXS_REQUEST_V2_STATUS_PENDING;
|
||||
uint32_t requestStatus = RsTokenService::PENDING;
|
||||
while (!wasStopped()) {
|
||||
requestStatus = service->requestStatus(token);
|
||||
if (requestStatus == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED ||
|
||||
requestStatus == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) {
|
||||
if (requestStatus == RsTokenService::FAILED ||
|
||||
requestStatus == RsTokenService::COMPLETE) {
|
||||
break;
|
||||
}
|
||||
msleep(100);
|
||||
@ -132,7 +132,7 @@ void GxsForumsFillThread::run()
|
||||
return;
|
||||
}
|
||||
|
||||
if (requestStatus == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) {
|
||||
if (requestStatus == RsTokenService::FAILED) {
|
||||
//#TODO
|
||||
return;
|
||||
}
|
||||
|
@ -164,8 +164,8 @@ bool TokenQueue::checkForRequest(uint32_t token)
|
||||
{
|
||||
/* check token */
|
||||
uint32_t status = mService->requestStatus(token);
|
||||
return ( (RsTokenService::GXS_REQUEST_V2_STATUS_FAILED == status) ||
|
||||
(RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == status) );
|
||||
return ( (RsTokenService::FAILED == status) ||
|
||||
(RsTokenService::COMPLETE == status) );
|
||||
}
|
||||
|
||||
bool TokenQueue::activeRequestExist(const uint32_t& userType) const
|
||||
|
@ -42,7 +42,7 @@ void GenExchangeTest::pollForToken(uint32_t token, const RsTokReqOptions &opts,
|
||||
Sleep((int) (timeDelta * 1000));
|
||||
#endif
|
||||
|
||||
if((RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == mTokenService->requestStatus(token)))
|
||||
if((RsTokenService::COMPLETE == mTokenService->requestStatus(token)))
|
||||
{
|
||||
switch(opts.mReqType)
|
||||
{
|
||||
@ -81,7 +81,7 @@ void GenExchangeTest::pollForToken(uint32_t token, const RsTokReqOptions &opts,
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if(RsTokenService::GXS_REQUEST_V2_STATUS_FAILED == mTokenService->requestStatus(token))
|
||||
else if(RsTokenService::FAILED == mTokenService->requestStatus(token))
|
||||
{
|
||||
mTokenService->cancelRequest(token);
|
||||
break;
|
||||
@ -108,12 +108,12 @@ bool GenExchangeTest::pollForMsgAcknowledgement(uint32_t token,
|
||||
Sleep((int) (timeDelta * 1000));
|
||||
#endif
|
||||
|
||||
if((RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == mTokenService->requestStatus(token)))
|
||||
if((RsTokenService::COMPLETE == mTokenService->requestStatus(token)))
|
||||
{
|
||||
mTestService->acknowledgeTokenMsg(token, msgId);
|
||||
return true;
|
||||
}
|
||||
else if(RsTokenService::GXS_REQUEST_V2_STATUS_FAILED == mTokenService->requestStatus(token))
|
||||
else if(RsTokenService::FAILED == mTokenService->requestStatus(token))
|
||||
{
|
||||
mTokenService->cancelRequest(token);
|
||||
return false;
|
||||
@ -146,12 +146,12 @@ bool GenExchangeTest::pollForGrpAcknowledgement(uint32_t token,
|
||||
Sleep((int) (timeDelta * 1000));
|
||||
#endif
|
||||
|
||||
if((RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == mTokenService->requestStatus(token)))
|
||||
if((RsTokenService::COMPLETE == mTokenService->requestStatus(token)))
|
||||
{
|
||||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
return true;
|
||||
}
|
||||
else if(RsTokenService::GXS_REQUEST_V2_STATUS_FAILED == mTokenService->requestStatus(token))
|
||||
else if(RsTokenService::FAILED == mTokenService->requestStatus(token))
|
||||
{
|
||||
mTokenService->cancelRequest(token);
|
||||
return false;
|
||||
|
@ -242,7 +242,7 @@ bool GxsPeerNode::createIdentity(const std::string &name,
|
||||
return false;
|
||||
}
|
||||
|
||||
while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tick();
|
||||
sleep(1);
|
||||
@ -316,7 +316,7 @@ bool GxsPeerNode::createCircle(const std::string &name,
|
||||
uint32_t token;
|
||||
mGxsCircles->createGroup(token, grp1) ;
|
||||
|
||||
while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tick();
|
||||
sleep(1);
|
||||
@ -371,7 +371,7 @@ bool GxsPeerNode::createGroup(const std::string &name,
|
||||
return false;
|
||||
}
|
||||
|
||||
while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tick();
|
||||
sleep(1);
|
||||
@ -402,7 +402,7 @@ bool GxsPeerNode::createMsg(const std::string &msgstr,
|
||||
return false;
|
||||
}
|
||||
|
||||
while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tick();
|
||||
sleep(1);
|
||||
@ -430,7 +430,7 @@ bool GxsPeerNode::subscribeToGroup(const RsGxsGroupId &groupId, bool subscribe)
|
||||
return false;
|
||||
}
|
||||
|
||||
while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tick();
|
||||
sleep(1);
|
||||
@ -453,7 +453,7 @@ bool GxsPeerNode::getGroups(std::vector<RsTestGroup> &groups)
|
||||
|
||||
uint32_t token;
|
||||
tokenService->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts);
|
||||
while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tick();
|
||||
sleep(1);
|
||||
@ -475,7 +475,7 @@ bool GxsPeerNode::getGroupList(std::list<RsGxsGroupId> &groups)
|
||||
|
||||
uint32_t token;
|
||||
tokenService->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts);
|
||||
while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tick();
|
||||
sleep(1);
|
||||
@ -500,7 +500,7 @@ bool GxsPeerNode::getMsgList(const RsGxsGroupId &id, std::list<RsGxsMessageId> &
|
||||
grpIds.push_back(id);
|
||||
|
||||
tokenService->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, grpIds);
|
||||
while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tick();
|
||||
sleep(1);
|
||||
@ -533,7 +533,7 @@ bool GxsPeerNode::getIdentities(std::vector<RsGxsIdGroup> &groups)
|
||||
|
||||
uint32_t token;
|
||||
tokenService->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts);
|
||||
while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tick();
|
||||
sleep(1);
|
||||
@ -553,7 +553,7 @@ bool GxsPeerNode::getIdentitiesList(std::list<RsGxsGroupId> &groups)
|
||||
|
||||
uint32_t token;
|
||||
tokenService->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts);
|
||||
while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tick();
|
||||
sleep(1);
|
||||
@ -575,7 +575,7 @@ bool GxsPeerNode::getCircles(std::vector<RsGxsCircleGroup> &groups)
|
||||
|
||||
uint32_t token;
|
||||
tokenService->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts);
|
||||
while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tick();
|
||||
sleep(1);
|
||||
@ -595,7 +595,7 @@ bool GxsPeerNode::getCirclesList(std::list<RsGxsGroupId> &groups)
|
||||
|
||||
uint32_t token;
|
||||
tokenService->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts);
|
||||
while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tick();
|
||||
sleep(1);
|
||||
|
@ -118,14 +118,14 @@ TEST(libretroshare_services, DISABLED_GXS_nxs_basic2)
|
||||
uint32_t token2;
|
||||
|
||||
ASSERT_TRUE(testService->submitTestGroup(token1, grp1));
|
||||
while(tokenService->requestStatus(token1) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token1) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tester.tick();
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
ASSERT_TRUE(testService->submitTestGroup(token2, grp2));
|
||||
while(tokenService->requestStatus(token2) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
while(tokenService->requestStatus(token2) != RsTokenService::COMPLETE)
|
||||
{
|
||||
tester.tick();
|
||||
sleep(1);
|
||||
|
Loading…
Reference in New Issue
Block a user