Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/gxs/rsgenexchange.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2801,6 +2801,10 @@ void RsGenExchange::publishGrps()

if(ret == SERVICE_CREATE_SUCCESS)
{
// MODIFICATION: Update timestamp BEFORE serialization so the payload matches the meta.
// This fixes propagation issues where peers rejected the update due to stale timestamp in bin data.
grpItem->meta.mPublishTs = time(NULL);

uint32_t size = mSerialiser->size(grpItem);
char *gData = new char[size];
serialOk = mSerialiser->serialise(grpItem, gData, &size);
Expand All @@ -2816,7 +2820,7 @@ void RsGenExchange::publishGrps()
if(serialOk && servCreateOk)
{
grp->metaData = new RsGxsGrpMetaData();
grpItem->meta.mPublishTs = time(NULL);
// grpItem->meta.mPublishTs = time(NULL); // Moved up
*(grp->metaData) = grpItem->meta;

// TODO: change when publish key optimisation added (public groups don't have publish key
Expand Down
31 changes: 8 additions & 23 deletions src/services/p3idservice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -663,10 +663,15 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
mRejectedIdentities.insert(RsGxsId(groupChange->mGroupId));
break;

case RsGxsNotify::TYPE_GROUP_DELETED:
case RsGxsNotify::TYPE_UPDATED:
case RsGxsNotify::TYPE_PUBLISHED:
{
// Invalidate cache to force reload of new data (e.g. avatar)
{
RsStackMutex stack(mIdMtx);
mKeyCache.erase(RsGxsId(gid));
}

auto ev = std::make_shared<RsGxsIdentityEvent>();
ev->mIdentityId = gid;

Expand Down Expand Up @@ -1126,11 +1131,11 @@ bool p3IdService::updateIdentity( const RsGxsId& id, const std::string& name, co
else
group.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC;



uint32_t token;
bool ret = true;

// Cache pgp passphrase to allow a proper re-signing of the group data

if(!pseudonimous && !pgpPassword.empty())
{
if(!RsLoginHandler::cachePgpPassphrase(pgpPassword))
Expand All @@ -1140,7 +1145,6 @@ bool p3IdService::updateIdentity( const RsGxsId& id, const std::string& name, co
goto LabelUpdateIdentityCleanup;
}
}
mKeyCache.erase(id);

if(!updateGroup(token, group))
{
Expand Down Expand Up @@ -2108,25 +2112,6 @@ bool p3IdService::updateGroup(uint32_t& token, RsGxsIdGroup &group)

RsGenExchange::updateGroup(token, item);

// if its in the cache - clear it.
{
RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/
if (mKeyCache.erase(id))
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::updateGroup() Removed from PublicKeyCache";
std::cerr << std::endl;
#endif
}
else
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::updateGroup() Not in PublicKeyCache";
std::cerr << std::endl;
#endif
}
}

return true;
}

Expand Down
Loading