mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-10 10:05:09 +03:00
Merge pull request #5934 from urbit/ted/doff-6
gall: kill old subscriptions on %doff
This commit is contained in:
commit
6b43d30d3d
8
pkg/arvo/gen/hood/doff.hoon
Normal file
8
pkg/arvo/gen/hood/doff.hoon
Normal file
@ -0,0 +1,8 @@
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
~
|
||||
[dude=_`dude:gall`%$ ship=_`@p`(bex 128)]
|
||||
==
|
||||
=/ darg=(unit dude:gall) ?:(=(%$ dude) ~ `dude)
|
||||
=/ sarg=(unit ^ship) ?:(=((bex 128) ship) ~ `ship)
|
||||
[%helm-doff darg sarg]
|
@ -260,6 +260,11 @@
|
||||
=< abet
|
||||
(emit %pass /helm/cors/reject %arvo %e %reject-origin origin)
|
||||
::
|
||||
++ poke-doff
|
||||
|= [dude=(unit dude:gall) ship=(unit ship)]
|
||||
=< abet
|
||||
(emit %pass /helm/doff %arvo %g %doff dude ship)
|
||||
::
|
||||
++ poke
|
||||
|= [=mark =vase]
|
||||
?> ?| ?=(%helm-hi mark)
|
||||
@ -277,6 +282,7 @@
|
||||
%helm-code =;(f (f !<(_+<.f vase)) poke-code)
|
||||
%helm-cors-approve =;(f (f !<(_+<.f vase)) poke-cors-approve)
|
||||
%helm-cors-reject =;(f (f !<(_+<.f vase)) poke-cors-reject)
|
||||
%helm-doff =;(f (f !<(_+<.f vase)) poke-doff)
|
||||
%helm-gall-sift =;(f (f !<(_+<.f vase)) poke-gall-sift)
|
||||
%helm-gall-verb =;(f (f !<(_+<.f vase)) poke-gall-verb)
|
||||
%helm-hi =;(f (f !<(_+<.f vase)) poke-hi)
|
||||
|
@ -1659,6 +1659,7 @@
|
||||
[%jolt =desk =dude] :: (re)start agent
|
||||
[%idle =dude] :: suspend agent
|
||||
[%nuke =dude] :: delete agent
|
||||
[%doff dude=(unit dude) ship=(unit ship)] :: kill subscriptions
|
||||
$>(%init vane-task) :: set owner
|
||||
$>(%trim vane-task) :: trim state
|
||||
$>(%vega vane-task) :: report upgrade
|
||||
|
@ -2417,6 +2417,15 @@
|
||||
++ on-memo
|
||||
|= [=bone payload=* valence=?(%plea %boon)]
|
||||
^+ peer-core
|
||||
?: ?& (~(has in closing.peer-state) bone)
|
||||
!=(payload [%$ /flow %cork ~])
|
||||
==
|
||||
~> %slog.0^leaf/"ames: ignoring message on closing bone {<bone>}"
|
||||
peer-core
|
||||
?: (~(has in corked.peer-state) bone)
|
||||
~> %slog.0^leaf/"ames: ignoring message on corked bone {<bone>}"
|
||||
peer-core
|
||||
::
|
||||
=/ =message-blob (dedup-message (jim payload))
|
||||
=. peer-core (run-message-pump bone %memo message-blob)
|
||||
::
|
||||
|
@ -429,6 +429,18 @@
|
||||
=/ =case [%da now]
|
||||
=/ =wire /sys/cor/[dap]/(scot %p ship)/[desk]/(scot case)
|
||||
(mo-pass wire %c %warp ship desk ~ %sing %a case /app/[dap]/hoon)
|
||||
:: +mo-doff: kill all outgoing subscriptions
|
||||
::
|
||||
++ mo-doff
|
||||
|= [dude=(unit dude) ship=(unit ship)]
|
||||
^+ mo-core
|
||||
=/ apps=(list (pair term yoke))
|
||||
?~ dude ~(tap by yokes.state)
|
||||
(drop (bind (~(get by yokes.state) u.dude) (lead u.dude)))
|
||||
|- ^+ mo-core
|
||||
?~ apps mo-core
|
||||
=/ ap-core (ap-yoke:ap:mo-core p.i.apps [~ our] q.i.apps)
|
||||
$(apps t.apps, mo-core ap-abet:(ap-doff:ap-core ship))
|
||||
:: +mo-receive-core: receives an app core built by %ford.
|
||||
::
|
||||
:: Presuming we receive a good core, we first check to see if the agent
|
||||
@ -1751,6 +1763,39 @@
|
||||
::
|
||||
(ap-pass (ap-nonce-wire sub-wire dock) %agent dock %leave ~)
|
||||
(ap-pass sub-wire %huck dock %b %huck `sign-arvo`[%gall %unto %kick ~])
|
||||
:: +ap-doff: kill all outgoing subscriptions
|
||||
::
|
||||
:: Also kills old subscriptions that should have been killed but
|
||||
:: were not correctly removed in prerelease versions of the
|
||||
:: request queue fix. This includes nonce 0, which no longer exists.
|
||||
::
|
||||
++ ap-doff
|
||||
|= ship=(unit ship)
|
||||
^+ ap-core
|
||||
=/ subs ~(tap in ~(key by boat.yoke))
|
||||
|- ^+ ap-core
|
||||
?~ subs ap-core
|
||||
=+ [wyr dok]=i.subs
|
||||
?: &(?=(^ ship) !=(u.ship ship.dok))
|
||||
$(subs t.subs)
|
||||
:: kill old-style subscription wire with no nonce
|
||||
::
|
||||
=. ap-core (ap-pass wyr %agent dok %leave ~)
|
||||
:: kill new-style subscriptions at every previously-known nonce
|
||||
::
|
||||
=/ let (~(got by boar.yoke) wyr dok)
|
||||
=/ non 0
|
||||
=/ pre "gall: +ap-doff {<[agent-name wyr dok]>}"
|
||||
=- ((slog leaf+"{pre} done" ~) -)
|
||||
%- (slog leaf+"{pre} {<,.let>} total..." ~)
|
||||
|- ^+ ap-core
|
||||
=. ap-core (ap-pass [(scot %ud non) wyr] %agent dok %leave ~)
|
||||
?: (lth non let)
|
||||
$(non +(non))
|
||||
:: do the %kick last: leaves must be processed first
|
||||
::
|
||||
=. ap-core (ap-pass wyr %huck dok %b %huck [%gall %unto %kick ~])
|
||||
^$(subs t.subs)
|
||||
:: +ap-mule: run virtualized with intercepted scry, preserving type
|
||||
::
|
||||
:: Compare +mute and +mule. Those pass through scry, which
|
||||
@ -1945,6 +1990,7 @@
|
||||
%jolt mo-abet:(mo-jolt:mo-core dude.task our desk.task)
|
||||
%idle mo-abet:(mo-idle:mo-core dude.task)
|
||||
%nuke mo-abet:(mo-nuke:mo-core dude.task)
|
||||
%doff mo-abet:(mo-doff:mo-core +.task)
|
||||
%spew mo-abet:(mo-spew:mo-core veb.task)
|
||||
%sift mo-abet:(mo-sift:mo-core dudes.task)
|
||||
%trim [~ gall-payload]
|
||||
|
Loading…
Reference in New Issue
Block a user