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