mirror of
https://github.com/urbit/shrub.git
synced 2024-12-26 05:23:35 +03:00
Merge pull request #3786 from urbit/jb/ames-peek-forward-lane
ames: updates forward-lane scry-handling to prevent routing loops
This commit is contained in:
commit
aa200cf25a
@ -785,23 +785,35 @@
|
|||||||
~ ``noun+!>(u.peer)
|
~ ``noun+!>(u.peer)
|
||||||
::
|
::
|
||||||
[%forward-lane ~]
|
[%forward-lane ~]
|
||||||
:: find lane for u.who, or their galaxy
|
::
|
||||||
|
:: this duplicates the routing hack from +send-blob:event-core
|
||||||
|
:: so long as neither the peer nor the peer's sponsoring galaxy is us:
|
||||||
|
::
|
||||||
|
:: - no route to the peer: send to the peer's sponsoring galaxy
|
||||||
|
:: - direct route to the peer: use that
|
||||||
|
:: - indirect route to the peer: send to both that route and the
|
||||||
|
:: the peer's sponsoring galaxy
|
||||||
::
|
::
|
||||||
:^ ~ ~ %noun
|
:^ ~ ~ %noun
|
||||||
!> ^- (list lane)
|
!> ^- (list lane)
|
||||||
=/ ship-state (~(get by peers.ames-state) u.who)
|
?. ?& ?=([~ %known *] peer)
|
||||||
?. ?=([~ %known *] ship-state)
|
!=(our u.who)
|
||||||
|
==
|
||||||
~
|
~
|
||||||
=/ peer-state +.u.ship-state
|
=; zar=(trap (list lane))
|
||||||
?. =(~ route.peer-state) ::NOTE avoid tmi
|
?~ route.u.peer $:zar
|
||||||
[lane:(need route.peer-state)]~
|
=* rot u.route.u.peer
|
||||||
|- ^- (list lane)
|
?:(direct.rot [lane.rot ~] [lane.rot $:zar])
|
||||||
?: ?=(%czar (clan:title sponsor.peer-state))
|
::
|
||||||
[%& sponsor.peer-state]~
|
|. ^- (list lane)
|
||||||
=/ next (~(get by peers.ames-state) sponsor.peer-state)
|
?: ?=(%czar (clan:title sponsor.u.peer))
|
||||||
|
?: =(our sponsor.u.peer)
|
||||||
|
~
|
||||||
|
[%& sponsor.u.peer]~
|
||||||
|
=/ next (~(get by peers.ames-state) sponsor.u.peer)
|
||||||
?. ?=([~ %known *] next)
|
?. ?=([~ %known *] next)
|
||||||
~
|
~
|
||||||
$(peer-state +.u.next)
|
$(peer next)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
[%bones @ ~]
|
[%bones @ ~]
|
||||||
|
Loading…
Reference in New Issue
Block a user