mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-21 13:51:50 +03:00
fine: track pending requests for unknown peers
This commit is contained in:
parent
769d10fdd4
commit
709dd75d74
@ -511,6 +511,7 @@
|
|||||||
$: messages=(list [=duct =plea])
|
$: messages=(list [=duct =plea])
|
||||||
packets=(set =blob)
|
packets=(set =blob)
|
||||||
heeds=(set duct)
|
heeds=(set duct)
|
||||||
|
keens=(set path)
|
||||||
==
|
==
|
||||||
:: $peer-state: state for a peer with known life and keys
|
:: $peer-state: state for a peer with known life and keys
|
||||||
::
|
::
|
||||||
|
@ -582,12 +582,21 @@
|
|||||||
=fine-state
|
=fine-state
|
||||||
==
|
==
|
||||||
+$ ames-state-5
|
+$ ames-state-5
|
||||||
$: peers=(map ship ship-state)
|
$: peers=(map ship ship-state-5)
|
||||||
=unix=duct
|
=unix=duct
|
||||||
=life
|
=life
|
||||||
crypto-core=acru:ames
|
crypto-core=acru:ames
|
||||||
=bug
|
=bug
|
||||||
==
|
==
|
||||||
|
+$ ship-state-5
|
||||||
|
$% [%alien alien-agenda-5]
|
||||||
|
[%known peer-state]
|
||||||
|
==
|
||||||
|
+$ alien-agenda-5
|
||||||
|
$: messages=(list [=duct =plea])
|
||||||
|
packets=(set =blob)
|
||||||
|
heeds=(set duct)
|
||||||
|
==
|
||||||
:: $fine-state: remote scry subsystem state
|
:: $fine-state: remote scry subsystem state
|
||||||
::
|
::
|
||||||
:: hear: awaiting existence
|
:: hear: awaiting existence
|
||||||
@ -1003,14 +1012,23 @@
|
|||||||
++ state-5-to-6
|
++ state-5-to-6
|
||||||
|= old=ames-state-5
|
|= old=ames-state-5
|
||||||
^- ^ames-state
|
^- ^ames-state
|
||||||
old(bug [bug.old *fine-state])
|
%= old
|
||||||
|
peers (~(run by peers.old) ship-state-5-to-6)
|
||||||
|
bug [bug.old *fine-state]
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ ship-state-5-to-6
|
||||||
|
|= old=ship-state-5
|
||||||
|
^- ship-state
|
||||||
|
?. ?=(%alien -.old) old
|
||||||
|
old(heeds [heeds.old ~])
|
||||||
::
|
::
|
||||||
++ state-4-to-5
|
++ state-4-to-5
|
||||||
|= ames-state=ames-state-5
|
|= ames-state=ames-state-5
|
||||||
^- ames-state-5
|
^- ames-state-5
|
||||||
=. peers.ames-state
|
=. peers.ames-state
|
||||||
%- ~(run by peers.ames-state)
|
%- ~(run by peers.ames-state)
|
||||||
|= =ship-state
|
|= ship-state=ship-state-5
|
||||||
?. ?=(%known -.ship-state)
|
?. ?=(%known -.ship-state)
|
||||||
ship-state
|
ship-state
|
||||||
=. snd.ship-state
|
=. snd.ship-state
|
||||||
@ -1728,6 +1746,16 @@
|
|||||||
%+ roll ~(tap in packets.todos)
|
%+ roll ~(tap in packets.todos)
|
||||||
|= [=blob core=_event-core]
|
|= [=blob core=_event-core]
|
||||||
(send-blob:core | ship blob)
|
(send-blob:core | ship blob)
|
||||||
|
:: apply remote scry requests
|
||||||
|
::
|
||||||
|
=^ moz=(list move) ames-state
|
||||||
|
%+ roll ~(tap in keens.todos)
|
||||||
|
|= [=path moz=(list move) =_ames-state]
|
||||||
|
=^ mos ames-state
|
||||||
|
%. [ship path 1]
|
||||||
|
send-request:(fine now rof original-duct ames-state)
|
||||||
|
[(weld moz mos) ames-state]
|
||||||
|
=. moves (weld (flop moz) moves)
|
||||||
::
|
::
|
||||||
event-core(duct original-duct)
|
event-core(duct original-duct)
|
||||||
--
|
--
|
||||||
@ -3234,18 +3262,25 @@
|
|||||||
=/ omen
|
=/ omen
|
||||||
~| [%fine %invalid-namespace-path path]
|
~| [%fine %invalid-namespace-path path]
|
||||||
(need (de-omen path))
|
(need (de-omen path))
|
||||||
|
=* ship p.bem.omen
|
||||||
=. want.state (~(put ju want.state) path duct)
|
=. want.state (~(put ju want.state) path duct)
|
||||||
?: (~(has by part.state) path)
|
?: (~(has by part.state) path)
|
||||||
:: request is already ongoing
|
:: request is already ongoing
|
||||||
::
|
::
|
||||||
[~ ames-state]
|
[~ ames-state]
|
||||||
:: kick off the request
|
|
||||||
::
|
|
||||||
=. part.state (~(put by part.state) path *partial-fine)
|
=. part.state (~(put by part.state) path *partial-fine)
|
||||||
:_ ames-state
|
:: if we don't know the target yet, store the request for later
|
||||||
=/ =lane:ames (get-lane p.bem.omen)
|
::
|
||||||
=/ =hoot (encode-request path 1)
|
=/ peer (~(get by peers.ames-state) ship)
|
||||||
[unix-duct.ames-state %give %send lane `@ux`hoot]~
|
?. ?=([~ %known *] peer)
|
||||||
|
::TODO full enqueue-alien-todo
|
||||||
|
=. peers.ames-state
|
||||||
|
%+ ~(put by peers.ames-state) ship
|
||||||
|
?~ peer [%alien %*(. *alien-agenda keens [path ~ ~])]
|
||||||
|
?> ?=(%alien -.u.peer)
|
||||||
|
u.peer(keens (~(put in keens.u.peer) path))
|
||||||
|
[~ ames-state]
|
||||||
|
(send-request p.bem.omen path 1)
|
||||||
::
|
::
|
||||||
++ on-yawn
|
++ on-yawn
|
||||||
|= =path
|
|= =path
|
||||||
@ -3451,6 +3486,18 @@
|
|||||||
~| [%fine %response-not-cask]
|
~| [%fine %response-not-cask]
|
||||||
;;((cask) (cue (rsh 3^64 mess)))
|
;;((cask) (cue (rsh 3^64 mess)))
|
||||||
::
|
::
|
||||||
|
++ send-request
|
||||||
|
|= [=ship =path num=@ud]
|
||||||
|
^- (quip move _ames-state)
|
||||||
|
:_ ames-state
|
||||||
|
:: make sure we exclude the ship from the path proper,
|
||||||
|
:: since it already gets included in the request header
|
||||||
|
::
|
||||||
|
=. path (oust [1 1] path)
|
||||||
|
=/ =lane:ames (get-lane ship)
|
||||||
|
=/ =hoot (encode-request ship path 1)
|
||||||
|
[unix-duct.ames-state %give %send lane `@ux`hoot]~
|
||||||
|
::
|
||||||
++ process-response
|
++ process-response
|
||||||
|= [=path data=(unit (cask))]
|
|= [=path data=(unit (cask))]
|
||||||
^- (quip move _ames-state)
|
^- (quip move _ames-state)
|
||||||
|
Loading…
Reference in New Issue
Block a user