ames: fix parsing fine timer wire

This commit is contained in:
yosoyubik 2023-03-28 13:40:10 +02:00
parent f34e472bdd
commit 8e54f7fcc3

View File

@ -250,20 +250,23 @@
|= [her=ship =bone] |= [her=ship =bone]
^- wire ^- wire
/pump/(scot %p her)/(scot %ud bone) /pump/(scot %p her)/(scot %ud bone)
:: +parse-pump-timer-wire: parse .her and .bone from |packet-pump wire :: +parse-pump-wire: parse .her and .bone from |packet-pump wire
:: ::
++ parse-pump-timer-wire ++ parse-pump-wire
|= =wire |= [ship=@ bone=@]
^- (unit [%pump her=ship =bone]) ^- (unit [%pump her=^ship =^bone])
:: ?~ ship=`(unit @p)`(slaw %p ship)
~| %ames-wire-timer^wire
?. ?=([%pump @ @ ~] wire)
~ ~
?~ ship=`(unit @p)`(slaw %p i.t.wire) ?~ bone=`(unit @ud)`(slaw %ud bone)
~ ~
?~ bone=`(unit @ud)`(slaw %ud i.t.t.wire) `pump/[u.ship u.bone]
::
++ parse-fine-wire
|= [ship=@ =wire]
^- (unit [%fine her=^ship =^wire])
?~ ship=`(unit @p)`(slaw %p ship)
~ ~
`[%pump u.ship u.bone] `fine/[u.ship wire]
:: +derive-symmetric-key: $symmetric-key from $private-key and $public-key :: +derive-symmetric-key: $symmetric-key from $private-key and $public-key
:: ::
:: Assumes keys have a tag on them like the result of the |ex:crub core. :: Assumes keys have a tag on them like the result of the |ex:crub core.
@ -1336,7 +1339,7 @@
|= [=bone =^error] |= [=bone =^error]
^+ peer-core ^+ peer-core
=. peer-core abet:(call:(abed:mi:peer-core bone) %done ok=%.n) =. peer-core abet:(call:(abed:mi:peer-core bone) %done ok=%.n)
=. event-core abet:peer-core =. event-core abet:peer-core :: XX extraneous?
:: construct nack-trace message, referencing .failed $message-num :: construct nack-trace message, referencing .failed $message-num
:: ::
=/ failed=message-num =/ failed=message-num
@ -1867,9 +1870,9 @@
:: ::
?. ?=([%recork ~] wire) ?. ?=([%recork ~] wire)
=/ res=(unit ?([%fine her=ship =^wire] [%pump her=ship =bone])) =/ res=(unit ?([%fine her=ship =^wire] [%pump her=ship =bone]))
?+ wire ~ ?+ wire ~| %ames-wire-timer^wire !!
[%pump ship=@ bone=@ ~] (parse-pump-timer-wire wire) [%pump ship=@ bone=@ ~] (parse-pump-wire &1.wire &2.wire)
[%fine %behn %wake ship=@ *] `fine/[i.t.t.t.wire t.t.t.t.wire] [%fine %behn %wake @ *] (parse-fine-wire &4.wire t.t.t.t.wire)
== ==
?~ res ?~ res
%- (slog leaf+"ames: got timer for strange wire: {<wire>}" ~) %- (slog leaf+"ames: got timer for strange wire: {<wire>}" ~)
@ -1889,8 +1892,7 @@
fi-abet:ke-abet:ke-take-wake:(ke-abed:ke:fi:peer-core wire.u.res) fi-abet:ke-abet:ke-take-wake:(ke-abed:ke:fi:peer-core wire.u.res)
== ==
:: ::
=. event-core =. event-core (emit duct %pass /recork %b %wait `@da`(add now ~d1))
(emit duct %pass /recork %b %wait `@da`(add now ~d1))
:: ::
?^ error ?^ error
%- (slog 'ames: recork timer failed' u.error) %- (slog 'ames: recork timer failed' u.error)
@ -2268,12 +2270,12 @@
|= [=ship =path] |= [=ship =path]
^+ event-core ^+ event-core
=+ ~:(spit path) :: assert length =+ ~:(spit path) :: assert length
?~ ship-state=(~(get by peers.ames-state) ship) ?^ ship-state=(~(get by peers.ames-state) ship)
%+ enqueue-alien-todo ship ?> ?=([%known *] u.ship-state)
|= todos=alien-agenda fi-abet:(on-keen:fi:(abed-peer:pe ship +.u.ship-state) path duct)
todos(keens (~(put ju keens.todos) path duct)) %+ enqueue-alien-todo ship
?> ?=([%known *] u.ship-state) |= todos=alien-agenda
fi-abet:(on-keen:fi:(abed-peer:pe ship +.u.ship-state) path duct) todos(keens (~(put ju keens.todos) path duct))
:: ::
++ on-yawn ++ on-yawn
|= [=ship =path] |= [=ship =path]