From 216ce199b627599bdd54587c27b00896ee46a688 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 26 Mar 2024 10:38:20 +0100 Subject: [PATCH] gall: check if a %leave got %nacked before resending --- pkg/arvo/sys/vane/gall.hoon | 43 ++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 2c91a92324..c74e67eb76 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -754,13 +754,17 @@ ~| [full-wire=full-wire hen=hen stand=stand] =^ rr stand ~(get to stand) :- rr - ?: =(~ stand) - :: outstanding leaves are only deleted when acked - :: - ?: &(?=(^ err) ?=(%leave rr)) - outstanding.state + ?. =(~ stand) + (~(put by outstanding.state) [full-wire hen] stand) + :: outstanding leaves are only deleted when acked; + :: a nacked %leave is flagged with a %missing request + :: we add to the outstanding queue that is only checked + :: in the nacked-leaves timer to skip dead-flow %leave(s) + :: + ?. &(?=(^ err) ?=(%leave rr)) (~(del by outstanding.state) [full-wire hen]) - (~(put by outstanding.state) [full-wire hen] stand) + %- ~(put by outstanding.state) + [[full-wire hen] (~(put to stand) %missing)] :: non-null case of wire is old, remove on next breach after :: 2019/12 :: @@ -2999,14 +3003,29 @@ %- ~(rep by outstanding.state) |= [[[=^wire =^duct] stand=(qeu remote-request)] core=_mo-core:mo] ?: =(~ stand) core - =^ rr stand ~(get to stand) + =^ rr stand ~(get to stand) :: sanity check in the outstanding queue: - :: if there's a %leave, that should be the only request + :: if there's a %leave that was nacked, there should be a %missing request + :: otherwise %leave is the only request in the queue, and we haven't heard + :: anc %ack or a %nack, so %ames is still trying to send it. :: - ~? >>> &(?=(%leave rr) =(^ stand)) - "outstanding queue not empty [{} {} {}]" - =? core &(?=(%leave rr) =(~ stand)) - (mo-handle-nacked-leaves:(mo-abed:core duct) wire) + ~? >>> ?& ?=(%leave rr) + =(^ stand) + =^(rr stand ~(get to stand) !=(%missing rr)) + == + "extraneous request outstanding [{} {} {} {}]" + =? core ?& ?=(%leave rr) + =(^ stand) + =^(rr stand ~(get to stand) &(=(%missing rr) =(~ stand))) + == + =+ core=(mo-handle-nacked-leaves:(mo-abed:core duct) wire) + :: make sure that only the %leave remains in the queue + :: + %_ core + outstanding.state + %+ ~(put by outstanding.state) [wire duct] + (~(put to *(qeu remote-request)) %leave) + == core :: ~| [%gall-take-failed wire]