Merge pull request #1826 from csoler/v0.6-FT4

attempt to solve GXS data access problems in new blocking API
This commit is contained in:
csoler 2020-03-13 14:37:53 +01:00 committed by GitHub
commit 4c4b7ce754
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 73 additions and 50 deletions

View file

@ -140,7 +140,7 @@ virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::strin
std::vector<RsGxsComment> &msgs ) override
{ return mCommentService->getGxsRelatedComments(token, msgs); }
virtual bool createNewComment(uint32_t &token, RsGxsComment &msg) override
virtual bool createNewComment(uint32_t &token, const RsGxsComment &msg) override
{
return mCommentService->createGxsComment(token, msg);
}
@ -277,7 +277,7 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
/// @deprecated Implementation of @see RsGxsChannels::createComment
RS_DEPRECATED_FOR(createCommentV2)
bool createComment(RsGxsComment& comment) override;
bool createComment(RsGxsComment &comment) override;
/// @deprecated Implementation of @see RsGxsChannels::createVote
RS_DEPRECATED_FOR(createVoteV2)

View file

@ -278,9 +278,13 @@ bool p3GxsCircles::getCirclesSummaries(std::list<RsGroupMetaData>& circles)
uint32_t token;
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
if( !requestGroupInfo(token, opts)
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
return getGroupSummary(token, circles);
if( !requestGroupInfo(token, opts) || waitToken(token) != RsTokenService::COMPLETE )
{
std::cerr << "Cannot get circles summary. Token queue is overloaded?" << std::endl;
return false;
}
else
return getGroupSummary(token, circles);
}
bool p3GxsCircles::getCirclesInfo( const std::list<RsGxsGroupId>& circlesIds,
@ -289,9 +293,13 @@ bool p3GxsCircles::getCirclesInfo( const std::list<RsGxsGroupId>& circlesIds,
uint32_t token;
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
if( !requestGroupInfo(token, opts, circlesIds)
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
return getGroupData(token, circlesInfo);
if( !requestGroupInfo(token, opts, circlesIds) || waitToken(token) != RsTokenService::COMPLETE )
{
std::cerr << "Cannot get circle info. Token queue is overloaded?" << std::endl;
return false;
}
else
return getGroupData(token, circlesInfo);
}
bool p3GxsCircles::getCircleRequests( const RsGxsGroupId& circleId,

View file

@ -425,7 +425,7 @@ double p3GxsCommentService::calculateBestScore(int upVotes, int downVotes)
/********************************************************************************************/
bool p3GxsCommentService::createGxsComment(uint32_t &token, RsGxsComment &msg)
bool p3GxsCommentService::createGxsComment(uint32_t &token, const RsGxsComment &msg)
{
#ifdef DEBUG_GXSCOMMON
std::cerr << "p3GxsCommentService::createGxsComment() GroupId: " << msg.mMeta.mGroupId;

View file

@ -66,7 +66,7 @@ class p3GxsCommentService: public GxsTokenQueue
bool getGxsCommentData(const uint32_t &token, std::vector<RsGxsComment> &msgs);
bool getGxsRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &msgs);
bool createGxsComment(uint32_t &token, RsGxsComment &msg);
bool createGxsComment(uint32_t &token, const RsGxsComment &msg);
bool createGxsVote(uint32_t &token, RsGxsVote &msg);
// Special Acknowledge.

View file

@ -85,7 +85,7 @@ public:
return mCommentService->getGxsRelatedComments(token, msgs);
}
virtual bool createNewComment(uint32_t &token, RsGxsComment &msg) override
virtual bool createNewComment(uint32_t &token, const RsGxsComment &msg) override
{
return mCommentService->createGxsComment(token, msg);
}

View file

@ -96,10 +96,16 @@ virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgI
std::vector<RsGxsComment> &msgs )
{ return mCommentService->getGxsRelatedComments(token, msgs); }
virtual bool createNewComment(uint32_t &token, RsGxsComment &msg)
virtual bool createNewComment(uint32_t &token, const RsGxsComment &msg) override
{
return mCommentService->createGxsComment(token, msg);
}
virtual bool createComment(RsGxsComment& msg) override
{
uint32_t token;
return mCommentService->createGxsComment(token, msg) && waitToken(token) == RsTokenService::COMPLETE ;
}
virtual bool createNewVote(uint32_t &token, RsGxsVote &msg)
{