1
1
mirror of https://github.com/urbit/shrub.git synced 2024-12-27 14:17:13 +03:00

ames: skip corks if pending acks for naxplanations

This commit is contained in:
yosoyubik 2023-05-24 12:35:38 +02:00
parent 2f16a3b1b1
commit f6101569f5

View File

@ -3775,12 +3775,20 @@
%done (done ok.task) %done (done ok.task)
:: ::
%hear %hear
?. ?| corked |^ ?: ?| corked
?& %*(corked sink bone (mix 0b10 bone)) ?& %*(corked sink bone (mix 0b10 bone))
=(%nack (received bone)) =(%nack (received bone))
== == == ==
ack-on-corked-bone
::
?> ?=(%& -.meat.shut-packet.task)
=+ [num-fragments fragment-num fragment]=+.meat.shut-packet.task
?. &(=(num-fragments 1) =(fragment-num 0))
(hear [lane shut-packet ok]:task) (hear [lane shut-packet ok]:task)
:: if we %hear a task on a corked bone, always ack (check-pending-acks fragment-num num-fragments fragment)
::
++ ack-on-corked-bone
:: if we %hear a fragment on a corked bone, always ack
:: ::
=. peer-core =. peer-core
%+ send-shut-packet bone %+ send-shut-packet bone
@ -3788,6 +3796,29 @@
%. sink %. sink
%+ pe-trace odd.veb %+ pe-trace odd.veb
|.("hear {<(received bone)>} on corked bone={<bone>}") |.("hear {<(received bone)>} on corked bone={<bone>}")
::
++ check-pending-acks
:: if this is a %cork %plea and are still waiting to
:: hear %acks for previous naxplanation we sent, no-op
::
|= [num=@ud frags=@ud frag=@uw]
^+ sink
=/ message-blob=*
%+ assemble-fragments frags
(~(gas by *(map fragment-num fragment)) [num frag]~)
=/ cork-plea=?
?=(^ ;;((soft [%$ path %cork ~]) message-blob))
=/ pending-ack=?
=/ nax-bone=^bone (mix 0b10 bone)
=/ live-packets=@ud
~(wyt by live.packet-pump-state.state:(abed:mu nax-bone))
(gth live-packets 0)
?. &(cork-plea pending-ack)
(hear [lane shut-packet ok]:task)
%. sink
%+ pe-trace odd.veb
|.("pending ack for naxplanation, skip %cork bone={<bone>}")
--
== ==
:: ::
+| %tasks +| %tasks