group-hook: touch up watch-nack and kick logic

In both, we make clear that the wire is always of the /@/group/^ form,
and alias the "group path" portion of the wire for clarity.

For kick, more obviously reuse the same wire, don't reconstruct it.

For watch-nack, only delete from the synced map if the source of the
watch-nack is still relevant. While we don't expect this to be relevant
considering current mode of operation, this does protect us against
strange cases.
This commit is contained in:
Fang 2020-03-26 20:16:30 +01:00
parent bf912f6aac
commit ea48161334
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972

View File

@ -74,20 +74,26 @@
?~ p.sign
[~ this]
%- (slog u.p.sign)
?> ?=([@ @ *] wire)
=/ =ship (slav %p i.wire)
=. synced.state (~(del by synced.state) t.t.wire)
?> ?=([@ %group ^] wire)
=/ =ship (slav %p i.wire)
=* group t.t.wire
:: only remove from synced if this watch-nack came from the ship we
:: thought we were actively syncing from
::
=? synced.state
=(ship (~(gut by synced.state) group ship))
(~(del by synced.state) group)
[~ this]
::
%kick
?> ?=([@ @ *] wire)
?> ?=([@ %group ^] wire)
=/ =ship (slav %p i.wire)
?. (~(has by synced.state) t.t.wire)
=* group t.t.wire
?. (~(has by synced.state) group)
[~ this]
=/ group-path [%group t.t.wire]
=/ group-wire [i.wire group-path]
=* group-path t.wire
:_ this
[%pass group-wire %agent [ship %group-hook] %watch group-path]~
[%pass wire %agent [ship %group-hook] %watch group-path]~
::
%fact
?. ?=(%group-update p.cage.sign)