1
1
mirror of https://github.com/urbit/shrub.git synced 2024-12-25 21:12:56 +03:00

ames: simplify pending-acks conditional

This commit is contained in:
yosoyubik 2023-05-26 10:09:44 +02:00
parent f6101569f5
commit 1e74e8d19a

View File

@ -3774,7 +3774,7 @@
%drop sink(nax.state (~(del in nax.state) message-num.task))
%done (done ok.task)
::
%hear
%hear
|^ ?: ?| corked
?& %*(corked sink bone (mix 0b10 bone))
=(%nack (received bone))
@ -3783,9 +3783,9 @@
::
?> ?=(%& -.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)
(check-pending-acks fragment-num num-fragments fragment)
?: &(=(num-fragments 1) =(fragment-num 0))
(check-pending-acks fragment)
(hear [lane shut-packet ok]:task)
::
++ ack-on-corked-bone
:: if we %hear a fragment on a corked bone, always ack
@ -3798,22 +3798,16 @@
|.("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
:: if this is a %cork %plea and we are still waiting to
:: hear %acks for previous naxplanations we sent, no-op
::
|= [num=@ud frags=@ud frag=@uw]
|= 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)
=/ blob=* (cue (rep packet-size [frag]~))
=+ pump=(abed:mu (mix 0b10 bone))
?. ?& ?=(^ ;;((soft [%$ path %cork ~]) blob))
?=(^ live.packet-pump-state.state.pump)
==
(hear [lane shut-packet ok]:task)
%. sink
%+ pe-trace odd.veb