gall and ames: |hi works, fixed alef nack-trace bug

This commit is contained in:
Ted Blackman 2019-11-02 20:52:48 -04:00
parent 6f2ebe8ebd
commit 22ef92053a
2 changed files with 29 additions and 15 deletions

View File

@ -402,6 +402,9 @@
:: always zero.
::
+$ ack-meat (each fragment-num [ok=? lag=@dr])
:: $naxplanation: nack trace; explains which message failed and why
::
+$ naxplanation [=message-num =error]
::
+| %statics
::
@ -963,7 +966,8 @@
:: construct nack-trace message, referencing .failed $message-num
::
=/ failed=message-num last-acked:(~(got by rcv.peer-state) bone)
=/ =message-blob (jam [failed u.error])
=/ =naxplanation [failed u.error]
=/ =message-blob (jam naxplanation)
:: send nack-trace message on associated .nack-trace-bone
::
=. peer-core (make-peer-core peer-state channel)
@ -1821,14 +1825,14 @@
^+ peer-core
~> %slog.0^leaf/"ames: nack trace {<her.channel^bone>}"
::
=+ ;; [=failed=^message-num =error] message
=+ ;; =naxplanation message
:: ack nack-trace message (only applied if we don't later crash)
::
=. peer-core (run-message-sink bone %done ok=%.y)
:: flip .bone's second bit to find referenced flow
::
=/ target-bone=^bone (mix 0b10 bone)
=/ nax-key [target-bone failed-message-num]
=/ nax-key [target-bone message-num.naxplanation]
:: if we haven't heard a message nack, pretend we have
::
:: The nack-trace message counts as a valid message nack on
@ -1841,12 +1845,12 @@
::
=? peer-core !(~(has in nax.peer-state) nax-key)
%- run-message-pump
[target-bone %hear failed-message-num %| ok=%.n lag=`@dr`0]
[target-bone %hear message-num.naxplanation %| ok=%.n lag=`@dr`0]
:: clear the nack from our state and relay to vane
::
=. nax.peer-state (~(del in nax.peer-state) nax-key)
::
(emit (got-duct target-bone) %give %done `error)
(emit (got-duct target-bone) %give %done `error.naxplanation)
:: +on-sink-plea: handle request message received by |message-sink
::
++ on-sink-plea
@ -1871,10 +1875,11 @@
:: we previously crashed on this message; send nack
::
=. peer-core (run-message-sink bone %done ok=%.n)
:: also send nack-trace
:: also send nack-trace with blank .error for security
::
=/ nack-trace-bone=^bone (mix 0b10 bone)
=/ =message-blob (jam [message-num ~])
=/ =naxplanation [message-num *error]
=/ =message-blob (jam naxplanation)
::
(run-message-pump nack-trace-bone %memo message-blob)
--

View File

@ -396,7 +396,7 @@
%peer [%s p.agent-action]
==
::
=/ sys-path
=/ =wire
=/ action -.agent-action
/sys/way/[action]
::
@ -404,7 +404,7 @@
=/ =path /ge/[foreign-agent]
[%a %plea ship %g path ames-request]
::
(mo-pass sys-path note-arvo)
(mo-pass wire note-arvo)
:: +mo-track-rift: ensure we're subscribed to jael for .ship breaches
::
++ mo-track-rift
@ -548,7 +548,7 @@
|= [=path =sign-arvo]
^+ mo-core
::
?> ?=([%req @ @ @ ~] path)
?> ?=([%req @ @ ~] path)
=/ him (slav %p i.t.path)
=/ dap i.t.t.path
::
@ -610,13 +610,12 @@
|= [=path =sign-arvo]
^+ mo-core
::
?> ?=([%way @ @ @ *] path)
=/ him (slav %p i.t.path)
=/ agent-name `@tas`i.t.t.path
=/ =remote-request ;;(remote-request i.t.t.t.path)
?> ?=([%way @ *] path)
::
?+ sign-arvo !!
[%a %done *]
::
=/ =remote-request ;;(remote-request i.t.path)
=/ err=(unit tang)
?~ error=error.sign-arvo
~
@ -630,10 +629,20 @@
==
::
[%a %boon *]
::
?> ?=([@ @ ~] t.t.path)
=/ him (slav %p i.t.path)
=/ agent-name `@tas`i.t.t.path
::
=/ =ames-response ;;(ames-response payload.sign-arvo)
(mo-handle-ames-response him agent-name ames-response)
::
[%a %lost *]
::
?> ?=([@ @ ~] t.t.path)
=/ him (slav %p i.t.path)
=/ agent-name `@tas`i.t.t.path
::
=/ sys-wire [%sys path]
:: TODO: %drip %quit so app crash can't kill the remote %pull
::
@ -801,7 +810,7 @@
^+ mo-core
:: %u/%pull gets automatically acked
::
=? mo-core !?=(%u -.ames-request) (mo-give %done ~)
=? mo-core ?=(%u -.ames-request) (mo-give %done ~)
::
=/ =wire /sys/req/(scot %p ship)/[agent-name]
::