Merge branch 'next/kelvin/413' of https://github.com/urbit/urbit into pkova/fix-eyre-clog

This commit is contained in:
pkova 2023-04-24 13:43:36 +03:00
commit 3792ba5cc7
3 changed files with 78 additions and 39 deletions

View File

@ -1044,14 +1044,14 @@
== ==
$: %9
$% $: %larva
events=(qeu queued-event)
events=(qeu queued-event-11)
state=ames-state-9
==
[%adult state=ames-state-9]
== ==
$: %10
$% $: %larva
events=(qeu queued-event)
events=(qeu queued-event-11)
state=ames-state-10
==
[%adult state=ames-state-10]
@ -1125,7 +1125,17 @@
::
[%9 %larva *]
~> %slog.0^leaf/"ames: larva: load"
=. queued-events events.old
=. queued-events
:: "+rep:in on a +qeu looks strange, but works fine."
::
%- ~(rep in events.old)
|= [e=queued-event-11 q=(qeu queued-event)]
%- ~(put to q) ^- queued-event
?. ?=(%call -.e) e
=/ task=task-11 ((harden task-11) wrapped-task.e)
%= e
wrapped-task ?.(?=(%snub -.task) task [%snub %deny ships.task])
==
larval-gate
::
[%10 %adult *]
@ -1135,7 +1145,17 @@
::
[%10 %larva *]
~> %slog.1^leaf/"ames: larva: load"
=. queued-events events.old
=. queued-events
:: "+rep:in on a +qeu looks strange, but works fine."
::
%- ~(rep in events.old)
|= [e=queued-event-11 q=(qeu queued-event)]
%- ~(put to q) ^- queued-event
?. ?=(%call -.e) e
=/ task=task-11 ((harden task-11) wrapped-task.e)
%= e
wrapped-task ?.(?=(%snub -.task) task [%snub %deny ships.task])
==
larval-gate
::
[%11 %adult *]
@ -1777,7 +1797,7 @@
%. &
(ev-trace &(dry odd.veb) ship |.((weld "stale %watch plea " log)))
:: the current subscription can be safely corked if there
:: is a flow with a naxplanation ack on a backward bone
:: is a flow with a naxplanation ack on a backward bone
::
=+ backward-bone=(mix 0b10 bone)
?. =(2 (mod backward-bone 4))
@ -2332,6 +2352,13 @@
::
++ pump-core |=(=bone (mu bone *message-pump-state))
++ sink-core |=(=bone (mi bone *message-sink-state))
++ is-corked
|= =bone
?| (~(has in corked.peer-state) bone)
?& =(1 (end 0 bone))
=(1 (end 0 (rsh 0 bone)))
(~(has in corked.peer-state) (mix 0b10 bone))
== ==
::
+| %tasks
::
@ -2379,10 +2406,9 @@
:_ tang.u.dud
leaf+"ames: {<her>} fragment crashed {<mote.u.dud>}"
abet:(call:abed:(sink-core bone) %hear lane shut-packet ?=(~ dud))
:: benign ack on corked bone
:: benign ack on corked bone (also for naxplanation acks)
::
?: (~(has in corked.peer-state) bone)
peer-core
?: (is-corked bone) peer-core
:: Just try again on error, printing trace
::
:: Note this implies that vanes should never crash on %done,
@ -2483,10 +2509,10 @@
=(1 current:(~(got by snd.peer-state) bone))
==
(send-blob | her (attestation-packet [her her-life]:channel))
?: (~(has in corked.peer-state) bone)
:: if the bone was corked the flow doesn't exist anymore
:: TODO: clean up corked bones in the peer state when it's _safe_?
:: (e.g. if this bone is N blocks behind the next one)
?: (is-corked bone)
:: no-op if the bone (or, if a naxplanation, the reference bone)
:: was corked, because the flow doesn't exist anymore
:: TODO: clean up corked bones?
::
peer-core
:: maybe resend some timed out packets
@ -2625,21 +2651,23 @@
::
++ handle-cork
|= =bone
^+ peer-core
|^ ^+ peer-core
?. (~(has in closing.peer-state) bone) peer-core
=/ =message-pump-state
=/ pump=message-pump-state
(~(gut by snd.peer-state) bone *message-pump-state)
=? peer-core ?=(^ next-wake.packet-pump-state.message-pump-state)
=* next-wake u.next-wake.packet-pump-state.message-pump-state
=/ =wire (make-pump-timer-wire her bone)
:: resetting timer for boons
=? event-core ?=(^ next-wake.packet-pump-state.pump)
:: reset-timer for boons
::
(pe-emit [/ames]~ %pass wire %b %rest next-wake)
(reset-timer her bone u.next-wake.packet-pump-state.pump)
=/ nax-bone=^bone (mix 0b10 bone)
=? peer-core (~(has by snd.peer-state) nax-bone)
%. peer-core
%+ pe-trace odd.veb
|.("remove naxplanation flow {<[her bone=nax-bone]>}")
=/ nax-pump=message-pump-state
(~(gut by snd.peer-state) nax-bone *message-pump-state)
=? event-core ?=(^ next-wake.packet-pump-state.nax-pump)
%- %^ ev-trace odd.veb her
|.("remove naxplanation flow {<[her bone=nax-bone]>}")
:: reset timer for naxplanations
::
(reset-timer her nax-bone u.next-wake.packet-pump-state.nax-pump)
=. peer-state
=, peer-state
%_ peer-state
@ -2651,6 +2679,11 @@
closing (~(del in closing) bone)
==
peer-core
::
++ reset-timer
|= [=ship =^bone wake=@da]
(emit [/ames]~ %pass (make-pump-timer-wire ship bone) %b %rest wake)
--
::
+| %internals
:: +mu: constructor for |pump message sender core

