From 2d63b112d3700729536966d8553787c50f028dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 9 Apr 2022 12:56:59 +0200 Subject: Sync: always check peer owner --- src/sync.cpp | 10 +++++++--- 1 file 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 & 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); } -- cgit v1.2.3