mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-19 04:41:37 +03:00
ames: add +abed arms to peer-core
This commit is contained in:
parent
d214fad1bd
commit
439184fa7c
@ -1302,13 +1302,11 @@
|
|||||||
~> %slog.0^leaf/"ames: dropping malformed wire: {(spud wire)}"
|
~> %slog.0^leaf/"ames: dropping malformed wire: {(spud wire)}"
|
||||||
event-core
|
event-core
|
||||||
?> ?=([@ her=ship *] u.parsed)
|
?> ?=([@ her=ship *] u.parsed)
|
||||||
=* her her.u.parsed
|
=* her her.u.parsed
|
||||||
=/ =peer-state (got-peer-state her)
|
=/ peer-core (abed-got:pe her)
|
||||||
=/ =channel [[our her] now channel-state -.peer-state]
|
|
||||||
=/ peer-core (pe peer-state channel)
|
|
||||||
|^
|
|^
|
||||||
?: ?& ?=([%new *] u.parsed)
|
?: ?& ?=([%new *] u.parsed)
|
||||||
(lth rift.u.parsed rift.peer-state)
|
(lth rift.u.parsed rift.peer-state.peer-core)
|
||||||
==
|
==
|
||||||
:: ignore events from an old rift
|
:: ignore events from an old rift
|
||||||
::
|
::
|
||||||
@ -1341,19 +1339,18 @@
|
|||||||
=/ sink-core (mi:peer-core bone *message-sink-state)
|
=/ sink-core (mi:peer-core bone *message-sink-state)
|
||||||
=. peer-core abet:(call:abed:sink-core %done ok=%.n)
|
=. peer-core abet:(call:abed:sink-core %done ok=%.n)
|
||||||
=. event-core abet:peer-core
|
=. event-core abet:peer-core
|
||||||
=/ =^peer-state (got-peer-state her)
|
|
||||||
=/ =^channel [[our her] now channel-state -.peer-state]
|
|
||||||
:: construct nack-trace message, referencing .failed $message-num
|
:: construct nack-trace message, referencing .failed $message-num
|
||||||
::
|
::
|
||||||
=/ failed=message-num last-acked:(~(got by rcv.peer-state) bone)
|
=/ failed=message-num
|
||||||
|
last-acked:(~(got by rcv.peer-state.peer-core) bone)
|
||||||
=/ =naxplanation [failed error]
|
=/ =naxplanation [failed error]
|
||||||
=/ =message-blob (jam naxplanation)
|
=/ =message-blob (jam naxplanation)
|
||||||
:: send nack-trace message on associated .nack-trace-bone
|
:: send nack-trace message on associated .nack-trace-bone
|
||||||
::
|
::
|
||||||
=. peer-core (pe peer-state channel)
|
|
||||||
=/ nack-trace-bone=^bone (mix 0b10 bone)
|
=/ nack-trace-bone=^bone (mix 0b10 bone)
|
||||||
::
|
::
|
||||||
=+ pump-core=(mu:peer-core nack-trace-bone *message-pump-state)
|
=/ pump-core
|
||||||
|
(mu:(abed-got:pe her) nack-trace-bone *message-pump-state)
|
||||||
abet:(call:abed:pump-core %memo message-blob)
|
abet:(call:abed:pump-core %memo message-blob)
|
||||||
--
|
--
|
||||||
:: +on-sift: handle request to filter debug output by ship
|
:: +on-sift: handle request to filter debug output by ship
|
||||||
@ -1407,8 +1404,7 @@
|
|||||||
^+ event-core
|
^+ event-core
|
||||||
=/ par (get-peer-state her)
|
=/ par (get-peer-state her)
|
||||||
?~ par event-core
|
?~ par event-core
|
||||||
=/ =channel [[our her] now channel-state -.u.par]
|
=/ peer-core (abed-peer:pe her u.par)
|
||||||
=/ peer-core (pe u.par channel)
|
|
||||||
=/ bones ~(tap in ~(key by snd.u.par))
|
=/ bones ~(tap in ~(key by snd.u.par))
|
||||||
|- ^+ event-core
|
|- ^+ event-core
|
||||||
?~ bones abet:peer-core
|
?~ bones abet:peer-core
|
||||||
@ -1477,28 +1473,22 @@
|
|||||||
|= =ship
|
|= =ship
|
||||||
^+ event-core
|
^+ event-core
|
||||||
=/ ship-state (~(get by peers.ames-state) ship)
|
=/ ship-state (~(get by peers.ames-state) ship)
|
||||||
?. ?=([~ %known *] ship-state)
|
?: ?=([~ %known *] ship-state)
|
||||||
%+ enqueue-alien-todo ship
|
abet:on-heed:(abed-peer:pe ship +.u.ship-state)
|
||||||
|= todos=alien-agenda
|
%+ enqueue-alien-todo ship
|
||||||
todos(heeds (~(put in heeds.todos) duct))
|
|= todos=alien-agenda
|
||||||
::
|
todos(heeds (~(put in heeds.todos) duct))
|
||||||
=/ =peer-state +.u.ship-state
|
|
||||||
=/ =channel [[our ship] now channel-state -.peer-state]
|
|
||||||
abet:on-heed:(pe peer-state channel)
|
|
||||||
:: +on-jilt: handle request to stop tracking .ship's responsiveness
|
:: +on-jilt: handle request to stop tracking .ship's responsiveness
|
||||||
::
|
::
|
||||||
++ on-jilt
|
++ on-jilt
|
||||||
|= =ship
|
|= =ship
|
||||||
^+ event-core
|
^+ event-core
|
||||||
=/ ship-state (~(get by peers.ames-state) ship)
|
=/ ship-state (~(get by peers.ames-state) ship)
|
||||||
?. ?=([~ %known *] ship-state)
|
?: ?=([~ %known *] ship-state)
|
||||||
%+ enqueue-alien-todo ship
|
abet:on-jilt:(abed-peer:pe ship +.u.ship-state)
|
||||||
|= todos=alien-agenda
|
%+ enqueue-alien-todo ship
|
||||||
todos(heeds (~(del in heeds.todos) duct))
|
|= todos=alien-agenda
|
||||||
::
|
todos(heeds (~(del in heeds.todos) duct))
|
||||||
=/ =peer-state +.u.ship-state
|
|
||||||
=/ =channel [[our ship] now channel-state -.peer-state]
|
|
||||||
abet:on-jilt:(pe peer-state channel)
|
|
||||||
:: +on-hear: handle raw packet receipt
|
:: +on-hear: handle raw packet receipt
|
||||||
::
|
::
|
||||||
++ on-hear
|
++ on-hear
|
||||||
@ -1519,10 +1509,7 @@
|
|||||||
:: so we should only get responses from ships we know.
|
:: so we should only get responses from ships we know.
|
||||||
:: below we assume sndr.shot is a known peer.
|
:: below we assume sndr.shot is a known peer.
|
||||||
=* from sndr.shot
|
=* from sndr.shot
|
||||||
=/ =peer-state (got-peer-state from)
|
fi-abet:(on-hear:fi:(abed-got:pe from) l shot)
|
||||||
=/ =channel [[our from] now channel-state -.peer-state]
|
|
||||||
=/ peer-core (pe peer-state channel)
|
|
||||||
fi-abet:(on-hear:fi:peer-core l shot)
|
|
||||||
:: +on-hear-packet: handle mildly processed packet receipt
|
:: +on-hear-packet: handle mildly processed packet receipt
|
||||||
::
|
::
|
||||||
++ on-hear-packet
|
++ on-hear-packet
|
||||||
@ -1683,8 +1670,8 @@
|
|||||||
`[direct=%.n |+u.origin.shot]
|
`[direct=%.n |+u.origin.shot]
|
||||||
:: perform peer-specific handling of packet
|
:: perform peer-specific handling of packet
|
||||||
::
|
::
|
||||||
=/ peer-core (pe peer-state channel)
|
=< abet
|
||||||
abet:(on-hear-shut-packet:peer-core lane shut-packet dud)
|
(~(on-hear-shut-packet pe peer-state channel) [lane shut-packet dud])
|
||||||
:: +on-take-boon: receive request to give message to peer
|
:: +on-take-boon: receive request to give message to peer
|
||||||
::
|
::
|
||||||
++ on-take-boon
|
++ on-take-boon
|
||||||
@ -1696,22 +1683,18 @@
|
|||||||
:: XX use ev-trace?
|
:: XX use ev-trace?
|
||||||
=/ =tape "; fine dropping malformed wire {<wire>}"
|
=/ =tape "; fine dropping malformed wire {<wire>}"
|
||||||
(emit duct %pass /parse-wire %d %flog %text tape)
|
(emit duct %pass /parse-wire %d %flog %text tape)
|
||||||
=/ =peer-state (got-peer-state u.her)
|
abet:(on-pine-boon:fi:(abed-got:pe u.her) t.t.t.wire payload)
|
||||||
=/ =channel [[our u.her] now channel-state -.peer-state]
|
|
||||||
fi-abet:(on-pine-boon:fi:(pe peer-state channel) t.t.t.wire payload)
|
|
||||||
::
|
::
|
||||||
?~ parsed=(parse-bone-wire wire)
|
?~ parsed=(parse-bone-wire wire)
|
||||||
~> %slog.0^leaf/"ames: dropping malformed wire: {(spud wire)}"
|
~> %slog.0^leaf/"ames: dropping malformed wire: {(spud wire)}"
|
||||||
event-core
|
event-core
|
||||||
::
|
::
|
||||||
?> ?=([@ her=ship *] u.parsed)
|
?> ?=([@ her=ship *] u.parsed)
|
||||||
=* her her.u.parsed
|
=* her her.u.parsed
|
||||||
=/ =peer-state (got-peer-state her)
|
=/ peer-core (abed-got:pe her)
|
||||||
=/ =channel [[our her] now channel-state -.peer-state]
|
|
||||||
=/ peer-core (pe peer-state channel)
|
|
||||||
::
|
::
|
||||||
?: ?& ?=([%new *] u.parsed)
|
?: ?& ?=([%new *] u.parsed)
|
||||||
(lth rift.u.parsed rift.peer-state)
|
(lth rift.u.parsed rift.peer-state.peer-core)
|
||||||
==
|
==
|
||||||
:: ignore events from an old rift
|
:: ignore events from an old rift
|
||||||
::
|
::
|
||||||
@ -1770,7 +1753,7 @@
|
|||||||
=/ sndr [our our-life.channel]
|
=/ sndr [our our-life.channel]
|
||||||
=/ rcvr [ship her-life.channel]
|
=/ rcvr [ship her-life.channel]
|
||||||
"plea {<sndr rcvr bone=bone vane.plea path.plea>}"
|
"plea {<sndr rcvr bone=bone vane.plea path.plea>}"
|
||||||
abet:(on-memo:(pe peer-state channel) bone plea %plea)
|
abet:(~(on-memo pe [peer-state channel]) bone plea %plea)
|
||||||
:: +on-cork: handle request to kill a flow
|
:: +on-cork: handle request to kill a flow
|
||||||
::
|
::
|
||||||
++ on-cork
|
++ on-cork
|
||||||
@ -1801,7 +1784,7 @@
|
|||||||
=/ sndr [our our-life.channel]
|
=/ sndr [our our-life.channel]
|
||||||
=/ rcvr [ship her-life.channel]
|
=/ rcvr [ship her-life.channel]
|
||||||
"cork plea {<sndr rcvr bone=bone vane.plea path.plea>}"
|
"cork plea {<sndr rcvr bone=bone vane.plea path.plea>}"
|
||||||
abet:(on-memo:(pe peer-state channel) bone plea %plea)
|
abet:(~(on-memo pe [peer-state channel]) bone plea %plea)
|
||||||
:: +on-kroc: cork all stale flows from failed subscriptions
|
:: +on-kroc: cork all stale flows from failed subscriptions
|
||||||
::
|
::
|
||||||
++ on-kroc
|
++ on-kroc
|
||||||
@ -1908,13 +1891,12 @@
|
|||||||
%- slog
|
%- slog
|
||||||
[leaf+"ames: got timer for strange ship: {<her.u.res>}, ignoring" ~]
|
[leaf+"ames: got timer for strange ship: {<her.u.res>}, ignoring" ~]
|
||||||
::
|
::
|
||||||
=/ =channel [[our her.u.res] now channel-state -.u.state]
|
=/ peer-core (abed-peer:pe her.u.res u.state)
|
||||||
=/ peer-core (pe u.state channel)
|
|
||||||
?- -.u.res
|
?- -.u.res
|
||||||
%pump abet:(on-wake:peer-core bone.u.res error)
|
%pump abet:(on-wake:peer-core bone.u.res error)
|
||||||
::
|
::
|
||||||
%fine
|
%fine
|
||||||
=< fi-abet
|
=< abet
|
||||||
ke-abet:ke-take-wake:(ke-abed:ke:fi:peer-core wire.u.res)
|
ke-abet:ke-take-wake:(ke-abed:ke:fi:peer-core wire.u.res)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
@ -1932,10 +1914,7 @@
|
|||||||
=+ [her sat]=i.pez
|
=+ [her sat]=i.pez
|
||||||
?. ?=(%known -.sat)
|
?. ?=(%known -.sat)
|
||||||
$(pez t.pez)
|
$(pez t.pez)
|
||||||
=* peer-state +.sat
|
$(pez t.pez, event-core abet:recork-one:(abed-peer:pe her +.sat))
|
||||||
=/ =channel [[our her] now channel-state -.peer-state]
|
|
||||||
=/ peer-core (pe peer-state channel)
|
|
||||||
$(pez t.pez, event-core abet:recork-one:peer-core)
|
|
||||||
:: +on-init: first boot; subscribe to our info from jael
|
:: +on-init: first boot; subscribe to our info from jael
|
||||||
::
|
::
|
||||||
++ on-init
|
++ on-init
|
||||||
@ -2170,8 +2149,8 @@
|
|||||||
++ meet-alien-fine
|
++ meet-alien-fine
|
||||||
|= [peens=(jug path ^duct) key=?(%keen %pine)]
|
|= [peens=(jug path ^duct) key=?(%keen %pine)]
|
||||||
^+ event-core
|
^+ event-core
|
||||||
=+ fine=fi:(pe *peer-state *channel)
|
=+ fine=fi:(abed:pe ship)
|
||||||
=; f=_fine fi-abet:f
|
=< fi-abet ^+ fine
|
||||||
%- ~(rep by peens)
|
%- ~(rep by peens)
|
||||||
|= [[=path ducts=(set ^duct)] cor=_fine]
|
|= [[=path ducts=(set ^duct)] cor=_fine]
|
||||||
%- ~(rep in ducts)
|
%- ~(rep in ducts)
|
||||||
@ -2281,10 +2260,7 @@
|
|||||||
|= todos=alien-agenda
|
|= todos=alien-agenda
|
||||||
todos(pines (~(put ju keens.todos) path duct))
|
todos(pines (~(put ju keens.todos) path duct))
|
||||||
?> ?=([%known *] u.ship-state)
|
?> ?=([%known *] u.ship-state)
|
||||||
=/ =peer-state +.u.ship-state
|
fi-abet:(on-pine:fi:(abed-peer:pe ship +.u.ship-state) path duct)
|
||||||
=/ =channel [[our ship] now channel-state -.peer-state]
|
|
||||||
=/ peer-core (pe peer-state channel)
|
|
||||||
fi-abet:(on-pine:fi:peer-core path duct)
|
|
||||||
:: XX: crashing correct behaviour?
|
:: XX: crashing correct behaviour?
|
||||||
=+ blk=(need (de-part:balk our rift.ames-state life.ames-state path))
|
=+ blk=(need (de-part:balk our rift.ames-state life.ames-state path))
|
||||||
?> ?=(%c van.blk)
|
?> ?=(%c van.blk)
|
||||||
@ -2308,10 +2284,7 @@
|
|||||||
|= todos=alien-agenda
|
|= todos=alien-agenda
|
||||||
todos(keens (~(put ju keens.todos) path duct))
|
todos(keens (~(put ju keens.todos) path duct))
|
||||||
?> ?=([%known *] u.ship-state)
|
?> ?=([%known *] u.ship-state)
|
||||||
=/ =peer-state +.u.ship-state
|
fi-abet:(on-keen:fi:(abed-peer:pe ship +.u.ship-state) path duct)
|
||||||
=/ =channel [[our ship] now channel-state -.peer-state]
|
|
||||||
=/ peer-core (pe peer-state channel)
|
|
||||||
fi-abet:(on-keen:fi:peer-core path duct)
|
|
||||||
::
|
::
|
||||||
++ on-yawn
|
++ on-yawn
|
||||||
|= [=ship =path]
|
|= [=ship =path]
|
||||||
@ -2319,11 +2292,7 @@
|
|||||||
?~ ship-state=(~(get by peers.ames-state) ship)
|
?~ ship-state=(~(get by peers.ames-state) ship)
|
||||||
~|(%no-ship-for-yawn !!)
|
~|(%no-ship-for-yawn !!)
|
||||||
?> ?=([%known *] u.ship-state)
|
?> ?=([%known *] u.ship-state)
|
||||||
=/ =peer-state +.u.ship-state
|
fi-abet:ke-abet:(ke-unsub:(ke-abed:ke:fi:(abed:pe ship) path) duct)
|
||||||
=/ =channel [[our ship] now channel-state -.peer-state]
|
|
||||||
=/ peer-core (pe peer-state channel)
|
|
||||||
=< fi-abet
|
|
||||||
ke-abet:(ke-unsub:(ke-abed:ke:fi:peer-core path) duct)
|
|
||||||
::
|
::
|
||||||
+| %implementation
|
+| %implementation
|
||||||
:: +enqueue-alien-todo: helper to enqueue a pending request
|
:: +enqueue-alien-todo: helper to enqueue a pending request
|
||||||
@ -2470,16 +2439,24 @@
|
|||||||
:: +pe: create nested |peer-core for per-peer processing
|
:: +pe: create nested |peer-core for per-peer processing
|
||||||
::
|
::
|
||||||
++ pe
|
++ pe
|
||||||
|= [=peer-state =channel]
|
|_ [=peer-state =channel]
|
||||||
=* veb veb.bug.channel
|
+* veb veb.bug.channel
|
||||||
=* her her.channel
|
her her.channel
|
||||||
=* scry scry.peer-state
|
scry scry.peer-state
|
||||||
|%
|
|
||||||
::
|
::
|
||||||
+| %helpers
|
+| %helpers
|
||||||
::
|
::
|
||||||
++ peer-core .
|
++ peer-core .
|
||||||
++ pe-emit |=(move peer-core(event-core (emit +<)))
|
++ pe-emit |=(move peer-core(event-core (emit +<)))
|
||||||
|
++ abed |=(=ship (abed-peer ship (gut-peer-state ship)))
|
||||||
|
++ abed-got |=(=ship (abed-peer ship (got-peer-state ship)))
|
||||||
|
++ abed-peer
|
||||||
|
|= [=ship peer=^peer-state]
|
||||||
|
%_ peer-core
|
||||||
|
peer-state peer
|
||||||
|
channel [[our ship] now channel-state -.peer]
|
||||||
|
==
|
||||||
|
::
|
||||||
++ abet
|
++ abet
|
||||||
^+ event-core
|
^+ event-core
|
||||||
=. peers.ames-state
|
=. peers.ames-state
|
||||||
@ -3771,7 +3748,6 @@
|
|||||||
--
|
--
|
||||||
--
|
--
|
||||||
:: +fi: construct |fine remote scry core
|
:: +fi: construct |fine remote scry core
|
||||||
:: XX TODO rethink core naming/structure to follow current ames
|
|
||||||
::
|
::
|
||||||
++ fi
|
++ fi
|
||||||
=> |%
|
=> |%
|
||||||
@ -3838,8 +3814,7 @@
|
|||||||
+| %helpers
|
+| %helpers
|
||||||
::
|
::
|
||||||
++ fine-core .
|
++ fine-core .
|
||||||
:: ++ fi-abed XX TODO
|
++ fi-abet abet :: XX +abet:pe, call directly instead?
|
||||||
++ fi-abet abet :: +abet:pe
|
|
||||||
::
|
::
|
||||||
+| %entry-points
|
+| %entry-points
|
||||||
::
|
::
|
||||||
@ -3886,7 +3861,7 @@
|
|||||||
(on-keen (slag 3 (en-path:balk u.blk)) duct)
|
(on-keen (slag 3 (en-path:balk u.blk)) duct)
|
||||||
::
|
::
|
||||||
+| %internal
|
+| %internal
|
||||||
::
|
:: XX TODO rethink core naming/structure to follow current ames
|
||||||
++ ke
|
++ ke
|
||||||
|_ $: =path
|
|_ $: =path
|
||||||
keen-id=@ud
|
keen-id=@ud
|
||||||
|
Loading…
Reference in New Issue
Block a user