View File

@ -26,13 +26,6 @@
&+[leaf+"OK {name}"]~
|+(flop `tang`[leaf+"FAILED {name}" p.run])
==
:: +filter-tests-by-prefix: TODO document
::
++ filter-tests-by-prefix
|= [prefix=path tests=(list test)]
^+ tests
=/ prefix-length=@ud (lent prefix)
(skim tests |=([p=path *] =(prefix (scag prefix-length p))))
:: +resolve-test-paths: add test names to file paths to form full identifiers
::
++ resolve-test-paths
@ -130,15 +123,11 @@
gather-tests(fiz t.fiz, build-ok |)
~> %slog.0^leaf+"built {(spud s.beam.i.fiz)}"
=/ arms=(list test-arm) (get-test-arms u.cor)
::
:: XX this logic appears to be vestigial
::
:: if test path specified an arm prefix, filter arms to match
=? arms ?=(^ test.i.fiz)
|- ^+ arms
?~ arms ~|(no-test-arm+i.fiz !!)
?: =(name.i.arms u.test.i.fiz)
[i.arms]~
$(arms t.arms)
%+ skim arms
|= test-arm
=((end [3 (met 3 u.test.i.fiz)] name) u.test.i.fiz)
=. test-arms (~(put by test-arms) (snip s.beam.i.fiz) arms)
gather-tests(fiz t.fiz)
%- pure:m !> ^= ok

View File

@ -237,10 +237,27 @@
%+ ~(put by pub) path
=/ last=[=aeon =rock:lake] (fall (pry:rok rok.tide) *[key val]:rok)
=. wav.tide (put:wav wav.tide next wave)
=. mem.tide (~(del by mem.tide) next)
=. mem.tide ~
?. =(next (add aeon.last waves.rul.tide)) buoy
buoy(tid (form tide))
::
++ fork :: Fork a pub into an empty path.
|= [from=paths to=paths]
^- pubs
:- %0
?< (~(has by pub) to)
(~(put by pub) to (~(got by pub) from))
::
++ copy :: Fork a sub into an empty path.
|= [sub=_(mk-subs lake *) from=[ship dude *] to=paths]
^- pubs
:- %0
?< (~(has by pub) to)
%+ ~(put by pub) to
%* . *$<(aeon buoy)
rok.tid (put:rok ~ [aeon rock]:(need (~(got by +:sub) from)))
==
::
++ perm :: Change permissions with gate.
|= [where=(list paths) diff=$-((unit (set ship)) (unit (set ship)))]
^- pubs