From a7e0fd8345ff901494a5b617a6b1e4ae255e6b85 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sat, 7 Feb 2015 01:04:51 +0000 Subject: [PATCH] Fixed double feed publication git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7920 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- TODO.txt | 2 +- libretroshare/src/gxs/rsgenexchange.cc | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/TODO.txt b/TODO.txt index da1403572..f907dd404 100644 --- a/TODO.txt +++ b/TODO.txt @@ -47,7 +47,7 @@ List of fixes/improvements before 0.6 News feed [X] remove the Ghost news feed items - [ ] remove the double feed publication + [X] remove the double feed publication libretroshare [ ] fix the data race in pqissl diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 43a25bfa4..06c640b80 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -36,6 +36,7 @@ #include "rsgixs.h" #include "rsgxsutil.h" +#include #define PUB_GRP_MASK 0x000f #define RESTR_GRP_MASK 0x00f0 @@ -2526,7 +2527,12 @@ void RsGenExchange::processRecvdMessages() { meta->mMsgStatus = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED | GXS_SERV::GXS_MSG_STATUS_GUI_NEW | GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD; msgs.insert(std::make_pair(msg, meta)); - msgIds[msg->grpId].push_back(msg->msgId); + + std::vector &msgv = msgIds[msg->grpId]; + if (std::find(msgv.begin(), msgv.end(), msg->msgId) == msgv.end()) + { + msgv.push_back(msg->msgId); + } NxsMsgPendingVect::iterator validated_entry = std::find(mMsgPendingValidate.begin(), mMsgPendingValidate.end(), getMsgIdPair(*msg)); @@ -2900,7 +2906,13 @@ void RsGenExchange::removeDeleteExistingMessages( RsGeneralDataService::MsgStore RsGxsMessageId::std_vector::iterator it2 = std::find(notifyIds.begin(), notifyIds.end(), cit2->second->mMsgId); if(it2 != notifyIds.end()) + { notifyIds.erase(it2); + if (notifyIds.empty()) + { + msgIdsNotify.erase(cit2->second->mGroupId); + } + } #ifdef GEN_EXCH_DEBUG std::cerr << " discarding " << cit2->second->mMsgId << std::endl; #endif