From 47665d5843fcaee6b1eb63cb264da95f860106fd Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 18 Jun 2019 17:38:25 -0700 Subject: [PATCH] track and clear nax in |message-still --- sys/vane/alef.hoon | 79 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 67 insertions(+), 12 deletions(-) diff --git a/sys/vane/alef.hoon b/sys/vane/alef.hoon index 30714f3e2..f7cd32be7 100644 --- a/sys/vane/alef.hoon +++ b/sys/vane/alef.hoon @@ -530,6 +530,7 @@ last-heard=message-num pending-vane-ack=(qeu [=message-num =message]) live-messages=(map message-num partial-rcv-message) + nax=(set message-num) == :: $partial-rcv-message: message for which we've received some fragments :: @@ -740,10 +741,12 @@ :: $message-still-task: job for |message-still :: :: %done: receive confirmation from vane of processing or failure +:: %forget-nack: clear .message-num from .nax.state :: %hear: handle receiving a message fragment packet :: +$ message-still-task $% [%done ok=?] + [%forget-nack =message-num] [%hear =lane =shut-packet] == :: $message-still-gift: effect from |message-still @@ -846,13 +849,34 @@ ++ event-core . ++ abet [(flop moves) ames-state] ++ emit |=(=move event-core(moves [move moves])) - :: + :: +on-aver: handle notice from vane that it processed a message :: ++ on-aver |= [=wire error=(unit error)] ^+ event-core :: - !! + =+ ^- [her=ship =bone] (parse-bone-wire wire) + :: + =/ =peer-state + =- ?>(?=(%known -<) ->) + (~(got by peers.ames-state) her) + :: + =/ =channel [[our her] now +>.ames-state -.peer-state] + =/ peer-core (make-peer-core peer-state channel) + =/ ok=? ?=(~ error) + :: send message (n)ack packet + :: + =. event-core abet:(run-message-still:peer-core bone %done ok) + :: if positive ack, we're done + :: + ?: ok + event-core + :: send nack-trace message on designated bone + :: + =/ nack-trace-bone=^bone (mix 0b10 bone) + =. peer-core (make-peer-core peer-state channel) + :: + abet:(run-message-pump:peer-core nack-trace-bone %send /a/nax error) :: :: ++ on-hear @@ -1103,6 +1127,10 @@ ++ process-ack-message |= [=message-num ok=?] ^+ peer-core + :: is this bone a nack-trace bone? + :: + ?: =(1 (end 0 1 (rsh 0 1 bone))) + !! :: positive ack gets emitted trivially :: ?: ok @@ -1175,7 +1203,8 @@ :: odd .bone; "request" message to pass to vane before acking :: ?: =(1 (end 0 1 bone)) - =/ =wire msg-path + =/ =wire (make-bone-wire her.channel bone) + :: ?- i.msg-path %a ~| %pass-to-ames^her.channel !! %c (emit duct %pass wire %c %buzz her.channel message.gift) @@ -1794,8 +1823,9 @@ =- [(flop gifts) state] :: ?- -.task - %done (on-done ok.task) - %hear (on-hear [lane shut-packet]:task) + %done (on-done ok.task) + %forget-nack (on-forget-nack message-num.task) + %hear (on-hear [lane shut-packet]:task) == :: +on-hear: receive message fragment, possibly completing message :: @@ -1822,9 +1852,10 @@ :: single packet ack :: (give %send-ack seq %& fragment-num) - :: whole message (n)ack TODO nack lookup + :: whole message (n)ack :: - (give %send-ack seq %| ok=%.y lag=`@dr`0) + =/ ok=? (~(has in nax.state) seq) + (give %send-ack seq %| ok lag=`@dr`0) :: last-acked ?=([%bone @ @ ~] wire) + [`@p`(slav %p i.t.wire) `@ud`(slav %ud i.t.t.wire)] :: +make-pump-timer-wire: construct wire for |packet-pump timer :: ++ make-pump-timer-wire