mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 14:42:02 +03:00
Merge branch 'develop' into i/6065/clean-flows
This commit is contained in:
commit
25dc16addb
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2035ef65290065edbd99a86f9f5a36978617bc1983131fa474a9a5c0e91dc15d
|
||||
size 5998440
|
||||
oid sha256:544744b6d1360692b83be7f3e505d0710ea6ce541912509601e81fec2a2cea2e
|
||||
size 5992253
|
||||
|
@ -363,6 +363,8 @@
|
||||
:: %sift: limit verbosity to .ships
|
||||
:: %snub: set packet blacklist to .ships
|
||||
:: %spew: set verbosity toggles
|
||||
:: %cong: adjust congestion control parameters
|
||||
:: %stir: recover from timer desync
|
||||
:: %trim: release memory
|
||||
:: %vega: kernel reload notification
|
||||
::
|
||||
@ -380,6 +382,7 @@
|
||||
[%sift ships=(list ship)]
|
||||
[%snub ships=(list ship)]
|
||||
[%spew veb=(list verb)]
|
||||
[%cong msg=@ud mem=@ud]
|
||||
[%stir arg=@t]
|
||||
$>(%trim vane-task)
|
||||
$>(%vega vane-task)
|
||||
@ -1551,6 +1554,9 @@
|
||||
:: gall scry endpoint
|
||||
::
|
||||
[%scry ~]
|
||||
:: respond with the @p the requester is authenticated as
|
||||
::
|
||||
[%name ~]
|
||||
:: respond with the default file not found page
|
||||
::
|
||||
[%four-oh-four ~]
|
||||
|
@ -609,6 +609,7 @@
|
||||
:: crypto-core: interface for encryption and signing
|
||||
:: bug: debug printing configuration
|
||||
:: snub: blocklist for incoming packets
|
||||
:: cong: parameters for marking a flow as clogged
|
||||
::
|
||||
:: Note: .corks is only still present for unreleased migration reasons
|
||||
::
|
||||
@ -621,6 +622,7 @@
|
||||
=bug
|
||||
corks=(set wire)
|
||||
snub=(set ship)
|
||||
cong=[msg=@ud mem=@ud]
|
||||
==
|
||||
+$ ames-state-4 ames-state-5
|
||||
+$ ames-state-5
|
||||
@ -703,6 +705,11 @@
|
||||
ships=(set ship)
|
||||
==
|
||||
::
|
||||
+$ bug-10
|
||||
$: veb=_[`?`%.n `?`%.n `?`%.n `?`%.n `?`%.n `?`%.n `?`%.n `?`%.n]
|
||||
ships=(set ship)
|
||||
==
|
||||
::
|
||||
+$ ames-state-9
|
||||
$: peers=(map ship ship-state)
|
||||
=unix=duct
|
||||
@ -713,6 +720,16 @@
|
||||
snub=(set ship)
|
||||
==
|
||||
::
|
||||
+$ ames-state-10
|
||||
$: peers=(map ship ship-state)
|
||||
=unix=duct
|
||||
=life
|
||||
crypto-core=acru:ames
|
||||
bug=bug-10
|
||||
corks=(set wire)
|
||||
snub=(set ship)
|
||||
==
|
||||
::
|
||||
:: $bug: debug printing configuration
|
||||
::
|
||||
:: veb: verbosity toggles
|
||||
@ -876,7 +893,8 @@
|
||||
[%7 ames-state-7]
|
||||
[%8 ames-state-8]
|
||||
[%9 ames-state-9]
|
||||
[%10 ^ames-state]
|
||||
[%10 ames-state-10]
|
||||
[%11 ^ames-state]
|
||||
==
|
||||
::
|
||||
|= [now=@da eny=@ rof=roof]
|
||||
@ -999,7 +1017,7 @@
|
||||
:: lifecycle arms; mostly pass-throughs to the contained adult ames
|
||||
::
|
||||
++ scry scry:adult-core
|
||||
++ stay [%10 %larva queued-events ames-state.adult-gate]
|
||||
++ stay [%11 %larva queued-events ames-state.adult-gate]
|
||||
++ load
|
||||
|= $= old
|
||||
$% $: %4
|
||||
@ -1045,6 +1063,13 @@
|
||||
[%adult state=ames-state-9]
|
||||
== ==
|
||||
$: %10
|
||||
$% $: %larva
|
||||
events=(qeu queued-event)
|
||||
state=ames-state-10
|
||||
==
|
||||
[%adult state=ames-state-10]
|
||||
== ==
|
||||
$: %11
|
||||
$% $: %larva
|
||||
events=(qeu queued-event)
|
||||
state=_ames-state.adult-gate
|
||||
@ -1109,12 +1134,22 @@
|
||||
=. queued-events events.old
|
||||
larval-gate
|
||||
::
|
||||
[%10 %adult *] (load:adult-core %10 state.old)
|
||||
[%10 %adult *]
|
||||
=. cached-state `[%10 state.old]
|
||||
~> %slog.0^leaf/"ames: larva reload"
|
||||
larval-gate
|
||||
::
|
||||
[%10 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva: load"
|
||||
=. queued-events events.old
|
||||
=. adult-gate (load:adult-core %10 state.old)
|
||||
larval-gate
|
||||
::
|
||||
[%11 %adult *] (load:adult-core %11 state.old)
|
||||
::
|
||||
[%11 %larva *]
|
||||
~> %slog.1^leaf/"ames: larva: load"
|
||||
=. queued-events events.old
|
||||
=. adult-gate (load:adult-core %11 state.old)
|
||||
larval-gate
|
||||
::
|
||||
==
|
||||
@ -1137,7 +1172,9 @@
|
||||
9+(state-8-to-9:load:adult-core +.u.cached-state)
|
||||
=? u.cached-state ?=(%9 -.u.cached-state)
|
||||
10+(state-9-to-10:load:adult-core +.u.cached-state)
|
||||
?> ?=(%10 -.u.cached-state)
|
||||
=? u.cached-state ?=(%10 -.u.cached-state)
|
||||
11+(state-10-to-11:load:adult-core +.u.cached-state)
|
||||
?> ?=(%11 -.u.cached-state)
|
||||
=. ames-state.adult-gate +.u.cached-state
|
||||
[moz larval-core(cached-state ~)]
|
||||
--
|
||||
@ -1178,6 +1215,7 @@
|
||||
%sift (on-sift:event-core ships.task)
|
||||
%snub (on-snub:event-core ships.task)
|
||||
%spew (on-spew:event-core veb.task)
|
||||
%cong (on-cong:event-core [msg mem]:task)
|
||||
%stir (on-stir:event-core arg.task)
|
||||
%trim on-trim:event-core
|
||||
%vega on-vega:event-core
|
||||
@ -1214,19 +1252,19 @@
|
||||
[moves ames-gate]
|
||||
:: +stay: extract state before reload
|
||||
::
|
||||
++ stay [%10 %adult ames-state]
|
||||
++ stay [%11 %adult ames-state]
|
||||
:: +load: load in old state after reload
|
||||
::
|
||||
++ load
|
||||
=< |= $= old-state
|
||||
$% [%10 ^ames-state]
|
||||
$% [%11 ^ames-state]
|
||||
==
|
||||
^+ ames-gate
|
||||
?> ?=(%10 -.old-state)
|
||||
?> ?=(%11 -.old-state)
|
||||
ames-gate(ames-state +.old-state)
|
||||
:: all state transitions are called from larval ames
|
||||
::
|
||||
|%
|
||||
:: +state-4-to-5 called from larval-ames
|
||||
::
|
||||
++ state-4-to-5
|
||||
|= ames-state=ames-state-4
|
||||
@ -1244,7 +1282,6 @@
|
||||
message-pump-state
|
||||
ship-state
|
||||
ames-state
|
||||
:: +state-5-to-6 called from larval-ames
|
||||
::
|
||||
++ state-5-to-6
|
||||
|= ames-state=ames-state-5
|
||||
@ -1267,7 +1304,6 @@
|
||||
:_ +.peer-state
|
||||
=, -.peer-state
|
||||
[symmetric-key life rift public-key sponsor]
|
||||
:: +state-6-to-7 called from larval-ames
|
||||
::
|
||||
++ state-6-to-7
|
||||
|= ames-state=ames-state-6
|
||||
@ -1282,41 +1318,42 @@
|
||||
^- peer-state
|
||||
:- +<.ship-state
|
||||
[route qos ossuary snd rcv nax heeds ~ ~ ~]:ship-state
|
||||
:: +state-7-to-8 called from larval-ames
|
||||
::
|
||||
++ state-7-to-8
|
||||
|= ames-state=ames-state-7
|
||||
^- ames-state-8
|
||||
:* peers.ames-state
|
||||
unix-duct.ames-state
|
||||
life.ames-state
|
||||
crypto-core.ames-state
|
||||
bug.ames-state
|
||||
=, ames-state
|
||||
:* peers unix-duct life crypto-core bug
|
||||
*(set wire)
|
||||
==
|
||||
::
|
||||
++ state-8-to-9
|
||||
|= ames-state=ames-state-8
|
||||
^- ames-state-9
|
||||
:* peers.ames-state
|
||||
unix-duct.ames-state
|
||||
life.ames-state
|
||||
crypto-core.ames-state
|
||||
bug.ames-state
|
||||
corks.ames-state
|
||||
=, ames-state
|
||||
:* peers unix-duct life crypto-core bug corks
|
||||
*(set ship)
|
||||
==
|
||||
::
|
||||
++ state-9-to-10
|
||||
|= ames-state=ames-state-9
|
||||
^- ^^ames-state
|
||||
:* peers.ames-state
|
||||
unix-duct.ames-state
|
||||
life.ames-state
|
||||
crypto-core.ames-state
|
||||
^- ames-state-10
|
||||
=, ames-state
|
||||
:* peers unix-duct life crypto-core
|
||||
%= bug.ames-state
|
||||
veb [&1 &2 &3 &4 &5 &6 |6 %.n]:veb.bug.ames-state
|
||||
veb [&1 &2 &3 &4 &5 &6 |6 %.n]:veb.bug
|
||||
==
|
||||
corks.ames-state
|
||||
snub.ames-state
|
||||
corks snub
|
||||
==
|
||||
::
|
||||
++ state-10-to-11
|
||||
|= ames-state=ames-state-10
|
||||
^- ^^ames-state
|
||||
=, ames-state
|
||||
:* peers unix-duct life crypto-core bug corks snub
|
||||
:: 5 messages and 100Kb of data outstanding
|
||||
::
|
||||
[msg=5 mem=100.000]
|
||||
==
|
||||
--
|
||||
:: +scry: dereference namespace
|
||||
@ -1583,6 +1620,13 @@
|
||||
=. peer-core (run-message-pump:peer-core i.bones %prod ~)
|
||||
$(bones t.bones)
|
||||
--
|
||||
:: +on-cong: adjust congestion control parameters
|
||||
::
|
||||
++ on-cong
|
||||
|= [msg=@ud mem=@ud]
|
||||
^+ event-core
|
||||
=. cong.ames-state msg^mem
|
||||
event-core
|
||||
:: +on-stir: recover from timer desync, setting new timers as needed
|
||||
::
|
||||
:: .arg is unused, meant to ease future debug commands
|
||||
@ -2577,27 +2621,40 @@
|
||||
?: =(0 (end 0 bone))
|
||||
~
|
||||
`u=message-pump-state
|
||||
:: clogged: are five or more response messages unsent to this peer?
|
||||
::
|
||||
=/ clogged=?
|
||||
=| acc=@ud
|
||||
|- ^- ?
|
||||
?~ pumps
|
||||
%.n
|
||||
=. acc
|
||||
%+ add acc
|
||||
%+ add
|
||||
:: in-flight messages
|
||||
::
|
||||
(sub [next current]:i.pumps)
|
||||
:: queued messages
|
||||
::
|
||||
~(wyt in unsent-messages.i.pumps)
|
||||
|^ &(nuf-messages nuf-memory)
|
||||
:: +nuf-messages: are there enough messages to mark as clogged?
|
||||
::
|
||||
?: (gte acc 5)
|
||||
%.y
|
||||
$(pumps t.pumps)
|
||||
:: if clogged, notify client vanek
|
||||
++ nuf-messages
|
||||
=| num=@ud
|
||||
|- ^- ?
|
||||
?~ pumps |
|
||||
=. num
|
||||
;: add num
|
||||
(sub [next current]:i.pumps)
|
||||
~(wyt in unsent-messages.i.pumps)
|
||||
==
|
||||
?: (gte num msg.cong.ames-state)
|
||||
&
|
||||
$(pumps t.pumps)
|
||||
:: +nuf-memory: is enough memory used to mark as clogged?
|
||||
::
|
||||
++ nuf-memory
|
||||
=| mem=@ud
|
||||
|- ^- ?
|
||||
?~ pumps |
|
||||
=. mem
|
||||
%+ add
|
||||
%- ~(rep in unsent-messages.i.pumps)
|
||||
|=([a=@ b=_mem] (add b (met 3 a)))
|
||||
?~ unsent-fragments.i.pumps 0
|
||||
(met 3 fragment.i.unsent-fragments.i.pumps)
|
||||
?: (gte mem mem.cong.ames-state)
|
||||
&
|
||||
$(pumps t.pumps)
|
||||
--
|
||||
:: if clogged, notify client vane
|
||||
::
|
||||
?. clogged
|
||||
peer-core
|
||||
|
@ -70,7 +70,7 @@
|
||||
++ axle
|
||||
$: :: date: date at which http-server's state was updated to this data structure
|
||||
::
|
||||
date=%~2020.10.18
|
||||
date=%~2022.7.26
|
||||
:: server-state: state of inbound requests
|
||||
::
|
||||
=server-state
|
||||
@ -744,11 +744,32 @@
|
||||
::
|
||||
%scry
|
||||
(handle-scry authenticated address request(url suburl))
|
||||
::
|
||||
%name
|
||||
(handle-name authenticated request)
|
||||
::
|
||||
%four-oh-four
|
||||
%^ return-static-data-on-duct 404 'text/html'
|
||||
(error-page 404 authenticated url.request ~)
|
||||
==
|
||||
:: +handle-name: respond with our @p or 403
|
||||
::
|
||||
++ handle-name
|
||||
|= [authenticated=? =request:http]
|
||||
|^ ^- (quip move server-state)
|
||||
?. authenticated
|
||||
(error-response 403 ~)
|
||||
?. =(%'GET' method.request)
|
||||
(error-response 405 "may only GET name")
|
||||
%^ return-static-data-on-duct 200 'text/plain'
|
||||
(as-octs:mimes:html (scot %p our))
|
||||
::
|
||||
++ error-response
|
||||
|= [status=@ud =tape]
|
||||
^- (quip move server-state)
|
||||
%^ return-static-data-on-duct status 'text/html'
|
||||
(error-page status authenticated url.request tape)
|
||||
--
|
||||
:: +handle-scry: respond with scry result, 404 or 500
|
||||
::
|
||||
++ handle-scry
|
||||
@ -848,7 +869,7 @@
|
||||
%leave ~
|
||||
==
|
||||
::
|
||||
?(%authentication %logout)
|
||||
?(%authentication %logout %name)
|
||||
[~ state]
|
||||
::
|
||||
%channel
|
||||
@ -2207,6 +2228,7 @@
|
||||
[[~ /~/logout] duct [%logout ~]]
|
||||
[[~ /~/channel] duct [%channel ~]]
|
||||
[[~ /~/scry] duct [%scry ~]]
|
||||
[[~ /~/name] duct [%name ~]]
|
||||
==
|
||||
[~ http-server-gate]
|
||||
:: %trim: in response to memory pressure
|
||||
@ -2577,15 +2599,36 @@
|
||||
:: +load: migrate old state to new state (called on vane reload)
|
||||
::
|
||||
++ load
|
||||
|= old=axle
|
||||
=> |%
|
||||
++ axle-old
|
||||
%+ cork
|
||||
axle
|
||||
|= =axle
|
||||
axle(date %~2020.10.18)
|
||||
--
|
||||
|= old=$%(axle axle-old)
|
||||
^+ ..^$
|
||||
:: enable https redirects if certificate configured
|
||||
::
|
||||
=. redirect.http-config.server-state.old
|
||||
?& ?=(^ secure.ports.server-state.old)
|
||||
?=(^ secure.http-config.server-state.old)
|
||||
?- -.old
|
||||
%~2020.10.18
|
||||
%= $
|
||||
date.old %~2022.7.26
|
||||
::
|
||||
bindings.server-state.old
|
||||
%+ insert-binding
|
||||
[[~ /~/name] outgoing-duct.server-state.old [%name ~]]
|
||||
bindings.server-state.old
|
||||
==
|
||||
..^$(ax old)
|
||||
::
|
||||
%~2022.7.26
|
||||
:: enable https redirects if certificate configured
|
||||
::
|
||||
=. redirect.http-config.server-state.old
|
||||
?& ?=(^ secure.ports.server-state.old)
|
||||
?=(^ secure.http-config.server-state.old)
|
||||
==
|
||||
..^$(ax old)
|
||||
==
|
||||
:: +stay: produce current state
|
||||
::
|
||||
++ stay `axle`ax
|
||||
|
Loading…
Reference in New Issue
Block a user