Merge pull request #6827 from urbit/develop

Merge develop to next/kelvin/411
This commit is contained in:
Pyry Kovanen 2023-10-12 15:58:13 +03:00 committed by GitHub
commit 679cd0b3e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 87213 additions and 152 deletions

View File

@ -628,6 +628,8 @@
:: duct: ['/paths', ...], :: duct: ['/paths', ...],
:: message-num: 123 :: message-num: 123
:: }, ...], :: }, ...],
:: closing: [bone, ..., bone],
:: corked: [bone, ..., bone],
:: heeds: [['/paths', ...] ...] :: heeds: [['/paths', ...] ...]
:: scries: :: scries:
:: -> { =path :: -> { =path
@ -706,8 +708,8 @@
|^ =/ mix=(list flow) |^ =/ mix=(list flow)
=- (sort - dor) =- (sort - dor)
%+ welp %+ welp
(turn ~(tap by snd) (tack %snd)) (turn ~(tap by snd) (tack %snd closing corked))
(turn ~(tap by rcv) (tack %rcv)) (turn ~(tap by rcv) (tack %rcv closing corked))
=/ [forward=(list flow) backward=(list flow)] =/ [forward=(list flow) backward=(list flow)]
%+ skid mix %+ skid mix
|= [=bone *] |= [=bone *]
@ -719,6 +721,8 @@
:: ::
+$ flow +$ flow
$: =bone $: =bone
closing=?
corked=?
:: ::
$= state $= state
$% [%snd message-pump-state] $% [%snd message-pump-state]
@ -727,17 +731,17 @@
== ==
:: ::
++ tack ++ tack
|* =term |* [=term closing=(set bone) corked=(set bone)]
|* [=bone =noun] |* [=bone =noun]
[bone [term noun]] [bone (~(has in closing) bone) (~(has in corked) bone) [term noun]]
:: ::
++ build ++ build
|= flow |= flow
^- json ^- json
%+ frond -.state %+ frond -.state
?- -.state ?- -.state
%snd (snd-with-bone ossuary bone +.state) %snd (snd-with-bone ossuary bone closing corked +.state)
%rcv (rcv-with-bone ossuary bone +.state) %rcv (rcv-with-bone ossuary bone closing corked +.state)
== ==
-- --
:: ::
@ -749,6 +753,10 @@
:* 'message-num'^(numb message-num) :* 'message-num'^(numb message-num)
(bone-to-pairs bone ossuary) (bone-to-pairs bone ossuary)
== ==
::
'closing'^(set-array closing numb)
::
'corked'^(set-array corked numb)
:: ::
'heeds'^(set-array heeds from-duct) 'heeds'^(set-array heeds from-duct)
:: ::
@ -756,10 +764,12 @@
== ==
:: ::
++ snd-with-bone ++ snd-with-bone
|= [=ossuary =bone message-pump-state] |= [=ossuary =bone closing=? corked=? message-pump-state]
^- json ^- json
%- pairs %- pairs
:* 'current'^(numb current) :* 'closing'^b+closing
'corked'^b+corked
'current'^(numb current)
'next'^(numb next) 'next'^(numb next)
:: ::
:- 'unsent-messages' :: as byte sizes :- 'unsent-messages' :: as byte sizes
@ -811,10 +821,12 @@
== ==
:: ::
++ rcv-with-bone ++ rcv-with-bone
|= [=ossuary =bone message-sink-state] |= [=ossuary =bone closing=? corked=? message-sink-state]
^- json ^- json
%- pairs %- pairs
:* 'last-acked'^(numb last-acked) :* 'closing'^b+closing
'corked'^b+corked
'last-acked'^(numb last-acked)
'last-heard'^(numb last-heard) 'last-heard'^(numb last-heard)
:: ::
:- 'pending-vane-ack' :- 'pending-vane-ack'

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2727,6 +2727,34 @@
+$ bitt (map duct (pair ship path)) :: incoming subs +$ bitt (map duct (pair ship path)) :: incoming subs
+$ boat (map [=wire =ship =term] [acked=? =path]) :: outgoing subs +$ boat (map [=wire =ship =term] [acked=? =path]) :: outgoing subs
+$ boar (map [=wire =ship =term] nonce=@) :: and their nonces +$ boar (map [=wire =ship =term] nonce=@) :: and their nonces
::
+$ path-state
$: bob=(unit @ud)
fan=((mop @ud (pair @da (each page @uvI))) lte)
==
+$ stats :: statistics
$: change=@ud :: processed move count
eny=@uvJ :: entropy
time=@da :: current event time
==
+$ egg :: migratory agent state
$% [%nuke sky=(map spur @ud)] :: see /sys/gall $yoke
$: %live
control-duct=duct
run-nonce=@t
sub-nonce=@
=stats
=bitt
=boat
=boar
code=~
old-state=[%| vase]
=beak
marks=(map duct mark)
sky=(map spur path-state)
ken=(jug spar:ames wire)
== ==
+$ egg-any $%([%15 egg])
+$ bowl :: standard app state +$ bowl :: standard app state
$: $: our=ship :: host $: $: our=ship :: host
src=ship :: guest src=ship :: guest

View File

@ -2023,11 +2023,11 @@
%- (slog leaf+"ames: turning off dead flow consolidation" ~) %- (slog leaf+"ames: turning off dead flow consolidation" ~)
=. event-core =. event-core
(emit:event-core duct.u.ded %pass wire.u.ded %b %rest date.u.ded) (emit:event-core duct.u.ded %pass wire.u.ded %b %rest date.u.ded)
(wake-dead-flows:event-core %.n ~) (wake-dead-flows:event-core ~)
:: ::
%- (slog leaf+"ames: switching to dead flow consolidation" ~) %- (slog leaf+"ames: switching to dead flow consolidation" ~)
=; cor=event-core =; cor=event-core
(wake-dead-flows:cor %.y ~) set-dead-flow-timer:(wake-dead-flows:cor ~)
%- ~(rep by peers.ames-state:event-core) %- ~(rep by peers.ames-state:event-core)
|= [[=ship =ship-state] core=_event-core] |= [[=ship =ship-state] core=_event-core]
^+ event-core ^+ event-core
@ -2481,27 +2481,26 @@
++ cork-bone |=(=bone abet:(on-cork-flow:peer-core bone)) ++ cork-bone |=(=bone abet:(on-cork-flow:peer-core bone))
++ kill-bone |=(=bone abet:(on-kill-flow:peer-core bone)) ++ kill-bone |=(=bone abet:(on-kill-flow:peer-core bone))
-- --
:: +wake-dead-flow: call on-wake on all dead flows, optionally setting new :: +set-dead-flow-timer: set dead flow timer and corresponding ames state
:: dead flow timer
:: ::
++ wake-dead-flows ++ set-dead-flow-timer
|= [set-new-timer=? error=(unit tang)]
^+ event-core ^+ event-core
=. flow.dead.ames-state.event-core =. flow.dead.ames-state.event-core
?. set-new-timer
flow/~
flow/`[~[/ames] /dead-flow `@da`(add now ~m2)] flow/`[~[/ames] /dead-flow `@da`(add now ~m2)]
=. event-core (emit:event-core ~[/ames] %pass /dead-flow %b %wait `@da`(add now ~m2))
?. set-new-timer :: +wake-dead-flows: call on-wake on all dead flows, discarding any
event-core :: ames-state changes
(emit:event-core ~[/ames] %pass /dead-flow %b %wait `@da`(add now ~m2)) ::
++ wake-dead-flows
|= [error=(unit tang)]
^+ event-core
%- ~(rep by peers.ames-state:event-core) %- ~(rep by peers.ames-state:event-core)
|= [[=ship =ship-state] core=_event-core] |= [[=ship =ship-state] core=_event-core]
^+ event-core ^+ event-core
=/ peer-state=(unit peer-state) (get-peer-state:core ship) =/ peer-state=(unit peer-state) (get-peer-state:core ship)
?~ peer-state core ?~ peer-state core
=/ peer-core (abed-peer:pe:core ship u.peer-state) =/ peer-core (abed-peer:pe:core ship u.peer-state)
=< abet =< abort
^+ peer-core ^+ peer-core
%- ~(rep by snd.u.peer-state) %- ~(rep by snd.u.peer-state)
|= [[=bone =message-pump-state] cor=_peer-core] |= [[=bone =message-pump-state] cor=_peer-core]
@ -2530,7 +2529,7 @@
(request-attestation u.ship) (request-attestation u.ship)
:: ::
?: ?=([%dead-flow ~] wire) ?: ?=([%dead-flow ~] wire)
(wake-dead-flows %.y error) set-dead-flow-timer:(wake-dead-flows error)
:: ::
?. ?=([%recork ~] wire) ?. ?=([%recork ~] wire)
=/ res=(unit ?([%fine her=ship =^wire] [%pump her=ship =bone])) =/ res=(unit ?([%fine her=ship =^wire] [%pump her=ship =bone]))
@ -3122,6 +3121,7 @@
channel [[our ship] now channel-state -.peer] channel [[our ship] now channel-state -.peer]
== ==
:: ::
++ abort event-core :: keeps moves, discards state changes
++ abet ++ abet
^+ event-core ^+ event-core
=. peers.ames-state =. peers.ames-state
@ -5326,6 +5326,9 @@
:: /ax/snubbed (?(%allow %deny) (list ship)) :: /ax/snubbed (?(%allow %deny) (list ship))
:: /ax/fine/hunk/[path/...] (list @ux) scry response fragments :: /ax/fine/hunk/[path/...] (list @ux) scry response fragments
:: /ax/fine/ducts/[path/] (list duct) :: /ax/fine/ducts/[path/] (list duct)
:: /ax/rift @
:: /ax/corked/[ship] (set bone)
:: /ax/closing/[ship] (set bone)
:: ::
?. ?=(%x ren) ~ ?. ?=(%x ren) ~
=> .(tyl `(pole knot)`tyl) => .(tyl `(pole knot)`tyl)
@ -5498,5 +5501,19 @@
:: ::
[%rift ~] [%rift ~]
``noun+!>(rift.ames-state) ``noun+!>(rift.ames-state)
::
[%corked her=@ ~]
=/ who (slaw %p her.tyl)
?~ who [~ ~]
=/ per (~(get by peers.ames-state) u.who)
?. ?=([~ %known *] per) [~ ~]
``noun+!>(corked.u.per)
::
[%closing her=@ ~]
=/ who (slaw %p her.tyl)
?~ who [~ ~]
=/ per (~(get by peers.ames-state) u.who)
?. ?=([~ %known *] per) [~ ~]
``noun+!>(closing.u.per)
== ==
-- --

View File

@ -366,6 +366,8 @@
} }
button[type=submit] { button[type=submit] {
margin-top: 1rem; margin-top: 1rem;
}
button[type=submit], a.button {
font-size: 1rem; font-size: 1rem;
padding: 0.5rem 1rem; padding: 0.5rem 1rem;
border-radius: 0.5rem; border-radius: 0.5rem;
@ -373,6 +375,7 @@
color: var(--white); color: var(--white);
border: none; border: none;
font-weight: 600; font-weight: 600;
text-decoration: none;
} }
input:invalid ~ button[type=submit] { input:invalid ~ button[type=submit] {
border-color: currentColor; border-color: currentColor;
@ -380,7 +383,7 @@
color: var(--gray-400); color: var(--gray-400);
pointer-events: none; pointer-events: none;
} }
span.guest { span.guest, span.guest a {
color: var(--gray-400); color: var(--gray-400);
} }
span.failed { span.failed {
@ -475,8 +478,13 @@
;div#local ;div#local
;p:"Urbit ID" ;p:"Urbit ID"
;input(value "{(scow %p our)}", disabled "true", class "mono"); ;input(value "{(scow %p our)}", disabled "true", class "mono");
;p:"Access Key" ;+ ?: =(%ours -.identity)
;div
;p:"Already authenticated"
;a.button/"{(trip (fall redirect-url '/'))}":"Continue"
==
;form(action "/~/login", method "post", enctype "application/x-www-form-urlencoded") ;form(action "/~/login", method "post", enctype "application/x-www-form-urlencoded")
;p:"Access Key"
;input ;input
=type "password" =type "password"
=name "password" =name "password"
@ -519,10 +527,13 @@
;button(name "eauth", type "submit"):"Continue" ;button(name "eauth", type "submit"):"Continue"
== ==
== ==
;* ?. ?=(%fake -.identity) ~ ;* ?: ?=(%ours -.identity) ~
=+ id=(trim 29 (scow %p who.identity)) =+ id=(trim 29 (scow %p who.identity))
=+ as="proceed as{?:(?=(%fake -.identity) " guest" "")}"
;+ ;span.guest.mono ;+ ;span.guest.mono
; Current guest identity: ; Or
;a/"{(trip (fall redirect-url '/'))}":"{as}"
; :
;br; ;br;
; {p.id} ; {p.id}
;br; ;br;
@ -1242,33 +1253,14 @@
=/ with-eauth=(unit ?) =/ with-eauth=(unit ?)
?: =(~ eauth-url:eauth) ~ ?: =(~ eauth-url:eauth) ~
`?=(^ (get-header:http 'eauth' args.request-line)) `?=(^ (get-header:http 'eauth' args.request-line))
:: if we received a simple get: redirect if logged in, otherwise :: if we received a simple get: show the login page
:: show login page ::
::NOTE we never auto-redirect, to avoid redirect loops with apps that
:: send unprivileged users to the login screen
:: ::
?: =('GET' method.request) ?: =('GET' method.request)
?. (request-is-logged-in request) %^ return-static-data-on-duct 200 'text/html'
%^ return-static-data-on-duct 200 'text/html' (login-page redirect our identity with-eauth %.n)
(login-page redirect our identity with-eauth %.n)
=/ session-id (session-id-from-request request)
:: session-id should always be populated here since we are logged in
?~ session-id
%^ return-static-data-on-duct 200 'text/html'
(login-page redirect our identity with-eauth %.n)
=/ cookie-line=@t
(session-cookie-string u.session-id &)
=/ actual-redirect
?~ redirect '/'
?:(=(u.redirect '') '/' u.redirect)
%- handle-response
:* %start
:- status-code=303
^= headers
:~ ['location' actual-redirect]
['set-cookie' cookie-line]
==
data=~
complete=%.y
==
:: if we are not a post, return an error :: if we are not a post, return an error
:: ::
?. =('POST' method.request) ?. =('POST' method.request)
@ -2238,12 +2230,20 @@
[%b %rest expiration-time] [%b %rest expiration-time]
:: +on-get-request: handles a GET request :: +on-get-request: handles a GET request
:: ::
:: GET requests open a channel for the server to send events to the :: GET requests connect to a channel for the server to send events to
:: client in text/event-stream format. :: the client in text/event-stream format.
:: ::
++ on-get-request ++ on-get-request
|= [channel-id=@t [session-id=@uv =identity] =request:http] |= [channel-id=@t [session-id=@uv =identity] =request:http]
^- [(list move) server-state] ^- [(list move) server-state]
:: if the channel doesn't exist, we cannot serve it.
:: this 404 also lets clients know if their channel was reaped since
:: they last connected to it.
::
?. (~(has by session.channel-state.state) channel-id)
%^ return-static-data-on-duct 404 'text/html'
(error-page 404 | url.request ~)
::
=/ mode=?(%json %jam) =/ mode=?(%json %jam)
(find-channel-mode %'GET' header-list.request) (find-channel-mode %'GET' header-list.request)
=^ [exit=? =wall moves=(list move)] state =^ [exit=? =wall moves=(list move)] state
@ -2253,23 +2253,14 @@
?~ maybe-raw-header=(get-header:http 'last-event-id' header-list.request) ?~ maybe-raw-header=(get-header:http 'last-event-id' header-list.request)
~ ~
(rush u.maybe-raw-header dum:ag) (rush u.maybe-raw-header dum:ag)
:: if the channel doesn't exist yet, simply instantiate it here =/ channel
:: (~(got by session.channel-state.state) channel-id)
?~ maybe-channel=(~(get by session.channel-state.state) channel-id) :: we put some demands on the get request, and may need to do some
=- [[| ~ ~] state(session.channel-state -)] :: cleanup for prior requests.
%+ ~(put by session.channel-state.state) channel-id
::NOTE some other fields initialized at the end of this arm
%* . *channel
identity identity
next-id (fall maybe-last-event-id 0)
last-ack now
==
:: if the channel does exist, we put some demands on the get request,
:: and may need to do some cleanup for prior requests.
:: ::
:: find the channel creator's identity, make sure it matches :: find the channel creator's identity, make sure it matches
:: ::
?. =(identity identity.u.maybe-channel) ?. =(identity identity.channel)
=^ mos state =^ mos state
%^ return-static-data-on-duct 403 'text/html' %^ return-static-data-on-duct 403 'text/html'
(error-page 403 | url.request ~) (error-page 403 | url.request ~)
@ -2278,34 +2269,34 @@
:: ::
::TODO or could we change that on the spot, given that only a single ::TODO or could we change that on the spot, given that only a single
:: request will ever be listening to this channel? :: request will ever be listening to this channel?
?. =(mode mode.u.maybe-channel) ?. =(mode mode.channel)
=^ mos state =^ mos state
%^ return-static-data-on-duct 406 'text/html' %^ return-static-data-on-duct 406 'text/html'
=; msg=tape (error-page 406 %.y url.request msg) =; msg=tape (error-page 406 %.y url.request msg)
"channel already established in {(trip mode.u.maybe-channel)} mode" "channel already established in {(trip mode.channel)} mode"
[[& ~ mos] state] [[& ~ mos] state]
:: when opening an event-stream, we must cancel our timeout timer :: when opening an event-stream, we must cancel our timeout timer
:: if there's no duct already bound. else, kill the old request, :: if there's no duct already bound. else, kill the old request,
:: we will replace its duct at the end of this arm :: we will replace its duct at the end of this arm
:: ::
=^ cancel-moves state =^ cancel-moves state
?: ?=([%& *] state.u.maybe-channel) ?: ?=([%& *] state.channel)
:_ state :_ state
(cancel-timeout-move channel-id p.state.u.maybe-channel)^~ (cancel-timeout-move channel-id p.state.channel)^~
=. duct-to-key.channel-state.state =. duct-to-key.channel-state.state
(~(del by duct-to-key.channel-state.state) p.state.u.maybe-channel) (~(del by duct-to-key.channel-state.state) p.state.channel)
=/ cancel-heartbeat =/ cancel-heartbeat
?~ heartbeat.u.maybe-channel ~ ?~ heartbeat.channel ~
:_ ~ :_ ~
%+ cancel-heartbeat-move channel-id %+ cancel-heartbeat-move channel-id
[date duct]:u.heartbeat.u.maybe-channel [date duct]:u.heartbeat.channel
=- [(weld cancel-heartbeat -<) ->] =- [(weld cancel-heartbeat -<) ->]
(handle-response(duct p.state.u.maybe-channel) [%cancel ~]) (handle-response(duct p.state.channel) [%cancel ~])
:: flush events older than the passed in 'Last-Event-ID' :: flush events older than the passed in 'Last-Event-ID'
:: ::
=? state ?=(^ maybe-last-event-id) =? state ?=(^ maybe-last-event-id)
(acknowledge-events channel-id u.maybe-last-event-id) (acknowledge-events channel-id u.maybe-last-event-id)
::TODO that did not remove them from the u.maybe-channel queue though! ::TODO that did not remove them from the channel queue though!
:: we may want to account for maybe-last-event-id, for efficiency. :: we may want to account for maybe-last-event-id, for efficiency.
:: (the client _should_ ignore events it heard previously if we do :: (the client _should_ ignore events it heard previously if we do
:: end up re-sending them, but _requiring_ that feels kinda risky) :: end up re-sending them, but _requiring_ that feels kinda risky)
@ -2316,7 +2307,7 @@
[[| - cancel-moves] state] [[| - cancel-moves] state]
%- zing %- zing
%- flop %- flop
=/ queue events.u.maybe-channel =/ queue events.channel
=| events=(list wall) =| events=(list wall)
|- |-
^+ events ^+ events
@ -2328,7 +2319,7 @@
:: since conversion failure also gets caught during first receive. :: since conversion failure also gets caught during first receive.
:: we can't do anything about this, so consider it unsupported. :: we can't do anything about this, so consider it unsupported.
=/ said =/ said
(channel-event-to-tape u.maybe-channel request-id channel-event) (channel-event-to-tape channel request-id channel-event)
?~ said $ ?~ said $
$(events [(event-tape-to-wall id +.u.said) events]) $(events [(event-tape-to-wall id +.u.said) events])
?: exit [moves state] ?: exit [moves state]
@ -2393,6 +2384,8 @@
:: ::
:: PUT requests send commands from the client to the server. We receive :: PUT requests send commands from the client to the server. We receive
:: a set of commands in JSON format in the body of the message. :: a set of commands in JSON format in the body of the message.
:: channels don't exist until a PUT request is sent. it's valid for
:: this request to contain an empty list of commands.
:: ::
++ on-put-request ++ on-put-request
|= [channel-id=@t =identity =request:http] |= [channel-id=@t =identity =request:http]

View File

@ -42,9 +42,9 @@
:: $move: Arvo-level move :: $move: Arvo-level move
:: ::
+$ move [=duct move=(wind note-arvo gift-arvo)] +$ move [=duct move=(wind note-arvo gift-arvo)]
:: $state-13: overall gall state, versioned :: $state-15: overall gall state, versioned
:: ::
+$ state-14 [%14 state] +$ state-15 [%15 state]
:: $state: overall gall state :: $state: overall gall state
:: ::
:: system-duct: TODO document :: system-duct: TODO document
@ -53,6 +53,7 @@
:: yokes: running agents :: yokes: running agents
:: blocked: moves to agents that haven't been started yet :: blocked: moves to agents that haven't been started yet
:: bug: debug printing configuration :: bug: debug printing configuration
:: leaves: retry nacked %leaves timer, if set
:: ::
+$ state +$ state
$: system-duct=duct $: system-duct=duct
@ -61,6 +62,7 @@
yokes=(map term yoke) yokes=(map term yoke)
blocked=(map term (qeu blocked-move)) blocked=(map term (qeu blocked-move))
=bug =bug
leaves=(unit [=duct =wire date=@da])
== ==
:: $routes: new cuff; TODO: document :: $routes: new cuff; TODO: document
:: ::
@ -102,26 +104,10 @@
ken=(jug spar:ames wire) ken=(jug spar:ames wire)
== == == ==
:: ::
+$ path-state
$: bob=(unit @ud)
fan=((mop @ud (pair @da (each page @uvI))) lte)
==
::
++ on-path ((on @ud (pair @da (each page @uvI))) lte) ++ on-path ((on @ud (pair @da (each page @uvI))) lte)
:: $blocked-move: enqueued move to an agent :: $blocked-move: enqueued move to an agent
:: ::
+$ blocked-move [=duct =routes move=(each deal unto)] +$ blocked-move [=duct =routes move=(each deal unto)]
:: $stats: statistics
::
:: change: how many moves this agent has processed
:: eny: entropy
:: time: date of current event processing
::
+$ stats [change=@ud eny=@uvJ time=@da]
:: $ames-response: network response message (%boon)
::
:: %d: fact
:: %x: quit
:: ::
+$ ames-response +$ ames-response
$% [%d =mark noun=*] $% [%d =mark noun=*]
@ -161,38 +147,22 @@
:: ::
:: $spore: structures for update, produced by +stay :: $spore: structures for update, produced by +stay
:: ::
:: remember to duplicate version tag changes here to $egg-any:gall in lull
::
+$ spore +$ spore
$: %14 $: %15
system-duct=duct system-duct=duct
outstanding=(map [wire duct] (qeu remote-request)) outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship) contacts=(set ship)
eggs=(map term egg) eggs=(map term egg)
blocked=(map term (qeu blocked-move)) blocked=(map term (qeu blocked-move))
=bug =bug
leaves=(unit [=duct =wire date=@da])
== ==
:: $egg: migratory agent state; $yoke with .old-state instead of .agent
::
+$ egg
$% [%nuke sky=(map spur @ud)]
$: %live
control-duct=duct
run-nonce=@t
sub-nonce=@
=stats
=bitt
=boat
=boar
code=~
old-state=[%| vase]
=beak
marks=(map duct mark)
sky=(map spur path-state)
ken=(jug spar:ames wire)
== ==
-- --
:: adult gall vane interface, for type compatibility with pupa :: adult gall vane interface, for type compatibility with pupa
:: ::
=| state=state-14 =| state=state-15
|= [now=@da eny=@uvJ rof=roof] |= [now=@da eny=@uvJ rof=roof]
=* gall-payload . =* gall-payload .
~% %gall-top ..part ~ ~% %gall-top ..part ~
@ -220,7 +190,8 @@
++ mo-core . ++ mo-core .
++ mo-abed |=(hun=duct mo-core(hen hun)) ++ mo-abed |=(hun=duct mo-core(hen hun))
++ mo-abet [(flop moves) gall-payload] ++ mo-abet [(flop moves) gall-payload]
++ mo-give |=(g=gift mo-core(moves [[hen give+g] moves])) ++ mo-emit |=(=move mo-core(moves [move moves]))
++ mo-give |=(=gift (mo-emit hen give+gift))
++ mo-talk ++ mo-talk
|= rup=(each suss tang) |= rup=(each suss tang)
^- [wire note-arvo] ^- [wire note-arvo]
@ -230,8 +201,8 @@
%& [%text "gall: {(t q)}ed %{(t p)}":[t=trip p.rup]] %& [%text "gall: {(t q)}ed %{(t p)}":[t=trip p.rup]]
%| [%talk leaf+"gall: failed" (flop p.rup)] %| [%talk leaf+"gall: failed" (flop p.rup)]
== ==
++ mo-pass |=(p=[wire note-arvo] mo-core(moves [[hen pass+p] moves])) ++ mo-pass |=(p=[wire note-arvo] (mo-emit hen pass+p))
++ mo-slip |=(p=note-arvo mo-core(moves [[hen slip+p] moves])) ++ mo-slip |=(p=note-arvo (mo-emit hen slip+p))
++ mo-past ++ mo-past
|= =(list [wire note-arvo]) |= =(list [wire note-arvo])
?~ list ?~ list
@ -370,12 +341,8 @@
=. outstanding.state =. outstanding.state
=/ stand =/ stand
(~(gut by outstanding.state) [wire hen] *(qeu remote-request)) (~(gut by outstanding.state) [wire hen] *(qeu remote-request))
%+ ~(put by outstanding.state) [wire hen] (~(put by outstanding.state) [wire hen] (~(put to stand) -.deal))
(~(gas to stand) ?.(?=(%leave -.deal) ~[-.deal] ~[%leave])) (mo-pass wire note-arvo)
=. mo-core (mo-pass wire note-arvo)
?. ?=(%leave -.deal)
mo-core
(mo-pass wire [%a [%cork ship]])
:: +mo-track-ship: subscribe to ames and jael for notices about .ship :: +mo-track-ship: subscribe to ames and jael for notices about .ship
:: ::
++ mo-track-ship ++ mo-track-ship
@ -529,6 +496,10 @@
:: ::
?+ sign-arvo !! ?+ sign-arvo !!
[%ames %done *] [%ames %done *]
=/ err=(unit tang)
?~ error=error.sign-arvo
~
`[[%leaf (trip tag.u.error)] tang.u.error]
=^ remote-request outstanding.state =^ remote-request outstanding.state
?~ t.t.t.wire ?~ t.t.t.wire
=/ full-wire sys+wire =/ full-wire sys+wire
@ -545,29 +516,42 @@
=^ rr stand ~(get to stand) =^ rr stand ~(get to stand)
:- rr :- rr
?: =(~ stand) ?: =(~ stand)
:: outstanding leaves are only deleted when acked
::
?: &(?=(^ err) ?=(%leave rr))
outstanding.state
(~(del by outstanding.state) [full-wire hen]) (~(del by outstanding.state) [full-wire hen])
(~(put by outstanding.state) [full-wire hen] stand) (~(put by outstanding.state) [full-wire hen] stand)
:: non-null case of wire is old, remove on next breach after :: non-null case of wire is old, remove on next breach after
:: 2019/12 :: 2019/12
:: ::
[;;(remote-request i.t.t.t.wire) outstanding.state] [;;(remote-request i.t.t.t.wire) outstanding.state]
:: :: send a %cork if we get a %nack upon initial subscription
=/ err=(unit tang)
?~ error=error.sign-arvo
~
`[[%leaf (trip tag.u.error)] tang.u.error]
:: send a %cork if we get a nack upon initial subscription
:: ::
=? mo-core =? mo-core
&(?=(^ err) |(?=(%watch-as remote-request) ?=(%watch remote-request))) &(?=(^ err) |(?=(%watch-as remote-request) ?=(%watch remote-request)))
(mo-pass [%sys wire] %a %cork ship) (mo-pass sys+wire %a %cork ship)
:: ::
?- remote-request ?- remote-request
%watch-as (mo-give %unto %watch-ack err) %watch-as (mo-give %unto %watch-ack err)
%watch (mo-give %unto %watch-ack err) %watch (mo-give %unto %watch-ack err)
%poke (mo-give %unto %poke-ack err) %poke (mo-give %unto %poke-ack err)
%leave mo-core
%missing ~>(%slog.[3 'gall: missing'] mo-core) %missing ~>(%slog.[3 'gall: missing'] mo-core)
::
%leave
:: if we get an %ack for a %leave, send %cork. otherwise,
:: the /nacked-leaves timer will re-send the %leave eventually.
::
?~ err
(mo-pass sys+wire %a %cork ship)
:: if first time hearing a %nack for a %leave, after upgrade
:: or if all outstanding %leaves have been handled, set up timer
::
=? mo-core ?=(~ leaves.state)
(mo-emit [/gall]~ %pass /nacked-leaves %b %wait `@da`(add now ~m2))
=? leaves.state ?=(~ leaves.state)
`[[/gall]~ /nacked-leaves `@da`(add now ~m2)]
mo-core
== ==
:: ::
[%ames %boon *] [%ames %boon *]
@ -905,6 +889,13 @@
^+ mo-core ^+ mo-core
=. dudes.bug.state (sy dudes) =. dudes.bug.state (sy dudes)
mo-core mo-core
::
++ mo-handle-nacked-leaves
|= =wire
^+ mo-core
?> ?=([%sys %way @ @ ~] wire)
(mo-pass wire %a %plea (slav %p &3.wire) %g /ge/[&4.wire] %0 %u ~)
::
:: +ap: agent engine :: +ap: agent engine
:: ::
:: An inner, agent-level core. The sample refers to the agent we're :: An inner, agent-level core. The sample refers to the agent we're
@ -1546,7 +1537,7 @@
++ on-bad-nonce ++ on-bad-nonce
|= stored-nonce=@ |= stored-nonce=@
%. ap-core %. ap-core
%- slog :~ %+ trace odd.veb.bug.state :~
=/ nonces [expected=stored-nonce got=nonce] =/ nonces [expected=stored-nonce got=nonce]
=/ ok |(?=(?(%fact %kick) -.sign) =(~ p.sign)) =/ ok |(?=(?(%fact %kick) -.sign) =(~ p.sign))
leaf+"{<agent-name>}: stale {<-.sign>} {<nonces>} ok={<ok>}" leaf+"{<agent-name>}: stale {<-.sign>} {<nonces>} ok={<ok>}"
@ -1955,18 +1946,37 @@
:: ::
++ load ++ load
|^ |= old=spore-any |^ |= old=spore-any
=? old ?=(%7 -.old) (spore-7-to-8 old) =? old ?=(%7 -.old) (spore-7-to-8 old)
=? old ?=(%8 -.old) (spore-8-to-9 old) =? old ?=(%8 -.old) (spore-8-to-9 old)
=? old ?=(%9 -.old) (spore-9-to-10 old) =? old ?=(%9 -.old) (spore-9-to-10 old)
=? old ?=(%10 -.old) (spore-10-to-11 old) =? old ?=(%10 -.old) (spore-10-to-11 old)
=? old ?=(%11 -.old) (spore-11-to-12 old) =? old ?=(%11 -.old) (spore-11-to-12 old)
=? old ?=(%12 -.old) (spore-12-to-13 old) =? old ?=(%12 -.old) (spore-12-to-13 old)
=? old ?=(%13 -.old) (spore-13-to-14 old) =? old ?=(%13 -.old) (spore-13-to-14 old)
?> ?=(%14 -.old) =? old ?=(%14 -.old) (spore-14-to-15 old)
?> ?=(%15 -.old)
gall-payload(state old) gall-payload(state old)
:: ::
+$ spore-any +$ spore-any
$%(spore spore-7 spore-8 spore-9 spore-10 spore-11 spore-12 spore-13) $% spore
spore-7
spore-8
spore-9
spore-10
spore-11
spore-12
spore-13
spore-14
==
+$ spore-14
$: %14
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship)
eggs=(map term egg)
blocked=(map term (qeu blocked-move))
=bug
==
+$ spore-13 +$ spore-13
$: %13 $: %13
system-duct=duct system-duct=duct
@ -2185,9 +2195,10 @@
:: ::
++ spore-13-to-14 ++ spore-13-to-14
|= old=spore-13 |= old=spore-13
^- spore ^- spore-14
%= old %= old
- %14 - %14
::
blocked blocked
^- (map term (qeu blocked-move)) ^- (map term (qeu blocked-move))
%- ~(run by blocked.old) %- ~(run by blocked.old)
@ -2200,6 +2211,12 @@
attributing.routes [ship=attributing.routes.blocked path=/] attributing.routes [ship=attributing.routes.blocked path=/]
== ==
== ==
:: added nacked-leaves timer
::
++ spore-14-to-15
|= old=spore-14
^- spore
old(- %15, bug [bug.old ~])
-- --
:: +scry: standard scry :: +scry: standard scry
:: ::
@ -2290,6 +2307,24 @@
[~ ~] [~ ~]
[~ ~ atom+!>(u.nonce)] [~ ~ atom+!>(u.nonce)]
:: ::
?: ?& =(%v care)
=([%$ %da now] coin)
=(our ship)
==
=/ yok (~(get by yokes.state) dap)
?. ?=([~ %live *] yok)
[~ ~]
=/ =egg
%= u.yok
code ~
agent
:- %|
?: ?=(%| -.agent.u.yok)
p.agent.u.yok
on-save:p.agent.u.yok
==
``noun+!>([-:*spore egg])
::
?: ?& =(%w care) ?: ?& =(%w care)
=([%$ %da now] coin) =([%$ %da now] coin)
=(our ship) =(our ship)
@ -2412,6 +2447,24 @@
=/ =gift ?>(?=([%behn %heck %gall *] syn) +>+.syn) =/ =gift ?>(?=([%behn %heck %gall *] syn) +>+.syn)
[[duct %give gift]~ gall-payload] [[duct %give gift]~ gall-payload]
:: ::
?: ?=([%nacked-leaves ~] wire)
=; core=_mo-core:mo
:: next time a %leave gets nacked, the state and timer will be set again.
::
mo-abet:core(leaves.state ~)
%- ~(rep by outstanding.state)
|= [[[=^wire =^duct] stand=(qeu remote-request)] core=_mo-core:mo]
?: =(~ stand) core
=^ rr stand ~(get to stand)
:: sanity check in the outstanding queue:
:: if there's a %leave, that should be the only request
::
~? >>> &(?=(%leave rr) =(^ stand))
"outstanding queue not empty [{<wire>} {<duct>} {<stand>}]"
=? core &(?=(%leave rr) =(~ stand))
(mo-handle-nacked-leaves:(mo-abed:core duct) wire)
core
::
~| [%gall-take-failed wire] ~| [%gall-take-failed wire]
?> ?=([?(%sys %use) *] wire) ?> ?=([?(%sys %use) *] wire)
=< mo-abet =< mo-abet

View File

@ -12,7 +12,7 @@
++ parse-current-version ++ parse-current-version
|= current=vere |= current=vere
^- @t ^- @t
(rear rev.current) (slav %ta (rear rev.current))
:: ::
++ is-equal-version ++ is-equal-version
|= [latest=@t current=vere] |= [latest=@t current=vere]

View File

@ -153,8 +153,12 @@ export class Ames extends Component {
snd['packet-pump-state'].live.length > 0 ) snd['packet-pump-state'].live.length > 0 )
? 'active, ' ? 'active, '
: ''; : '';
const color = snd['closing'] ? 'lightyellow': snd['corked'] ? 'lightred' : 'transparent';
return {key: 'snd ' + active + snd.bone + ', ' + renderDuct(snd.duct), jsx: ( return {key: 'snd ' + active + snd.bone + ', ' + renderDuct(snd.duct), jsx: (
<Summary summary={summary} details={details} /> <div style={{backgroundColor: color}}>
<Summary summary={summary} details={details} />
</div>
)}; )};
} }
@ -198,8 +202,12 @@ export class Ames extends Component {
{nax}<br/> {nax}<br/>
{liveMessages} {liveMessages}
</>); </>);
const color = rcv['closing'] ? 'ligthyellow': rcv['corked'] ? 'lightred' : 'transparent';
return {key: 'rcv ' + rcv.bone + ', ' + renderDuct(rcv.duct), jsx: ( return {key: 'rcv ' + rcv.bone + ', ' + renderDuct(rcv.duct), jsx: (
<Summary summary={summary} details={details} /> <div style={{backgroundColor: color}}>
<Summary summary={summary} details={details} />
</div>
)}; )};
} }
@ -330,6 +338,13 @@ export class Ames extends Component {
last contact {msToDa(p.qos['last-contact'])} last contact {msToDa(p.qos['last-contact'])}
</td> </td>
</tr> </tr>
<tr>
<td class="inter">Bones </td>
<td>
closing: {p.closing.length},
corked: {p.corked.length}
</td>
</tr>
</tbody></table> </tbody></table>
</>); </>);

View File

@ -749,13 +749,12 @@
;< ~ bind:m perform-init-wo-timer ;< ~ bind:m perform-init-wo-timer
;< ~ bind:m perform-born ;< ~ bind:m perform-born
;< ~ bind:m (wait ~d1) ;< ~ bind:m (wait ~d1)
;< ~ bind:m perform-authentication-2
;< mos=(list move) bind:m ;< mos=(list move) bind:m
(get '/~/channel/0123456789abcdef' cookie) (get '/~/channel/0123456789abcdef' cookie)
;< now=@da bind:m get-now ;< now=@da bind:m get-now
=/ mov-1 (ex-wait /channel/heartbeat/'0123456789abcdef' (add now ~s20)) =/ headers ['content-type' 'text/html']~
=/ mov-2 (ex-channel-response ~) =/ body `(error-page:eyre-gate 404 %.n '/~/channel/0123456789abcdef' ~)
(expect-moves mos mov-1 mov-2 ~) (expect-moves mos (ex-response 404 headers body) ~)
:: ::
++ test-channel-put-zero-requests ++ test-channel-put-zero-requests
%- eval-mare %- eval-mare