added code to notify GxsBroadcast system with new distant search results

This commit is contained in:
csoler 2018-06-23 22:25:36 +02:00
parent 5b9666855d
commit 6ccc7654d6
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
15 changed files with 63 additions and 6 deletions

View file

@ -1110,6 +1110,8 @@ void RsGenExchange::receiveChanges(std::vector<RsGxsNotify*>& changes)
RsGxsNotify* n = *vit;
RsGxsGroupChange* gc;
RsGxsMsgChange* mc;
RsGxsDistantSearchResultChange *gt;
if((mc = dynamic_cast<RsGxsMsgChange*>(n)) != NULL)
{
if (mc->metaChange())
@ -1132,6 +1134,10 @@ void RsGenExchange::receiveChanges(std::vector<RsGxsNotify*>& changes)
out.mGrps.splice(out.mGrps.end(), gc->mGrpIdList);
}
}
else if((gt = dynamic_cast<RsGxsDistantSearchResultChange*>(n)) != NULL)
{
out.mDistantSearchReqs.push_back(gt->mRequestId);
}
else
std::cerr << "(EE) Unknown changes type!!" << std::endl;
@ -1641,6 +1647,8 @@ void RsGenExchange::receiveDistantSearchResults(TurtleRequestId id,const RsGxsGr
RsGxsDistantSearchResultChange* gc = new RsGxsDistantSearchResultChange(id,grpId);
mNotifications.push_back(gc);
std::cerr << "RsGenExchange::receiveDistantSearchResults(): received result for request " << std::hex << id << std::dec << std::endl;
}
void RsGenExchange::notifyReceivePublishKey(const RsGxsGroupId &grpId)
{

View file

@ -5136,7 +5136,8 @@ void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std:
// only keep groups that are not locally known, and groups that are not already in the mDistantSearchResults structure
for(auto it(group_infos.begin());it!=group_infos.end();++it)
if(grpMeta[(*it).group_id] == NULL)
#warning Uncomment when done with testing!
// if(grpMeta[(*it).group_id] == NULL)
{
filtered_results.push_back(*it) ;
search_results_map[(*it).group_id] = *it;
@ -5146,9 +5147,11 @@ void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std:
bool RsGxsNetService::search(const std::string& substring,std::list<RsGxsGroupSummary>& group_infos)
{
RS_STACK_MUTEX(mNxsMutex) ;
RsGxsGrpMetaTemporaryMap grpMetaMap;
mDataStore->retrieveGxsGrpMetaData(grpMetaMap);
{
RS_STACK_MUTEX(mNxsMutex) ;
mDataStore->retrieveGxsGrpMetaData(grpMetaMap);
}
RsGroupNetworkStats stats ;

View file

@ -55,7 +55,7 @@ public:
* Called when new distant search result arrive.
* \param grpId
*/
virtual void receiveDistantSearchResults(TurtleRequestId& /*id*/,const RsGxsGroupId& /*grpId*/)
virtual void receiveDistantSearchResults(TurtleRequestId /*id*/,const RsGxsGroupId& /*grpId*/)
{
std::cerr << __PRETTY_FUNCTION__ << ": not overloaded but still called. Nothing will happen." << std::endl;
}

View file

@ -44,6 +44,7 @@ public:
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgsMeta;
std::list<RsGxsGroupId> mGrps;
std::list<RsGxsGroupId> mGrpsMeta;
std::list<TurtleRequestId> mDistantSearchReqs;
};
/*!

View file

@ -46,7 +46,7 @@ public:
RsGxsDistantSearchResultChange(TurtleRequestId id,const RsGxsGroupId& group_id) : mRequestId(id),mGroupId(group_id){}
NotifyType getType() { return TYPE_RECEIVED_DISTANT_SEARCH_RESULTS ; }
private:
TurtleRequestId mRequestId ;
RsGxsGroupId mGroupId;
};