ames: correct behaviour for %yawn

This commit is contained in:
Liam Fitzgerald 2022-02-23 15:10:11 -06:00
parent 479e060e32
commit c16aaae201

View File

@ -2574,14 +2574,9 @@
=. keens.scry (put:orm keens.scry keen-id keen-state) =. keens.scry (put:orm keens.scry keen-id keen-state)
ke-abet:ke-start:(ke-abed:keen-core path) ke-abet:ke-start:(ke-abed:keen-core path)
:: ::
:: TODO: fix, only cancel on when no more subscribers
++ pe-yawn ++ pe-yawn
|= =path |= =path
=/ keen-id=@ud (~(got by order.scry) path) ke-abet:ke-unsub:(ke-abed:keen-core path)
=. order.scry (~(del by order.scry) path)
=. keens.scry +:(del:orm keens.scry keen-id)
~& yawn/path
pe-core
:: ::
++ pe-hear ++ pe-hear
|= [=lane =packet] |= [=lane =packet]
@ -2620,7 +2615,10 @@
=, keen =, keen
:: num-fragments is 0 when unknown (i.e. no response :: num-fragments is 0 when unknown (i.e. no response
:: yet) :: yet)
&(!=(0 num-fragments) =(num-fragments num-received)) :: if no-one is listening, kill request
?| =(~ listeners.keen)
&(!=(0 num-fragments) =(num-fragments num-received))
==
?: gone ?: gone
ke-abet-gone ke-abet-gone
=. ke-core ke-set-wake =. ke-core ke-set-wake
@ -2764,6 +2762,11 @@
++ ke-sub ++ ke-sub
=. listeners.keen (~(put in listeners.keen) duct) =. listeners.keen (~(put in listeners.keen) duct)
ke-core ke-core
:: scry is autocancelled in +ke-abet if no more listeners
::
++ ke-unsub
=. listeners.keen (~(del in listeners.keen) duct)
ke-core
:: ::
++ ke-emit ++ ke-emit
|= =hoot |= =hoot
@ -2913,7 +2916,8 @@
~| [%fine %invalid-namespace-path path] ~| [%fine %invalid-namespace-path path]
(need (de-omen path)) (need (de-omen path))
=/ peer-core (pe-abed:fine-peer p.bem.omen) =/ peer-core (pe-abed:fine-peer p.bem.omen)
?~ peer-core !! ?~ peer-core
~|(%no-ship-for-yawn !!)
pe-abet:(pe-yawn:u.peer-core path) pe-abet:(pe-yawn:u.peer-core path)
:: ::
++ on-bide ++ on-bide