summaryrefslogtreecommitdiff
path: root/src/sync.cpp
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2022-04-09 12:56:59 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2022-04-29 23:39:12 +0200
commit2d63b112d3700729536966d8553787c50f028dd4 (patch)
treeed2d193ca2ee3c246239b6c12580ce0c54662ad9 /src/sync.cpp
parent399195dc6f40e04117aa2994f0763394c6c7f70f (diff)
Sync: always check peer owner
Diffstat (limited to 'src/sync.cpp')
-rw-r--r--src/sync.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/sync.cpp b/src/sync.cpp
index 85fed96..8263974 100644
--- a/src/sync.cpp
+++ b/src/sync.cpp
@@ -24,7 +24,7 @@ void SyncService::handle(Context & ctx)
return;
const auto & powner = pid->finalOwner();
- const auto & owner = ctx.peer().server().identity().finalOwner();
+ const Identity owner = ctx.peer().server().identity().finalOwner();
if (!powner.sameAs(owner))
return;
@@ -57,7 +57,11 @@ void SyncService::peerWatcher(size_t, const Peer * peer)
void SyncService::localStateWatcher(const vector<Ref> & refs)
{
const auto & plist = server->peerList();
+ const Identity owner = server->identity().finalOwner();
+
for (size_t i = 0; i < plist.size(); i++)
- for (const auto & r : refs)
- plist.at(i).send(myUUID, r);
+ if (auto id = plist.at(i).identity())
+ if (id->finalOwner().sameAs(owner))
+ for (const auto & r : refs)
+ plist.at(i).send(myUUID, r);
}