mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 00:13:12 +03:00
Merge pull request #6970 from urbit/pkova/clog
ames, gall: more sane clog handling
This commit is contained in:
commit
880655b8f5
@ -586,7 +586,6 @@
|
||||
%- pairs
|
||||
:~ 'messages'^(numb (lent messages))
|
||||
'packets'^(numb ~(wyt in packets))
|
||||
'heeds'^(set-array heeds from-duct)
|
||||
'keens'^(set-array ~(key by keens) path)
|
||||
==
|
||||
::
|
||||
@ -650,7 +649,6 @@
|
||||
:: }, ...],
|
||||
:: closing: [bone, ..., bone],
|
||||
:: corked: [bone, ..., bone],
|
||||
:: heeds: [['/paths', ...] ...]
|
||||
:: scries:
|
||||
:: -> { =path
|
||||
:: keen-state: {
|
||||
@ -777,8 +775,6 @@
|
||||
'closing'^(set-array closing numb)
|
||||
::
|
||||
'corked'^(set-array corked numb)
|
||||
::
|
||||
'heeds'^(set-array heeds from-duct)
|
||||
::
|
||||
'scries'^(scries ~(tap by keens))
|
||||
==
|
||||
|
File diff suppressed because one or more lines are too long
@ -765,8 +765,6 @@
|
||||
::
|
||||
:: %hear: packet from unix
|
||||
:: %dear: lane from unix
|
||||
:: %heed: track peer's responsiveness; gives %clog if slow
|
||||
:: %jilt: stop tracking peer's responsiveness
|
||||
:: %cork: request to delete message flow
|
||||
:: %tame: request to delete route for ship
|
||||
:: %kroc: request to delete specific message flows, from their bones
|
||||
@ -797,8 +795,6 @@
|
||||
$+ ames-task
|
||||
$% [%hear =lane =blob]
|
||||
[%dear =ship =lane]
|
||||
[%heed =ship]
|
||||
[%jilt =ship]
|
||||
[%cork =ship]
|
||||
[%tame =ship]
|
||||
[%kroc bones=(list [ship bone])]
|
||||
@ -828,6 +824,7 @@
|
||||
:: Messaging Gifts
|
||||
::
|
||||
:: %boon: response message from remote ship
|
||||
:: %noon: boon with duct for clog tracking
|
||||
:: %clog: notify vane that %boon's to peer are backing up locally
|
||||
:: %done: notify vane that peer (n)acked our message
|
||||
:: %lost: notify vane that we crashed on %boon
|
||||
@ -845,7 +842,7 @@
|
||||
::
|
||||
+$ gift
|
||||
$% [%boon payload=*]
|
||||
[%clog =ship]
|
||||
[%noon id=* payload=*]
|
||||
[%done error=(unit error)]
|
||||
[%lost ~]
|
||||
[%send =lane =blob]
|
||||
@ -1012,13 +1009,11 @@
|
||||
::
|
||||
:: messages: pleas local vanes have asked us to send
|
||||
:: packets: packets we've tried to send
|
||||
:: heeds: local tracking requests; passed through into $peer-state
|
||||
::
|
||||
+$ alien-agenda
|
||||
$+ alien-agenda
|
||||
$: messages=(list [=duct =plea])
|
||||
packets=(set =blob)
|
||||
heeds=(set duct)
|
||||
keens=(jug path duct)
|
||||
chums=(jug path duct)
|
||||
==
|
||||
@ -1040,7 +1035,6 @@
|
||||
:: information completes the packet+nack-trace, we remove the
|
||||
:: entry and emit a nack to the local vane that asked us to send
|
||||
:: the message.
|
||||
:: heeds: listeners for %clog notifications
|
||||
:: closing: bones closed on the sender side
|
||||
:: corked: bones closed on both sender and receiver
|
||||
::
|
||||
@ -1058,7 +1052,6 @@
|
||||
snd=(map bone message-pump-state)
|
||||
rcv=(map bone message-sink-state)
|
||||
nax=(set [=bone =message-num])
|
||||
heeds=(set duct)
|
||||
closing=(set bone)
|
||||
corked=(set bone)
|
||||
keens=(map path keen-state)
|
||||
@ -2733,13 +2726,15 @@
|
||||
|%
|
||||
+$ gift :: outgoing result
|
||||
$% [%boon payload=*] :: ames response
|
||||
[%noon id=* payload=*]
|
||||
[%done error=(unit error:ames)] :: ames message (n)ack
|
||||
[%flub ~] :: not ready to handle plea
|
||||
[%unto p=unto] ::
|
||||
== ::
|
||||
+$ task :: incoming request
|
||||
$~ [%vega ~] ::
|
||||
$% [%deal p=sack q=term r=deal] :: full transmission
|
||||
$% [%clog id=*] :: clog notification
|
||||
[%deal p=sack q=term r=deal] :: full transmission
|
||||
[%sear =ship] :: clear pending queues
|
||||
[%jolt =desk =dude] :: (re)start agent
|
||||
[%idle =dude] :: suspend agent
|
||||
|
@ -76,13 +76,6 @@
|
||||
:: Ames's perspective, the newly restarted peer is a new ship.
|
||||
:: Ames's guarantees are not maintained across a breach.
|
||||
::
|
||||
:: A vane can pass Ames a %heed $task to request Ames track a peer's
|
||||
:: responsiveness. If our %boon's to it start backing up locally,
|
||||
:: Ames will give a %clog back to the requesting vane containing the
|
||||
:: unresponsive peer's urbit address. This interaction does not use
|
||||
:: ducts as unique keys. Stop tracking a peer by sending Ames a
|
||||
:: %jilt $task.
|
||||
::
|
||||
:: Debug output can be adjusted using %sift and %spew $task's.
|
||||
::
|
||||
!:
|
||||
@ -218,10 +211,7 @@
|
||||
::
|
||||
++ parse-bone-wire
|
||||
|= =wire
|
||||
^- %- unit
|
||||
$% [%old her=ship =bone]
|
||||
[%new her=ship =rift =bone]
|
||||
==
|
||||
^- (unit parsed-bone-wire)
|
||||
?. ?| ?=([%bone @ @ @ ~] wire)
|
||||
?=([%bone @ @ ~] wire)
|
||||
==
|
||||
@ -239,6 +229,11 @@
|
||||
`@ud`(slav %ud i.t.t.wire)
|
||||
`@ud`(slav %ud i.t.t.t.wire)
|
||||
==
|
||||
::
|
||||
+$ parsed-bone-wire
|
||||
$% [%old her=ship =bone]
|
||||
[%new her=ship =rift =bone]
|
||||
==
|
||||
:: +make-pump-timer-wire: construct wire for |packet-pump timer
|
||||
::
|
||||
++ make-pump-timer-wire
|
||||
@ -620,7 +615,7 @@
|
||||
:: dead: dead flow consolidation timer and recork timer, if set
|
||||
::
|
||||
+$ ames-state
|
||||
$+ ames-state-20
|
||||
$+ ames-state-21
|
||||
$: peers=(map ship ship-state)
|
||||
=unix=duct
|
||||
=life
|
||||
@ -1336,7 +1331,7 @@
|
||||
::
|
||||
+$ ames-state-19
|
||||
$+ ames-state-19
|
||||
$: peers=(map ship ship-state)
|
||||
$: peers=(map ship ship-state-20)
|
||||
=unix=duct
|
||||
=life
|
||||
=rift
|
||||
@ -1351,6 +1346,74 @@
|
||||
::
|
||||
=chain
|
||||
==
|
||||
::
|
||||
+$ task-20
|
||||
$+ task-20
|
||||
$% task
|
||||
[%heed =ship]
|
||||
[%jilt =ship]
|
||||
==
|
||||
::
|
||||
+$ queued-event-20
|
||||
$+ queued-event-20
|
||||
$% [%call =duct wrapped-task=(hobo task-20)]
|
||||
[%take =wire =duct =sign]
|
||||
==
|
||||
::
|
||||
+$ peer-state-20
|
||||
$+ peer-state-20
|
||||
$: $: =symmetric-key
|
||||
=life
|
||||
=rift
|
||||
=public-key
|
||||
sponsor=ship
|
||||
==
|
||||
route=(unit [direct=? =lane])
|
||||
=qos
|
||||
=ossuary
|
||||
snd=(map bone message-pump-state)
|
||||
rcv=(map bone message-sink-state)
|
||||
nax=(set [=bone =message-num])
|
||||
heeds=(set duct)
|
||||
closing=(set bone)
|
||||
corked=(set bone)
|
||||
keens=(map path keen-state)
|
||||
=chain
|
||||
==
|
||||
::
|
||||
+$ alien-agenda-20
|
||||
$+ alien-agenda-20
|
||||
$: messages=(list [=duct =plea])
|
||||
packets=(set =blob)
|
||||
heeds=(set duct)
|
||||
keens=(jug path duct)
|
||||
chums=(jug path duct)
|
||||
==
|
||||
::
|
||||
+$ ship-state-20
|
||||
$+ ship-state-20
|
||||
$% [%alien alien-agenda-20]
|
||||
[%known peer-state-20]
|
||||
==
|
||||
::
|
||||
+$ ames-state-20
|
||||
$+ ames-state-20
|
||||
$: peers=(map ship ship-state-20)
|
||||
=unix=duct
|
||||
=life
|
||||
=rift
|
||||
crypto-core=acru:ames
|
||||
=bug
|
||||
snub=[form=?(%allow %deny) ships=(set ship)]
|
||||
cong=[msg=_5 mem=_100.000]
|
||||
::
|
||||
$= dead
|
||||
$: flow=[%flow (unit dead-timer)]
|
||||
cork=[%cork (unit dead-timer)]
|
||||
==
|
||||
::
|
||||
=chain
|
||||
==
|
||||
:: $bug: debug printing configuration
|
||||
::
|
||||
:: veb: verbosity toggles
|
||||
@ -1399,7 +1462,7 @@
|
||||
$>(%flog task:dill)
|
||||
==
|
||||
$: %g
|
||||
$>(%deal task:gall)
|
||||
$>(?(%clog %deal) task:gall)
|
||||
==
|
||||
$: %j
|
||||
$> $? %private-keys
|
||||
@ -1433,7 +1496,7 @@
|
||||
gift:jael
|
||||
==
|
||||
$: @tas
|
||||
$>(?(%boon %done) gift:ames)
|
||||
$>(?(%noon %boon %done) gift:ames)
|
||||
== ==
|
||||
::
|
||||
:: $message-pump-task: job for |message-pump
|
||||
@ -1504,7 +1567,8 @@
|
||||
[%17 ames-state-17]
|
||||
[%18 ames-state-17]
|
||||
[%19 ames-state-19]
|
||||
[%20 ^ames-state]
|
||||
[%20 ames-state-20]
|
||||
[%21 ^ames-state]
|
||||
==
|
||||
::
|
||||
|= [now=@da eny=@ rof=roof]
|
||||
@ -1627,7 +1691,7 @@
|
||||
:: lifecycle arms; mostly pass-throughs to the contained adult ames
|
||||
::
|
||||
++ scry scry:adult-core
|
||||
++ stay [%20 %larva queued-events ames-state.adult-gate]
|
||||
++ stay [%10 %larva queued-events ames-state.adult-gate]
|
||||
++ load
|
||||
|= $= old
|
||||
$% $: %4
|
||||
@ -1737,12 +1801,19 @@
|
||||
== ==
|
||||
$: %19 :: %keen & %deep modified
|
||||
$% $: %larva
|
||||
events=(qeu queued-event)
|
||||
events=(qeu queued-event-20)
|
||||
state=ames-state-19
|
||||
==
|
||||
[%adult state=ames-state-19]
|
||||
== ==
|
||||
$: %20 :: start informal %ping
|
||||
$% $: %larva
|
||||
events=(qeu queued-event-20)
|
||||
state=ames-state-20
|
||||
==
|
||||
[%adult state=ames-state-20]
|
||||
== ==
|
||||
$: %21 :: remove %heed and %jilt
|
||||
$% $: %larva
|
||||
events=(qeu queued-event)
|
||||
state=_ames-state.adult-gate
|
||||
@ -1810,7 +1881,8 @@
|
||||
[%9 %larva *]
|
||||
~> %slog.0^leaf/"ames: larva %9 load"
|
||||
=. cached-state `[%9 state.old]
|
||||
=. queued-events %- event-17-and-18-to-last
|
||||
=. queued-events %- event-20-to-21
|
||||
%- event-17-and-18-to-last
|
||||
%- event-12-til-16-to-17
|
||||
%- event-9-til-11-to-12
|
||||
events.old
|
||||
@ -1824,7 +1896,8 @@
|
||||
[%10 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva %10 load"
|
||||
=. cached-state `[%10 state.old]
|
||||
=. queued-events %- event-17-and-18-to-last
|
||||
=. queued-events %- event-20-to-21
|
||||
%- event-17-and-18-to-last
|
||||
%- event-12-til-16-to-17
|
||||
%- event-9-til-11-to-12
|
||||
events.old
|
||||
@ -1838,7 +1911,8 @@
|
||||
[%11 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva %11 load"
|
||||
=. cached-state `[%11 state.old]
|
||||
=. queued-events %- event-17-and-18-to-last
|
||||
=. queued-events %- event-20-to-21
|
||||
%- event-17-and-18-to-last
|
||||
%- event-12-til-16-to-17
|
||||
%- event-9-til-11-to-12
|
||||
events.old
|
||||
@ -1852,7 +1926,8 @@
|
||||
[%12 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva %12 load"
|
||||
=. cached-state `[%12 state.old]
|
||||
=. queued-events %- event-17-and-18-to-last
|
||||
=. queued-events %- event-20-to-21
|
||||
%- event-17-and-18-to-last
|
||||
%- event-12-til-16-to-17
|
||||
events.old
|
||||
larval-gate
|
||||
@ -1865,7 +1940,8 @@
|
||||
[%13 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva %13 load"
|
||||
=. cached-state `[%13 state.old]
|
||||
=. queued-events %- event-17-and-18-to-last
|
||||
=. queued-events %- event-20-to-21
|
||||
%- event-17-and-18-to-last
|
||||
%- event-12-til-16-to-17
|
||||
events.old
|
||||
larval-gate
|
||||
@ -1878,7 +1954,8 @@
|
||||
[%14 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva %14 load"
|
||||
=. cached-state `[%14 state.old]
|
||||
=. queued-events %- event-17-and-18-to-last
|
||||
=. queued-events %- event-20-to-21
|
||||
%- event-17-and-18-to-last
|
||||
%- event-12-til-16-to-17
|
||||
events.old
|
||||
larval-gate
|
||||
@ -1891,7 +1968,8 @@
|
||||
[%15 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva %15 load"
|
||||
=. cached-state `[%15 state.old]
|
||||
=. queued-events %- event-17-and-18-to-last
|
||||
=. queued-events %- event-20-to-21
|
||||
%- event-17-and-18-to-last
|
||||
%- event-12-til-16-to-17
|
||||
events.old
|
||||
larval-gate
|
||||
@ -1904,7 +1982,8 @@
|
||||
[%16 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva %16 load"
|
||||
=. cached-state `[%16 state.old]
|
||||
=. queued-events %- event-17-and-18-to-last
|
||||
=. queued-events %- event-20-to-21
|
||||
%- event-17-and-18-to-last
|
||||
%- event-12-til-16-to-17
|
||||
events.old
|
||||
larval-gate
|
||||
@ -1917,7 +1996,7 @@
|
||||
[%17 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva %17 load"
|
||||
=. cached-state `[%17 state.old]
|
||||
=. queued-events (event-17-and-18-to-last events.old)
|
||||
=. queued-events (event-20-to-21 (event-17-and-18-to-last events.old))
|
||||
larval-gate
|
||||
::
|
||||
[%18 %adult *]
|
||||
@ -1928,7 +2007,7 @@
|
||||
[%18 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva %18 load"
|
||||
=. cached-state `[%18 state.old]
|
||||
=. queued-events (event-17-and-18-to-last events.old)
|
||||
=. queued-events (event-20-to-21 (event-17-and-18-to-last events.old))
|
||||
larval-gate
|
||||
::
|
||||
[%19 %adult *]
|
||||
@ -1939,15 +2018,26 @@
|
||||
[%19 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva %19 load"
|
||||
=. cached-state `[%19 state.old]
|
||||
=. queued-events events.old
|
||||
=. queued-events (event-20-to-21 events.old)
|
||||
larval-gate
|
||||
::
|
||||
[%20 %adult *] (load:adult-core %20 state.old)
|
||||
[%20 %adult *]
|
||||
=. cached-state `[%20 state.old]
|
||||
~> %slog.0^leaf/"ames: larva %20 reload"
|
||||
larval-gate
|
||||
::
|
||||
[%20 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva %20 load"
|
||||
=. cached-state `[%20 state.old]
|
||||
=. queued-events (event-20-to-21 events.old)
|
||||
larval-gate
|
||||
::
|
||||
[%21 %adult *] (load:adult-core %21 state.old)
|
||||
::
|
||||
[%21 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva %21 load"
|
||||
=. queued-events events.old
|
||||
=. adult-gate (load:adult-core %20 state.old)
|
||||
=. adult-gate (load:adult-core %21 state.old)
|
||||
larval-gate
|
||||
==
|
||||
::
|
||||
@ -2005,6 +2095,15 @@
|
||||
%naxplanation
|
||||
[%deep %nack ship.task nack-bone.task ;;(message [hed msg])]
|
||||
==
|
||||
++ event-20-to-21
|
||||
|= events=(qeu queued-event-20)
|
||||
^- (qeu queued-event)
|
||||
%- ~(rep in events)
|
||||
|= [e=queued-event-20 q=(qeu queued-event)]
|
||||
?. ?=(%call -.e) (~(put to q) e)
|
||||
=/ task=task-20 ((harden task-20) wrapped-task.e)
|
||||
?: ?=(?(%heed %jilt) -.task) q
|
||||
(~(put to q) e(wrapped-task task))
|
||||
--
|
||||
:: +molt: re-evolve to adult-ames
|
||||
::
|
||||
@ -2075,7 +2174,9 @@
|
||||
=+ ev-core=(ev [now eny rof] [/saxo]~ ames-state.adult-gate)
|
||||
[unix-duct.+.u.cached-state %give %saxo get-sponsors:ev-core]
|
||||
::
|
||||
?> ?=(%20 -.u.cached-state)
|
||||
=? u.cached-state ?=(%20 -.u.cached-state)
|
||||
21+(state-20-to-21:load:adult-core +.u.cached-state)
|
||||
?> ?=(%21 -.u.cached-state)
|
||||
=. ames-state.adult-gate +.u.cached-state
|
||||
[moz larval-core(cached-state ~)]
|
||||
--
|
||||
@ -2174,27 +2275,14 @@
|
||||
~> %slog.0^leaf/"ames: dropping malformed wire: {(spud wire)}"
|
||||
event-core
|
||||
?> ?=([@ her=ship *] u.parsed)
|
||||
=* her her.u.parsed
|
||||
=/ peer-core (abed-got:pe her)
|
||||
|^
|
||||
?: ?& ?=([%new *] u.parsed)
|
||||
(lth rift.u.parsed rift.peer-state.peer-core)
|
||||
==
|
||||
:: ignore events from an old rift
|
||||
::
|
||||
%- %^ ev-trace odd.veb her
|
||||
|.("dropping old rift wire: {(spud wire)}")
|
||||
=/ peer-core (abed-got:pe her.u.parsed)
|
||||
?~ bon=(bone-ok u.parsed wire rift.peer-state.peer-core)
|
||||
event-core
|
||||
=/ =bone
|
||||
?-(u.parsed [%new *] bone.u.parsed, [%old *] bone.u.parsed)
|
||||
=? peer-core ?=([%old *] u.parsed)
|
||||
%- %^ ev-trace odd.veb her
|
||||
|.("parsing old wire: {(spud wire)}")
|
||||
peer-core
|
||||
|^
|
||||
:: relay the vane ack to the foreign peer
|
||||
::
|
||||
=< abet
|
||||
?~(error (send-ack bone) (send-nack bone u.error))
|
||||
?~(error (send-ack u.bon) (send-nack u.bon u.error))
|
||||
::
|
||||
:: if processing succeded, send positive ack packet and exit
|
||||
::
|
||||
@ -2381,28 +2469,6 @@
|
||||
|= =error
|
||||
^+ event-core
|
||||
(emit duct %pass /crud %d %flog %crud error)
|
||||
:: +on-heed: handle request to track .ship's responsiveness
|
||||
::
|
||||
++ on-heed
|
||||
|= =ship
|
||||
^+ event-core
|
||||
=/ ship-state (~(get by peers.ames-state) ship)
|
||||
?: ?=([~ %known *] ship-state)
|
||||
abet:on-heed:(abed-peer:pe ship +.u.ship-state)
|
||||
%^ enqueue-alien-todo ship ship-state
|
||||
|= todos=alien-agenda
|
||||
todos(heeds (~(put in heeds.todos) duct))
|
||||
:: +on-jilt: handle request to stop tracking .ship's responsiveness
|
||||
::
|
||||
++ on-jilt
|
||||
|= =ship
|
||||
^+ event-core
|
||||
=/ ship-state (~(get by peers.ames-state) ship)
|
||||
?: ?=([~ %known *] ship-state)
|
||||
abet:on-jilt:(abed-peer:pe ship +.u.ship-state)
|
||||
%^ enqueue-alien-todo ship ship-state
|
||||
|= todos=alien-agenda
|
||||
todos(heeds (~(del in heeds.todos) duct))
|
||||
:: +on-dear: handle lane from unix
|
||||
::
|
||||
++ on-dear
|
||||
@ -2634,6 +2700,40 @@
|
||||
::
|
||||
=< abet
|
||||
(~(on-hear-shut-packet pe peer-state channel) [lane u.shut-packet dud])
|
||||
::
|
||||
++ bone-ok
|
||||
|= [parsed=parsed-bone-wire =wire =rift]
|
||||
^- (unit bone)
|
||||
=* her her.parsed
|
||||
::
|
||||
?: ?& ?=([%new *] parsed)
|
||||
(lth rift.parsed rift)
|
||||
==
|
||||
:: ignore events from an old rift
|
||||
::
|
||||
%- %^ ev-trace odd.veb her
|
||||
|.("dropping old rift wire: {(spud wire)}")
|
||||
~
|
||||
=/ =bone
|
||||
?-(parsed [%new *] bone.parsed, [%old *] bone.parsed)
|
||||
=+ ?. ?=([%old *] parsed) ~
|
||||
%- %^ ev-trace odd.veb her
|
||||
|.("parsing old wire: {(spud wire)}")
|
||||
~
|
||||
`bone
|
||||
::
|
||||
++ on-take-noon
|
||||
|= [=wire payload=* id=*]
|
||||
^+ event-core
|
||||
?~ parsed=(parse-bone-wire wire)
|
||||
~> %slog.0^leaf/"ames: dropping malformed wire: {(spud wire)}"
|
||||
event-core
|
||||
?> ?=([@ her=ship *] u.parsed)
|
||||
=/ peer-core (abed-got:pe her.u.parsed)
|
||||
?~ bone=(bone-ok u.parsed wire rift.peer-state.peer-core)
|
||||
event-core
|
||||
::
|
||||
abet:(check-clog:(on-memo:peer-core u.bone [%boon payload]) u.bone id)
|
||||
:: +on-take-boon: receive request to give message to peer
|
||||
::
|
||||
++ on-take-boon
|
||||
@ -2644,24 +2744,10 @@
|
||||
event-core
|
||||
::
|
||||
?> ?=([@ her=ship *] u.parsed)
|
||||
=* her her.u.parsed
|
||||
=/ peer-core (abed-got:pe her)
|
||||
::
|
||||
?: ?& ?=([%new *] u.parsed)
|
||||
(lth rift.u.parsed rift.peer-state.peer-core)
|
||||
==
|
||||
:: ignore events from an old rift
|
||||
::
|
||||
%- %^ ev-trace odd.veb her
|
||||
|.("dropping old rift wire: {(spud wire)}")
|
||||
=/ peer-core (abed-got:pe her.u.parsed)
|
||||
?~ bone=(bone-ok u.parsed wire rift.peer-state.peer-core)
|
||||
event-core
|
||||
=/ =bone
|
||||
?-(u.parsed [%new *] bone.u.parsed, [%old *] bone.u.parsed)
|
||||
=? peer-core ?=([%old *] u.parsed)
|
||||
%- %^ ev-trace odd.veb her
|
||||
|.("parsing old wire: {(spud wire)}")
|
||||
peer-core
|
||||
abet:(on-memo:peer-core bone [%boon payload])
|
||||
abet:(on-memo:peer-core u.bone [%boon payload])
|
||||
:: +on-plea: handle request to send message
|
||||
::
|
||||
++ on-plea
|
||||
@ -3172,12 +3258,6 @@
|
||||
:: save current duct
|
||||
::
|
||||
=/ original-duct duct
|
||||
:: apply heeds
|
||||
::
|
||||
=. event-core
|
||||
%+ roll ~(tap in heeds.todos)
|
||||
|= [=^duct core=_event-core]
|
||||
(on-heed:core(duct duct) ship)
|
||||
:: apply outgoing messages, reversing for FIFO order
|
||||
::
|
||||
=. event-core
|
||||
@ -3590,11 +3670,7 @@
|
||||
::
|
||||
+| %tasks
|
||||
::
|
||||
++ on-heed
|
||||
peer-core(heeds.peer-state (~(put in heeds.peer-state) duct))
|
||||
::
|
||||
++ on-jilt
|
||||
peer-core(heeds.peer-state (~(del in heeds.peer-state) duct))
|
||||
:: +update-qos: update and maybe print connection status
|
||||
::
|
||||
++ update-qos
|
||||
@ -3611,12 +3687,7 @@
|
||||
peer-core
|
||||
:: print message
|
||||
::
|
||||
=. peer-core (pe-emit duct %pass /qos %d %flog %text u.text)
|
||||
:: if peer has stopped responding, check if %boon's are backing up
|
||||
::
|
||||
?. ?=(?(%dead %unborn) -.qos.peer-state)
|
||||
peer-core
|
||||
check-clog
|
||||
(pe-emit duct %pass /qos %d %flog %text u.text)
|
||||
:: +on-hear-shut-packet: handle receipt of ack or message fragment
|
||||
::
|
||||
++ on-hear-shut-packet
|
||||
@ -3655,6 +3726,15 @@
|
||||
|= =bone
|
||||
^+ peer-core
|
||||
abet:(call:(abed:mi:peer-core bone) %flub ~)
|
||||
::
|
||||
++ check-clog
|
||||
|= [=bone id=*]
|
||||
^+ peer-core
|
||||
=/ =message-pump-state (~(got by snd.peer-state) bone)
|
||||
~& [%check-clog unsent-messages.message-pump-state]
|
||||
?: (gth ~(wyt in unsent-messages.message-pump-state) msg.cong.ames-state)
|
||||
(pe-emit [/ames]~ %pass /clog %g %clog id)
|
||||
peer-core
|
||||
:: +on-memo: handle request to send message
|
||||
::
|
||||
++ on-memo
|
||||
@ -3669,13 +3749,7 @@
|
||||
~> %slog.0^leaf/"ames: ignoring message on corked bone {<bone>}"
|
||||
peer-core
|
||||
::
|
||||
=. peer-core abet:(call:(abed:mu bone) %memo message)
|
||||
::
|
||||
?: ?& ?=(%boon -.message)
|
||||
(gte now (add ~s30 last-contact.qos.peer-state))
|
||||
==
|
||||
check-clog
|
||||
peer-core
|
||||
abet:(call:(abed:mu bone) %memo message)
|
||||
:: +on-wake: handle timer expiration
|
||||
::
|
||||
++ on-wake
|
||||
@ -3803,55 +3877,6 @@
|
||||
recork-one
|
||||
::
|
||||
+| %implementation
|
||||
:: +check-clog: notify clients if peer has stopped responding
|
||||
::
|
||||
++ check-clog
|
||||
^+ peer-core
|
||||
::
|
||||
:: Only look at response bones. Request bones are unregulated,
|
||||
:: since requests tend to be much smaller than responses.
|
||||
::
|
||||
=/ pumps=(list message-pump-state)
|
||||
%+ murn ~(tap by snd.peer-state)
|
||||
|= [=bone =message-pump-state]
|
||||
?: =(0 (end 0 bone))
|
||||
~
|
||||
`u=message-pump-state
|
||||
:: if clogged, notify client vane
|
||||
::
|
||||
|^ ?. &(nuf-messages nuf-memory) peer-core
|
||||
%+ roll ~(tap in heeds.peer-state)
|
||||
|=([d=^duct core=_peer-core] (pe-emit:core d %give %clog her))
|
||||
:: +nuf-messages: are there enough messages to mark as clogged?
|
||||
::
|
||||
++ nuf-messages
|
||||
=| num=@ud
|
||||
|- ^- ?
|
||||
?~ pumps |
|
||||
=. num
|
||||
;: add num
|
||||
(sub [next current]:i.pumps)
|
||||
~(wyt in unsent-messages.i.pumps)
|
||||
==
|
||||
?: (gte num msg.cong.ames-state)
|
||||
&
|
||||
$(pumps t.pumps)
|
||||
:: +nuf-memory: is enough memory used to mark as clogged?
|
||||
::
|
||||
++ nuf-memory
|
||||
=| mem=@ud
|
||||
|- ^- ?
|
||||
?~ pumps |
|
||||
=. mem
|
||||
%+ add
|
||||
%- ~(rep in unsent-messages.i.pumps)
|
||||
|=([m=message b=_mem] (add b (met 3 (jim m))))
|
||||
?~ unsent-fragments.i.pumps 0
|
||||
(met 3 fragment.i.unsent-fragments.i.pumps)
|
||||
?: (gte mem mem.cong.ames-state)
|
||||
&
|
||||
$(pumps t.pumps)
|
||||
--
|
||||
:: +send-shut-packet: fire encrypted packet at rcvr and maybe sponsors
|
||||
::
|
||||
++ send-shut-packet
|
||||
@ -5406,9 +5431,7 @@
|
||||
%born on-born:event-core
|
||||
%hear (on-hear:event-core [lane blob ~]:task)
|
||||
%dear (on-dear:event-core +.task)
|
||||
%heed (on-heed:event-core ship.task)
|
||||
%init on-init:event-core
|
||||
%jilt (on-jilt:event-core ship.task)
|
||||
%prod (on-prod:event-core ships.task)
|
||||
%sift (on-sift:event-core ships.task)
|
||||
%snub (on-snub:event-core [form ships]:task)
|
||||
@ -5438,7 +5461,7 @@
|
||||
|= [=wire =duct dud=(unit goof) =sign]
|
||||
^- [(list move) _ames-gate]
|
||||
?^ dud
|
||||
~|(%ames-take-dud (mean tang.u.dud))
|
||||
~&(%ames-take-dud (mean tang.u.dud))
|
||||
::
|
||||
=/ event-core (ev [now eny rof] duct ames-state)
|
||||
::
|
||||
@ -5450,6 +5473,7 @@
|
||||
?- sign
|
||||
[@ %done *] (on-take-done:event-core wire error.sign)
|
||||
[@ %boon *] (on-take-boon:event-core wire payload.sign)
|
||||
[@ %noon *] (on-take-noon:event-core wire payload.sign id.sign)
|
||||
::
|
||||
[%ames %tune *] (on-tune:event-core wire [[ship path] roar]:sign)
|
||||
::
|
||||
@ -5465,15 +5489,15 @@
|
||||
[moves ames-gate]
|
||||
:: +stay: extract state before reload
|
||||
::
|
||||
++ stay [%20 %adult ames-state]
|
||||
++ stay [%21 %adult ames-state]
|
||||
:: +load: load in old state after reload
|
||||
::
|
||||
++ load
|
||||
=< |= $= old-state
|
||||
$% [%20 ^ames-state]
|
||||
$% [%21 ^ames-state]
|
||||
==
|
||||
^+ ames-gate
|
||||
?> ?=(%20 -.old-state)
|
||||
?> ?=(%21 -.old-state)
|
||||
ames-gate(ames-state +.old-state)
|
||||
:: all state transitions are called from larval ames
|
||||
::
|
||||
@ -5715,7 +5739,7 @@
|
||||
peers
|
||||
%- ~(run by peers.old)
|
||||
|= s=ship-state-17
|
||||
^- ship-state
|
||||
^- ship-state-20
|
||||
?: ?=(%alien -.s)
|
||||
%= s
|
||||
keens [keens.s ~]
|
||||
@ -5748,10 +5772,25 @@
|
||||
::
|
||||
++ state-19-to-20
|
||||
|= old=ames-state-19
|
||||
^- ^ames-state
|
||||
^- ames-state-20
|
||||
%= old
|
||||
veb.bug [&1 &2 &3 &4 &5 &6 &7 &8 |8 %.n]:veb.bug.old
|
||||
==
|
||||
::
|
||||
++ state-20-to-21
|
||||
|= old=ames-state-20
|
||||
^- ^ames-state
|
||||
%= old
|
||||
peers
|
||||
%- ~(run by peers.old)
|
||||
|= s=ship-state-20
|
||||
^- ship-state
|
||||
?: ?=(%alien -.s)
|
||||
[%alien messages.s packets.s keens.s chums.s]
|
||||
:* -.s -.+.s route.s qos.s ossuary.s snd.s rcv.s
|
||||
nax.s closing.s corked.s keens.s chain.s
|
||||
==
|
||||
==
|
||||
--
|
||||
:: +scry: dereference namespace
|
||||
::
|
||||
|
@ -594,9 +594,6 @@
|
||||
:: first contact; update state and subscribe to notifications
|
||||
::
|
||||
=. contacts.state (~(put in contacts.state) ship)
|
||||
:: ask ames to track .ship's connectivity
|
||||
::
|
||||
=. moves [[system-duct.state %pass /sys/lag %a %heed ship] moves]
|
||||
:: ask jael to track .ship's breaches
|
||||
::
|
||||
=/ =note-arvo [%j %public-keys (silt ship ~)]
|
||||
@ -616,8 +613,6 @@
|
||||
::
|
||||
=. contacts.state (~(del in contacts.state) ship)
|
||||
::
|
||||
=. moves [[system-duct.state %pass /sys/lag %a %jilt ship] moves]
|
||||
::
|
||||
=/ =note-arvo [%j %nuke (silt ship ~)]
|
||||
=. moves
|
||||
[[system-duct.state %pass /sys/era note-arvo] moves]
|
||||
@ -657,7 +652,6 @@
|
||||
%lyv ..mo-core :: vestigial
|
||||
%cor ..mo-core :: vestigial
|
||||
%era (mo-handle-sys-era wire sign-arvo)
|
||||
%lag (mo-handle-sys-lag wire sign-arvo)
|
||||
%req (mo-handle-sys-req wire sign-arvo)
|
||||
%way (mo-handle-sys-way wire sign-arvo)
|
||||
==
|
||||
@ -671,24 +665,20 @@
|
||||
?. ?=(%breach -.public-keys-result.sign-arvo)
|
||||
mo-core
|
||||
(mo-breach /jael who.public-keys-result.sign-arvo)
|
||||
:: +mo-handle-sys-lag: handle an ames %clog notification
|
||||
:: +mo-handle-sys-clog: handle an ames %clog notification
|
||||
::
|
||||
++ mo-handle-sys-lag
|
||||
|= [=wire =sign-arvo]
|
||||
++ mo-handle-sys-clog
|
||||
|= [=duct agent-name=term]
|
||||
^+ mo-core
|
||||
=/ yoke (~(get by yokes.state) agent-name)
|
||||
?~ yoke
|
||||
mo-core
|
||||
=? mo-core ?=(%live -.u.yoke)
|
||||
=/ app (ap-abed:ap agent-name [~ our /ames])
|
||||
ap-abet:(ap-clog:app duct)
|
||||
::
|
||||
?> ?=([%lag ~] wire)
|
||||
?> ?=([%ames %clog *] sign-arvo)
|
||||
::
|
||||
=/ agents=(list [=dude =yoke]) ~(tap by yokes.state)
|
||||
|- ^+ mo-core
|
||||
?~ agents mo-core
|
||||
::
|
||||
=? mo-core ?=(%live -.yoke.i.agents)
|
||||
=/ app (ap-abed:ap dude.i.agents [~ our /ames])
|
||||
ap-abet:(ap-clog:app ship.sign-arvo)
|
||||
::
|
||||
$(agents t.agents)
|
||||
mo-core
|
||||
::
|
||||
:: +mo-handle-sys-req: TODO description
|
||||
::
|
||||
:: TODO: what should we do if the remote nacks our %pull?
|
||||
@ -699,7 +689,6 @@
|
||||
?> ?=([%req @ @ ~] wire)
|
||||
=/ him (slav %p i.t.wire)
|
||||
=/ dap i.t.t.wire
|
||||
::
|
||||
?> ?=([?(%gall %behn) %unto *] sign-arvo)
|
||||
=/ =unto +>.sign-arvo
|
||||
::
|
||||
@ -713,7 +702,7 @@
|
||||
::
|
||||
%fact
|
||||
=+ [mark noun]=[p q.q]:cage.unto
|
||||
(mo-give %boon %d mark noun)
|
||||
(mo-give %noon [dap [/gall/sys/req/[i.t.wire]/[dap] hen]] %d mark noun)
|
||||
::
|
||||
%kick
|
||||
(mo-give %boon %x ~)
|
||||
@ -734,6 +723,7 @@
|
||||
=/ foreign-agent i.t.t.wire
|
||||
::
|
||||
?+ sign-arvo !!
|
||||
::
|
||||
[%ames %done *]
|
||||
=/ err=(unit tang)
|
||||
?~ error=error.sign-arvo
|
||||
@ -1653,17 +1643,11 @@
|
||||
:: TODO: %drip local app notification for error isolation
|
||||
::
|
||||
++ ap-clog
|
||||
|= =ship
|
||||
|= =duct
|
||||
^+ ap-core
|
||||
::
|
||||
=/ in=(list [=duct =^ship =path]) ~(tap by bitt.yoke)
|
||||
|- ^+ ap-core
|
||||
?~ in ap-core
|
||||
::
|
||||
=? ap-core =(ship ship.i.in)
|
||||
=/ core ap-kill-up(agent-duct duct.i.in)
|
||||
core(agent-duct agent-duct)
|
||||
$(in t.in)
|
||||
=/ core ap-kill-up(agent-duct duct)
|
||||
core(agent-duct agent-duct)
|
||||
:: +ap-agent-core: agent core with current bowl and state
|
||||
::
|
||||
++ ap-agent-core
|
||||
@ -2369,6 +2353,10 @@
|
||||
::
|
||||
=/ mo-core (mo-abed:mo duct)
|
||||
?- -.task
|
||||
%clog
|
||||
=+ ;;([dap=@tas =^duct] id.task)
|
||||
mo-abet:(mo-handle-sys-clog:mo-core duct dap)
|
||||
::
|
||||
%deal
|
||||
=/ [=sack =term =deal] [p q r]:task
|
||||
?. =(q.sack our)
|
||||
@ -2462,6 +2450,7 @@
|
||||
blocked=(map term (qeu blocked-move-13))
|
||||
=bug
|
||||
==
|
||||
::
|
||||
+$ blocked-move-13 [=duct routes=routes-13 move=(each deal unto)]
|
||||
+$ routes-13
|
||||
$: disclosing=(unit (set ship))
|
||||
|
@ -46,16 +46,6 @@ export class Ames extends Component {
|
||||
return <SearchableList placeholder="path" items={items}/>;
|
||||
}
|
||||
|
||||
renderDucts(ducts) {
|
||||
const items = ducts.map(duct => {
|
||||
return {
|
||||
key: duct.join(' '),
|
||||
jsx: (<div>{renderDuct(duct)}</div>)
|
||||
}
|
||||
});
|
||||
return <SearchableList placeholder="duct" items={items}/>
|
||||
}
|
||||
|
||||
renderSnd(snd) {
|
||||
const unsent = snd['unsent-messages'].reduce((a, b) => {
|
||||
return a + b + ' bytes, ';
|
||||
@ -309,7 +299,6 @@ export class Ames extends Component {
|
||||
return (<>
|
||||
Pending messages: {peer.alien.messages}
|
||||
Pending packets: {peer.alien.packets}
|
||||
Heeds: {this.renderDucts(peer.alien.heeds)}
|
||||
Keens: {this.renderPaths(peer.alien.keens)}
|
||||
</>);
|
||||
} else if (peer.known) {
|
||||
@ -373,11 +362,6 @@ export class Ames extends Component {
|
||||
<SearchableList placeholder="bone" items={naxItems} />
|
||||
</>);
|
||||
|
||||
const heeds = (<>
|
||||
<h4 style={{marginTop: '1em'}}>heeds</h4>
|
||||
{this.renderDucts(p.heeds)}
|
||||
</>);
|
||||
|
||||
const scryItems = p.scries.map(this.renderScry);
|
||||
const scry = (<>
|
||||
<h4 style={{marginTop: '1em'}}>scries</h4>
|
||||
@ -395,7 +379,6 @@ export class Ames extends Component {
|
||||
{forward}
|
||||
{backward}
|
||||
{nax}
|
||||
{heeds}
|
||||
{scry}
|
||||
</>);
|
||||
} else {
|
||||
|
@ -33,8 +33,7 @@
|
||||
[~1111.1.1 0xdead.beef *roof]
|
||||
:- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
|
||||
[%deal [~nec ~bud /] %pub %watch /foo]
|
||||
:~ :- ~[/init] [%pass /sys/lag %a %heed ~bud]
|
||||
:- ~[/init] [%pass /sys/era %j %public-keys (sy ~bud ~)]
|
||||
:~ :- ~[/init] [%pass /sys/era %j %public-keys (sy ~bud ~)]
|
||||
:- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
|
||||
[%pass /sys/way/~bud/pub %a %plea ~bud %g /ge/pub [%0 %s /foo]]
|
||||
==
|
||||
@ -84,8 +83,7 @@
|
||||
[~1111.1.2 0xbeef.dead *roof]
|
||||
:- ~[/bone/~nec/0/1 //unix]
|
||||
[%plea ~nec %g /ge/pub [%0 %s /foo]]
|
||||
:~ :- ~[/init] [%pass /sys/lag %a %heed ~nec]
|
||||
:- ~[/init] [%pass /sys/era %j %public-keys (sy ~nec ~)]
|
||||
:~ :- ~[/init] [%pass /sys/era %j %public-keys (sy ~nec ~)]
|
||||
:- ~[/bone/~nec/0/1 //unix]
|
||||
[%pass /sys/req/~nec/pub %g %deal [~nec ~bud /] %pub %watch /foo]
|
||||
==
|
||||
@ -172,18 +170,6 @@
|
||||
~
|
||||
==
|
||||
:- t11 |. :- %|
|
||||
:: start the clog and kick process; give clog to publisher gall
|
||||
~? > dbug 'start the clog and kick process; give clog to publisher gall'
|
||||
=^ t12 gall.bud
|
||||
%: gall-check-take:v gall.bud
|
||||
[~1111.1.4 0xbeef.dead *roof]
|
||||
:+ /sys/lag ~[/init]
|
||||
[%ames %clog ~nec]
|
||||
:~ :- ~[/sys/req/~nec/pub /bone/~nec/0/1 //unix]
|
||||
[%give %unto %kick ~]
|
||||
==
|
||||
==
|
||||
:- t12 |. :- %|
|
||||
:: gall gives %kick %boon to ames
|
||||
~? > dbug 'gall gives %kick %boon to ames'
|
||||
=^ t13 gall.bud
|
||||
|
Loading…
Reference in New Issue
Block a user