Merge pull request #6604 from urbit/p/6593/early-abet

ames: more bugfixes after #6593
This commit is contained in:
Ted Blackman 2023-05-22 11:11:54 -04:00 committed by GitHub
commit 89d881f33b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1819,7 +1819,7 @@
=/ ship-state (~(get by peers.ames-state) ship)
?: ?=([~ %known *] ship-state)
abet:on-heed:(abed-peer:pe ship +.u.ship-state)
%+ enqueue-alien-todo ship
%^ enqueue-alien-todo ship ship-state
|= todos=alien-agenda
todos(heeds (~(put in heeds.todos) duct))
:: +on-jilt: handle request to stop tracking .ship's responsiveness
@ -1830,7 +1830,7 @@
=/ ship-state (~(get by peers.ames-state) ship)
?: ?=([~ %known *] ship-state)
abet:on-jilt:(abed-peer:pe ship +.u.ship-state)
%+ enqueue-alien-todo ship
%^ enqueue-alien-todo ship ship-state
|= todos=alien-agenda
todos(heeds (~(del in heeds.todos) duct))
:: +on-hear: handle raw packet receipt
@ -1903,7 +1903,7 @@
`p.lane
::
=/ =blob (etch-shot shot)
(send-blob & rcvr.shot blob)
(send-blob for=& rcvr.shot blob (~(get by peers.ames-state) rcvr.shot))
:: +on-hear-keys: handle receipt of attestion request
::
++ on-hear-keys
@ -1913,7 +1913,8 @@
|.("requested attestation")
?. =(%pawn (clan:title our))
event-core
(send-blob | sndr.shot (attestation-packet sndr.shot 1))
=/ =blob (attestation-packet sndr.shot 1)
(send-blob for=| sndr.shot blob (~(get by peers.ames-state) sndr.shot))
:: +on-hear-open: handle receipt of plaintext comet self-attestation
::
++ on-hear-open
@ -1970,7 +1971,7 @@
:: will be resent.
::
?. ?=([~ %known *] sndr-state)
(enqueue-alien-todo sndr.shot |=(alien-agenda +<))
(enqueue-alien-todo sndr.shot sndr-state |=(alien-agenda +<))
:: decrypt packet contents using symmetric-key.channel
::
:: If we know them, we have a $channel with them, which we've
@ -2061,7 +2062,7 @@
=/ ship-state (~(get by peers.ames-state) ship)
::
?. ?=([~ %known *] ship-state)
%+ enqueue-alien-todo ship
%^ enqueue-alien-todo ship ship-state
|= todos=alien-agenda
todos(messages [[duct plea] messages.todos])
::
@ -2083,7 +2084,7 @@
=/ =plea [%$ /flow [%cork ~]]
=/ ship-state (~(get by peers.ames-state) ship)
?. ?=([~ %known *] ship-state)
%+ enqueue-alien-todo ship
%^ enqueue-alien-todo ship ship-state
|= todos=alien-agenda
todos(messages [[duct plea] messages.todos])
=/ =peer-state +.u.ship-state
@ -2436,7 +2437,8 @@
:: if we're a comet, send self-attestation packet first
::
=? event-core =(%pawn (clan:title our))
(send-blob | ship (attestation-packet ship life.point))
=/ =blob (attestation-packet ship life.point)
(send-blob for=| ship blob (~(get by peers.ames-state) ship))
:: save current duct
::
=/ original-duct duct
@ -2459,7 +2461,7 @@
=. event-core
%+ roll ~(tap in packets.todos)
|= [=blob core=_event-core]
(send-blob:core | ship blob)
(send-blob:core for=| ship blob (~(get by peers.ames-state) ship))
:: apply remote scry requests
::
=. event-core (meet-alien-fine keens.todos)
@ -2576,7 +2578,7 @@
=/ ship-state (~(get by peers.ames-state) ship)
?: ?=([~ %known *] ship-state)
abet:(on-keen:(abed-peer:pe ship +.u.ship-state) path duct)
%+ enqueue-alien-todo ship
%^ enqueue-alien-todo ship ship-state
|= todos=alien-agenda
todos(keens (~(put ju keens.todos) path duct))
::
@ -2602,10 +2604,11 @@
:: If talking to a comet, requests attestation packet.
::
++ enqueue-alien-todo
|= [=ship mutate=$-(alien-agenda alien-agenda)]
|= $: =ship
ship-state=(unit ship-state)
mutate=$-(alien-agenda alien-agenda)
==
^+ event-core
::
=/ ship-state (~(get by peers.ames-state) ship)
:: create a default $alien-agenda on first contact
::
=+ ^- [already-pending=? todos=alien-agenda]
@ -2633,7 +2636,9 @@
|= =ship
^+ event-core
=+ (ev-trace msg.veb ship |.("requesting attestion"))
=. event-core (send-blob | ship (sendkeys-packet ship))
=. event-core
=/ =blob (sendkeys-packet ship)
(send-blob for=| ship blob (~(get by peers.ames-state) ship))
=/ =wire /alien/(scot %p ship)
(emit duct %pass wire %b %wait (add now ~s30))
:: +send-blob: fire packet at .ship and maybe sponsors
@ -2646,19 +2651,16 @@
::
++ send-blob
~/ %send-blob
|= [for=? =ship =blob]
|= [for=? =ship =blob ship-state=(unit ship-state)]
::
=/ final-ship ship
%- (ev-trace rot.veb final-ship |.("send-blob: to {<ship>}"))
|-
|^ ^+ event-core
::
=/ ship-state (~(get by peers.ames-state) ship)
::
?. ?=([~ %known *] ship-state)
?: ?=(%pawn (clan:title ship))
(try-next-sponsor (^sein:title ship))
%+ enqueue-alien-todo ship
%^ enqueue-alien-todo ship ship-state
|= todos=alien-agenda
todos(packets (~(put in packets.todos) blob))
::
@ -2707,7 +2709,7 @@
::
?: =(ship sponsor)
event-core
^$(ship sponsor)
^$(ship sponsor, ship-state (~(get by peers.ames-state) sponsor))
--
:: +attestation-packet: generate signed self-attestation for .her
::
@ -2901,10 +2903,6 @@
:: expire direct route if the peer is not responding
::
=. peer-state (update-peer-route her peer-state)
:: required so that the following +send-blob's (including
:: inside +call:mu), access up-to-date peer state
::
=. event-core abet
:: resend comet attestation packet if first message times out
::
:: The attestation packet doesn't get acked, so if we tried to
@ -2918,7 +2916,8 @@
?& ?=(%pawn (clan:title our))
=(1 current:(~(got by snd.peer-state) bone))
==
(send-blob | her (attestation-packet [her her-life]:channel))
=/ =blob (attestation-packet [her her-life]:channel)
(send-blob for=| her blob `known/peer-state)
?: (is-corked bone)
:: no-op if the bone (or, if a naxplanation, the reference bone)
:: was corked, because the flow doesn't exist anymore
@ -3046,13 +3045,16 @@
:: here.
::
=. event-core
%^ send-blob | her
%- etch-shot
%: etch-shut-packet
shut-packet(bone (mix 1 bone.shut-packet))
symmetric-key.channel
our her
our-life.channel her-life.channel
%: send-blob for=| her
%- etch-shot
%: etch-shut-packet
shut-packet(bone (mix 1 bone.shut-packet))
symmetric-key.channel
our her
our-life.channel her-life.channel
==
::
ship-state=`known/peer-state
==
peer-core
:: +recork-one: re-send the next %cork to the peer
@ -4161,7 +4163,8 @@
|=(frag=@ud `hoot``@`(etch-shot (make-shot %0 fi-full-path frag)))
::
++ fi-send
|=(=blob fine(event-core (send-blob for=| her blob)))
|= =blob
fine(event-core (send-blob for=| her blob `known/peer-state))
::
++ fi-give-tune
|= dat=(unit roar)