Merge branch 'master' into gxs_mail_experiments

This commit is contained in:
Gioacchino Mazzurco 2017-03-13 22:57:33 +01:00
commit 2630ed4573
223 changed files with 123466 additions and 98194 deletions

View file

@ -30,6 +30,7 @@
#include "rsgenexchange.h"
#include "gxssecurity.h"
#include "util/contentvalue.h"
#include "util/rsprint.h"
#include "retroshare/rsgxsflags.h"
#include "retroshare/rsgxscircles.h"
#include "retroshare/rsgrouter.h"
@ -1318,11 +1319,9 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem
delete item;
}
}
else
{
std::cerr << "RsGenExchange::getGroupData() ERROR deserialising item";
std::cerr << std::endl;
}
else if(data.bin_len > 0)
std::cerr << "(EE) RsGenExchange::getGroupData() Item type is probably not handled. Data is: " << RsUtil::BinToHex((unsigned char*)data.bin_data,std::min(50u,data.bin_len)) << ((data.bin_len>50)?"...":"") << std::endl;
delete *lit;
}
}
@ -1666,14 +1665,14 @@ void RsGenExchange::updateGroup(uint32_t& token, RsGxsGrpItem* grpItem)
#endif
}
void RsGenExchange::deleteGroup(uint32_t& token, RsGxsGrpItem* grpItem)
void RsGenExchange::deleteGroup(uint32_t& token, const RsGxsGroupId& grpId)
{
RS_STACK_MUTEX(mGenMtx) ;
RS_STACK_MUTEX(mGenMtx) ;
token = mDataAccess->generatePublicToken();
mGroupDeletePublish.push_back(GroupDeletePublish(grpItem, token));
mGroupDeletePublish.push_back(GroupDeletePublish(grpId, token));
#ifdef GEN_EXCH_DEBUG
std::cerr << "RsGenExchange::deleteGroup() token: " << token;
std::cerr << "RsGenExchange::deleteGroup() token: " << token;
std::cerr << std::endl;
#endif
}
@ -2317,14 +2316,10 @@ void RsGenExchange::processGroupDelete()
std::vector<GroupDeletePublish>::iterator vit = mGroupDeletePublish.begin();
for(; vit != mGroupDeletePublish.end(); ++vit)
{
GroupDeletePublish& gdp = *vit;
uint32_t token = gdp.mToken;
const RsGxsGroupId& groupId = gdp.grpItem->meta.mGroupId;
std::vector<RsGxsGroupId> gprIds;
gprIds.push_back(groupId);
gprIds.push_back(vit->mGroupId);
mDataStore->removeGroups(gprIds);
toNotify.insert(std::make_pair(
token, GrpNote(true, groupId)));
toNotify.insert(std::make_pair( vit->mToken, GrpNote(true, vit->mGroupId)));
}

View file

@ -519,7 +519,7 @@ protected:
* @param token
* @param grpItem
*/
void deleteGroup(uint32_t& token, RsGxsGrpItem* grpItem);
void deleteGroup(uint32_t& token, const RsGxsGroupId &grpId);
public:
/*!

View file

@ -37,7 +37,7 @@ typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsGxsMsgMetaData*> > MsgRelatedM
// Default values that are used throughout GXS code
static const uint32_t RS_GXS_DEFAULT_MSG_STORE_PERIOD = 86400 * 365 ; // 1 year. Default time for which messages are keps in the database.
static const uint32_t RS_GXS_DEFAULT_MSG_STORE_PERIOD = 86400 * 372 ; // 1 year. Default time for which messages are keps in the database.
static const uint32_t RS_GXS_DEFAULT_MSG_SEND_PERIOD = 86400 * 30 * 1 ; // one month. Default delay after which we don't send messages
static const uint32_t RS_GXS_DEFAULT_MSG_REQ_PERIOD = 86400 * 30 * 1 ; // one month. Default Delay after which we don't request messages

View file

@ -50,7 +50,7 @@ bool RsGxsDataAccess::requestGroupInfo(uint32_t &token, uint32_t ansType, const
{
if(groupIds.empty())
{
std::cerr << "Group Id list is empty" << std::endl;
std::cerr << "(WW) Group Id list is empty" << std::endl;
return false;
}

View file

@ -1451,7 +1451,9 @@ bool RsGxsNetService::saveList(bool& cleanup, std::list<RsItem*>& save)
{
RS_STACK_MUTEX(mNxsMutex) ;
#ifdef NXS_NET_DEBUG_0
std::cerr << "RsGxsNetService::saveList()..." << std::endl;
#endif
// hardcore templates
std::transform(mClientGrpUpdateMap.begin(), mClientGrpUpdateMap.end(), std::back_inserter(save), get_second<ClientGrpMap,RsGxsGrpUpdateItem>(mServType,&RsGxsGrpUpdateItem::peerID));
@ -3818,10 +3820,7 @@ void RsGxsNetService::handleRecvSyncGroup(RsNxsSyncGrpReqItem *item)
uint32_t status = RS_NXS_ITEM_ENCRYPTION_STATUS_UNKNOWN ;
if(encryptSingleNxsItem(gItem, grpMeta->mCircleId,mit->first, encrypted_item,status))
{
itemL.push_back(encrypted_item) ;
delete gItem ;
}
else
{
switch(status)
@ -3836,6 +3835,7 @@ void RsGxsNetService::handleRecvSyncGroup(RsNxsSyncGrpReqItem *item)
std::cerr << " Could not encrypt item for grpId " << grpMeta->mGroupId << " for circle " << grpMeta->mCircleId << ". Not sending it." << std::endl;
}
}
delete gItem ;
}
else
itemL.push_back(gItem);

View file

@ -195,7 +195,9 @@ bool RsGxsIntegrityCheck::check()
if(stats.mSuppliers == 0 && stats.mMaxVisibleCount == 0 && stats.mGrpAutoSync)
{
#ifdef DEBUG_GXSUTIL
GXSUTIL_DEBUG() << "Scheduling group \"" << grp->metaData->mGroupName << "\" ID=" << grp->grpId << " in service " << std::hex << mGenExchangeClient->serviceType() << std::dec << " for deletion because it has no suppliers not any visible data at friends." << std::endl;
#endif
grpsToDel.push_back(grp->grpId);
}
}

View file

@ -222,9 +222,9 @@ public:
class GroupDeletePublish
{
public:
GroupDeletePublish(RsGxsGrpItem* item, uint32_t token)
: grpItem(item), mToken(token) {}
RsGxsGrpItem* grpItem;
GroupDeletePublish(const RsGxsGroupId& grpId, uint32_t token)
: mGroupId(grpId), mToken(token) {}
RsGxsGroupId mGroupId;
uint32_t mToken;
};