mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Avoid crash when subscribeToChannel is fed with invaled channel id
Fix a couple compiler warning too
This commit is contained in:
parent
ce3e2a2c9d
commit
3b8f6997bb
@ -1493,6 +1493,11 @@ int RsDataService::retrieveGxsGrpMetaData(RsGxsGrpMetaTemporaryMap& grp)
|
||||
std::cerr << "RsDataService::retrieveGxsGrpMetaData() " << mDbName << ", Requests: " << requestedGroups << ", Results: " << resultCount << ", Time: " << timer.duration() << std::endl;
|
||||
#endif
|
||||
|
||||
/* Remove not found entries as stated in the documentation */
|
||||
for(auto i = grp.begin(); i != grp.end();)
|
||||
if(!i->second) i = grp.erase(i);
|
||||
else ++i;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1009,18 +1009,14 @@ bool RsGxsDataAccess::getGroupSummary(GroupMetaReq* req)
|
||||
}
|
||||
|
||||
bool RsGxsDataAccess::getGroupList(GroupIdReq* req)
|
||||
{
|
||||
getGroupList(req->mGroupIds, req->Options, req->mGroupIdResult);
|
||||
|
||||
return true;
|
||||
}
|
||||
{ return getGroupList(req->mGroupIds, req->Options, req->mGroupIdResult); }
|
||||
|
||||
bool RsGxsDataAccess::getGroupList(const std::list<RsGxsGroupId>& grpIdsIn, const RsTokReqOptions& opts, std::list<RsGxsGroupId>& grpIdsOut)
|
||||
{
|
||||
RsGxsGrpMetaTemporaryMap grpMeta;
|
||||
|
||||
for(auto lit = grpIdsIn.begin(); lit != grpIdsIn.end(); ++lit)
|
||||
grpMeta[*lit] = NULL;
|
||||
grpMeta[*lit] = nullptr;
|
||||
|
||||
mDataStore->retrieveGxsGrpMetaData(grpMeta);
|
||||
|
||||
|
@ -101,7 +101,6 @@ class RsGxsChannels: public RsGxsIfaceHelper, public RsGxsCommentService
|
||||
{
|
||||
public:
|
||||
explicit RsGxsChannels(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {}
|
||||
virtual ~RsGxsChannels() {}
|
||||
|
||||
/**
|
||||
* @brief Create channel. Blocking API.
|
||||
@ -544,4 +543,6 @@ public:
|
||||
RS_DEPRECATED_FOR(turtleChannelRequest)
|
||||
virtual bool retrieveDistantGroup(const RsGxsGroupId& group_id,RsGxsChannelGroup& distant_group)=0;
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual ~RsGxsChannels();
|
||||
};
|
||||
|
@ -1015,7 +1015,7 @@ bool p3GxsChannels::getChannelsInfo(
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
if( !requestGroupInfo(token, opts, chanIds)
|
||||
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
|
||||
return getGroupData(token, channelsInfo);
|
||||
return getGroupData(token, channelsInfo) && !channelsInfo.empty();
|
||||
}
|
||||
|
||||
bool p3GxsChannels::getContentSummaries(
|
||||
@ -2532,3 +2532,5 @@ void p3GxsChannels::cleanTimedOutCallbacks()
|
||||
else ++cbpt;
|
||||
} // RS_STACK_MUTEX(mDistantChannelsCallbacksMapMutex)
|
||||
}
|
||||
|
||||
RsGxsChannels::~RsGxsChannels() = default;
|
||||
|
@ -111,13 +111,13 @@ virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::strin
|
||||
/// @see RsGxsChannels::turtleSearchRequest
|
||||
virtual bool turtleSearchRequest(const std::string& matchString,
|
||||
const std::function<void (const RsGxsGroupSummary&)>& multiCallback,
|
||||
rstime_t maxWait = 300 );
|
||||
rstime_t maxWait = 300 ) override;
|
||||
|
||||
/// @see RsGxsChannels::turtleChannelRequest
|
||||
virtual bool turtleChannelRequest(
|
||||
const RsGxsGroupId& channelId,
|
||||
const std::function<void (const RsGxsChannelGroup& result)>& multiCallback,
|
||||
rstime_t maxWait = 300 );
|
||||
rstime_t maxWait = 300 ) override;
|
||||
|
||||
/// @see RsGxsChannels::localSearchRequest
|
||||
virtual bool localSearchRequest(const std::string& matchString,
|
||||
@ -178,26 +178,26 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
|
||||
|
||||
|
||||
/// Implementation of @see RsGxsChannels::getChannelsSummaries
|
||||
virtual bool getChannelsSummaries(std::list<RsGroupMetaData>& channels);
|
||||
bool getChannelsSummaries(std::list<RsGroupMetaData>& channels) override;
|
||||
|
||||
/// Implementation of @see RsGxsChannels::getChannelsInfo
|
||||
virtual bool getChannelsInfo(
|
||||
bool getChannelsInfo(
|
||||
const std::list<RsGxsGroupId>& chanIds,
|
||||
std::vector<RsGxsChannelGroup>& channelsInfo );
|
||||
std::vector<RsGxsChannelGroup>& channelsInfo ) override;
|
||||
|
||||
/// Implementation of @see RsGxsChannels::getChannelContent
|
||||
virtual bool getChannelContent( const RsGxsGroupId& channelId,
|
||||
const std::set<RsGxsMessageId>& contentsIds,
|
||||
std::vector<RsGxsChannelPost>& posts,
|
||||
std::vector<RsGxsComment>& comments );
|
||||
bool getChannelContent( const RsGxsGroupId& channelId,
|
||||
const std::set<RsGxsMessageId>& contentsIds,
|
||||
std::vector<RsGxsChannelPost>& posts,
|
||||
std::vector<RsGxsComment>& comments ) override;
|
||||
|
||||
/// Implementation of @see RsGxsChannels::getContentSummaries
|
||||
virtual bool getContentSummaries(
|
||||
bool getContentSummaries(
|
||||
const RsGxsGroupId& channelId,
|
||||
std::vector<RsMsgMetaData>& summaries ) override;
|
||||
|
||||
/// Implementation of @see RsGxsChannels::createChannelV2
|
||||
virtual bool createChannelV2(
|
||||
bool createChannelV2(
|
||||
const std::string& name, const std::string& description,
|
||||
const RsGxsImage& thumbnail = RsGxsImage(),
|
||||
const RsGxsId& authorId = RsGxsId(),
|
||||
@ -207,12 +207,8 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
|
||||
std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string)
|
||||
) override;
|
||||
|
||||
/// @deprecated Implementation of @see RsGxsChannels::createComment
|
||||
RS_DEPRECATED_FOR(createCommentV2)
|
||||
virtual bool createComment(RsGxsComment& comment) override;
|
||||
|
||||
/// Implementation of @see RsGxsChannels::createComment
|
||||
virtual bool createCommentV2(
|
||||
bool createCommentV2(
|
||||
const RsGxsGroupId& channelId,
|
||||
const RsGxsMessageId& threadId,
|
||||
const std::string& comment,
|
||||
@ -224,11 +220,7 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
|
||||
) override;
|
||||
|
||||
/// Implementation of @see RsGxsChannels::editChannel
|
||||
virtual bool editChannel(RsGxsChannelGroup& channel) override;
|
||||
|
||||
/// @deprecated Implementation of @see RsGxsChannels::createPost
|
||||
RS_DEPRECATED_FOR(createPostV2)
|
||||
virtual bool createPost(RsGxsChannelPost& post) override;
|
||||
bool editChannel(RsGxsChannelGroup& channel) override;
|
||||
|
||||
/// Implementation of @see RsGxsChannels::createPostV2
|
||||
bool createPostV2(
|
||||
@ -241,12 +233,8 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
|
||||
std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string)
|
||||
) override;
|
||||
|
||||
/// @deprecated Implementation of @see RsGxsChannels::createVote
|
||||
RS_DEPRECATED_FOR(createVoteV2)
|
||||
virtual bool createVote(RsGxsVote& vote) override;
|
||||
|
||||
/// Implementation of @see RsGxsChannels::createVoteV2
|
||||
virtual bool createVoteV2(
|
||||
bool createVoteV2(
|
||||
const RsGxsGroupId& channelId, const RsGxsMessageId& postId,
|
||||
const RsGxsMessageId& commentId, const RsGxsId& authorId,
|
||||
RsGxsVoteType vote,
|
||||
@ -255,8 +243,8 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
|
||||
) override;
|
||||
|
||||
/// Implementation of @see RsGxsChannels::subscribeToChannel
|
||||
virtual bool subscribeToChannel( const RsGxsGroupId &groupId,
|
||||
bool subscribe );
|
||||
bool subscribeToChannel( const RsGxsGroupId &groupId,
|
||||
bool subscribe ) override;
|
||||
|
||||
/// Implementation of @see RsGxsChannels::setPostRead
|
||||
virtual bool markRead(const RsGxsGrpMsgIdPair& msgId, bool read);
|
||||
@ -266,7 +254,20 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
|
||||
|
||||
/// Implementation of @see RsGxsChannels::createChannel
|
||||
RS_DEPRECATED_FOR(createChannelV2)
|
||||
virtual bool createChannel(RsGxsChannelGroup& channel) override;
|
||||
bool createChannel(RsGxsChannelGroup& channel) override;
|
||||
|
||||
/// @deprecated Implementation of @see RsGxsChannels::createPost
|
||||
RS_DEPRECATED_FOR(createPostV2)
|
||||
bool createPost(RsGxsChannelPost& post) override;
|
||||
|
||||
/// @deprecated Implementation of @see RsGxsChannels::createComment
|
||||
RS_DEPRECATED_FOR(createCommentV2)
|
||||
bool createComment(RsGxsComment& comment) override;
|
||||
|
||||
/// @deprecated Implementation of @see RsGxsChannels::createVote
|
||||
RS_DEPRECATED_FOR(createVoteV2)
|
||||
bool createVote(RsGxsVote& vote) override;
|
||||
|
||||
|
||||
protected:
|
||||
// Overloaded from GxsTokenQueue for Request callbacks.
|
||||
|
Loading…
Reference in New Issue
Block a user