mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 16:51:42 +03:00
Merge pull request #6828 from urbit/pkova/nail
lull, ames: add %nail task to send lanes to unix
This commit is contained in:
commit
57d023d8ab
@ -828,6 +828,7 @@
|
||||
:: %done: notify vane that peer (n)acked our message
|
||||
:: %lost: notify vane that we crashed on %boon
|
||||
:: %send: packet to unix
|
||||
:: %nail: lanes to unix
|
||||
::
|
||||
:: Remote Scry Gifts
|
||||
::
|
||||
@ -843,6 +844,7 @@
|
||||
[%done error=(unit error)]
|
||||
[%lost ~]
|
||||
[%send =lane =blob]
|
||||
[%nail =ship lanes=(list lane)]
|
||||
::
|
||||
[%tune spar roar=(unit roar)]
|
||||
::
|
||||
|
@ -107,6 +107,25 @@
|
||||
~% %ames ..part ~
|
||||
|%
|
||||
+| %helpers
|
||||
:: +get-forward-lanes: get all lanes to send to when forwarding to peer
|
||||
::
|
||||
++ get-forward-lanes
|
||||
|= [our=@p peer=peer-state peers=(map ship ship-state)]
|
||||
^- (list lane)
|
||||
=; zar=(trap (list lane))
|
||||
?~ route.peer $:zar
|
||||
=* rot u.route.peer
|
||||
?:(direct.rot [lane.rot ~] [lane.rot $:zar])
|
||||
::
|
||||
|. ^- (list lane)
|
||||
?: ?=(%czar (clan:title sponsor.peer))
|
||||
?: =(our sponsor.peer)
|
||||
~
|
||||
[%& sponsor.peer]~
|
||||
=/ next (~(get by peers) sponsor.peer)
|
||||
?. ?=([~ %known *] next)
|
||||
~
|
||||
$(peer +.u.next)
|
||||
:: +trace: print if .verb is set and we're tracking .ship
|
||||
::
|
||||
++ trace
|
||||
@ -2259,11 +2278,17 @@
|
||||
(on-publ / [%full (my [sndr.shot point]~)])
|
||||
:: manually add the lane to the peer state
|
||||
::
|
||||
=. peers.ames-state
|
||||
=/ =peer-state (gut-peer-state sndr.shot)
|
||||
=. route.peer-state `[direct=%.n lane]
|
||||
=. peers.ames-state
|
||||
(~(put by peers.ames-state) sndr.shot %known peer-state)
|
||||
::
|
||||
=. event-core
|
||||
%- emit
|
||||
:* unix-duct.ames-state %give %nail sndr.shot
|
||||
(get-forward-lanes our peer-state peers.ames-state)
|
||||
==
|
||||
::
|
||||
event-core
|
||||
:: +on-hear-shut: handle receipt of encrypted packet
|
||||
::
|
||||
@ -2304,6 +2329,7 @@
|
||||
(sift-shut-packet shot [symmetric-key her-life our-life]:channel)
|
||||
?~ shut-packet
|
||||
event-core
|
||||
=/ old-route route.peer-state
|
||||
:: non-galaxy: update route with heard lane or forwarded lane
|
||||
::
|
||||
=? route.peer-state !=(%czar (clan:title her.channel))
|
||||
@ -2333,6 +2359,12 @@
|
||||
route.peer-state
|
||||
`[direct=%.n |+u.origin.shot]
|
||||
`[direct=%.n |+u.origin.shot]
|
||||
::
|
||||
=? event-core !=(old-route route.peer-state)
|
||||
%- emit
|
||||
:* unix-duct.ames-state %give %nail sndr.shot
|
||||
(get-forward-lanes our peer-state peers.ames-state)
|
||||
==
|
||||
:: perform peer-specific handling of packet
|
||||
::
|
||||
=< abet
|
||||
@ -2694,6 +2726,12 @@
|
||||
=. peers.ames-state
|
||||
(~(put by peers.ames-state) ship [%known peer-state])
|
||||
::
|
||||
=. event-core
|
||||
%- emit
|
||||
:* unix-duct.ames-state %give %nail ship
|
||||
(get-forward-lanes our peer-state peers.ames-state)
|
||||
==
|
||||
::
|
||||
event-core
|
||||
:: +on-publ-rekey: handle new key for peer
|
||||
::
|
||||
@ -2750,6 +2788,12 @@
|
||||
event-core
|
||||
=. sponsor.u.state u.sponsor
|
||||
=. peers.ames-state (~(put by peers.ames-state) ship %known u.state)
|
||||
=. event-core
|
||||
%- emit
|
||||
:* unix-duct.ames-state %give %nail ship
|
||||
(get-forward-lanes our u.state peers.ames-state)
|
||||
==
|
||||
::
|
||||
event-core
|
||||
:: +on-publ-full: handle new pki data for peer(s)
|
||||
::
|
||||
@ -2875,6 +2919,11 @@
|
||||
=. peers.ames-state
|
||||
(~(put by peers.ames-state) ship %known peer-state)
|
||||
::
|
||||
=? event-core ?=(%czar (clan:title ship))
|
||||
%- emit
|
||||
:* unix-duct.ames-state %give %nail ship
|
||||
(get-forward-lanes our peer-state peers.ames-state)
|
||||
==
|
||||
event-core
|
||||
--
|
||||
:: +on-take-turf: relay %turf move from jael to unix
|
||||
@ -3284,7 +3333,13 @@
|
||||
=. peer-core (update-qos %ames qos:(is-peer-dead now peer-state))
|
||||
:: expire direct route if the peer is not responding
|
||||
::
|
||||
=/ old-route route.peer-state
|
||||
=. peer-state (update-peer-route her peer-state)
|
||||
=? peer-core !=(old-route route.peer-state)
|
||||
%- pe-emit
|
||||
:* unix-duct.ames-state %give %nail her
|
||||
(get-forward-lanes our peer-state peers.ames-state)
|
||||
==
|
||||
:: resend comet attestation packet if first message times out
|
||||
::
|
||||
:: The attestation packet doesn't get acked, so if we tried to
|
||||
@ -3336,11 +3391,13 @@
|
||||
++ on-dear
|
||||
|= =lane
|
||||
^+ peer-core
|
||||
peer-core(route.peer-state `[%.y lane])
|
||||
%- pe-emit:peer-core(route.peer-state `[%.y lane])
|
||||
[unix-duct.ames-state %give %nail her ~[lane]]
|
||||
::
|
||||
++ on-tame
|
||||
^+ peer-core
|
||||
peer-core(route.peer-state ~)
|
||||
%- pe-emit:peer-core(route.peer-state ~)
|
||||
[unix-duct.ames-state %give %nail her ~]
|
||||
:: +on-cork-flow: mark .bone as closing
|
||||
::
|
||||
++ on-cork-flow
|
||||
@ -4817,7 +4874,13 @@
|
||||
=. peer-core (update-qos %fine qos:(is-peer-dead now peer-state))
|
||||
:: has the direct route expired?
|
||||
::
|
||||
=/ old-route route.peer-state
|
||||
=. peer-state (update-peer-route her peer-state)
|
||||
=? peer-core !=(old-route route.peer-state)
|
||||
%- pe-emit
|
||||
:* unix-duct.ames-state %give %nail her
|
||||
(get-forward-lanes our peer-state peers.ames-state)
|
||||
==
|
||||
=. metrics.keen on-timeout:fi-gauge
|
||||
=^ want=(unit want) wan.keen
|
||||
?~ res=(pry:fi-mop wan.keen) `wan.keen
|
||||
@ -5382,7 +5445,8 @@
|
||||
!> ^- (list lane)
|
||||
?: =(our u.who)
|
||||
~
|
||||
?. ?=([~ %known *] peer)
|
||||
?: ?=([~ %known *] peer)
|
||||
(get-forward-lanes our +.u.peer peers.ames-state)
|
||||
=/ sax (rof ~ /ames %j `beam`[[our %saxo %da now] /(scot %p u.who)])
|
||||
?. ?=([~ ~ *] sax)
|
||||
~
|
||||
@ -5390,20 +5454,6 @@
|
||||
?: =(our gal)
|
||||
~
|
||||
[%& gal]~
|
||||
=; zar=(trap (list lane))
|
||||
?~ route.u.peer $:zar
|
||||
=* rot u.route.u.peer
|
||||
?:(direct.rot [lane.rot ~] [lane.rot $:zar])
|
||||
::
|
||||
|. ^- (list lane)
|
||||
?: ?=(%czar (clan:title sponsor.u.peer))
|
||||
?: =(our sponsor.u.peer)
|
||||
~
|
||||
[%& sponsor.u.peer]~
|
||||
=/ next (~(get by peers.ames-state) sponsor.u.peer)
|
||||
?. ?=([~ %known *] next)
|
||||
~
|
||||
$(peer next)
|
||||
==
|
||||
::
|
||||
[%bones her=@ ~]
|
||||
|
@ -442,7 +442,7 @@
|
||||
%+ expect-eq
|
||||
!> =- [~[//unix] %pass /qos %d %flog %text -]
|
||||
"; {<our-comet>} is your neighbor"
|
||||
!> (snag 0 `(list move:ames)`moves7)
|
||||
!> (snag 1 `(list move:ames)`moves7)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> [~[/g/talk] %give %boon post]
|
||||
@ -473,11 +473,11 @@
|
||||
;: weld
|
||||
%+ expect-eq
|
||||
!> [~[//unix] %pass /qos %d %flog %text "; {<our-comet>} is your neighbor"]
|
||||
!> (snag 0 `(list move:ames)`moves4)
|
||||
!> (snag 1 `(list move:ames)`moves4)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> [~[//unix] %pass /qos %d %flog %text "; {<our-comet2>} is your neighbor"]
|
||||
!> (snag 0 `(list move:ames)`moves7)
|
||||
!> (snag 1 `(list move:ames)`moves7)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> [~[/g/talk] %give %boon [%post 'first1!!']]
|
||||
|
Loading…
Reference in New Issue
Block a user